mirror of
https://github.com/inaturalist/iNaturalistReactNative.git
synced 2025-12-23 22:18:36 -05:00
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:
13
.eslintrc.js
13
.eslintrc.js
@@ -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"]
|
||||
}
|
||||
]
|
||||
};
|
||||
|
||||
@@ -1,4 +0,0 @@
|
||||
module.exports = {
|
||||
plugins: ["testing-library"],
|
||||
extends: ["plugin:testing-library/react"]
|
||||
};
|
||||
Reference in New Issue
Block a user