Skip to content

Commit 41558ef

Browse files
committed
Upgrade to ESLint 9
1 parent 3adc046 commit 41558ef

9 files changed

Lines changed: 3002 additions & 1394 deletions

File tree

eslint.config.mjs

Lines changed: 148 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,148 @@
1+
import {defineConfig, globalIgnores} from "eslint/config";
2+
import {fixupConfigRules, fixupPluginRules} from "@eslint/compat";
3+
import typescriptEslint from "@typescript-eslint/eslint-plugin";
4+
import tsParser from "@typescript-eslint/parser";
5+
import path from "node:path";
6+
import {fileURLToPath} from "node:url";
7+
import js from "@eslint/js";
8+
import {FlatCompat} from "@eslint/eslintrc";
9+
10+
const __filename = fileURLToPath(import.meta.url);
11+
const __dirname = path.dirname(__filename);
12+
const compat = new FlatCompat({
13+
baseDirectory: __dirname,
14+
recommendedConfig: js.configs.recommended,
15+
allConfig: js.configs.all,
16+
});
17+
18+
export default defineConfig([
19+
globalIgnores([
20+
"src/emulator/dingusppc.js",
21+
"src/emulator/minivmac-*.js",
22+
"src/emulator/ppc.js",
23+
"src/emulator/previous.js",
24+
"src/emulator/BasiliskII.js",
25+
"src/emulator/SheepShaver.js",
26+
]),
27+
{
28+
extends: fixupConfigRules(
29+
compat.extends(
30+
"eslint:recommended",
31+
"plugin:@typescript-eslint/recommended",
32+
"plugin:react-hooks/recommended",
33+
"plugin:import/recommended"
34+
)
35+
),
36+
37+
plugins: {
38+
"@typescript-eslint": fixupPluginRules(typescriptEslint),
39+
},
40+
41+
languageOptions: {
42+
parser: tsParser,
43+
ecmaVersion: 5,
44+
sourceType: "script",
45+
46+
parserOptions: {
47+
project: true,
48+
tsconfigRootDir: "./",
49+
},
50+
},
51+
52+
rules: {
53+
"array-callback-return": "error",
54+
"no-constant-binary-expression": "error",
55+
"no-constructor-return": "error",
56+
"no-promise-executor-return": "error",
57+
"no-self-compare": "error",
58+
"no-template-curly-in-string": "error",
59+
"no-unmodified-loop-condition": "error",
60+
"no-unreachable-loop": "error",
61+
62+
"require-atomic-updates": [
63+
"error",
64+
{
65+
allowProperties: true,
66+
},
67+
],
68+
69+
"no-eval": "error",
70+
"no-implied-eval": "error",
71+
"no-new-object": "error",
72+
"no-new-wrappers": "error",
73+
"no-script-url": "error",
74+
"no-useless-constructor": "error",
75+
"no-useless-rename": "error",
76+
"no-var": "error",
77+
eqeqeq: "error",
78+
79+
"object-shorthand": [
80+
"error",
81+
"always",
82+
{
83+
avoidQuotes: true,
84+
},
85+
],
86+
87+
"prefer-const": "error",
88+
"import/consistent-type-specifier-style": [
89+
"error",
90+
"prefer-inline",
91+
],
92+
"import/no-unresolved": "off",
93+
"import/no-empty-named-blocks": "error",
94+
95+
"import/no-duplicates": [
96+
"error",
97+
{
98+
"prefer-inline": true,
99+
},
100+
],
101+
102+
"@typescript-eslint/consistent-type-imports": [
103+
"error",
104+
{
105+
fixStyle: "inline-type-imports",
106+
},
107+
],
108+
109+
"@typescript-eslint/no-unused-vars": [
110+
"error",
111+
{
112+
vars: "all",
113+
args: "none",
114+
ignoreRestSiblings: false,
115+
},
116+
],
117+
118+
"@typescript-eslint/prefer-optional-chain": "error",
119+
"@typescript-eslint/array-type": "error",
120+
"@typescript-eslint/consistent-generic-constructors": "error",
121+
"@typescript-eslint/no-duplicate-enum-values": "error",
122+
"@typescript-eslint/no-mixed-enums": "error",
123+
"@typescript-eslint/no-unsafe-enum-comparison": "error",
124+
"@typescript-eslint/no-dynamic-delete": "error",
125+
"@typescript-eslint/prefer-nullish-coalescing": "error",
126+
"@typescript-eslint/no-non-null-asserted-nullish-coalescing":
127+
"error",
128+
"@typescript-eslint/no-unnecessary-type-arguments": "error",
129+
"@typescript-eslint/non-nullable-type-assertion-style": "error",
130+
"@typescript-eslint/prefer-for-of": "error",
131+
"@typescript-eslint/prefer-includes": "error",
132+
"@typescript-eslint/prefer-return-this-type": "error",
133+
"@typescript-eslint/prefer-string-starts-ends-with": "error",
134+
135+
"@typescript-eslint/require-array-sort-compare": [
136+
"error",
137+
{
138+
ignoreStringArrays: true,
139+
},
140+
],
141+
142+
"@typescript-eslint/no-explicit-any": "off",
143+
"@typescript-eslint/no-inferrable-types": "off",
144+
"@typescript-eslint/no-non-null-assertion": "off",
145+
"@typescript-eslint/no-unused-vars": "off",
146+
},
147+
},
148+
]);

0 commit comments

Comments
 (0)