Skip to content

Commit ccf0174

Browse files
committed
better eslint config
1 parent 3cf7b2c commit ccf0174

File tree

1 file changed

+25
-27
lines changed

1 file changed

+25
-27
lines changed

eslint.config.mjs

Lines changed: 25 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,33 @@
11
import { defineConfig } from "eslint/config";
2-
import { fixupConfigRules } from "@eslint/compat";
32
import globals from "globals";
4-
import path from "node:path";
5-
import { fileURLToPath } from "node:url";
63
import js from "@eslint/js";
7-
import { FlatCompat } from "@eslint/eslintrc";
8-
9-
const __filename = fileURLToPath(import.meta.url);
10-
const __dirname = path.dirname(__filename);
11-
const compat = new FlatCompat({
12-
baseDirectory: __dirname,
13-
recommendedConfig: js.configs.recommended,
14-
allConfig: js.configs.all
15-
});
16-
17-
export default defineConfig([{
18-
extends: fixupConfigRules(compat.extends("eslint:recommended", "plugin:import/recommended")),
4+
import importPlugin from "eslint-plugin-import";
195

6+
export default defineConfig([
7+
{
208
languageOptions: {
21-
globals: {
22-
...globals.browser,
23-
...globals.node,
24-
Atomics: "readonly",
25-
SharedArrayBuffer: "readonly",
26-
},
9+
globals: {
10+
...globals.browser,
11+
...globals.node,
12+
Atomics: "readonly",
13+
SharedArrayBuffer: "readonly",
14+
},
15+
ecmaVersion: 2022,
16+
sourceType: "module",
17+
},
18+
plugins: {
19+
import: importPlugin,
2720
},
28-
2921
rules: {
30-
"no-unused-vars": ["warn", {
31-
argsIgnorePattern: "^_",
32-
varsIgnorePattern: "^_",
33-
}],
22+
...js.configs.recommended.rules,
23+
...importPlugin.configs.recommended.rules,
24+
"no-unused-vars": [
25+
"warn",
26+
{
27+
argsIgnorePattern: "^_",
28+
varsIgnorePattern: "^_",
29+
},
30+
],
3431
},
35-
}]);
32+
},
33+
]);

0 commit comments

Comments
 (0)