Skip to content

Commit

Permalink
fix(eslint-config): extend extraneous dependencies patterns
Browse files Browse the repository at this point in the history
  • Loading branch information
rozsival committed Apr 16, 2024
1 parent 7087b3f commit f93722e
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion packages/eslint-config/src/base/rules/imports.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down
14 changes: 7 additions & 7 deletions packages/eslint-config/src/constants.ts
Original file line number Diff line number Diff line change
@@ -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;
2 changes: 1 addition & 1 deletion packages/eslint-config/src/react/rules/imports.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
};

0 comments on commit f93722e

Please sign in to comment.