Skip to content

Commit ad7178d

Browse files
better-salmonwmertens
authored andcommitted
chore(eslint): Migrate ESLint configuration to new format and update dependencies
deleted: .eslintrc.cjs
1 parent 039a304 commit ad7178d

30 files changed

+970
-869
lines changed

.changeset/grumpy-ladybugs-wonder.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'eslint-plugin-qwik': patch
3+
---
4+
5+
Improve types and README documentation with clear configuration examples for ESLint 9+ (flat config). Added `globalIgnores` for more clarity and `tseslint.config` for better type inference inside the `parserOptions` option.

.eslintignore

-33
This file was deleted.

.eslintrc.cjs

-45
This file was deleted.

eslint.config.js

+94
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
import globals from 'globals';
2+
import js from '@eslint/js';
3+
import tseslint from 'typescript-eslint';
4+
import noOnlyTests from 'eslint-plugin-no-only-tests';
5+
import { globalIgnores } from 'eslint/config';
6+
// import { qwikEslint9Plugin } from 'eslint-plugin-qwik';
7+
8+
const ignores = [
9+
'**/.history',
10+
'**/.vscode',
11+
'**/dist',
12+
'**/dist-dev',
13+
'**/lib',
14+
'**/node_modules',
15+
'**/tsc-out',
16+
'**/external',
17+
'**/*.',
18+
'**/*.log',
19+
'**/etc',
20+
'**/target',
21+
'**/temp',
22+
'**/tsdoc-metadata.json',
23+
'**/.DS_Store',
24+
'**/*.mp4',
25+
'scripts/**/*',
26+
'**/server/**/*.js',
27+
'**/*.tsbuildinfo',
28+
'packages/docs/api/**/*',
29+
'packages/docs/public/repl/repl-sw.js*',
30+
'packages/docs/src/routes/examples/apps/**/*',
31+
'packages/docs/src/routes/playground/app/**/*',
32+
'packages/docs/src/routes/tutorial/**/*',
33+
'packages/qwik-labs/lib/**/*',
34+
'packages/qwik-labs/lib-types/**/*',
35+
'packages/qwik-labs/vite/**/*',
36+
'packages/insights/drizzle.config.ts',
37+
'packages/insights/panda.config.ts',
38+
'starters/apps/base',
39+
'starters/apps/library',
40+
'starters/templates',
41+
'**/vite.config.ts',
42+
];
43+
44+
export default tseslint.config(
45+
globalIgnores(ignores),
46+
js.configs.recommended,
47+
tseslint.configs.recommended,
48+
// qwikEslint9Plugin.configs.recommended,
49+
{
50+
languageOptions: {
51+
globals: {
52+
...globals.browser,
53+
...globals.node,
54+
...globals.es2021,
55+
},
56+
parserOptions: {
57+
// Needed when using the qwik plugin
58+
// projectService: true,
59+
// tsconfigRootDir: import.meta.dirname,
60+
},
61+
},
62+
},
63+
{
64+
plugins: {
65+
'no-only-tests': noOnlyTests,
66+
},
67+
rules: {
68+
'no-only-tests/no-only-tests': 'error',
69+
},
70+
name: 'no-only-tests',
71+
},
72+
{
73+
rules: {
74+
'@typescript-eslint/no-explicit-any': 'off',
75+
'@typescript-eslint/explicit-module-boundary-types': 'off',
76+
'@typescript-eslint/no-inferrable-types': 'off',
77+
'@typescript-eslint/no-non-null-assertion': 'off',
78+
'@typescript-eslint/no-empty-interface': 'off',
79+
'@typescript-eslint/no-namespace': 'off',
80+
'@typescript-eslint/no-empty-function': 'off',
81+
'@typescript-eslint/no-this-alias': 'off',
82+
'@typescript-eslint/ban-types': 'off',
83+
'@typescript-eslint/ban-ts-comment': 'off',
84+
'prefer-spread': 'off',
85+
'no-case-declarations': 'off',
86+
'no-console': ['error', { allow: ['warn', 'error'] }],
87+
'no-only-tests/no-only-tests': 'error',
88+
'@typescript-eslint/no-unused-vars': 'off',
89+
'@typescript-eslint/no-var-requires': 'off',
90+
curly: 'error',
91+
'no-new-func': 'error',
92+
},
93+
}
94+
);

package.json

