Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade eslint from 8 to 9 #7143

Draft
wants to merge 32 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
33904d7
feat: let eslint-plugin-qwink support Eslint 9 and 8 simultaneously
Nov 19, 2024
93f850e
feat: let eslint-plugin-qwink support Eslint 9 and 8 simultaneously
Nov 19, 2024
83909c4
Merge branch 'main' into 6048_eslint-flag
JerryWu1234 Nov 19, 2024
6953229
Merge branch 'main' into 6048_eslint-flag
JerryWu1234 Nov 22, 2024
efb017d
support 8 and 9
Nov 22, 2024
f2bdd0d
Merge branch '6048_eslint-flag' of https://github.com/JerryWu1234/qwi…
Nov 22, 2024
5c0723e
upgrade
Nov 22, 2024
0738804
upgrade
Nov 22, 2024
5ed62c5
upgrade
Nov 22, 2024
35ccf83
upgrade
Nov 22, 2024
df6f8f9
Merge branch '6048_eslint-flag' of https://github.com/JerryWu1234/qwi…
Nov 22, 2024
fc3aa53
Update qwik-binding-map.ts
JerryWu1234 Nov 22, 2024
f6d7862
upgrade
Nov 22, 2024
af55f94
upgrade
Nov 22, 2024
64b5c11
upgrade
Nov 22, 2024
cce51f0
upgrade
Nov 22, 2024
20a6fd4
upgrade
Nov 22, 2024
0bda546
upgrade
Nov 22, 2024
02cba46
fix
Nov 22, 2024
5701e52
Merge branch 'main' into 6048_eslint-flag
JerryWu1234 Nov 27, 2024
0f75492
Merge branch 'main' into 6048_eslint-flag
JerryWu1234 Nov 28, 2024
2458862
fix
Nov 28, 2024
b82a195
Merge branch '6048_eslint-flag' of https://github.com/JerryWu1234/qwi…
Nov 28, 2024
278a5df
Merge branch 'main' into 6048_eslint-flag
JerryWu1234 Nov 29, 2024
d378168
Merge branch 'main' into 6048_eslint-flag
JerryWu1234 Dec 6, 2024
0dab706
Merge branch 'main' into 6048_eslint-flag
JerryWu1234 Dec 10, 2024
1c8abcd
feat: upgrade eslint from 8 to 9
JerryWu1234 Dec 10, 2024
76eec39
Merge branch 'main' into upgrade_eslint_6115
JerryWu1234 Dec 31, 2024
d67938a
merge
JerryWu1234 Feb 8, 2025
ba551e6
reinistall to clean pnpm lock
JerryWu1234 Feb 8, 2025
fa82495
upgrade
JerryWu1234 Feb 8, 2025
c343de6
Merge branch 'main' into upgrade_eslint_6115
JerryWu1234 Feb 12, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,4 @@ starters/apps/base
starters/apps/library
starters/templates
vite.config.ts
packages/eslint-plugin-qwik
45 changes: 0 additions & 45 deletions .eslintrc.cjs

This file was deleted.

