Skip to content

Commit

Permalink
Switched to eslint flat config
Browse files Browse the repository at this point in the history
Signed-off-by: paulober <[email protected]>
  • Loading branch information
paulober committed Apr 8, 2024
1 parent cb4ea5e commit cc7a742
Show file tree
Hide file tree
Showing 7 changed files with 94 additions and 71 deletions.
54 changes: 0 additions & 54 deletions .eslintrc.json

This file was deleted.

58 changes: 58 additions & 0 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -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",
]
}
];
9 changes: 5 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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",
Expand Down
1 change: 0 additions & 1 deletion src/extension.mts
Original file line number Diff line number Diff line change
Expand Up @@ -462,7 +462,6 @@ export async function activate(context: ExtensionContext): Promise<void> {
}
}

// eslint-disable-next-line @typescript-eslint/no-empty-function
export function deactivate(): void {
void commands.executeCommand("setContext", ContextKeys.isPicoProject, true);

Expand Down
4 changes: 0 additions & 4 deletions src/utils/download.mts
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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 {
Expand Down Expand Up @@ -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 {
Expand Down Expand Up @@ -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 {
Expand Down
1 change: 0 additions & 1 deletion src/utils/githubREST.mts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
38 changes: 31 additions & 7 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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:
Expand All @@ -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:
Expand Down Expand Up @@ -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"
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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"
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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"
Expand Down

0 comments on commit cc7a742

Please sign in to comment.