Skip to content

Commit

Permalink
Remove ESLint extends and add Jest rules (facebook#9587)
Browse files Browse the repository at this point in the history
  • Loading branch information
mrmckeb authored and yoyota committed Jun 28, 2021
1 parent f0a76f1 commit 54b6e61
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 0 deletions.
3 changes: 3 additions & 0 deletions packages/cra-template/template.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@
"react-toastify": "^5.5.0",
"typeface-roboto": "0.0.75",
"web-vitals": "^0.2.2"
},
"eslintConfig": {
"extends": ["react-app", "react-app/jest"]
}
}
}
33 changes: 33 additions & 0 deletions packages/eslint-config-react-app/jest.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
/**
* Copyright (c) 2015-present, Facebook, Inc.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/

'use strict';

// We use eslint-loader so even warnings are very visible.
// This is why we prefer to use "WARNING" level for potential errors,
// and we try not to use "ERROR" level at all.

module.exports = {
plugins: ['jest'],
overrides: [
{
files: ['**/__tests__/**/*', '**/*.{spec,test}.*'],
env: {
'jest/globals': true,
},
// A subset of the recommended rules:
// https://github.com/jest-community/eslint-plugin-jest#rules
rules: {
'jest/expect-expect': 'warn',
'jest/no-identical-title': 'warn',
'jest/valid-describe': 'warn',
'jest/valid-expect': 'warn',
'jest/valid-expect-in-promise': 'warn',
},
},
],
};

0 comments on commit 54b6e61

Please sign in to comment.