Skip to content

Commit 69e595c

Browse files
authored
Update eslint to v9 (#35485)
Update eslint and all plugins. Many plugins still do not ship type definitions so I had to add stubs. Also, I had to put a few typescript error expectations because if some unknown error in the types. `eslint-plugin-no-jquery` is disabled because it's not compatible with eslint 9 flat config (wikimedia/eslint-plugin-no-jquery#311).
1 parent e612b97 commit 69e595c

29 files changed

+1493
-1453
lines changed

.eslintrc.cjs

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

Makefile

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ TAR_EXCLUDES := .git data indexers queues log node_modules $(EXECUTABLE) $(DIST)
162162
GO_DIRS := build cmd models modules routers services tests
163163
WEB_DIRS := web_src/js web_src/css
164164

165-
ESLINT_FILES := web_src/js tools *.ts *.cjs tests/e2e
165+
ESLINT_FILES := web_src/js tools *.ts tests/e2e
166166
STYLELINT_FILES := web_src/css web_src/js/components/*.vue
167167
SPELLCHECK_FILES := $(GO_DIRS) $(WEB_DIRS) templates options/locale/locale_en-US.ini .github $(filter-out CHANGELOG.md, $(wildcard *.go *.md *.yml *.yaml *.toml)) $(filter-out tools/misspellings.csv, $(wildcard tools/*))
168168
EDITORCONFIG_FILES := templates .github/workflows options/locale/locale_en-US.ini
@@ -346,12 +346,12 @@ lint-backend-fix: lint-go-fix lint-go-gitea-vet lint-editorconfig ## lint backen
346346

347347
.PHONY: lint-js
348348
lint-js: node_modules ## lint js files
349-
$(NODE_VARS) pnpm exec eslint --color --max-warnings=0 --ext js,ts,vue $(ESLINT_FILES)
349+
$(NODE_VARS) pnpm exec eslint --color --max-warnings=0 --flag unstable_native_nodejs_ts_config $(ESLINT_FILES)
350350
$(NODE_VARS) pnpm exec vue-tsc
351351

352352
.PHONY: lint-js-fix
353353
lint-js-fix: node_modules ## lint js files and fix issues
354-
$(NODE_VARS) pnpm exec eslint --color --max-warnings=0 --ext js,ts,vue $(ESLINT_FILES) --fix
354+
$(NODE_VARS) pnpm exec eslint --color --max-warnings=0 --flag unstable_native_nodejs_ts_config $(ESLINT_FILES) --fix
355355
$(NODE_VARS) pnpm exec vue-tsc
356356

357357
.PHONY: lint-css

eslint.config.ts

Lines changed: 1029 additions & 0 deletions
Large diffs are not rendered by default.

package.json

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@
6969
"@eslint-community/eslint-plugin-eslint-comments": "4.5.0",
7070
"@playwright/test": "1.55.0",
7171
"@stoplight/spectral-cli": "6.15.0",
72-
"@stylistic/eslint-plugin-js": "3.1.0",
72+
"@stylistic/eslint-plugin": "5.3.1",
7373
"@stylistic/stylelint-plugin": "4.0.0",
7474
"@types/codemirror": "5.60.16",
7575
"@types/dropzone": "5.7.9",
@@ -82,24 +82,24 @@
8282
"@types/throttle-debounce": "5.0.2",
8383
"@types/tinycolor2": "1.4.6",
8484
"@types/toastify-js": "1.12.4",
85-
"@typescript-eslint/eslint-plugin": "8.43.0",
8685
"@typescript-eslint/parser": "8.43.0",
8786
"@vitejs/plugin-vue": "6.0.1",
8887
"@vitest/eslint-plugin": "1.3.9",
89-
"eslint": "8.57.0",
88+
"eslint": "9.35.0",
9089
"eslint-import-resolver-typescript": "4.4.4",
91-
"eslint-plugin-array-func": "4.0.0",
92-
"eslint-plugin-github": "5.0.2",
90+
"eslint-plugin-array-func": "5.0.2",
91+
"eslint-plugin-github": "6.0.0",
9392
"eslint-plugin-import-x": "4.16.1",
9493
"eslint-plugin-no-jquery": "3.1.1",
95-
"eslint-plugin-no-use-extend-native": "0.5.0",
94+
"eslint-plugin-no-use-extend-native": "0.7.2",
9695
"eslint-plugin-playwright": "2.2.2",
9796
"eslint-plugin-regexp": "2.10.0",
9897
"eslint-plugin-sonarjs": "3.0.5",
99-
"eslint-plugin-unicorn": "56.0.1",
98+
"eslint-plugin-unicorn": "61.0.2",
10099
"eslint-plugin-vue": "10.4.0",
101100
"eslint-plugin-vue-scoped-css": "2.12.0",
102101
"eslint-plugin-wc": "3.0.1",
102+
"globals": "16.4.0",
103103
"happy-dom": "18.0.1",
104104
"markdownlint-cli": "0.45.0",
105105
"material-icon-theme": "5.27.0",
@@ -112,6 +112,7 @@
112112
"stylelint-value-no-unknown-custom-properties": "6.0.1",
113113
"svgo": "4.0.0",
114114
"type-fest": "4.41.0",
115+
"typescript-eslint": "8.43.0",
115116
"updates": "16.7.0",
116117
"vite-string-plugin": "1.4.6",
117118
"vitest": "3.2.4",

pnpm-lock.yaml

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

types.d.ts

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,29 @@
11
declare module '@techknowlogick/license-checker-webpack-plugin' {
22
const plugin: any;
3-
export = plugin
3+
export = plugin;
4+
}
5+
declare module 'eslint-plugin-no-use-extend-native' {
6+
import type {Eslint} from 'eslint';
7+
const plugin: Eslint.Plugin;
8+
export = plugin;
9+
}
10+
declare module 'eslint-plugin-array-func' {
11+
import type {Eslint} from 'eslint';
12+
const plugin: Eslint.Plugin;
13+
export = plugin;
14+
}
15+
declare module 'eslint-plugin-github' {
16+
import type {Eslint} from 'eslint';
17+
const plugin: Eslint.Plugin;
18+
export = plugin;
19+
}
20+
declare module 'eslint-plugin-no-jquery' {
21+
import type {Eslint} from 'eslint';
22+
const plugin: Eslint.Plugin;
23+
export = plugin;
24+
}
25+
declare module '@eslint-community/eslint-plugin-eslint-comments' {
26+
import type {Eslint} from 'eslint';
27+
const plugin: Eslint.Plugin;
28+
export = plugin;
429
}

updates.config.ts

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,6 @@ export default {
55
'@mcaptcha/vanilla-glue', // breaking changes in rc versions need to be handled
66
'@stylistic/eslint-plugin-js', // need to migrate to eslint 9
77
'cropperjs', // need to migrate to v2 but v2 is not compatible with v1
8-
'eslint', // need to migrate to eslint flat config first
9-
'eslint-plugin-array-func', // need to migrate to eslint flat config first
10-
'eslint-plugin-github', // need to migrate to eslint 9 - https://github.com/github/eslint-plugin-github/issues/585
11-
'eslint-plugin-no-use-extend-native', // need to migrate to eslint flat config first
12-
'eslint-plugin-unicorn', // need to migrate to eslint 9
13-
'eslint-plugin-vitest', // need to migrate to eslint flat config first
148
'tailwindcss', // need to migrate
159
],
1610
} satisfies Config;

web_src/js/components/RepoBranchTagSelector.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ export default defineComponent({
153153
return -1;
154154
},
155155
getActiveItem() {
156-
const el = this.$refs[`listItem${this.activeItemIndex}`]; // eslint-disable-line no-jquery/variable-pattern
156+
const el = this.$refs[`listItem${this.activeItemIndex}`];
157157
// @ts-expect-error - el is unknown type
158158
return (el && el.length) ? el[0] : null;
159159
},

web_src/js/components/ViewFileTreeStore.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import {pathEscapeSegments} from '../utils/url.ts';
44
import {createElementFromHTML} from '../utils/dom.ts';
55
import {html} from '../utils/html.ts';
66

7-
export function createViewFileTreeStore(props: { repoLink: string, treePath: string, currentRefNameSubURL: string}) {
7+
export function createViewFileTreeStore(props: {repoLink: string, treePath: string, currentRefNameSubURL: string}) {
88
const store = reactive({
99
rootFiles: [],
1010
selectedItem: props.treePath,

web_src/js/features/codeeditor.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ type EditorConfig = {
1919
trim_trailing_whitespace?: boolean,
2020
insert_final_newline?: boolean,
2121
root?: boolean,
22-
}
22+
};
2323

2424
const languagesByFilename: Record<string, string> = {};
2525
const languagesByExt: Record<string, string> = {};

0 commit comments

Comments
 (0)