Merge pull request #14065 from backstage/add-jest-dirs-to-eslint-factory-overrides

build: add __tests__ and __mocks__ dirs to relevant parts of eslint-factory
This commit is contained in:
Patrik Oldsberg
2022-10-17 16:56:45 +02:00
committed by GitHub
2 changed files with 30 additions and 1 deletions
+14 -1
View File
@@ -96,12 +96,16 @@ function createConfig(dir, extraConfig = {}) {
`!${joinPath(dir, 'src/**')}`,
joinPath(dir, 'src/**/*.test.*'),
joinPath(dir, 'src/**/*.stories.*'),
joinPath(dir, 'src/**/__testUtils__/**'),
joinPath(dir, 'src/**/__mocks__/**'),
joinPath(dir, 'src/setupTests.*'),
]
: [
// Legacy config for packages that don't provide a dir
'**/*.test.*',
'**/*.stories.*',
'**/__testUtils__/**',
'**/__mocks__/**',
'**/src/setupTests.*',
'**/dev/**',
],
@@ -137,6 +141,8 @@ function createConfig(dir, extraConfig = {}) {
// Prevent imports of stories or tests
'*.stories*',
'*.test*',
'**/__testUtils__/**',
'**/__mocks__/**',
],
},
],
@@ -159,7 +165,14 @@ function createConfig(dir, extraConfig = {}) {
},
},
{
files: ['**/*.test.*', '**/*.stories.*', 'src/setupTests.*', '!src/**'],
files: [
'**/*.test.*',
'**/*.stories.*',
'**/__testUtils__/**',
'**/__mocks__/**',
'src/setupTests.*',
'!src/**',
],
rules: {
...testRules,
'no-restricted-syntax': [