Skip to content

Commit

Permalink
stricter eslint rules (#96)
Browse files Browse the repository at this point in the history
  • Loading branch information
kubikowski authored Jun 9, 2024
1 parent 9442e8c commit 4678a37
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 18 deletions.
27 changes: 27 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@
"import"
],
"rules": {
"array-bracket-spacing": [
"error",
"always"
],
"arrow-body-style": [
"error",
"as-needed"
Expand Down Expand Up @@ -50,6 +54,16 @@
"tab"
],
"max-len": "off",
"no-shadow": "error",
"no-var": "error",
"no-void": "error",
"no-undefined": "error",
"object-curly-spacing": [
"error",
"always"
],
"prefer-const": "error",
"prefer-template": "error",
"quotes": [
"error",
"single"
Expand Down Expand Up @@ -266,6 +280,10 @@
"@typescript-eslint/no-explicit-any": "error",
"@typescript-eslint/no-non-null-assertion": "off",
"@typescript-eslint/no-shadow": "error",
"array-bracket-spacing": [
"error",
"always"
],
"arrow-body-style": [
"error",
"as-needed"
Expand Down Expand Up @@ -295,6 +313,15 @@
],
"max-len": "off",
"no-shadow": "off",
"no-var": "error",
"no-void": "error",
"no-undefined": "error",
"object-curly-spacing": [
"error",
"always"
],
"prefer-const": "error",
"prefer-template": "error",
"quotes": [
"error",
"single"
Expand Down
13 changes: 5 additions & 8 deletions test/util/scale/timer.model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ export abstract class Timer {

private static add(methodName: string, timing: number): void {
if (!Timer.timings.has(methodName)) {
Timer.timings.set(methodName, [[]]);
Timer.timings.set(methodName, [ [] ]);
}

Timer.timings.get(methodName)?.slice(-1)[0]?.push(timing);
Expand Down Expand Up @@ -87,8 +87,10 @@ export abstract class Timer {
return AnsiFormat.fgGreen(formattedTiming);
} else if (totalTiming < 75_000) {
return AnsiFormat.fgYellow(formattedTiming);
} else {
} else if (totalTiming < 150_000) {
return AnsiFormat.fgRed(formattedTiming);
} else {
return AnsiFormat.fgWhite(formattedTiming);
}
}

Expand All @@ -111,11 +113,6 @@ export abstract class Timer {
}

private static formatTiming(timing: number): string {
const options: Intl.NumberFormatOptions = {
minimumFractionDigits: 3,
maximumFractionDigits: 3,
};

return timing.toLocaleString(undefined, options) + 'ms';
return `${ timing.toFixed(3) }ms`;
}
}
20 changes: 10 additions & 10 deletions test/util/test-sets/map-test-sets.model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,16 @@ export class MapTestSets extends TestSets<TestMap> {

public constructor() {
super(
new Map([[ 'id', 0 ]]),
new Map([[ 'id', 1 ]]),
new Map([[ 'id', 2 ]]),
new Map([[ 'id', 3 ]]),
new Map([[ 'id', 4 ]]),
new Map([[ 'id', 5 ]]),
new Map([[ 'id', 6 ]]),
new Map([[ 'id', 7 ]]),
new Map([[ 'id', 8 ]]),
new Map([[ 'id', 9 ]]),
new Map([ [ 'id', 0 ] ]),
new Map([ [ 'id', 1 ] ]),
new Map([ [ 'id', 2 ] ]),
new Map([ [ 'id', 3 ] ]),
new Map([ [ 'id', 4 ] ]),
new Map([ [ 'id', 5 ] ]),
new Map([ [ 'id', 6 ] ]),
new Map([ [ 'id', 7 ] ]),
new Map([ [ 'id', 8 ] ]),
new Map([ [ 'id', 9 ] ]),
);
}

Expand Down

0 comments on commit 4678a37

Please sign in to comment.