Improve ESLint config (#24290)

* Improve ESLint config
pull/24304/head
Logan Rosen 2025-02-18 12:30:36 -05:00 committed by GitHub
parent 83d4a408f6
commit c7a46ec25b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
6 changed files with 103 additions and 94 deletions

View File

@ -1,16 +1,16 @@
// @ts-check
import tseslint from "typescript-eslint";
import rootConfig from "../eslint.config.mjs"; import rootConfig from "../eslint.config.mjs";
export default [ export default tseslint.config(...rootConfig, {
...rootConfig, rules: {
{ "no-console": "off",
rules: { "import/no-extraneous-dependencies": "off",
"no-console": "off", "import/extensions": "off",
"import/no-extraneous-dependencies": "off", "import/no-dynamic-require": "off",
"import/extensions": "off", "global-require": "off",
"import/no-dynamic-require": "off", "@typescript-eslint/no-require-imports": "off",
"global-require": "off", "prefer-arrow-callback": "off",
"@typescript-eslint/no-require-imports": "off",
"prefer-arrow-callback": "off",
},
}, },
]; });

View File

@ -1,11 +1,16 @@
// @ts-check
/* eslint-disable import/no-extraneous-dependencies */ /* eslint-disable import/no-extraneous-dependencies */
import unusedImports from "eslint-plugin-unused-imports"; import unusedImports from "eslint-plugin-unused-imports";
import globals from "globals"; import globals from "globals";
import tsParser from "@typescript-eslint/parser";
import path from "node:path"; import path from "node:path";
import { fileURLToPath } from "node:url"; import { fileURLToPath } from "node:url";
import js from "@eslint/js"; import js from "@eslint/js";
import { FlatCompat } from "@eslint/eslintrc"; import { FlatCompat } from "@eslint/eslintrc";
import tseslint from "typescript-eslint";
import eslintConfigPrettier from "eslint-config-prettier";
import { configs as litConfigs } from "eslint-plugin-lit";
import { configs as wcConfigs } from "eslint-plugin-wc";
const _filename = fileURLToPath(import.meta.url); const _filename = fileURLToPath(import.meta.url);
const _dirname = path.dirname(_filename); const _dirname = path.dirname(_filename);
@ -15,17 +20,14 @@ const compat = new FlatCompat({
allConfig: js.configs.all, allConfig: js.configs.all,
}); });
export default [ export default tseslint.config(
...compat.extends( ...compat.extends("airbnb-base", "plugin:lit-a11y/recommended"),
"airbnb-base", eslintConfigPrettier,
"plugin:@typescript-eslint/recommended", litConfigs["flat/all"],
"plugin:@typescript-eslint/strict", tseslint.configs.recommended,
"plugin:@typescript-eslint/stylistic", tseslint.configs.strict,
"plugin:wc/recommended", tseslint.configs.stylistic,
"plugin:lit/all", wcConfigs["flat/recommended"],
"plugin:lit-a11y/recommended",
"prettier"
),
{ {
plugins: { plugins: {
"unused-imports": unusedImports, "unused-imports": unusedImports,
@ -43,7 +45,7 @@ export default [
Polymer: true, Polymer: true,
}, },
parser: tsParser, parser: tseslint.parser,
ecmaVersion: 2020, ecmaVersion: 2020,
sourceType: "module", sourceType: "module",
@ -184,5 +186,5 @@ export default [
], ],
"no-use-before-define": "off", "no-use-before-define": "off",
}, },
}, }
]; );

View File

@ -1,10 +1,10 @@
// @ts-check
import tseslint from "typescript-eslint";
import rootConfig from "../eslint.config.mjs"; import rootConfig from "../eslint.config.mjs";
export default [ export default tseslint.config(...rootConfig, {
...rootConfig, rules: {
{ "no-console": "off",
rules: {
"no-console": "off",
},
}, },
]; });

View File

