From f93722e74c9e0efa43b7afc3661c0f14107a0cda Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADt=20Rozs=C3=ADval?= Date: Tue, 16 Apr 2024 10:09:07 +0200 Subject: [PATCH] fix(eslint-config): extend extraneous dependencies patterns --- packages/eslint-config/src/base/rules/imports.ts | 2 +- packages/eslint-config/src/constants.ts | 14 +++++++------- packages/eslint-config/src/react/rules/imports.ts | 2 +- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/packages/eslint-config/src/base/rules/imports.ts b/packages/eslint-config/src/base/rules/imports.ts index 73ae52c..3587b9a 100644 --- a/packages/eslint-config/src/base/rules/imports.ts +++ b/packages/eslint-config/src/base/rules/imports.ts @@ -4,7 +4,7 @@ import { getExtraneousDependenciesRule, getImportExtensionsRule } from '../../ut export const imports: Linter.RulesRecord = { ...getImportExtensionsRule(), - ...getExtraneousDependenciesRule('/mock/**/*', '/mocks/**/*'), // Allow importing devDependencies in mock files + ...getExtraneousDependenciesRule('**/mock/**/*', '**/mocks/**/*'), // Allow importing devDependencies in mock files 'import/order': [ // Sort and group imports by type 'error', diff --git a/packages/eslint-config/src/constants.ts b/packages/eslint-config/src/constants.ts index 702e32d..01539b5 100644 --- a/packages/eslint-config/src/constants.ts +++ b/packages/eslint-config/src/constants.ts @@ -1,11 +1,11 @@ export const extraneousDependenciesPatterns = [ - '*.config.cjs', - '*.config.js', - '*.config.mjs', - '*.config.ts', - '/scripts/**/*', - '/tests/**/*', - '/types/*.d.ts', + '**/*.config.cjs', + '**/*.config.js', + '**/*.config.mjs', + '**/*.config.ts', + '**/scripts/**/*', + '**/tests/**/*', + '**/types/*.d.ts', ] as const; export const importExtensions = ['.cjs', '.js', '.ts'] as const; diff --git a/packages/eslint-config/src/react/rules/imports.ts b/packages/eslint-config/src/react/rules/imports.ts index d94da42..ef8e3ed 100644 --- a/packages/eslint-config/src/react/rules/imports.ts +++ b/packages/eslint-config/src/react/rules/imports.ts @@ -4,5 +4,5 @@ import { getExtraneousDependenciesRule, getImportExtensionsRule } from '../../ut export const imports: Linter.RulesRecord = { ...getImportExtensionsRule('.tsx'), // Avoid unnecessary `.tsx` extensions in imports - ...getExtraneousDependenciesRule('/mock/**/*', '/mocks/**/*', '/stories/**/*'), // Allow importing devDependencies in Storybook stories + ...getExtraneousDependenciesRule('**/mock/**/*', '**/mocks/**/*', '**/stories/**/*'), // Allow importing devDependencies in Storybook stories };