52 changes: 52 additions & 0 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
import eslint from '@eslint/js';
import tseslint from 'typescript-eslint';
import { fileURLToPath } from 'url';
import { dirname } from 'path';
import typescript from '@typescript-eslint/eslint-plugin';
import { includeIgnoreFile } from '@eslint/compat';
const __dirname = dirname(fileURLToPath(import.meta.url));
import globals from 'globals';
const gitignorePath = fileURLToPath(import.meta.resolve('./.eslintignore'));
const gitignorePathConfig = includeIgnoreFile(gitignorePath);
export default tseslint.config(
gitignorePathConfig,
{
languageOptions: {
parserOptions: {
sourceType: 'module',
ecmaFeatures: {
jsx: true,
},
globals: {
...globals.node,
...globals.es2021,
...globals.browser,
},
ecmaVersion: 2021,
project: ['./tsconfig.json'],
tsconfigRootDir: __dirname,
},
},
plugins: { '@typescript-eslint': typescript },
rules: {
'@typescript-eslint/no-explicit-any': 'off',
'@typescript-eslint/explicit-module-boundary-types': 'off',
'@typescript-eslint/no-inferrable-types': 'off',
'@typescript-eslint/no-non-null-assertion': 'off',
'@typescript-eslint/no-empty-interface': 'off',
'@typescript-eslint/no-namespace': 'off',
'@typescript-eslint/no-empty-function': 'off',
'@typescript-eslint/no-this-alias': 'off',
'@typescript-eslint/ban-types': 'off',
'@typescript-eslint/ban-ts-comment': 'off',
'prefer-spread': 'off',
'no-case-declarations': 'off',
'no-console': 'off',
'@typescript-eslint/no-unused-vars': ['error'],
'@typescript-eslint/consistent-type-imports': 'warn',
'@typescript-eslint/no-unnecessary-condition': 'warn',
},
},
eslint.configs.recommended,
tseslint.configs.recommended
);
10 changes: 6 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@
"@changesets/get-github-info": "0.6.0",
"@changesets/types": "6.0.0",
"@clack/prompts": "0.7.0",
"@eslint/compat": "^1.2.6",
"@eslint/eslintrc": "3.1.0",
"@mdx-js/mdx": "3.0.1",
"@microsoft/api-documenter": "7.24.2",
Expand All @@ -127,7 +128,7 @@
"@types/brotli": "1.3.4",
"@types/bun": "1.1.6",
"@types/cross-spawn": "6.0.6",
"@types/eslint": "8.56.10",
"@types/eslint": "9.6.1",
"@types/express": "4.17.21",
"@types/node": "20.14.11",
"@types/path-browserify": "1.0.2",
Expand All @@ -136,8 +137,7 @@
"@types/semver": "7.5.8",
"@types/tmp": "0.2.6",
"@types/which-pm-runs": "1.0.2",
"@typescript-eslint/eslint-plugin": "7.16.1",
"@typescript-eslint/parser": "7.16.1",
"@typescript-eslint/eslint-plugin": "8.23.0",
"all-contributors-cli": "6.26.1",
"brotli": "1.3.3",
"concurrently": "8.2.2",
Expand All @@ -146,11 +146,12 @@
"csstype": "3.1.3",
"dotenv": "16.4.5",
"esbuild": "0.20.2",
"eslint": "8.57.0",
"eslint": "9.16.0",
"eslint-plugin-no-only-tests": "3.1.0",
"eslint-plugin-qwik": "workspace:^",
"execa": "8.0.1",
"express": "4.20.0",
"globals": "15.13.0",
"install": "0.13.0",
"memfs": "4.14.0",
"monaco-editor": "0.45.0",
Expand All @@ -172,6 +173,7 @@
"tree-kill": "1.2.2",
"tsx": "4.19.1",
"typescript": "5.4.5",
"typescript-eslint": "8.23.0",
"undici": "*",
"vfile": "6.0.2",
"vite": "5.3.5",
Expand Down
42 changes: 0 additions & 42 deletions packages/docs/src/routes/demo/.eslintrc.cjs

This file was deleted.

51 changes: 51 additions & 0 deletions packages/docs/src/routes/demo/eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
import eslint from '@eslint/js';
import tseslint from 'typescript-eslint';
import { fileURLToPath } from 'url';
import { dirname } from 'path';
import typescript from '@typescript-eslint/eslint-plugin';
const __dirname = dirname(fileURLToPath(import.meta.url));
import globals from 'globals';

export default tseslint.config(
eslint.configs.recommended,
tseslint.configs.recommended,
{
languageOptions: {
parserOptions: {
sourceType: 'module',
ecmaFeatures: {
jsx: true,
},
globals: {
...globals.node,
...globals.es2021,
...globals.browser,
},
ecmaVersion: 2021,
project: ['./tsconfig.json'],
tsconfigRootDir: __dirname,
},
},
plugins: {
'@typescript-eslint': typescript,
},
rules: {
'@typescript-eslint/no-explicit-any': 'off',
'@typescript-eslint/explicit-module-boundary-types': 'off',
'@typescript-eslint/no-inferrable-types': 'off',
'@typescript-eslint/no-non-null-assertion': 'off',
'@typescript-eslint/no-empty-interface': 'off',
'@typescript-eslint/no-namespace': 'off',
'@typescript-eslint/no-empty-function': 'off',
'@typescript-eslint/no-this-alias': 'off',
'@typescript-eslint/ban-types': 'off',
'@typescript-eslint/ban-ts-comment': 'off',
'prefer-spread': 'off',
'no-case-declarations': 'off',
'no-console': 'off',
'@typescript-eslint/no-unused-vars': ['error'],
'@typescript-eslint/consistent-type-imports': 'warn',
'qwik/no-react-props': 'off',
},
}
);
44 changes: 0 additions & 44 deletions packages/docs/src/routes/demo/state/no-serialize/.eslintrc.cjs

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
import eslint from '@eslint/js';
import tseslint from 'typescript-eslint';
import { fileURLToPath } from 'url';
import { dirname } from 'path';
import typescript from '@typescript-eslint/eslint-plugin';
import qwik from 'eslint-plugin-qwik';
const __dirname = dirname(fileURLToPath(import.meta.url));
import globals from 'globals';

