Skip to content

Commit ef5bf6a

Browse files
mrmckebwombleton
authored andcommitted
fix: resolve CI build failure (facebook#9640)
1 parent 328243c commit ef5bf6a

File tree

5 files changed

+57
-31
lines changed

5 files changed

+57
-31
lines changed

packages/eslint-config-react-app/README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -36,10 +36,10 @@ That's it! You can override the settings from `eslint-config-react-app` by editi
3636

3737
This config also ships with optional Jest rules for ESLint (based on [`eslint-plugin-jest`](https://github.com/jest-community/eslint-plugin-jest)).
3838

39-
You'll first need to add the plugin.
39+
You'll first need to add the ESLint plugin for Jest (if you don't already have it installed).
4040

4141
```sh
42-
npm install --save-dev eslint-plugin-jest@24.x
42+
npm install --save-dev eslint-plugin-jest@^24.0.0
4343
```
4444

4545
You can then enable these rules by adding the Jest config to the `extends` array in your ESLint config.
+47
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
/**
2+
* Copyright (c) 2015-present, Facebook, Inc.
3+
*
4+
* This source code is licensed under the MIT license found in the
5+
* LICENSE file in the root directory of this source tree.
6+
*/
7+
8+
'use strict';
9+
10+
// This file contains the minimum ESLint configuration required for Create
11+
// React App support, and is used as the `baseConfig` for `eslint-loader`
12+
// to ensure that user-provided configs don't need this boilerplate.
13+
14+
module.exports = {
15+
root: true,
16+
17+
parser: 'babel-eslint',
18+
19+
plugins: ['react'],
20+
21+
env: {
22+
browser: true,
23+
commonjs: true,
24+
es6: true,
25+
jest: true,
26+
node: true,
27+
},
28+
29+
parserOptions: {
30+
ecmaVersion: 2018,
31+
sourceType: 'module',
32+
ecmaFeatures: {
33+
jsx: true,
34+
},
35+
},
36+
37+
settings: {
38+
react: {
39+
version: 'detect',
40+
},
41+
},
42+
43+
rules: {
44+
'react/jsx-uses-react': 'warn',
45+
'react/jsx-uses-vars': 'warn',
46+
},
47+
};

packages/eslint-config-react-app/index.js

+2-28
Original file line numberDiff line numberDiff line change
@@ -24,33 +24,9 @@
2424
const restrictedGlobals = require('confusing-browser-globals');
2525

2626
module.exports = {
27-
root: true,
27+
extends: [require.resolve('./base')],
2828

29-
parser: 'babel-eslint',
30-
31-
plugins: ['import', 'flowtype', 'jsx-a11y', 'react', 'react-hooks'],
32-
33-
env: {
34-
browser: true,
35-
commonjs: true,
36-
es6: true,
37-
jest: true,
38-
node: true,
39-
},
40-
41-
parserOptions: {
42-
ecmaVersion: 2018,
43-
sourceType: 'module',
44-
ecmaFeatures: {
45-
jsx: true,
46-
},
47-
},
48-
49-
settings: {
50-
react: {
51-
version: 'detect',
52-
},
53-
},
29+
plugins: ['import', 'flowtype', 'jsx-a11y', 'react-hooks'],
5430

5531
overrides: [
5632
{
@@ -269,8 +245,6 @@ module.exports = {
269245
ignore: [],
270246
},
271247
],
272-
'react/jsx-uses-react': 'warn',
273-
'react/jsx-uses-vars': 'warn',
274248
'react/no-danger-with-children': 'warn',
275249
// Disabled because of undesirable warnings
276250
// See https://github.com/facebook/create-react-app/issues/5204 for

packages/eslint-config-react-app/package.json

+3-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,9 @@
1212
"url": "https://github.com/facebook/create-react-app/issues"
1313
},
1414
"files": [
15-
"index.js"
15+
"base.js",
16+
"index.js",
17+
"jest.js"
1618
],
1719
"peerDependencies": {
1820
"@typescript-eslint/eslint-plugin": "^4.0.0",

packages/react-scripts/config/webpack.config.js

+3
Original file line numberDiff line numberDiff line change
@@ -362,6 +362,9 @@ module.exports = function (webpackEnv) {
362362
formatter: require.resolve('react-dev-utils/eslintFormatter'),
363363
eslintPath: require.resolve('eslint'),
364364
resolvePluginsRelativeTo: __dirname,
365+
baseConfig: {
366+
extends: [require.resolve('eslint-config-react-app/base')],
367+
},
365368
},
366369
loader: require.resolve('eslint-loader'),
367370
},

0 commit comments

Comments
 (0)