diff --git a/packages/cra-template/template.json b/packages/cra-template/template.json index 6e9b50fad9a..3be65aded0e 100644 --- a/packages/cra-template/template.json +++ b/packages/cra-template/template.json @@ -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"] } } } \ No newline at end of file diff --git a/packages/eslint-config-react-app/jest.js b/packages/eslint-config-react-app/jest.js new file mode 100644 index 00000000000..43ab8dc51cb --- /dev/null +++ b/packages/eslint-config-react-app/jest.js @@ -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', + }, + }, + ], +};