Skip to content

Commit

Permalink
fix: Fix eslint and its config for the breaking changes in ESLint v9.x
Browse files Browse the repository at this point in the history
  • Loading branch information
hangxingliu committed Apr 28, 2024
1 parent 2072f2a commit 50590e5
Show file tree
Hide file tree
Showing 5 changed files with 42 additions and 28 deletions.
19 changes: 0 additions & 19 deletions .eslintrc.js

This file was deleted.

24 changes: 24 additions & 0 deletions eslint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
//@ts-check
/// <reference types="node" />
const globals = require("globals");
const eslint = require("@eslint/js");
const tseslint = require("typescript-eslint");

module.exports = tseslint.config(eslint.configs.recommended, ...tseslint.configs.recommended, {
// ignores: [".tsc", "artifacts", "out", "node_modules", "eslint.config.js"],
rules: {
"no-useless-escape": "off",
"prefer-const": "warn",
"@typescript-eslint/no-var-requires": "off",
// https://github.com/typescript-eslint/typescript-eslint/issues/2621
"no-unused-vars": "off",
"@typescript-eslint/no-unused-vars": ["warn", { args: "none" }],
},
languageOptions: {
globals: {
...globals.browser,
...globals.node,
...globals.commonjs,
},
},
});
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -234,10 +234,10 @@
"webpack-cli": "^5"
},
"optionalDependencies": {
"@typescript-eslint/eslint-plugin": "^7",
"@typescript-eslint/parser": "^7",
"@eslint/js": "^9.1.1",
"@vscode/vsce": "^2.24.0",
"eslint": "^9"
"eslint": "^9.1.1",
"typescript-eslint": "^7.7.1"
},
"repository": {
"type": "git",
Expand Down
4 changes: 2 additions & 2 deletions src/syntax/common/tmLanguage-repo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ export class RepositoryManager {
readonly usage: { [name in RepositoryNames]: number };

constructor() {
const usage: any = {};
const usage: { [name in RepositoryNames]?: number } = {};
for (const name of Object.keys(this.repo)) usage[name] = 0;
this.usage = usage;
this.usage = usage as typeof this.usage;
}

/**
Expand Down
17 changes: 13 additions & 4 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@
minimatch "^3.1.2"
strip-json-comments "^3.1.1"

"@eslint/[email protected]":
"@eslint/[email protected]", "@eslint/js@^9.1.1":
version "9.1.1"
resolved "https://registry.yarnpkg.com/@eslint/js/-/js-9.1.1.tgz#eb0f82461d12779bbafc1b5045cde3143d350a8a"
integrity sha512-5WoDz3Y19Bg2BnErkZTp0en+c/i9PvgFS7MBe1+m60HjFr0hrphlAGp4yzI7pxpt4xShln4ZyYp4neJm8hmOkQ==
Expand Down Expand Up @@ -458,7 +458,7 @@
resolved "https://registry.yarnpkg.com/@types/vscode/-/vscode-1.88.0.tgz#2dc690237f7ef049942508c8609b6b9f5216b4d3"
integrity sha512-rWY+Bs6j/f1lvr8jqZTyp5arRMfovdxolcqGi+//+cPDOh8SBvzXH90e7BiSXct5HJ9HGW6jATchbRTpTJpEkw==

"@typescript-eslint/eslint-plugin@^7":
"@typescript-eslint/eslint-plugin@7.7.1":
version "7.7.1"
resolved "https://registry.yarnpkg.com/@typescript-eslint/eslint-plugin/-/eslint-plugin-7.7.1.tgz#50a9044e3e5fe76b22caf64fb7fc1f97614bdbfd"
integrity sha512-KwfdWXJBOviaBVhxO3p5TJiLpNuh2iyXyjmWN0f1nU87pwyvfS0EmjC6ukQVYVFJd/K1+0NWGPDXiyEyQorn0Q==
Expand All @@ -475,7 +475,7 @@
semver "^7.6.0"
ts-api-utils "^1.3.0"

"@typescript-eslint/parser@^7":
"@typescript-eslint/parser@7.7.1":
version "7.7.1"
resolved "https://registry.yarnpkg.com/@typescript-eslint/parser/-/parser-7.7.1.tgz#f940e9f291cdca40c46cb75916217d3a42d6ceea"
integrity sha512-vmPzBOOtz48F6JAGVS/kZYk4EkXao6iGrD838sp1w3NQQC0W8ry/q641KU4PrG7AKNAf56NOcR8GOpH8l9FPCw==
Expand Down Expand Up @@ -1389,7 +1389,7 @@ eslint-visitor-keys@^4.0.0:
resolved "https://registry.yarnpkg.com/eslint-visitor-keys/-/eslint-visitor-keys-4.0.0.tgz#e3adc021aa038a2a8e0b2f8b0ce8f66b9483b1fb"
integrity sha512-OtIRv/2GyiF6o/d8K7MYKKbXrOUBIK6SfkIRM4Z0dY3w+LiQ0vy3F57m0Z71bjbyeiWFiHJ8brqnmE6H6/jEuw==

eslint@^9:
eslint@^9.1.1:
version "9.1.1"
resolved "https://registry.yarnpkg.com/eslint/-/eslint-9.1.1.tgz#39ec657ccd12813cb4a1dab2f9229dcc6e468271"
integrity sha512-b4cRQ0BeZcSEzPpY2PjFY70VbO32K7BStTGtBsnIGdTSEEQzBi8hPBcGQmTG2zUvFr9uLe0TK42bw8YszuHEqg==
Expand Down Expand Up @@ -3318,6 +3318,15 @@ typed-rest-client@^1.8.4:
tunnel "0.0.6"
underscore "^1.12.1"

typescript-eslint@^7.7.1:
version "7.7.1"
resolved "https://registry.yarnpkg.com/typescript-eslint/-/typescript-eslint-7.7.1.tgz#16f82e83bb0955af02f258cb7a9de59e1bfb8706"
integrity sha512-ykEBfa3xx3odjZy6GRED4SCPrjo0rgHwstLlEgLX4EMEuv7QeIDSmfV+S6Kk+XkbsYn4BDEcPvsci1X26lRpMQ==
dependencies:
"@typescript-eslint/eslint-plugin" "7.7.1"
"@typescript-eslint/parser" "7.7.1"
"@typescript-eslint/utils" "7.7.1"

typescript@^5:
version "5.4.5"
resolved "https://registry.yarnpkg.com/typescript/-/typescript-5.4.5.tgz#42ccef2c571fdbd0f6718b1d1f5e6e5ef006f611"
Expand Down

0 comments on commit 50590e5

Please sign in to comment.