Skip to content

Commit 81c089f

Browse files
committed
Migrate ESLint to eslint.config.mjs
1 parent 902a954 commit 81c089f

File tree

3 files changed

+68
-49
lines changed

3 files changed

+68
-49
lines changed

.eslintignore

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

.eslintrc.js

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

eslint.config.mjs

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
import typescriptEslint from "@typescript-eslint/eslint-plugin";
2+
import tsParser from "@typescript-eslint/parser";
3+
import path from "node:path";
4+
import { fileURLToPath } from "node:url";
5+
import js from "@eslint/js";
6+
import { FlatCompat } from "@eslint/eslintrc";
7+
8+
const __filename = fileURLToPath(import.meta.url);
9+
const __dirname = path.dirname(__filename);
10+
const compat = new FlatCompat({
11+
baseDirectory: __dirname,
12+
recommendedConfig: js.configs.recommended,
13+
allConfig: js.configs.all,
14+
});
15+
16+
export default [
17+
{
18+
ignores: ["**/*.js", "**/extra", "node_modules/**/*", "eslint.config.mjs"],
19+
},
20+
...compat.extends(
21+
"eslint:recommended",
22+
"plugin:@typescript-eslint/recommended",
23+
"plugin:@typescript-eslint/recommended-requiring-type-checking",
24+
"prettier",
25+
),
26+
{
27+
plugins: {
28+
"@typescript-eslint": typescriptEslint,
29+
},
30+
31+
languageOptions: {
32+
parser: tsParser,
33+
ecmaVersion: 5,
34+
sourceType: "script",
35+
36+
parserOptions: {
37+
tsconfigRootDir: __dirname,
38+
project: ["./tsconfig.json", "./ts/WoltLabSuite/WebComponent/tsconfig.json"],
39+
},
40+
},
41+
42+
rules: {
43+
"@typescript-eslint/no-explicit-any": 0,
44+
"@typescript-eslint/no-non-null-assertion": 0,
45+
"@typescript-eslint/no-unsafe-argument": 0,
46+
"@typescript-eslint/no-unsafe-assignment": 0,
47+
"@typescript-eslint/no-unsafe-call": 0,
48+
"@typescript-eslint/no-unsafe-member-access": 0,
49+
"@typescript-eslint/no-unsafe-return": 0,
50+
51+
"@typescript-eslint/no-unused-vars": [
52+
"error",
53+
{
54+
argsIgnorePattern: "^_",
55+
varsIgnorePattern: "^_",
56+
},
57+
],
58+
59+
"@typescript-eslint/no-misused-promises": [
60+
"error",
61+
{
62+
checksVoidReturn: false,
63+
},
64+
],
65+
"@typescript-eslint/prefer-promise-reject-errors": ["error", { allowEmptyReject: true }],
66+
},
67+
},
68+
];

0 commit comments

Comments
 (0)