diff --git a/.eslintrc.json b/.eslintrc.json deleted file mode 100644 index 524a641..0000000 --- a/.eslintrc.json +++ /dev/null @@ -1,54 +0,0 @@ -{ - "root": true, - "parser": "@typescript-eslint/parser", - "parserOptions": { - "ecmaVersion": 14, - "sourceType": "module", - "project": "./tsconfig.json" - }, - "plugins": [ - "@typescript-eslint" - ], - "rules": { - "@typescript-eslint/naming-convention": "warn", - "@typescript-eslint/no-unused-vars": "warn", - "@typescript-eslint/no-explicit-any": "warn", - "@typescript-eslint/array-type": ["error", { "default": "array-simple" }], - "@typescript-eslint/consistent-type-imports": ["error", { "prefer": "type-imports" }], - "@typescript-eslint/explicit-function-return-type": ["error", { "allowExpressions": true }], - "@typescript-eslint/consistent-type-exports": "error", - "@typescript-eslint/semi": "warn", - "curly": "warn", - "eqeqeq": "warn", - "no-throw-literal": "warn", - "semi": "off", - "no-mixed-requires":"error", - "no-this-before-super": "warn", - "no-unreachable": "warn", - "no-unused-vars": "off", - "max-len": ["warn", { "code": 80, "comments": 100, "ignoreComments": false }], - "no-fallthrough": "warn", - "newline-before-return": "warn", - "no-return-await": "warn", - "arrow-body-style": ["error", "as-needed"], - "no-unexpected-multiline": "error" - }, - "ignorePatterns": [ - "out", - "dist", - "**/*.d.ts", - "web/*.js" - ], - "env": { - "node": true, - "es6": true, - "commonjs": true, - "browser": false - }, - "extends": [ - "eslint:recommended", - "plugin:@typescript-eslint/recommended", - "plugin:@typescript-eslint/recommended-requiring-type-checking", - "prettier" - ] -} diff --git a/eslint.config.mjs b/eslint.config.mjs new file mode 100644 index 0000000..3efd59d --- /dev/null +++ b/eslint.config.mjs @@ -0,0 +1,58 @@ +import globals from "globals"; + +import tseslint from "typescript-eslint"; + +import js from "@eslint/js"; +import eslintConfigPrettier from "eslint-config-prettier"; + +export default [ + js.configs.recommended, + ...tseslint.configs.recommendedTypeChecked, + eslintConfigPrettier, + { + languageOptions: { + ecmaVersion: 14, + sourceType: "module", + globals: { + ...globals.node, + ...globals.es6, + ...globals.commonjs + }, + parserOptions: { + project: true, + tsconfigRootDir: import.meta.dirname + } + }, + files: ["src/**/*.mts"], + rules: { + "@typescript-eslint/naming-convention": "warn", + "@typescript-eslint/no-unused-vars": "warn", + "@typescript-eslint/no-explicit-any": "warn", + "@typescript-eslint/array-type": ["error", { default: "array-simple" }], + "@typescript-eslint/consistent-type-imports": ["error", { prefer: "type-imports" }], + "@typescript-eslint/explicit-function-return-type": ["error", { allowExpressions: true }], + "@typescript-eslint/consistent-type-exports": "error", + "@typescript-eslint/semi": "warn", + curly: "warn", + eqeqeq: "warn", + "no-throw-literal": "warn", + semi: "off", + "no-mixed-requires": "error", + "no-this-before-super": "warn", + "no-unreachable": "warn", + "no-unused-vars": "off", + "max-len": ["warn", { code: 80, comments: 100, ignoreComments: false }], + "no-fallthrough": "warn", + "newline-before-return": "warn", + "no-return-await": "warn", + "arrow-body-style": ["error", "as-needed"], + "no-unexpected-multiline": "error" + }, + ignores: [ + "out/", + "dist/", + "**/*.d.ts", + "web/**/*.js", + ] + } +]; diff --git a/package.json b/package.json index 8c36ba3..44fc1c9 100644 --- a/package.json +++ b/package.json @@ -183,10 +183,11 @@ "compile": "rollup -c", "watch": "rollup -cw", "package": "rollup -c --environment BUILD:production --sourcemap hidden", - "lint": "eslint src --ext mts", + "lint": "eslint src", "test": "yarn run lint" }, "devDependencies": { + "@eslint/js": "^9.0.0", "@rollup/plugin-commonjs": "^25.0.7", "@rollup/plugin-node-resolve": "^15.2.3", "@rollup/plugin-typescript": "^11.1.6", @@ -196,13 +197,13 @@ "@types/uuid": "^9.0.8", "@types/vscode": "^1.87.0", "@types/which": "^3.0.3", - "@typescript-eslint/eslint-plugin": "^7.5.0", - "@typescript-eslint/parser": "^7.5.0", "eslint": "^9.0.0", "eslint-config-prettier": "^9.1.0", + "globals": "^15.0.0", "rollup": "^4.14.1", "tslib": "^2.6.2", - "typescript": "^5.4.4" + "typescript": "^5.4.4", + "typescript-eslint": "^7.5.0" }, "dependencies": { "adm-zip": "^0.5.12", diff --git a/src/extension.mts b/src/extension.mts index f6ef853..c82ca99 100644 --- a/src/extension.mts +++ b/src/extension.mts @@ -462,7 +462,6 @@ export async function activate(context: ExtensionContext): Promise { } } -// eslint-disable-next-line @typescript-eslint/no-empty-function export function deactivate(): void { void commands.executeCommand("setContext", ContextKeys.isPicoProject, true); diff --git a/src/utils/download.mts b/src/utils/download.mts index 05f2f50..dad48e7 100644 --- a/src/utils/download.mts +++ b/src/utils/download.mts @@ -238,7 +238,6 @@ export async function downloadAndInstallTools( await mkdir(tmpBasePath, { recursive: true }); const archiveFilePath = join(tmpBasePath, `sdk-tools.zip`); - // eslint-disable-next-line @typescript-eslint/naming-convention let sdkToolsAsset: GithubReleaseAssetData | undefined; try { @@ -466,7 +465,6 @@ export async function downloadAndInstallNinja( await mkdir(tmpBasePath, { recursive: true }); const archiveFilePath = join(tmpBasePath, `ninja.zip`); - // eslint-disable-next-line @typescript-eslint/naming-convention let ninjaAsset: GithubReleaseAssetData | undefined; try { @@ -609,7 +607,6 @@ export async function downloadAndInstallOpenOCD( const assetExt: string = process.platform === "win32" ? "zip" : "tar.gz"; const archiveFilePath = join(tmpBasePath, `openocd.${assetExt}`); - // eslint-disable-next-line @typescript-eslint/naming-convention let openocdAsset: GithubReleaseAssetData | undefined; try { @@ -756,7 +753,6 @@ export async function downloadAndInstallCmake( await mkdir(tmpBasePath, { recursive: true }); const archiveFilePath = join(tmpBasePath, `cmake-${version}.${assetExt}`); - // eslint-disable-next-line @typescript-eslint/naming-convention let cmakeAsset: GithubReleaseAssetData | undefined; try { diff --git a/src/utils/githubREST.mts b/src/utils/githubREST.mts index d36126a..a0c715c 100644 --- a/src/utils/githubREST.mts +++ b/src/utils/githubREST.mts @@ -73,7 +73,6 @@ interface AuthorizationHeaders { } export function getAuthorizationHeaders(): AuthorizationHeaders { - // eslint-disable-next-line @typescript-eslint/naming-convention const headers: AuthorizationHeaders = {}; // takes some time to execute (noticable in UI) const githubPAT = Settings.getInstance()?.getString(SettingsKey.githubToken); diff --git a/yarn.lock b/yarn.lock index 01ddf01..e848d61 100644 --- a/yarn.lock +++ b/yarn.lock @@ -54,7 +54,7 @@ __metadata: languageName: node linkType: hard -"@eslint/js@npm:9.0.0": +"@eslint/js@npm:9.0.0, @eslint/js@npm:^9.0.0": version: 9.0.0 resolution: "@eslint/js@npm:9.0.0" checksum: 10/b14b20af72410ef53e3e77e7d83cc1d6e6554b0092ceb9f969d25d765f4d775b4be32b0cd99bbfd6ce72eb2e4fb6b39b42a159b31909fbe1b3a5e88d75211687 @@ -437,7 +437,7 @@ __metadata: languageName: node linkType: hard -"@typescript-eslint/eslint-plugin@npm:^7.5.0": +"@typescript-eslint/eslint-plugin@npm:7.5.0": version: 7.5.0 resolution: "@typescript-eslint/eslint-plugin@npm:7.5.0" dependencies: @@ -462,7 +462,7 @@ __metadata: languageName: node linkType: hard -"@typescript-eslint/parser@npm:^7.5.0": +"@typescript-eslint/parser@npm:7.5.0": version: 7.5.0 resolution: "@typescript-eslint/parser@npm:7.5.0" dependencies: @@ -1328,6 +1328,13 @@ __metadata: languageName: node linkType: hard +"globals@npm:^15.0.0": + version: 15.0.0 + resolution: "globals@npm:15.0.0" + checksum: 10/f2f927fe457a5ed2c27b00b77ca22ec31fe5624aac2da178e228a5bcc9928df0f1853e79d6499e04283d184ea13e26cc8127e890098490c9fee616363cdf0d76 + languageName: node + linkType: hard + "globby@npm:^11.1.0": version: 11.1.0 resolution: "globby@npm:11.1.0" @@ -1480,7 +1487,7 @@ __metadata: languageName: node linkType: hard -"ip@npm:^2.0.1": +"ip@npm:^2.0.0": version: 2.0.1 resolution: "ip@npm:2.0.1" checksum: 10/d6dd154e1bc5e8725adfdd6fb92218635b9cbe6d873d051bd63b178f009777f751a5eea4c67021723a7056325fc3052f8b6599af0a2d56f042c93e684b4a0349 @@ -2108,6 +2115,7 @@ __metadata: version: 0.0.0-use.local resolution: "raspberry-pi-pico@workspace:." dependencies: + "@eslint/js": "npm:^9.0.0" "@rollup/plugin-commonjs": "npm:^25.0.7" "@rollup/plugin-node-resolve": "npm:^15.2.3" "@rollup/plugin-typescript": "npm:^11.1.6" @@ -2117,16 +2125,16 @@ __metadata: "@types/uuid": "npm:^9.0.8" "@types/vscode": "npm:^1.87.0" "@types/which": "npm:^3.0.3" - "@typescript-eslint/eslint-plugin": "npm:^7.5.0" - "@typescript-eslint/parser": "npm:^7.5.0" adm-zip: "npm:^0.5.12" eslint: "npm:^9.0.0" eslint-config-prettier: "npm:^9.1.0" + globals: "npm:^15.0.0" ini: "npm:^4.1.2" rimraf: "npm:^5.0.5" rollup: "npm:^4.14.1" tslib: "npm:^2.6.2" typescript: "npm:^5.4.4" + typescript-eslint: "npm:^7.5.0" uuid: "npm:^9.0.1" which: "npm:^4.0.0" languageName: unknown @@ -2383,7 +2391,7 @@ __metadata: version: 2.7.1 resolution: "socks@npm:2.7.1" dependencies: - ip: "npm:^2.0.1" + ip: "npm:^2.0.0" smart-buffer: "npm:^4.2.0" checksum: 10/5074f7d6a13b3155fa655191df1c7e7a48ce3234b8ccf99afa2ccb56591c195e75e8bb78486f8e9ea8168e95a29573cbaad55b2b5e195160ae4d2ea6811ba833 languageName: node @@ -2525,6 +2533,22 @@ __metadata: languageName: node linkType: hard +"typescript-eslint@npm:^7.5.0": + version: 7.5.0 + resolution: "typescript-eslint@npm:7.5.0" + dependencies: + "@typescript-eslint/eslint-plugin": "npm:7.5.0" + "@typescript-eslint/parser": "npm:7.5.0" + "@typescript-eslint/utils": "npm:7.5.0" + peerDependencies: + eslint: ^8.56.0 + peerDependenciesMeta: + typescript: + optional: true + checksum: 10/8f7fa31fe9801342374299dcc718fee3fdd73cf515c0e06b9b616dfcafb79216fc4add49b836d1cb044ffbc9ecc8ae7f7e2c32e7b7e06d669800faa45262703b + languageName: node + linkType: hard + "typescript@npm:^5.4.4": version: 5.4.4 resolution: "typescript@npm:5.4.4"