@ -186,8 +186,6 @@
"@types/tar": "6.1.13", "@types/tar": "6.1.13",
"@types/ua-parser-js": "0.7.39", "@types/ua-parser-js": "0.7.39",
"@types/webspeechapi": "0.0.29", "@types/webspeechapi": "0.0.29",
"@typescript-eslint/eslint-plugin": "8.24.0",
"@typescript-eslint/parser": "8.24.0",
"@vitest/coverage-v8": "3.0.5", "@vitest/coverage-v8": "3.0.5",
"babel-loader": "9.2.1", "babel-loader": "9.2.1",
"babel-plugin-template-html-minifier": "4.1.0", "babel-plugin-template-html-minifier": "4.1.0",
@ -227,6 +225,7 @@
"terser-webpack-plugin": "5.3.11", "terser-webpack-plugin": "5.3.11",
"ts-lit-plugin": "2.0.2", "ts-lit-plugin": "2.0.2",
"typescript": "5.7.3", "typescript": "5.7.3",
"typescript-eslint": "8.24.1",
"vitest": "3.0.5", "vitest": "3.0.5",
"webpack-stats-plugin": "1.1.3", "webpack-stats-plugin": "1.1.3",
"webpackbar": "7.0.0", "webpackbar": "7.0.0",

View File

@ -1,5 +0,0 @@
{
"rules": {
"import/no-extraneous-dependencies": 0
}
}

117
yarn.lock
View File