+6-17
Original file line numberDiff line numberDiff line change
@@ -9,16 +9,6 @@
99
"config": {
1010
"syncpack": {
1111
"versionGroups": [
12-
{
13-
"label": "Allow ESLint 9 types in eslint-plugin-qwik",
14-
"dependencies": [
15-
"@types/eslint"
16-
],
17-
"packages": [
18-
"eslint-plugin-qwik"
19-
],
20-
"policy": "matches@9.6.1"
21-
},
2212
{
2313
"label": "Be lenient in vite versions for prod. v4 is broken, v5 is good",
2414
"dependencyTypes": [
@@ -115,7 +105,7 @@
115105
"@changesets/get-github-info": "0.6.0",
116106
"@changesets/types": "6.1.0",
117107
"@clack/prompts": "0.7.0",
118-
"@eslint/eslintrc": "3.1.0",
108+
"@eslint/js": "9.25.1",
119109
"@mdx-js/mdx": "3.0.1",
120110
"@microsoft/api-documenter": "7.26.22",
121111
"@microsoft/api-extractor": "7.52.4",
@@ -127,7 +117,6 @@
127117
"@types/brotli": "1.3.4",
128118
"@types/bun": "1.1.6",
129119
"@types/cross-spawn": "6.0.6",
130-
"@types/eslint": "8.56.10",
131120
"@types/express": "4.17.21",
132121
"@types/node": "20.14.11",
133122
"@types/path-browserify": "1.0.2",
@@ -136,8 +125,6 @@
136125
"@types/semver": "7.5.8",
137126
"@types/tmp": "0.2.6",
138127
"@types/which-pm-runs": "1.0.2",
139-
"@typescript-eslint/eslint-plugin": "7.16.1",
140-
"@typescript-eslint/parser": "7.16.1",
141128
"all-contributors-cli": "6.26.1",
142129
"brotli": "1.3.3",
143130
"concurrently": "8.2.2",
@@ -146,11 +133,12 @@
146133
"csstype": "3.1.3",
147134
"dotenv": "16.4.5",
148135
"esbuild": "0.20.2",
149-
"eslint": "8.57.0",
150-
"eslint-plugin-no-only-tests": "3.1.0",
136+
"eslint": "9.25.1",
137+
"eslint-plugin-no-only-tests": "3.3.0",
151138
"eslint-plugin-qwik": "workspace:^",
152139
"execa": "8.0.1",
153140
"express": "4.20.0",
141+
"globals": "16.0.0",
154142
"install": "0.13.0",
155143
"memfs": "4.14.0",
156144
"monaco-editor": "0.45.0",
@@ -172,6 +160,7 @@
172160
"tree-kill": "1.2.2",
173161
"tsx": "4.19.1",
174162
"typescript": "5.4.5",
163+
"typescript-eslint": "8.26.1",
175164
"undici": "*",
176165
"vfile": "6.0.2",
177166
"vite": "5.3.5",
@@ -208,7 +197,7 @@
208197
"build.clean": "tsx ./scripts/build-clean.ts",
209198
"build.cli": "tsx --require ./scripts/runBefore.ts scripts/index.ts --cli --dev",
210199
"build.cli.prod": "tsx --require ./scripts/runBefore.ts scripts/index.ts --cli",
211-
"build.core": "tsx --require ./scripts/runBefore.ts scripts/index.ts --tsc --build --qwikcity --api --platform-binding",
200+
"build.core": "tsxs --require ./scripts/runBefore.ts scripts/index.ts --tsc --build --qwikcity --api --platform-binding",
212201
"build.eslint": "tsx --require ./scripts/runBefore.ts scripts/index.ts --eslint",
213202
"build.full": "tsx --require ./scripts/runBefore.ts scripts/index.ts --tsc --tsc-docs --build --supabaseauthhelpers --api --eslint --qwikcity --qwikworker --qwiklabs --qwikreact --qwikauth --cli --platform-binding --wasm",
214203
"build.local": "tsx --require ./scripts/runBefore.ts scripts/index.ts --tsc --tsc-docs --build --supabaseauthhelpers --api --eslint --qwikcity --qwikworker --qwiklabs --qwikreact --qwikauth --cli --platform-binding-wasm-copy",

packages/docs/src/routes/demo/.eslintrc.cjs

-42
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
import globals from 'globals';
2+
import js from '@eslint/js';
3+
import tseslint from 'typescript-eslint';
4+
import { globalIgnores } from 'eslint/config';
5+
// import { qwikEslint9Plugin } from 'eslint-plugin-qwik';
6+
7+
export default tseslint.config(
8+
globalIgnores(ignores),
9+
js.configs.recommended,
10+
tseslint.configs.recommended,
11+
// qwikEslint9Plugin.configs.recommended,
12+
{
13+
languageOptions: {
14+
globals: {
15+
...globals.browser,
16+
...globals.node,
17+
...globals.es2021,
18+
},
19+
parserOptions: {
20+
// Needed when using the qwik plugin
21+
// projectService: true,
22+
// tsconfigRootDir: import.meta.dirname,
23+
ecmaFeatures: { jsx: true },
24+
},
25+
},
26+
},
27+
{
28+
rules: {
29+
'@typescript-eslint/no-explicit-any': 'off',
30+
'@typescript-eslint/explicit-module-boundary-types': 'off',
31+
'@typescript-eslint/no-inferrable-types': 'off',
32+
'@typescript-eslint/no-non-null-assertion': 'off',
33+
'@typescript-eslint/no-empty-interface': 'off',
34+
'@typescript-eslint/no-namespace': 'off',
35+
'@typescript-eslint/no-empty-function': 'off',
36+
'@typescript-eslint/no-this-alias': 'off',
37+
'@typescript-eslint/ban-types': 'off',
38+
'@typescript-eslint/ban-ts-comment': 'off',
39+
'prefer-spread': 'off',
40+
'no-case-declarations': 'off',
41+
'no-console': 'off',
42+
'@typescript-eslint/no-unused-vars': ['error'],
43+
'@typescript-eslint/consistent-type-imports': 'warn',
44+
// 'qwik/no-react-props': 'off',
45+
},
46+
}
47+
);

packages/docs/src/routes/demo/tsconfig.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,6 @@
2121
"~/*": ["./src/*"]
2222
}
2323
},
24-
"files": ["./.eslintrc.cjs", "**/*.jsx"],
24+
"files": ["./eslint.config.js", "**/*.jsx"],
2525
"include": ["."]
2626
}

0 commit comments

Comments
 (0)