Skip to content

Commit d4d6cef

Browse files
authored
chore(eslint): standardise on flat base + plugin-recommended spread (#35)
1 parent ce0f0cd commit d4d6cef

2 files changed

Lines changed: 88 additions & 128 deletions

File tree

‎eslint.config.mjs‎

Lines changed: 42 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,28 @@
11
import js from '@eslint/js';
2-
import globals from 'globals';
3-
import tseslint from 'typescript-eslint';
4-
import { globalIgnores } from 'eslint/config';
2+
import ts from 'typescript-eslint';
53
import { qwikEslint9Plugin } from 'eslint-plugin-qwik';
64
import prettier from 'eslint-config-prettier';
5+
import globals from 'globals';
76

8-
const ignores = ['dist/**', 'node_modules/**', 'build/**', 'server/**'];
9-
10-
export default tseslint.config(
11-
globalIgnores(ignores),
7+
export default ts.config(
8+
{
9+
ignores: [
10+
'node_modules/**',
11+
'dist/**',
12+
'build/**',
13+
'coverage/**',
14+
'server/**',
15+
],
16+
},
1217
js.configs.recommended,
13-
tseslint.configs.recommended,
14-
qwikEslint9Plugin.configs.recommended,
15-
prettier,
18+
...ts.configs.recommended,
1619
{
20+
files: ['**/*.{ts,tsx}'],
1721
languageOptions: {
18-
globals: {
19-
...globals.browser,
20-
...globals.node,
21-
...globals.es2021,
22-
...globals.serviceworker,
23-
},
22+
parser: ts.parser,
2423
parserOptions: {
24+
ecmaVersion: 'latest',
25+
sourceType: 'module',
2526
projectService: {
2627
allowDefaultProject: [
2728
'knip.config.js',
@@ -33,11 +34,36 @@ export default tseslint.config(
3334
},
3435
tsconfigRootDir: import.meta.dirname,
3536
},
37+
globals: {
38+
...globals.browser,
39+
...globals.node,
40+
...globals.es2021,
41+
...globals.serviceworker,
42+
},
43+
},
44+
},
45+
{
46+
files: ['**/*.{js,mjs}'],
47+
languageOptions: {
48+
globals: { ...globals.node, ...globals.es2021 },
3649
},
3750
},
3851
{
52+
files: ['**/*.{test,spec}.{ts,tsx,js,mjs}', 'test/**/*.{ts,tsx,js,mjs}'],
53+
languageOptions: { globals: { ...globals.jest, ...globals.node } },
54+
},
55+
// qwik plugin rules need TS type info — restrict to TS files so they
56+
// don't try to type-check the config file itself.
57+
...qwikEslint9Plugin.configs.recommended.map((c) => ({
58+
...c,
59+
files: ['**/*.{ts,tsx}'],
60+
})),
61+
{
62+
files: ['**/*.{ts,tsx}'],
3963
rules: {
64+
// Pre-existing override: qwik examples use `any` deliberately.
4065
'@typescript-eslint/no-explicit-any': 'off',
4166
},
4267
},
68+
prettier,
4369
);

‎package-lock.json‎

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

0 commit comments

Comments
 (0)