From 9a6087e91ac34f349d45d21450974d9e7a437a89 Mon Sep 17 00:00:00 2001 From: Andrey Polischuk Date: Thu, 18 Jan 2024 15:49:58 +0300 Subject: [PATCH] fix(eslint-config): fix plugin resolving --- packages/eslint-config/js.js | 24 +++++++++++------------- packages/eslint-config/ts.js | 5 ++++- 2 files changed, 15 insertions(+), 14 deletions(-) diff --git a/packages/eslint-config/js.js b/packages/eslint-config/js.js index ae94b54..b74dad0 100644 --- a/packages/eslint-config/js.js +++ b/packages/eslint-config/js.js @@ -1,4 +1,11 @@ /* eslint-disable no-magic-numbers */ +/** + * @rushstack/eslint-patch is used to include plugins as dev + * dependencies instead of imposing them as peer dependencies + * + * https://www.npmjs.com/package/@rushstack/eslint-patch + */ +require('@rushstack/eslint-patch/modern-module-resolution') module.exports = { parser: '@babel/eslint-parser', @@ -87,22 +94,19 @@ module.exports = { next: 'expression' } ], - 'no-duplicate-imports': 2, + 'no-duplicate-imports': 'error', 'no-constant-condition': [ 'error', { checkLoops: false } ], - 'import/no-unresolved': ['error', {caseSensitiveStrict: true}], 'import/no-cycle': 'error', 'import/no-useless-path-segments': 'error', 'import/no-relative-parent-imports': 'error', 'import/no-default-export': 'error', - 'import/no-unused-modules': [ - 'error', - {missingExports: false, unusedExports: true} - ], + 'import/no-unused-modules': 'off', + 'import/no-unresolved': 'off', 'import/no-anonymous-default-export': [ 'error', {allowCallExpression: false} @@ -128,13 +132,7 @@ module.exports = { 'sonar/concise-regex': 'error', 'sonar/disabled-auto-escaping': 'error', 'sonar/disabled-resource-integrity': 'error', - /** - * правило невозможно отключить для отдельных случаев, - * при использовании webpack EnvironmentPlugin необходимо - * использовать process.env.SOME_VAR без деструктуризации - * https://github.com/webpack/webpack/issues/14800 - */ - 'sonar/destructuring-assignment-syntax': 'off', + 'sonar/destructuring-assignment-syntax': 'error', 'sonar/empty-string-repetition': 'error', 'sonar/function-name': [ 'error', diff --git a/packages/eslint-config/ts.js b/packages/eslint-config/ts.js index b3f5f39..38c4ec4 100644 --- a/packages/eslint-config/ts.js +++ b/packages/eslint-config/ts.js @@ -7,7 +7,6 @@ require('@rushstack/eslint-patch/modern-module-resolution') module.exports = { - parser: '@typescript-eslint/parser', rules: { '@typescript-eslint/no-unused-vars': [ 'error', @@ -17,6 +16,10 @@ module.exports = { overrides: [ { files: ['*.ts', '*.mts', '*.cts', '*.tsx'], + parser: '@typescript-eslint/parser', + parserOptions: { + project: true + }, extends: [ 'plugin:@typescript-eslint/recommended', 'plugin:import/typescript'