1
1
mirror of https://github.com/go-gitea/gitea synced 2024-12-22 00:24:27 +00:00

Switch to eslint-plugin-import-x (#32790)

Switch from deprecated `eslint-plugin-i` to
[`eslint-plugin-import-x`](https://github.com/un-ts/eslint-plugin-import-x).
This commit is contained in:
silverwind 2024-12-12 03:07:32 +01:00 committed by GitHub
parent 17f0411441
commit ee45950dab
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 96 additions and 104 deletions

View File

@ -16,10 +16,10 @@ parserOptions:
parser: "@typescript-eslint/parser" # for vue plugin - https://eslint.vuejs.org/user-guide/#how-to-use-a-custom-parser parser: "@typescript-eslint/parser" # for vue plugin - https://eslint.vuejs.org/user-guide/#how-to-use-a-custom-parser
settings: settings:
import/extensions: [".js", ".ts"] import-x/extensions: [".js", ".ts"]
import/parsers: import-x/parsers:
"@typescript-eslint/parser": [".js", ".ts"] "@typescript-eslint/parser": [".js", ".ts"]
import/resolver: import-x/resolver:
typescript: true typescript: true
plugins: plugins:
@ -28,7 +28,7 @@ plugins:
- "@typescript-eslint/eslint-plugin" - "@typescript-eslint/eslint-plugin"
- eslint-plugin-array-func - eslint-plugin-array-func
- eslint-plugin-github - eslint-plugin-github
- eslint-plugin-i - eslint-plugin-import-x
- eslint-plugin-no-jquery - eslint-plugin-no-jquery
- eslint-plugin-no-use-extend-native - eslint-plugin-no-use-extend-native
- eslint-plugin-regexp - eslint-plugin-regexp
@ -58,15 +58,15 @@ overrides:
no-restricted-globals: [2, addEventListener, blur, close, closed, confirm, defaultStatus, defaultstatus, error, event, external, find, focus, frameElement, frames, history, innerHeight, innerWidth, isFinite, isNaN, length, locationbar, menubar, moveBy, moveTo, name, onblur, onerror, onfocus, onload, onresize, onunload, open, opener, opera, outerHeight, outerWidth, pageXOffset, pageYOffset, parent, print, removeEventListener, resizeBy, resizeTo, screen, screenLeft, screenTop, screenX, screenY, scroll, scrollbars, scrollBy, scrollTo, scrollX, scrollY, status, statusbar, stop, toolbar, top] no-restricted-globals: [2, addEventListener, blur, close, closed, confirm, defaultStatus, defaultstatus, error, event, external, find, focus, frameElement, frames, history, innerHeight, innerWidth, isFinite, isNaN, length, locationbar, menubar, moveBy, moveTo, name, onblur, onerror, onfocus, onload, onresize, onunload, open, opener, opera, outerHeight, outerWidth, pageXOffset, pageYOffset, parent, print, removeEventListener, resizeBy, resizeTo, screen, screenLeft, screenTop, screenX, screenY, scroll, scrollbars, scrollBy, scrollTo, scrollX, scrollY, status, statusbar, stop, toolbar, top]
- files: ["*.config.*"] - files: ["*.config.*"]
rules: rules:
i/no-unused-modules: [0] import-x/no-unused-modules: [0]
- files: ["**/*.d.ts"] - files: ["**/*.d.ts"]
rules: rules:
i/no-unused-modules: [0] import-x/no-unused-modules: [0]
"@typescript-eslint/consistent-type-definitions": [0] "@typescript-eslint/consistent-type-definitions": [0]
"@typescript-eslint/consistent-type-imports": [0] "@typescript-eslint/consistent-type-imports": [0]
- files: ["web_src/js/types.ts"] - files: ["web_src/js/types.ts"]
rules: rules:
i/no-unused-modules: [0] import-x/no-unused-modules: [0]
- files: ["**/*.test.*", "web_src/js/test/setup.ts"] - files: ["**/*.test.*", "web_src/js/test/setup.ts"]
env: env:
vitest-globals/env: true vitest-globals/env: true
@ -394,49 +394,49 @@ rules:
id-blacklist: [0] id-blacklist: [0]
id-length: [0] id-length: [0]
id-match: [0] id-match: [0]
i/consistent-type-specifier-style: [0] import-x/consistent-type-specifier-style: [0]
i/default: [0] import-x/default: [0]
i/dynamic-import-chunkname: [0] import-x/dynamic-import-chunkname: [0]
i/export: [2] import-x/export: [2]
i/exports-last: [0] import-x/exports-last: [0]
i/extensions: [2, always, {ignorePackages: true}] import-x/extensions: [2, always, {ignorePackages: true}]
i/first: [2] import-x/first: [2]
i/group-exports: [0] import-x/group-exports: [0]
i/max-dependencies: [0] import-x/max-dependencies: [0]
i/named: [2] import-x/named: [2]
i/namespace: [0] import-x/namespace: [0]
i/newline-after-import: [0] import-x/newline-after-import: [0]
i/no-absolute-path: [0] import-x/no-absolute-path: [0]
i/no-amd: [2] import-x/no-amd: [2]
i/no-anonymous-default-export: [0] import-x/no-anonymous-default-export: [0]
i/no-commonjs: [2] import-x/no-commonjs: [2]
i/no-cycle: [2, {ignoreExternal: true, maxDepth: 1}] import-x/no-cycle: [2, {ignoreExternal: true, maxDepth: 1}]
i/no-default-export: [0] import-x/no-default-export: [0]
i/no-deprecated: [0] import-x/no-deprecated: [0]
i/no-dynamic-require: [0] import-x/no-dynamic-require: [0]
i/no-empty-named-blocks: [2] import-x/no-empty-named-blocks: [2]
i/no-extraneous-dependencies: [2] import-x/no-extraneous-dependencies: [2]
i/no-import-module-exports: [0] import-x/no-import-module-exports: [0]
i/no-internal-modules: [0] import-x/no-internal-modules: [0]
i/no-mutable-exports: [0] import-x/no-mutable-exports: [0]
i/no-named-as-default-member: [0] import-x/no-named-as-default-member: [0]
i/no-named-as-default: [0] import-x/no-named-as-default: [0]
i/no-named-default: [0] import-x/no-named-default: [0]
i/no-named-export: [0] import-x/no-named-export: [0]
i/no-namespace: [0] import-x/no-namespace: [0]
i/no-nodejs-modules: [0] import-x/no-nodejs-modules: [0]
i/no-relative-packages: [0] import-x/no-relative-packages: [0]
i/no-relative-parent-imports: [0] import-x/no-relative-parent-imports: [0]
i/no-restricted-paths: [0] import-x/no-restricted-paths: [0]
i/no-self-import: [2] import-x/no-self-import: [2]
i/no-unassigned-import: [0] import-x/no-unassigned-import: [0]
i/no-unresolved: [2, {commonjs: true, ignore: ["\\?.+$"]}] import-x/no-unresolved: [2, {commonjs: true, ignore: ["\\?.+$"]}]
i/no-unused-modules: [2, {unusedExports: true}] import-x/no-unused-modules: [2, {unusedExports: true}]
i/no-useless-path-segments: [2, {commonjs: true}] import-x/no-useless-path-segments: [2, {commonjs: true}]
i/no-webpack-loader-syntax: [2] import-x/no-webpack-loader-syntax: [2]
i/order: [0] import-x/order: [0]
i/prefer-default-export: [0] import-x/prefer-default-export: [0]
i/unambiguous: [0] import-x/unambiguous: [0]
init-declarations: [0] init-declarations: [0]
line-comment-position: [0] line-comment-position: [0]
logical-assignment-operators: [0] logical-assignment-operators: [0]

94
package-lock.json generated
View File

@ -87,7 +87,7 @@
"eslint-import-resolver-typescript": "3.7.0", "eslint-import-resolver-typescript": "3.7.0",
"eslint-plugin-array-func": "4.0.0", "eslint-plugin-array-func": "4.0.0",
"eslint-plugin-github": "5.1.3", "eslint-plugin-github": "5.1.3",
"eslint-plugin-i": "2.29.1", "eslint-plugin-import-x": "4.5.0",
"eslint-plugin-no-jquery": "3.1.0", "eslint-plugin-no-jquery": "3.1.0",
"eslint-plugin-no-use-extend-native": "0.5.0", "eslint-plugin-no-use-extend-native": "0.5.0",
"eslint-plugin-playwright": "2.1.0", "eslint-plugin-playwright": "2.1.0",
@ -8385,56 +8385,6 @@
"node": "*" "node": "*"
} }
}, },
"node_modules/eslint-plugin-i": {
"version": "2.29.1",
"resolved": "https://registry.npmjs.org/eslint-plugin-i/-/eslint-plugin-i-2.29.1.tgz",
"integrity": "sha512-ORizX37MelIWLbMyqI7hi8VJMf7A0CskMmYkB+lkCX3aF4pkGV7kwx5bSEb4qx7Yce2rAf9s34HqDRPjGRZPNQ==",
"dev": true,
"license": "MIT",
"dependencies": {
"debug": "^4.3.4",
"doctrine": "^3.0.0",
"eslint-import-resolver-node": "^0.3.9",
"eslint-module-utils": "^2.8.0",
"get-tsconfig": "^4.7.2",
"is-glob": "^4.0.3",
"minimatch": "^3.1.2",
"semver": "^7.5.4"
},
"engines": {
"node": ">=12"
},
"funding": {
"url": "https://opencollective.com/unts"
},
"peerDependencies": {
"eslint": "^7.2.0 || ^8"
}
},
"node_modules/eslint-plugin-i/node_modules/brace-expansion": {
"version": "1.1.11",
"resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz",
"integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==",
"dev": true,
"license": "MIT",
"dependencies": {
"balanced-match": "^1.0.0",
"concat-map": "0.0.1"
}
},
"node_modules/eslint-plugin-i/node_modules/minimatch": {
"version": "3.1.2",
"resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz",
"integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==",
"dev": true,
"license": "ISC",
"dependencies": {
"brace-expansion": "^1.1.7"
},
"engines": {
"node": "*"
}
},
"node_modules/eslint-plugin-i18n-text": { "node_modules/eslint-plugin-i18n-text": {
"version": "1.0.1", "version": "1.0.1",
"resolved": "https://registry.npmjs.org/eslint-plugin-i18n-text/-/eslint-plugin-i18n-text-1.0.1.tgz", "resolved": "https://registry.npmjs.org/eslint-plugin-i18n-text/-/eslint-plugin-i18n-text-1.0.1.tgz",
@ -8479,6 +8429,48 @@
"eslint": "^2 || ^3 || ^4 || ^5 || ^6 || ^7.2.0 || ^8 || ^9" "eslint": "^2 || ^3 || ^4 || ^5 || ^6 || ^7.2.0 || ^8 || ^9"
} }
}, },
"node_modules/eslint-plugin-import-x": {
"version": "4.5.0",
"resolved": "https://registry.npmjs.org/eslint-plugin-import-x/-/eslint-plugin-import-x-4.5.0.tgz",
"integrity": "sha512-l0OTfnPF8RwmSXfjT75N8d6ZYLVrVYWpaGlgvVkVqFERCI5SyBfDP7QEMr3kt0zWi2sOa9EQ47clbdFsHkF83Q==",
"dev": true,
"license": "MIT",
"dependencies": {
"@typescript-eslint/scope-manager": "^8.1.0",
"@typescript-eslint/utils": "^8.1.0",
"debug": "^4.3.4",
"doctrine": "^3.0.0",
"eslint-import-resolver-node": "^0.3.9",
"get-tsconfig": "^4.7.3",
"is-glob": "^4.0.3",
"minimatch": "^9.0.3",
"semver": "^7.6.3",
"stable-hash": "^0.0.4",
"tslib": "^2.6.3"
},
"engines": {
"node": "^18.18.0 || ^20.9.0 || >=21.1.0"
},
"peerDependencies": {
"eslint": "^8.57.0 || ^9.0.0"
}
},
"node_modules/eslint-plugin-import-x/node_modules/minimatch": {
"version": "9.0.5",
"resolved": "https://registry.npmjs.org/minimatch/-/minimatch-9.0.5.tgz",
"integrity": "sha512-G6T0ZX48xgozx7587koeX9Ys2NYy6Gmv//P89sEte9V9whIapMNF4idKxnW2QtCcLiTWlb/wfCabAtAFWhhBow==",
"dev": true,
"license": "ISC",
"dependencies": {
"brace-expansion": "^2.0.1"
},
"engines": {
"node": ">=16 || 14 >=14.17"
},
"funding": {
"url": "https://github.com/sponsors/isaacs"
}
},
"node_modules/eslint-plugin-import/node_modules/brace-expansion": { "node_modules/eslint-plugin-import/node_modules/brace-expansion": {
"version": "1.1.11", "version": "1.1.11",
"resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz",

View File

@ -86,7 +86,7 @@
"eslint-import-resolver-typescript": "3.7.0", "eslint-import-resolver-typescript": "3.7.0",
"eslint-plugin-array-func": "4.0.0", "eslint-plugin-array-func": "4.0.0",
"eslint-plugin-github": "5.1.3", "eslint-plugin-github": "5.1.3",
"eslint-plugin-i": "2.29.1", "eslint-plugin-import-x": "4.5.0",
"eslint-plugin-no-jquery": "3.1.0", "eslint-plugin-no-jquery": "3.1.0",
"eslint-plugin-no-use-extend-native": "0.5.0", "eslint-plugin-no-use-extend-native": "0.5.0",
"eslint-plugin-playwright": "2.1.0", "eslint-plugin-playwright": "2.1.0",

View File

@ -1,6 +1,6 @@
#!/usr/bin/env node #!/usr/bin/env node
import imageminZopfli from 'imagemin-zopfli'; // eslint-disable-line i/no-unresolved import imageminZopfli from 'imagemin-zopfli'; // eslint-disable-line import-x/no-unresolved
import {loadSVGFromString, Canvas, Rect, util} from 'fabric/node'; // eslint-disable-line i/no-unresolved import {loadSVGFromString, Canvas, Rect, util} from 'fabric/node'; // eslint-disable-line import-x/no-unresolved
import {optimize} from 'svgo'; import {optimize} from 'svgo';
import {readFile, writeFile} from 'node:fs/promises'; import {readFile, writeFile} from 'node:fs/promises';
import {argv, exit} from 'node:process'; import {argv, exit} from 'node:process';