Skip to content

Commit f736793

Browse files
authored
Merge pull request #7418 from better-salmon/upgrade-eslint
Migrate to ESLint 9 with flat config and fix monorepo linting
2 parents 039a304 + 1bf13c6 commit f736793

File tree

83 files changed

+1012
-988
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

83 files changed

+1012
-988
lines changed

.changeset/changelog-github-custom.ts

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,15 @@ const changelogFunctions: ChangelogFunctions = {
1212
'Please provide a repo to this changelog generator like this:\n"changelog": ["@changesets/changelog-github", { "repo": "org/repo" }]'
1313
);
1414
}
15-
if (dependenciesUpdated.length === 0) return '';
15+
if (dependenciesUpdated.length === 0) {
16+
return '';
17+
}
1618

1719
const changesetLink = `- Updated dependencies [${(
1820
await Promise.all(
1921
changesets.map(async (cs) => {
2022
if (cs.commit) {
21-
let { links } = await getInfo({
23+
const { links } = await getInfo({
2224
repo: options.repo,
2325
commit: cs.commit,
2426
});
@@ -45,12 +47,14 @@ const changelogFunctions: ChangelogFunctions = {
4547

4648
let prFromSummary: number | undefined;
4749
let commitFromSummary: string | undefined;
48-
let usersFromSummary: string[] = [];
50+
const usersFromSummary: string[] = [];
4951

5052
const replacedChangelog = changeset.summary
5153
.replace(/^\s*(?:pr|pull|pull\s+request):\s*#?(\d+)/im, (_, pr) => {
52-
let num = Number(pr);
53-
if (!isNaN(num)) prFromSummary = num;
54+
const num = Number(pr);
55+
if (!isNaN(num)) {
56+
prFromSummary = num;
57+
}
5458
return '';
5559
})
5660
.replace(/^\s*commit:\s*([^\s]+)/im, (_, commit) => {
@@ -91,7 +95,7 @@ const changelogFunctions: ChangelogFunctions = {
9195
}
9296
const commitToFetchFrom = commitFromSummary || changeset.commit;
9397
if (commitToFetchFrom) {
94-
let { links } = await getInfo({
98+
const { links } = await getInfo({
9599
repo: options.repo,
96100
commit: commitToFetchFrom,
97101
});

.changeset/every-humans-kiss.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'eslint-plugin-qwik': minor
3+
---
4+
5+
FEAT: our eslint plugin now supports eslint 9

.changeset/giant-carpets-brake.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
---
2+
'create-qwik': patch
3+
'@builder.io/qwik-city': patch
4+
'@builder.io/qwik': patch
5+
---
6+
7+
Fix linting errors which were previously being ignored across the monorepo.

.changeset/grumpy-ladybugs-wonder.md

Lines changed: 5 additions & 0 deletions
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

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

.eslintrc.cjs

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

eslint.config.js

Lines changed: 112 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,112 @@
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+
// packages with eslint.config.mjs
43+
'packages/qwik-labs',
44+
'packages/insights',
45+
'starters',
46+
// eslint.config.*
47+
'**/eslint.config.mjs',
48+
'**/eslint.config.js',
49+
];
50+
51+
export default tseslint.config(
52+
globalIgnores(ignores),
53+
js.configs.recommended,
54+
tseslint.configs.recommended,
55+
// qwikEslint9Plugin.configs.recommended,
56+
{
57+
languageOptions: {
58+
globals: {
59+
...globals.browser,
60+
...globals.node,
61+
...globals.es2021,
62+
},
63+
parserOptions: {
64+
// Needed when using the qwik plugin
65+
// projectService: true,
66+
// tsconfigRootDir: import.meta.dirname,
67+
},
68+
},
69+
},
70+
{
71+
plugins: {
72+
'no-only-tests': noOnlyTests,
73+
},
74+
rules: {
75+
'no-only-tests/no-only-tests': 'error',
76+
},
77+
name: 'no-only-tests',
78+
},
79+
{
80+
rules: {
81+
'@typescript-eslint/no-explicit-any': 'off',
82+
'@typescript-eslint/explicit-module-boundary-types': 'off',
83+
'@typescript-eslint/no-inferrable-types': 'off',
84+
'@typescript-eslint/no-non-null-assertion': 'off',
85+
'@typescript-eslint/no-empty-interface': 'off',
86+
'@typescript-eslint/no-namespace': 'off',
87+
'@typescript-eslint/no-empty-function': 'off',
88+
'@typescript-eslint/no-this-alias': 'off',
89+
'@typescript-eslint/ban-types': 'off',
90+
'@typescript-eslint/ban-ts-comment': 'off',
91+
'prefer-spread': 'off',
92+
'no-case-declarations': 'off',
93+
'no-console': ['error', { allow: ['warn', 'error'] }],
94+
'no-only-tests/no-only-tests': 'error',
95+
'@typescript-eslint/no-unused-vars': 'off',
96+
'@typescript-eslint/no-var-requires': 'off',
97+
curly: 'error',
98+
'no-new-func': 'error',
99+
'@typescript-eslint/no-empty-object-type': 'off',
100+
'@typescript-eslint/no-unused-expressions': 'off',
101+
'@typescript-eslint/no-unsafe-function-type': 'off',
102+
'@typescript-eslint/no-require-imports': 'off',
103+
'@typescript-eslint/no-wrapper-object-types': 'off',
104+
},
105+
},
106+
{
107+
files: ['packages/docs/**/*.{ts,tsx}'],
108+
rules: {
109+
'no-console': 'off',
110+
},
111+
}
112+
);

package.json

Lines changed: 7 additions & 18 deletions
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": "[email protected]"
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",
@@ -237,8 +226,8 @@
237226
"link.dist.npm": "cd packages/qwik && npm link && cd ../qwik-city && npm link && cd ../eslint-plugin-qwik && npm link && cd ../qwik-react && npm link",
238227
"link.dist.yarn": "cd packages/qwik && yarn link && cd ../qwik-city && yarn link && cd ../eslint-plugin-qwik && yarn link && cd ../qwik-react && yarn link",
239228
"lint": "pnpm lint.eslint && pnpm lint.prettier && pnpm lint.rust",
240-
"lint.eslint": "eslint --cache \"**/*.ts*\"",
241-
"lint.fix": "eslint --fix \"**/*.ts*\" && pnpm prettier.fix",
229+
"lint.eslint": "eslint --cache \"**/*.ts*\" && pnpm -r --parallel lint",
230+
"lint.fix": "eslint --fix \"**/*.ts*\" && pnpm -r --parallel lint.fix && pnpm prettier.fix",
242231
"lint.prettier": "prettier --cache --check .",
243232
"lint.rust": "make lint",
244233
"lint.syncpack": "syncpack list-mismatches",

packages/create-qwik/index.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
/* eslint-disable no-console */
21
import { runCreateCli } from './src/run-create-cli';
32
import { runCreateInteractiveCli } from './src/run-create-interactive-cli';
43
import { panic, printHeader } from '../qwik/src/cli/utils/utils';

packages/create-qwik/src/run-create-interactive-cli.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import { join, relative } from 'node:path';
77
import type { CreateAppResult } from '../../qwik/src/cli/types';
88
import { clearDir } from './helpers/clearDir';
99
import { createApp } from './create-app';
10-
/* eslint-disable no-console */
10+
1111
import fs from 'node:fs';
1212
import { getRandomJoke } from './helpers/jokes';
1313
import { installDepsCli } from './helpers/installDepsCli';

0 commit comments

Comments
 (0)