From cb15f4ba4c5e3f59cbdd3b1dbe9c8780a0e4181a Mon Sep 17 00:00:00 2001 From: Robert DiMartino Date: Mon, 22 Apr 2024 13:09:44 -0400 Subject: [PATCH 1/3] Update eslint configuration for new flat config --- .eslintignore | 1 - eslint.config.js | 21 +++++++++++++++++++++ package.json | 18 +----------------- yarn.lock | 2 +- 4 files changed, 23 insertions(+), 19 deletions(-) delete mode 100644 .eslintignore create mode 100644 eslint.config.js diff --git a/.eslintignore b/.eslintignore deleted file mode 100644 index 7053dc17..00000000 --- a/.eslintignore +++ /dev/null @@ -1 +0,0 @@ -/coverage/ diff --git a/eslint.config.js b/eslint.config.js new file mode 100644 index 00000000..463b32b9 --- /dev/null +++ b/eslint.config.js @@ -0,0 +1,21 @@ +import js from "@eslint/js"; +import eslintConfigPrettier from "eslint-config-prettier"; + +export default [ + js.configs.recommended, + eslintConfigPrettier, + { + languageOptions: { + ecmaVersion: 2020, + sourceType: "module", + globals: { + node: "readonly", + jest: "readonly" + } + }, + rules: { + "no-undef": "off" + }, + ignores: ["/coverage/"] + } +]; diff --git a/package.json b/package.json index aa7ea32a..0b4f42e0 100644 --- a/package.json +++ b/package.json @@ -23,6 +23,7 @@ "prettier": "^3.0.0" }, "devDependencies": { + "@eslint/js": "^9.1.1", "eslint": "^9.0.0", "eslint-config-prettier": "^9.0.0", "husky": "^9.0.2", @@ -30,23 +31,6 @@ "prettier": "^3.1.0", "pretty-quick": "^4.0.0" }, - "eslintConfig": { - "extends": [ - "eslint:recommended", - "prettier" - ], - "env": { - "jest": true, - "node": true - }, - "parserOptions": { - "ecmaVersion": 2020, - "sourceType": "module" - }, - "rules": { - "no-undef": "off" - } - }, "jest": { "globalSetup": "./test/js/globalSetup.js", "globalTeardown": "./test/js/globalTeardown.js", diff --git a/yarn.lock b/yarn.lock index 6ca2f41f..ffd1552c 100644 --- a/yarn.lock +++ b/yarn.lock @@ -329,7 +329,7 @@ minimatch "^3.1.2" strip-json-comments "^3.1.1" -"@eslint/js@9.1.1": +"@eslint/js@9.1.1", "@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== From 87db4336dc9691ed9708f6b8d3eabe02256b6be2 Mon Sep 17 00:00:00 2001 From: Robert DiMartino Date: Mon, 22 Apr 2024 13:10:04 -0400 Subject: [PATCH 2/3] Fix unused var lint --- src/plugin.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugin.js b/src/plugin.js index 71d2030b..da8647e5 100644 --- a/src/plugin.js +++ b/src/plugin.js @@ -105,7 +105,7 @@ export async function spawnServer(opts, killOnExit = true) { const pid = process.platform === "win32" ? server.pid : -server.pid; process.kill(pid); } - } catch (error) { + } catch { // If there's an error killing the process, we're going to ignore it. } }); From ebfa3520007d6ba8510aa944f0db6be260b7627f Mon Sep 17 00:00:00 2001 From: Robert DiMartino Date: Tue, 23 Apr 2024 14:06:16 -0400 Subject: [PATCH 3/3] Move eslint ignore to a separate object --- eslint.config.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/eslint.config.js b/eslint.config.js index 463b32b9..46346665 100644 --- a/eslint.config.js +++ b/eslint.config.js @@ -2,6 +2,7 @@ import js from "@eslint/js"; import eslintConfigPrettier from "eslint-config-prettier"; export default [ + { ignores: ["/coverage/"] }, js.configs.recommended, eslintConfigPrettier, { @@ -15,7 +16,6 @@ export default [ }, rules: { "no-undef": "off" - }, - ignores: ["/coverage/"] + } } ];