export default tseslint.config(
eslint.configs.recommended,
tseslint.configs.recommended,
qwik.configs.recommended,
{
languageOptions: {
parserOptions: {
sourceType: 'module',
ecmaFeatures: {
jsx: true,
},
globals: {
...globals.node,
...globals.es2021,
...globals.browser,
},
ecmaVersion: 2021,
project: ['../../tsconfig.json'],
tsconfigRootDir: __dirname,
},
},
plugins: {
'@typescript-eslint': typescript,
},
rules: {
'@typescript-eslint/no-explicit-any': 'off',
'@typescript-eslint/explicit-module-boundary-types': 'off',
'@typescript-eslint/no-inferrable-types': 'off',
'@typescript-eslint/no-non-null-assertion': 'off',
'@typescript-eslint/no-empty-interface': 'off',
'@typescript-eslint/no-namespace': 'off',
'@typescript-eslint/no-empty-function': 'off',
'@typescript-eslint/no-this-alias': 'off',
'@typescript-eslint/ban-types': 'off',
'@typescript-eslint/ban-ts-comment': 'off',
'prefer-spread': 'off',
'no-case-declarations': 'off',
'no-console': 'off',
'@typescript-eslint/no-unused-vars': ['error'],
'@typescript-eslint/consistent-type-imports': 'warn',
'qwik/no-react-props': 'off',
'qwik/valid-lexical-scope': 'off',
},
}
);
3 changes: 2 additions & 1 deletion packages/eslint-plugin-qwik/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@
"@types/estree": "1.0.5",
"@typescript-eslint/rule-tester": "8.14.0",
"redent": "4.0.0",
"@types/eslint": "9.6.1"
"@types/eslint": "9.6.1",
"@types/jsx-ast-utils": "3.3.1"
},
"engines": {
"node": ">=16.8.0 <18.0.0 || >=18.11"
Expand Down
8 changes: 7 additions & 1 deletion packages/eslint-plugin-qwik/src/jsxAtag.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
import { ESLintUtils, TSESTree } from '@typescript-eslint/utils';

const createRule = ESLintUtils.RuleCreator(() => 'https://qwik.dev/docs/advanced/dollar/');
interface RuleOptions {
recommended: string;
}

const createRule = ESLintUtils.RuleCreator<RuleOptions>(
() => 'https://qwik.dev/docs/advanced/dollar/'
);

export const jsxAtag = createRule({
defaultOptions: [],
Expand Down
9 changes: 6 additions & 3 deletions packages/eslint-plugin-qwik/src/jsxImg.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
import { ESLintUtils, TSESTree } from '@typescript-eslint/utils';
import { QwikEslintExamples } from '../examples';
import type { QwikEslintExamples } from '../examples';
interface RuleOptions {
recommended: string;
}

const createRule = ESLintUtils.RuleCreator(
const createRule = ESLintUtils.RuleCreator<RuleOptions>(
(name) => `https://qwik.dev/docs/advanced/eslint/#${name}`
);

Expand Down Expand Up @@ -148,7 +151,7 @@ function imgImportName(value: string) {
return `Img${toPascalCase(value)}`;
}

function toPascalCase(string) {
function toPascalCase(string: string) {
return `${string}`
.toLowerCase()
.replace(new RegExp(/[-_]+/, 'g'), ' ')
Expand Down
Loading
Loading