From fa21aa44cfbef8a98e9b89714f696964f886bfc6 Mon Sep 17 00:00:00 2001 From: kirillgroshkov Date: Sat, 10 Aug 2024 18:33:09 +0200 Subject: [PATCH] feat: disable eslint-plugin-unused-imports in favor of biome (experimental) --- cfg/eslint-rules.js | 11 ++++++----- cfg/eslint.config.js | 2 +- package.json | 1 - src/lint.util.ts | 4 +++- src/test/cfg/eslint.config.dump.json | 13 ------------- yarn.lock | 12 ------------ 6 files changed, 10 insertions(+), 33 deletions(-) diff --git a/cfg/eslint-rules.js b/cfg/eslint-rules.js index da3231b..415863e 100644 --- a/cfg/eslint-rules.js +++ b/cfg/eslint-rules.js @@ -324,11 +324,12 @@ module.exports = { argsIgnorePattern: '^_', }, ], - 'unused-imports/no-unused-imports': 2, - 'unused-imports/no-unused-vars': [ - 2, - { vars: 'all', varsIgnorePattern: '^_', args: 'after-used', argsIgnorePattern: '^_' }, - ], + // unused-imports/* rules are replaced by biome + // 'unused-imports/no-unused-imports': 2, + // 'unused-imports/no-unused-vars': [ + // 2, + // { vars: 'all', varsIgnorePattern: '^_', args: 'after-used', argsIgnorePattern: '^_' }, + // ], '@typescript-eslint/no-duplicate-enum-values': 2, '@typescript-eslint/no-redundant-type-constituents': 0, // `'a' | string` is still useful for DX '@typescript-eslint/no-empty-function': 0, diff --git a/cfg/eslint.config.js b/cfg/eslint.config.js index 82a868d..a4988f4 100644 --- a/cfg/eslint.config.js +++ b/cfg/eslint.config.js @@ -54,7 +54,7 @@ function getConfig() { plugins: { '@typescript-eslint': tseslint.plugin, 'import-x': require('eslint-plugin-import-x'), - 'unused-imports': require('eslint-plugin-unused-imports'), + // 'unused-imports': require('eslint-plugin-unused-imports'), // disabled in favor of biome rules 'simple-import-sort': require('eslint-plugin-simple-import-sort'), jsdoc: require('eslint-plugin-jsdoc'), ...(hasJest ? { jest: require('eslint-plugin-jest') } : {}), diff --git a/package.json b/package.json index 54a59fc..0740cdd 100644 --- a/package.json +++ b/package.json @@ -34,7 +34,6 @@ "eslint-plugin-jsdoc": "^50.0.0", "eslint-plugin-simple-import-sort": "^12.1.1", "eslint-plugin-unicorn": "^55.0.0", - "eslint-plugin-unused-imports": "4.0.1", "eslint-plugin-vue": "^9.0.0", "expect-type": "^0.19.0", "globals": "^15.8.0", diff --git a/src/lint.util.ts b/src/lint.util.ts index ac56ea8..be8cdc4 100644 --- a/src/lint.util.ts +++ b/src/lint.util.ts @@ -309,7 +309,9 @@ function runActionLint(): void { export function runBiome(verbose = false, fix = true): void { if (!fs.existsSync(`node_modules/@biomejs/biome`)) { - if (verbose) console.log(`biome is not installed (checked in node_modules/@biomejs), skipping`) + if (verbose) { + console.log(`biome is not installed (checked in node_modules/@biomejs/biome), skipping`) + } return } diff --git a/src/test/cfg/eslint.config.dump.json b/src/test/cfg/eslint.config.dump.json index 3e0b517..20a278a 100644 --- a/src/test/cfg/eslint.config.dump.json +++ b/src/test/cfg/eslint.config.dump.json @@ -22,7 +22,6 @@ "unicorn:eslint-plugin-unicorn@55.0.0", "vue:eslint-plugin-vue@9.27.0", "import-x", - "unused-imports", "simple-import-sort:eslint-plugin-simple-import-sort@12.1.1", "jsdoc", "jest:eslint-plugin-jest@28.8.0" @@ -1681,18 +1680,6 @@ "unicorn/throw-new-error": [ 2 ], - "unused-imports/no-unused-imports": [ - 2 - ], - "unused-imports/no-unused-vars": [ - 2, - { - "args": "after-used", - "argsIgnorePattern": "^_", - "vars": "all", - "varsIgnorePattern": "^_" - } - ], "use-isnan": [ 2 ], diff --git a/yarn.lock b/yarn.lock index 9c2e32e..f01f300 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2179,13 +2179,6 @@ eslint-plugin-unicorn@^55.0.0: semver "^7.6.1" strip-indent "^3.0.0" -eslint-plugin-unused-imports@4.0.1: - version "4.0.1" - resolved "https://registry.yarnpkg.com/eslint-plugin-unused-imports/-/eslint-plugin-unused-imports-4.0.1.tgz#b78916ecb82ae6d0f54efb33879c6c7ecb52f080" - integrity sha512-rax76s05z64uQgG9YXsWFmXrgjkaK79AvfeAWiSxhPP6RVGxeRaj4+2u+wxxu/mDy2pmJoOy1QTOEALMia2xGQ== - dependencies: - eslint-rule-composer "^0.3.0" - eslint-plugin-vue@^9.0.0: version "9.27.0" resolved "https://registry.yarnpkg.com/eslint-plugin-vue/-/eslint-plugin-vue-9.27.0.tgz#c22dae704a03d9ecefa81364ff89f60ce0481f94" @@ -2200,11 +2193,6 @@ eslint-plugin-vue@^9.0.0: vue-eslint-parser "^9.4.3" xml-name-validator "^4.0.0" -eslint-rule-composer@^0.3.0: - version "0.3.0" - resolved "https://registry.yarnpkg.com/eslint-rule-composer/-/eslint-rule-composer-0.3.0.tgz#79320c927b0c5c0d3d3d2b76c8b4a488f25bbaf9" - integrity sha512-bt+Sh8CtDmn2OajxvNO+BX7Wn4CIWMpTRm3MaiKPCQcnnlm0CS2mhui6QaoeQugs+3Kj2ESKEEGJUdVafwhiCg== - eslint-scope@^7.1.1: version "7.2.2" resolved "https://registry.yarnpkg.com/eslint-scope/-/eslint-scope-7.2.2.tgz#deb4f92563390f32006894af62a22dba1c46423f"