Skip to content

Commit b9f6b85

Browse files
committed
Migrate ESLint config to v9
- Ran `npx @eslint/migrate-config .eslintrc.json` to migrate the config - Ran `npm install globals @eslint/js @eslint/eslintrc -D` as instructed in the migration command output - Changed `github/recommended` to their new flatConfigs - Renamed `filenames/match-regex` to `github/filenames-match-regex` because the former is no longer maintained - Renamed `import/no-namespace` to "importPlugin/no-namespace" - Changed `eslint-disable no-console` to `eslint no-console: "off"` as the former no longer worked Ref: https://eslint.org/docs/latest/use/migrate-to-9.0.0 Ref: https://eslint.org/docs/latest/use/configure/migration-guide Ref: https://github.com/github/eslint-plugin-github?tab=readme-ov-file#flat-configuration-eslint-configjs
1 parent 3e0ea76 commit b9f6b85

File tree

6 files changed

+304
-1064
lines changed

6 files changed

+304
-1064
lines changed

.eslintignore

Lines changed: 0 additions & 4 deletions
This file was deleted.

.eslintrc.json

Lines changed: 0 additions & 63 deletions
This file was deleted.

__tests__/main.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* eslint-disable no-console */
1+
/* eslint no-console: "off" */
22
import * as child_process from 'child_process'
33
import * as path from 'path'
44
import * as process from 'process'

eslint.config.mjs

Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
import typescriptEslint from "@typescript-eslint/eslint-plugin";
2+
import stylistic from "@stylistic/eslint-plugin";
3+
import antiTrojanSource from "eslint-plugin-anti-trojan-source";
4+
import jest from "eslint-plugin-jest";
5+
import globals from "globals";
6+
import tsParser from "@typescript-eslint/parser";
7+
import tseslint from 'typescript-eslint';
8+
import github from 'eslint-plugin-github';
9+
import importPlugin from 'eslint-plugin-import';
10+
11+
export default tseslint.config([
12+
github.getFlatConfigs().recommended,
13+
...github.getFlatConfigs().typescript,
14+
importPlugin.flatConfigs.typescript,
15+
{
16+
ignores: ["**/dist/", "**/lib/", "**/node_modules/", "**/jest.config.js"],
17+
plugins: {
18+
"@typescript-eslint": typescriptEslint,
19+
"@stylistic": stylistic,
20+
"anti-trojan-source": antiTrojanSource,
21+
jest,
22+
},
23+
languageOptions: {
24+
globals: {
25+
...globals.jest,
26+
...jest.environments.globals.globals,
27+
...globals.node,
28+
},
29+
parser: tsParser,
30+
ecmaVersion: 9,
31+
sourceType: "module",
32+
parserOptions: {
33+
project: "./tsconfig.json",
34+
},
35+
},
36+
rules: {
37+
"@typescript-eslint/array-type": "error",
38+
"@typescript-eslint/await-thenable": "error",
39+
"@typescript-eslint/ban-ts-comment": "error",
40+
"@typescript-eslint/consistent-type-assertions": "error",
41+
"@typescript-eslint/explicit-function-return-type": ["error", {
42+
allowExpressions: true,
43+
}],
44+
"@typescript-eslint/explicit-member-accessibility": ["error", {
45+
accessibility: "no-public",
46+
}],
47+
"@stylistic/func-call-spacing": ["error", "never"],
48+
"@typescript-eslint/no-array-constructor": "error",
49+
"@typescript-eslint/no-empty-interface": "error",
50+
"@typescript-eslint/no-explicit-any": "error",
51+
"@typescript-eslint/no-extraneous-class": "error",
52+
"@typescript-eslint/no-for-in-array": "error",
53+
"@typescript-eslint/no-inferrable-types": "error",
54+
"@typescript-eslint/no-misused-new": "error",
55+
"@typescript-eslint/no-namespace": "error",
56+
"@typescript-eslint/no-non-null-assertion": "warn",
57+
"@typescript-eslint/no-require-imports": "error",
58+
"@typescript-eslint/no-unnecessary-qualifier": "error",
59+
"@typescript-eslint/no-unnecessary-type-assertion": "error",
60+
"@typescript-eslint/no-unused-vars": "off",
61+
"@typescript-eslint/no-useless-constructor": "error",
62+
"@typescript-eslint/no-var-requires": "error",
63+
"@typescript-eslint/prefer-for-of": "warn",
64+
"@typescript-eslint/prefer-function-type": "warn",
65+
"@typescript-eslint/prefer-includes": "error",
66+
"@typescript-eslint/prefer-string-starts-ends-with": "error",
67+
"@typescript-eslint/promise-function-async": "error",
68+
"@typescript-eslint/require-array-sort-compare": "error",
69+
"@typescript-eslint/restrict-plus-operands": "error",
70+
"@stylistic/semi": ["error", "never"],
71+
"@stylistic/type-annotation-spacing": "error",
72+
"@typescript-eslint/unbound-method": "error",
73+
"anti-trojan-source/no-bidi": "error",
74+
camelcase: "off",
75+
"eslint-comments/no-use": "off",
76+
"github/filenames-match-regex": ["error", "^[a-z_]+(\\.test|\\.d)?$"],
77+
"i18n-text/no-en": "off",
78+
"importPlugin/no-namespace": "off",
79+
"no-unused-vars": "off",
80+
semi: "off",
81+
},
82+
}
83+
]);

0 commit comments

Comments
 (0)