Skip to content

Commit 7287b75

Browse files
fix: add eslint-plugin-perfectionist, make eslint report all errors & warnings on ALL files during build
1 parent df7b42b commit 7287b75

File tree

6 files changed

+96
-10
lines changed

6 files changed

+96
-10
lines changed

.github/workflows/build.yml

+3
Original file line numberDiff line numberDiff line change
@@ -183,6 +183,9 @@ jobs:
183183
uses: ataylorme/eslint-annotate-action@d57a1193d4c59cbfbf3f86c271f42612f9dbd9e9 # 3.0.0
184184
with:
185185
report-json: reports/lint-report.json
186+
fail-on-error: true
187+
fail-on-warning: true
188+
only-pr-files: false
186189

187190
- name: Fail if lint failed
188191
shell: bash

eslint.config.mjs

+14-3
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,12 @@ import tsParser from "@typescript-eslint/parser";
1010
import love from "eslint-config-love";
1111
import importPlugin from "eslint-plugin-import-x";
1212
import nPlugin from "eslint-plugin-n";
13+
import perfectionist from "eslint-plugin-perfectionist";
1314
import prettier from "eslint-plugin-prettier/recommended";
1415
import promise from "eslint-plugin-promise";
1516

1617
import eslintPluginUnicorn from "eslint-plugin-unicorn";
18+
import globals from "globals";
1719
import tseslint from "typescript-eslint";
1820

1921
const __filename = fileURLToPath(import.meta.url);
@@ -161,6 +163,7 @@ export default tseslint.config(
161163
"import-x": importPlugin,
162164
n: nPlugin,
163165
promise,
166+
perfectionist,
164167
},
165168
settings: {
166169
"import-x/resolver": {
@@ -226,10 +229,10 @@ export default tseslint.config(
226229
selector: "enumMember",
227230
},
228231
],
229-
"@typescript-eslint/no-empty-interface": ["error"],
230232
"@typescript-eslint/no-empty-object-type": ["error"],
231233
"@typescript-eslint/no-explicit-any": ["error", { fixToUnknown: true, ignoreRestArgs: false }],
232234
"@typescript-eslint/no-extraneous-class": ["error"],
235+
"@typescript-eslint/no-magic-numbers": ["off"],
233236
"@typescript-eslint/no-shadow": ["error"],
234237
"@typescript-eslint/no-unused-expressions": [
235238
"error",
@@ -257,7 +260,6 @@ export default tseslint.config(
257260
"@typescript-eslint/prefer-string-starts-ends-with": ["error"],
258261
"@typescript-eslint/promise-function-async": ["off"],
259262
"@typescript-eslint/require-await": ["error"],
260-
"@typescript-eslint/sort-type-constituents": ["error"],
261263

262264
"@typescript-eslint/unified-signatures": ["error"],
263265

@@ -270,13 +272,22 @@ export default tseslint.config(
270272
"n/no-new-require": ["error"],
271273
"n/no-path-concat": ["error"],
272274
"n/process-exit-as-throw": ["error"],
275+
276+
"perfectionist/sort-intersection-types": ["error"],
277+
"perfectionist/sort-union-types": ["error"],
278+
273279
"promise/param-names": ["error"],
274280
},
275281
},
276282

277283
{
278284
extends: [tseslint.configs.disableTypeChecked],
279-
files: ["*.mjs"],
285+
files: ["*.js", "*.mjs"],
286+
languageOptions: {
287+
globals: {
288+
...globals.node,
289+
},
290+
},
280291
rules: {},
281292
},
282293
prettier,

package-lock.json

+75-4
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -54,12 +54,13 @@
5454
"conventional-changelog-conventionalcommits": "8.0.0",
5555
"dependency-cruiser": "16.4.1",
5656
"eslint": "8.57.0",
57-
"eslint-config-love": "64.0.0",
57+
"eslint-config-love": "66.0.0",
5858
"eslint-config-prettier": "9.1.0",
5959
"eslint-import-resolver-node": "0.3.9",
6060
"eslint-import-resolver-typescript": "3.6.3",
6161
"eslint-plugin-import-x": "4.2.1",
6262
"eslint-plugin-n": "17.10.2",
63+
"eslint-plugin-perfectionist": "3.6.0",
6364
"eslint-plugin-prettier": "5.2.1",
6465
"eslint-plugin-promise": "7.1.0",
6566
"eslint-plugin-unicorn": "55.0.0",

src/output-parser.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import type { AnnotationWithMessageAndLevel, CargoMessage, MaybeCargoMessage, St
66
import { AnnotationLevel } from "@/schema";
77

88
export class OutputParser {
9-
private readonly _workingDirectory: string | null;
9+
private readonly _workingDirectory: null | string;
1010
private readonly _uniqueAnnotations: Map<string, AnnotationWithMessageAndLevel>;
1111
private readonly _stats: Stats;
1212

src/schema.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ export interface AnnotationWithMessageAndLevel {
1515
export interface MaybeCargoMessage {
1616
reason: string;
1717
message?: {
18-
code?: string | null;
18+
code?: null | string;
1919
level: string;
2020
message: string;
2121
rendered: string;

0 commit comments

Comments
 (0)