Skip to content

Commit 13e66d2

Browse files
Better ESLint config
1 parent 1f543bd commit 13e66d2

File tree

3 files changed

+82
-75
lines changed

3 files changed

+82
-75
lines changed

eslint.config.mjs

Lines changed: 32 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1,41 +1,37 @@
11
import { defineConfig } from 'eslint/config';
2-
import globals from 'globals';
3-
import path from 'node:path';
4-
import { fileURLToPath } from 'node:url';
52
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 defineConfig([{
17-
extends: compat.extends('eslint:recommended'),
3+
import stylistic from '@stylistic/eslint-plugin';
4+
import globals from 'globals';
185

19-
languageOptions: {
20-
globals: {
21-
...globals.browser,
22-
...globals.commonjs,
23-
...globals.es2015,
24-
...globals.node,
25-
...globals.mocha,
6+
export default defineConfig([
7+
js.configs.recommended,
8+
{
9+
plugins: {
10+
'@stylistic': stylistic,
11+
},
12+
languageOptions: {
13+
globals: {
14+
...globals.browser,
15+
...globals.commonjs,
16+
...globals.es2017,
17+
...globals.node,
18+
...globals.mocha,
19+
},
20+
ecmaVersion: 2017,
21+
sourceType: 'module',
22+
},
23+
rules: {
24+
'no-console': 'off',
25+
'no-unused-vars': 'off',
26+
'@stylistic/linebreak-style': ['error', 'unix'],
27+
'@stylistic/quotes': ['error', 'single'],
28+
'@stylistic/semi': ['error', 'always'],
2629
},
27-
28-
ecmaVersion: 8,
29-
sourceType: 'module',
30-
},
31-
32-
ignores: ['**/eslint.config.*'],
33-
34-
rules: {
35-
'linebreak-style': ['error', 'unix'],
36-
quotes: ['error', 'single'],
37-
semi: ['error', 'always'],
38-
'no-console': 0,
39-
'no-unused-vars': 0,
4030
},
41-
}]);
31+
{
32+
files: ['**/eslint.config.*'],
33+
languageOptions: {
34+
ecmaVersion: 2021, // Node 18
35+
}
36+
}
37+
]);

package.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,10 @@
1111
"lint": "eslint ."
1212
},
1313
"devDependencies": {
14-
"@eslint/eslintrc": "^3.3.5",
1514
"@eslint/js": "9.39.4",
15+
"@stylistic/eslint-plugin": "^5.10.0",
1616
"@types/node": "^24.10.0",
1717
"eslint": "^9.39.4",
18-
"eslint-config-google": "^0.14.0",
1918
"firebase-tools": "^14.24.0",
2019
"globals": "^17.4.0",
2120
"pnpm": "^10.20.0",

pnpm-lock.yaml

Lines changed: 49 additions & 37 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)