This repository has been archived by the owner on Feb 10, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Now eslint/eslint#8813 is fixed this leads to much less object merging
- Loading branch information
Charlie Briggs
committed
Jul 9, 2019
1 parent
90ab405
commit e9d7561
Showing
3 changed files
with
38 additions
and
53 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,32 +1,27 @@ | ||
'use strict'; | ||
|
||
const jestConfig = require('eslint-plugin-jest').configs.recommended; | ||
const { usingJsx } = require('../lib/feature-detect'); | ||
|
||
// Can't extend in overrides: https://github.com/eslint/eslint/issues/8813 | ||
// the default jest/globals with jest/recommended doesn't work with eslint@5.x.x | ||
// https://github.com/jest-community/eslint-plugin-jest/issues/128 | ||
jestConfig.env = { | ||
jest: true, | ||
const config = { | ||
extends: ['plugin:jest/recommended'], | ||
rules: { | ||
// This disallows .skip, which is auseful tool for writing skelton tests | ||
// prior to full implementation. no-focused-tests is still enabled, which | ||
// catches .only - that's the killer | ||
'jest/no-disabled-tests': [0, { extensions: ['.js', '.jsx'] }], | ||
|
||
// Disable as it's frequently necessary to do inline requires | ||
// when working with jest mocks | ||
'global-require': 'off', | ||
}, | ||
}; | ||
|
||
if (usingJsx) { | ||
// allow test files to contain jsx but still keep the .js extension | ||
jestConfig.rules['react/jsx-filename-extension'] = [ | ||
config.rules['react/jsx-filename-extension'] = [ | ||
'error', | ||
{ extensions: ['.js', '.jsx'] }, | ||
]; | ||
} | ||
|
||
// This disallows .skip, which is auseful tool for writing skelton tests | ||
// prior to full implementation. no-focused-tests is still enabled, which | ||
// catches .only - that's the killer | ||
jestConfig.rules['jest/no-disabled-tests'] = [ | ||
0, | ||
{ extensions: ['.js', '.jsx'] }, | ||
]; | ||
|
||
// Disable as it's frequently necessary to do inline requires | ||
// when working with jest mocks | ||
jestConfig.rules['global-require'] = 'off'; | ||
|
||
module.exports = jestConfig; | ||
module.exports = config; |