Skip to content

Commit 5ecbbe5

Browse files
committed
feat: relax rules for non-src and test/spec files
1 parent f9f8c85 commit 5ecbbe5

1 file changed

Lines changed: 11 additions & 16 deletions

File tree

  • packages/eslint-config-recommended/src

packages/eslint-config-recommended/src/index.ts

Lines changed: 11 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -248,26 +248,21 @@ export function defineScTsConfig(...configs: Parameters<typeof defineConfig>): R
248248
},
249249
},
250250

251-
/*
252-
* allow some commonly used patterns for testing to pass eslint
253-
*/
251+
// relax the rules for files which are not part of the src/ folder and for test files
254252
{
255-
files: ['**/test/**/*.ts', '**/*.spec.ts', '**/*.test.ts'],
253+
files: [
254+
'!src/**/*.{ts,js,mjs,cjs}', // include everything unless in src folder
255+
'src/**/*.{spec,test}.ts', // include test files
256+
],
256257
rules: {
257-
'no-console': 'off',
258-
'max-classes-per-file': 'off',
259-
'@typescript-eslint/ban-ts-comment': 'off',
258+
// it is ok to use dev deps and deps that are listed inside the root package.json
259+
'import/no-extraneous-dependencies': ['error', { packageDir: ['.', '../..'] }],
260+
'@typescript-eslint/no-explicit-any': 'off',
260261
'@typescript-eslint/no-non-null-assertion': 'off',
261262
'@typescript-eslint/no-empty-function': 'off',
262-
},
263-
},
264-
265-
// for files which are not part of the src/ folder and for test files
266-
// it is ok to use dependencies that are listed inside the root package.json (e.g. @shiftcode/eslint-config-recommended)
267-
{
268-
files: ['!**/src/**', '**/*.spec.ts', '**/*.test.ts'],
269-
rules: {
270-
'import/no-extraneous-dependencies': ['error', { packageDir: ['.', '../..'] }],
263+
'@typescript-eslint/ban-ts-comment': 'off',
264+
'max-classes-per-file': 'off',
265+
'no-console': 'off',
271266
},
272267
},
273268

0 commit comments

Comments
 (0)