@ -5021,15 +5021,15 @@ __metadata:
languageName: node languageName: node
linkType: hard linkType: hard
"@typescript-eslint/eslint-plugin@npm:8.24.0": "@typescript-eslint/eslint-plugin@npm:8.24.1":
version: 8.24.0 version: 8.24.1
resolution: "@typescript-eslint/eslint-plugin@npm:8.24.0" resolution: "@typescript-eslint/eslint-plugin@npm:8.24.1"
dependencies: dependencies:
"@eslint-community/regexpp": "npm:^4.10.0" "@eslint-community/regexpp": "npm:^4.10.0"
"@typescript-eslint/scope-manager": "npm:8.24.0" "@typescript-eslint/scope-manager": "npm:8.24.1"
"@typescript-eslint/type-utils": "npm:8.24.0" "@typescript-eslint/type-utils": "npm:8.24.1"
"@typescript-eslint/utils": "npm:8.24.0" "@typescript-eslint/utils": "npm:8.24.1"
"@typescript-eslint/visitor-keys": "npm:8.24.0" "@typescript-eslint/visitor-keys": "npm:8.24.1"
graphemer: "npm:^1.4.0" graphemer: "npm:^1.4.0"
ignore: "npm:^5.3.1" ignore: "npm:^5.3.1"
natural-compare: "npm:^1.4.0" natural-compare: "npm:^1.4.0"
@ -5038,64 +5038,64 @@ __metadata:
"@typescript-eslint/parser": ^8.0.0 || ^8.0.0-alpha.0 "@typescript-eslint/parser": ^8.0.0 || ^8.0.0-alpha.0
eslint: ^8.57.0 || ^9.0.0 eslint: ^8.57.0 || ^9.0.0
typescript: ">=4.8.4 <5.8.0" typescript: ">=4.8.4 <5.8.0"
checksum: 10/2b65131dab6159285cd8688ae8fe4708e87f6aede7a6bcf65deec6f506a26f04409c7320d7957f59380f5b387fff2acfaa2c8117e2cbfc1b9368002e7905f616 checksum: 10/4c455e98d47f8dc1ea12c0dae0a849de49b0ad9aa5f9591b2ba24c07b75af0782a349d13cf6c5c375c6e8ba43d12555f932d43d31f25c8848eceb972021c12ee
languageName: node languageName: node
linkType: hard linkType: hard
"@typescript-eslint/parser@npm:8.24.0": "@typescript-eslint/parser@npm:8.24.1":
version: 8.24.0 version: 8.24.1
resolution: "@typescript-eslint/parser@npm:8.24.0" resolution: "@typescript-eslint/parser@npm:8.24.1"
dependencies: dependencies:
"@typescript-eslint/scope-manager": "npm:8.24.0" "@typescript-eslint/scope-manager": "npm:8.24.1"
"@typescript-eslint/types": "npm:8.24.0" "@typescript-eslint/types": "npm:8.24.1"
"@typescript-eslint/typescript-estree": "npm:8.24.0" "@typescript-eslint/typescript-estree": "npm:8.24.1"
"@typescript-eslint/visitor-keys": "npm:8.24.0" "@typescript-eslint/visitor-keys": "npm:8.24.1"
debug: "npm:^4.3.4" debug: "npm:^4.3.4"
peerDependencies: peerDependencies:
eslint: ^8.57.0 || ^9.0.0 eslint: ^8.57.0 || ^9.0.0
typescript: ">=4.8.4 <5.8.0" typescript: ">=4.8.4 <5.8.0"
checksum: 10/b5c66a3208c69144cd5d0b7a2c763205ef8ae88eea76067186bab0909aa9756fe015616b98a7f252a5106aa5e86baeb98f9affbdc0f5d19863a2150f2431bfe0 checksum: 10/9a0f86b140a2c63ff8eca17f40fe315d8a5b7ab51594e2630caff845717aab1c2138edd070e710d7edb0daf685d6bba827e983e8cb076b53d03eda07307b0113
languageName: node languageName: node
linkType: hard linkType: hard
"@typescript-eslint/scope-manager@npm:8.24.0": "@typescript-eslint/scope-manager@npm:8.24.1":
version: 8.24.0 version: 8.24.1
resolution: "@typescript-eslint/scope-manager@npm:8.24.0" resolution: "@typescript-eslint/scope-manager@npm:8.24.1"
dependencies: dependencies:
"@typescript-eslint/types": "npm:8.24.0" "@typescript-eslint/types": "npm:8.24.1"
"@typescript-eslint/visitor-keys": "npm:8.24.0" "@typescript-eslint/visitor-keys": "npm:8.24.1"
checksum: 10/175032d4f714d68b734d7281c340e073a37d348010d308b9cccf8d63d745b8cc9515229e32dcd838acf4a85e21a4e8eff6c557c31ba45e36917e3417de32d723 checksum: 10/ab668c073c51cf801a1f5ef8578d0ae29d778d92b143cb1575bb7a867016f45ef4d044ce374fbe47606391f2d39b6963df725964e90af85bff1c435d8006b535
languageName: node languageName: node
linkType: hard linkType: hard
"@typescript-eslint/type-utils@npm:8.24.0": "@typescript-eslint/type-utils@npm:8.24.1":
version: 8.24.0 version: 8.24.1
resolution: "@typescript-eslint/type-utils@npm:8.24.0" resolution: "@typescript-eslint/type-utils@npm:8.24.1"
dependencies: dependencies:
"@typescript-eslint/typescript-estree": "npm:8.24.0" "@typescript-eslint/typescript-estree": "npm:8.24.1"
"@typescript-eslint/utils": "npm:8.24.0" "@typescript-eslint/utils": "npm:8.24.1"
debug: "npm:^4.3.4" debug: "npm:^4.3.4"
ts-api-utils: "npm:^2.0.1" ts-api-utils: "npm:^2.0.1"
peerDependencies: peerDependencies:
eslint: ^8.57.0 || ^9.0.0 eslint: ^8.57.0 || ^9.0.0
typescript: ">=4.8.4 <5.8.0" typescript: ">=4.8.4 <5.8.0"
checksum: 10/a6558d0b0ab7a43826b481c103c556abbafa93c9941d75d647266dc0f55e68950f44a63842a2e7839a7448329f9b7ee88c84913084438dbac38dba5efbc1afbc checksum: 10/7161f6218f2f1a100142c50d71d5e470459821e3715a4d6717be3ae4e1ef8aac06c6144f1010690f15c34ee9d8330526324a8133e541aa7382439f180ccb2860
languageName: node languageName: node
linkType: hard linkType: hard
"@typescript-eslint/types@npm:8.24.0": "@typescript-eslint/types@npm:8.24.1":
version: 8.24.0 version: 8.24.1
resolution: "@typescript-eslint/types@npm:8.24.0" resolution: "@typescript-eslint/types@npm:8.24.1"
checksum: 10/ddaaec99c191830cc29ce289678d44f7201dd06c29540750ca4802b6bd2a6dfd8cc29b46ed270dc0198f23e742540bb1e4fe618b6b44e4e76bad7f774bd3fc4a checksum: 10/f3f624d7494c02a35810988388e2d5cc35ac10860e455148faba0fe332c6b8cf4be0aa0c1e0f0012813e2d6e86c17aadadfd0c7c6e73433c064755df7d81535b
languageName: node languageName: node
linkType: hard linkType: hard
"@typescript-eslint/typescript-estree@npm:8.24.0": "@typescript-eslint/typescript-estree@npm:8.24.1":
version: 8.24.0 version: 8.24.1
resolution: "@typescript-eslint/typescript-estree@npm:8.24.0" resolution: "@typescript-eslint/typescript-estree@npm:8.24.1"
dependencies: dependencies:
"@typescript-eslint/types": "npm:8.24.0" "@typescript-eslint/types": "npm:8.24.1"
"@typescript-eslint/visitor-keys": "npm:8.24.0" "@typescript-eslint/visitor-keys": "npm:8.24.1"
debug: "npm:^4.3.4" debug: "npm:^4.3.4"
fast-glob: "npm:^3.3.2" fast-glob: "npm:^3.3.2"
is-glob: "npm:^4.0.3" is-glob: "npm:^4.0.3"
@ -5104,32 +5104,32 @@ __metadata:
ts-api-utils: "npm:^2.0.1" ts-api-utils: "npm:^2.0.1"
peerDependencies: peerDependencies:
typescript: ">=4.8.4 <5.8.0" typescript: ">=4.8.4 <5.8.0"
checksum: 10/89e451f5d2136b405d046823c93ac7065d90c7a9f084ffb324e374c769b17ee2580d3711ada1e1575331b234059148f173230e560b08efa3073f8f0c04ce1224 checksum: 10/b0645010607d3469b85479344245ef1fd6bd24804271fb439280167ad87e9f05cdf6a2ba2ccbcdc946c339c323249a86dd1e7ce6e130eb6e73ea619795b76151
languageName: node languageName: node
linkType: hard linkType: hard
"@typescript-eslint/utils@npm:8.24.0": "@typescript-eslint/utils@npm:8.24.1":
version: 8.24.0 version: 8.24.1
resolution: "@typescript-eslint/utils@npm:8.24.0" resolution: "@typescript-eslint/utils@npm:8.24.1"
dependencies: dependencies:
"@eslint-community/eslint-utils": "npm:^4.4.0" "@eslint-community/eslint-utils": "npm:^4.4.0"
"@typescript-eslint/scope-manager": "npm:8.24.0" "@typescript-eslint/scope-manager": "npm:8.24.1"
"@typescript-eslint/types": "npm:8.24.0" "@typescript-eslint/types": "npm:8.24.1"
"@typescript-eslint/typescript-estree": "npm:8.24.0" "@typescript-eslint/typescript-estree": "npm:8.24.1"
peerDependencies: peerDependencies:
eslint: ^8.57.0 || ^9.0.0 eslint: ^8.57.0 || ^9.0.0
typescript: ">=4.8.4 <5.8.0" typescript: ">=4.8.4 <5.8.0"
checksum: 10/773a4085e45a94f5a64b34550e7d890b5418c69a9dcd58862410e7e0ded46e3380c8dd7d38baafaa93ef40b2a77320092bded3ca36f15b2f7ea6babeb831e590 checksum: 10/90890afc1de2eaabf94fb80e03713b81e976d927fa998159d132a0cf17c093a1722e27be9a642c5b94104db6dedb86a15addac046853c1f608bdcef27cfb1fd1
languageName: node languageName: node
linkType: hard linkType: hard
"@typescript-eslint/visitor-keys@npm:8.24.0": "@typescript-eslint/visitor-keys@npm:8.24.1":
version: 8.24.0 version: 8.24.1
resolution: "@typescript-eslint/visitor-keys@npm:8.24.0" resolution: "@typescript-eslint/visitor-keys@npm:8.24.1"
dependencies: dependencies:
"@typescript-eslint/types": "npm:8.24.0" "@typescript-eslint/types": "npm:8.24.1"
eslint-visitor-keys: "npm:^4.2.0" eslint-visitor-keys: "npm:^4.2.0"
checksum: 10/a93bc9e587784cbc47d6849f14581aa3f15574b187a7b98597362acbca43b06c36a6dfa889b5320ced62b182abf0b9759a694489d72fc7902cdea11830a7a535 checksum: 10/94876bd771e050dadf4af6e2bbb3819d3a14407d69a643153eb56857dae982cd3b68ba644613c433449e305ec0fd6f4aeab573ceb8f8d25fea9c55396153d6b9
languageName: node languageName: node
linkType: hard linkType: hard
@ -9398,8 +9398,6 @@ __metadata:
"@types/tar": "npm:6.1.13" "@types/tar": "npm:6.1.13"
"@types/ua-parser-js": "npm:0.7.39" "@types/ua-parser-js": "npm:0.7.39"
"@types/webspeechapi": "npm:0.0.29" "@types/webspeechapi": "npm:0.0.29"
"@typescript-eslint/eslint-plugin": "npm:8.24.0"
"@typescript-eslint/parser": "npm:8.24.0"
"@vaadin/combo-box": "npm:24.6.5" "@vaadin/combo-box": "npm:24.6.5"
"@vaadin/vaadin-themable-mixin": "npm:24.6.5" "@vaadin/vaadin-themable-mixin": "npm:24.6.5"
"@vibrant/color": "npm:4.0.0" "@vibrant/color": "npm:4.0.0"
@ -9487,6 +9485,7 @@ __metadata:
tsparticles-engine: "npm:2.12.0" tsparticles-engine: "npm:2.12.0"
tsparticles-preset-links: "npm:2.12.0" tsparticles-preset-links: "npm:2.12.0"
typescript: "npm:5.7.3" typescript: "npm:5.7.3"
typescript-eslint: "npm:8.24.1"
ua-parser-js: "npm:2.0.2" ua-parser-js: "npm:2.0.2"
vis-data: "npm:7.1.9" vis-data: "npm:7.1.9"
vis-network: "npm:9.1.9" vis-network: "npm:9.1.9"
@ -14685,6 +14684,20 @@ __metadata:
languageName: node languageName: node
linkType: hard linkType: hard
"typescript-eslint@npm:8.24.1":
version: 8.24.1
resolution: "typescript-eslint@npm:8.24.1"
dependencies:
"@typescript-eslint/eslint-plugin": "npm:8.24.1"
"@typescript-eslint/parser": "npm:8.24.1"
"@typescript-eslint/utils": "npm:8.24.1"
peerDependencies:
eslint: ^8.57.0 || ^9.0.0
typescript: ">=4.8.4 <5.8.0"
checksum: 10/c50e555c5a5a42f843d2a7d57315b35749eb05fdf2b264fd8471f8a825a744444fb534c0a6bb3f0086ad3b3dc0ef76da6ac3154a917af81c908016d5874cbbae
languageName: node
linkType: hard
"typescript@npm:5.7.3": "typescript@npm:5.7.3":
version: 5.7.3 version: 5.7.3
resolution: "typescript@npm:5.7.3" resolution: "typescript@npm:5.7.3"