Limit Jest usage to test files; conslidate ESLint config. (#3086)

Prior to this commit, technically Jest could have been imported in production files and ESLint would have been okay with that since it was allowed across the codebase.

After this commit, ESLint will only allow Jest usage in test files. In addition, the 3-line test-specific ESLint config was consolidated into the main config.

Co-authored-by: Johannes Klein <johannes.t.klein@gmail.com>
This commit is contained in:
Corey Farwell
2025-09-09 10:37:06 -04:00
committed by GitHub
parent 6231200580
commit 8ad5036273
2 changed files with 9 additions and 8 deletions

View File

@@ -144,10 +144,6 @@ module.exports = {
}],
"@typescript-eslint/no-unsafe-function-type": 1
},
// need this so jest doesn't show as undefined in jest.setup.js
env: {
jest: true
},
ignorePatterns: ["/coverage/*", "/vendor/*", "**/flow-typed"],
settings: {
"import/resolver": {
@@ -172,6 +168,15 @@ module.exports = {
rules: {
"@typescript-eslint/no-require-imports": "off"
}
},
{
files: ["tests/**/*", "__mocks__/**/*", "e2e/**/*"],
env: { jest: true }
},
{
files: ["tests/**/*"],
plugins: ["testing-library"],
extends: ["plugin:testing-library/react"]
}
]
};

View File

@@ -1,4 +0,0 @@
module.exports = {
plugins: ["testing-library"],
extends: ["plugin:testing-library/react"]
};