diff --git a/.eslintrc.js b/.eslintrc.js deleted file mode 100644 index 331ea6c..0000000 --- a/.eslintrc.js +++ /dev/null @@ -1,28 +0,0 @@ -module.exports = { - ignorePatterns: ['**/*.d.ts', '**/*.test.ts', '**/*.js', 'sample/**/*.*'], - parser: '@typescript-eslint/parser', - extends: ['plugin:@typescript-eslint/recommended'], - plugins: ['header'], - parserOptions: { - ecmaVersion: 2018, // Allows for the parsing of modern ECMAScript features - sourceType: 'module', // Allows for the use of imports - }, - rules: { - '@typescript-eslint/no-use-before-define': 'off', - '@typescript-eslint/explicit-function-return-type': 'off', - '@typescript-eslint/no-explicit-any': 'off', - '@typescript-eslint/no-non-null-assertion': 'off', - '@typescript-eslint/explicit-module-boundary-types': 'off', - '@typescript-eslint/no-unused-vars': 'off', - 'header/header': [ - 'error', - 'block', - `--------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - *--------------------------------------------------------------------------------------------`, - ], - // Place to specify ESLint rules. Can be used to overwrite rules specified from the extended configs - // e.g. "@typescript-eslint/explicit-function-return-type": "off", - }, -}; diff --git a/eslint.config.mjs b/eslint.config.mjs new file mode 100644 index 0000000..b71549c --- /dev/null +++ b/eslint.config.mjs @@ -0,0 +1,49 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ + +import header from "@tony.ganchev/eslint-plugin-header"; +import tsParser from "@typescript-eslint/parser"; +import path from "node:path"; +import { fileURLToPath } from "node:url"; +import js from "@eslint/js"; +import { FlatCompat } from "@eslint/eslintrc"; + +const __filename = fileURLToPath(import.meta.url); +const __dirname = path.dirname(__filename); +const compat = new FlatCompat({ + baseDirectory: __dirname, + recommendedConfig: js.configs.recommended, + allConfig: js.configs.all +}); + +export default [{ + ignores: ["**/*.d.ts", "**/*.test.ts", "**/*.js", "sample/**/*.*"], +}, ...compat.extends("plugin:@typescript-eslint/recommended"), { + plugins: { + header, + }, + + languageOptions: { + parser: tsParser, + ecmaVersion: 2018, + sourceType: "module", + }, + + rules: { + "@typescript-eslint/no-use-before-define": "off", + "@typescript-eslint/explicit-function-return-type": "off", + "@typescript-eslint/no-explicit-any": "off", + "@typescript-eslint/no-non-null-assertion": "off", + "@typescript-eslint/explicit-module-boundary-types": "off", + "@typescript-eslint/no-unused-vars": "off", + "@typescript-eslint/no-var-requires": "error", + + "header/header": [ + 2, + "block", + ["---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------"], + ], + }, +}]; \ No newline at end of file diff --git a/package-lock.json b/package-lock.json index 1b3da44..e03fdbb 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@vscode/test-web", - "version": "0.0.56", + "version": "0.0.57", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@vscode/test-web", - "version": "0.0.56", + "version": "0.0.57", "license": "MIT", "dependencies": { "@koa/cors": "^5.0.0", @@ -29,6 +29,9 @@ "vscode-test-web": "out/index.js" }, "devDependencies": { + "@eslint/eslintrc": "^3.1.0", + "@eslint/js": "^9.9.1", + "@tony.ganchev/eslint-plugin-header": "^3.1.2", "@types/gunzip-maybe": "^1.4.2", "@types/koa": "^2.15.0", "@types/koa__router": "^12.0.4", @@ -41,7 +44,6 @@ "@typescript-eslint/eslint-plugin": "^8.3.0", "@typescript-eslint/parser": "^8.3.0", "eslint": "^9.9.1", - "eslint-plugin-header": "^3.1.1", "typescript": "^5.5.4" }, "engines": { @@ -350,6 +352,15 @@ "node": ">=18" } }, + "node_modules/@tony.ganchev/eslint-plugin-header": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/@tony.ganchev/eslint-plugin-header/-/eslint-plugin-header-3.1.2.tgz", + "integrity": "sha512-u9sJvwqAw26+2MlUfVMTbVAygcNpp+wQA3YbJ5qtkltEBzEJN8I+VKJxRKC2MSG/26uxHk9LA/rXz8iaYLmu5A==", + "dev": true, + "peerDependencies": { + "eslint": ">=7.7.0" + } + }, "node_modules/@types/accepts": { "version": "1.3.5", "dev": true, @@ -1179,14 +1190,6 @@ } } }, - "node_modules/eslint-plugin-header": { - "version": "3.1.1", - "dev": true, - "license": "MIT", - "peerDependencies": { - "eslint": ">=7.7.0" - } - }, "node_modules/eslint-scope": { "version": "8.0.2", "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-8.0.2.tgz", diff --git a/package.json b/package.json index 35191c2..f5b4635 100644 --- a/package.json +++ b/package.json @@ -6,7 +6,7 @@ "compile": "tsc -p ./ && npm run compile-fs-provider", "watch": "tsc -w -p ./", "prepack": "npm run compile", - "test": "eslint src --ext ts && tsc --noEmit", + "test": "eslint src && tsc --noEmit", "preversion": "npm test", "postversion": "git push && git push --tags", "compile-fs-provider": "npm run --prefix=fs-provider compile-web", @@ -40,6 +40,8 @@ "vscode-uri": "^3.0.8" }, "devDependencies": { + "@eslint/eslintrc": "^3.1.0", + "@eslint/js": "^9.9.1", "@types/gunzip-maybe": "^1.4.2", "@types/koa": "^2.15.0", "@types/koa__router": "^12.0.4", @@ -52,7 +54,7 @@ "@typescript-eslint/eslint-plugin": "^8.3.0", "@typescript-eslint/parser": "^8.3.0", "eslint": "^9.9.1", - "eslint-plugin-header": "^3.1.1", + "@tony.ganchev/eslint-plugin-header": "^3.1.2", "typescript": "^5.5.4" }, "license": "MIT", diff --git a/src/index.ts b/src/index.ts index c7deb96..17e9fbb 100644 --- a/src/index.ts +++ b/src/index.ts @@ -582,7 +582,8 @@ async function cliMain(): Promise { console.error('uncaughtException', e); }); - // eslint-disable-next-line @typescript-eslint/no-var-requires + /* eslint-disable @typescript-eslint/no-var-requires */ + /* eslint-disable @typescript-eslint/no-require-imports */ const manifest = require('../package.json'); console.log(`${manifest.name}: ${manifest.version}`);