Skip to content

Commit

Permalink
fix: resolve CI build failure (facebook#9640)
Browse files Browse the repository at this point in the history
  • Loading branch information
mrmckeb authored and wombleton committed Jun 1, 2021
1 parent 328243c commit ef5bf6a
Show file tree
Hide file tree
Showing 5 changed files with 57 additions and 31 deletions.
4 changes: 2 additions & 2 deletions packages/eslint-config-react-app/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,10 @@ That's it! You can override the settings from `eslint-config-react-app` by editi

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

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

```sh
npm install --save-dev eslint-plugin-jest@24.x
npm install --save-dev eslint-plugin-jest@^24.0.0
```

You can then enable these rules by adding the Jest config to the `extends` array in your ESLint config.
Expand Down
47 changes: 47 additions & 0 deletions packages/eslint-config-react-app/base.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
/**
* 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';

// This file contains the minimum ESLint configuration required for Create
// React App support, and is used as the `baseConfig` for `eslint-loader`
// to ensure that user-provided configs don't need this boilerplate.

module.exports = {
root: true,

parser: 'babel-eslint',

plugins: ['react'],

env: {
browser: true,
commonjs: true,
es6: true,
jest: true,
node: true,
},

parserOptions: {
ecmaVersion: 2018,
sourceType: 'module',
ecmaFeatures: {
jsx: true,
},
},

settings: {
react: {
version: 'detect',
},
},

rules: {
'react/jsx-uses-react': 'warn',
'react/jsx-uses-vars': 'warn',
},
};
30 changes: 2 additions & 28 deletions packages/eslint-config-react-app/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,33 +24,9 @@
const restrictedGlobals = require('confusing-browser-globals');

module.exports = {
root: true,
extends: [require.resolve('./base')],

parser: 'babel-eslint',

plugins: ['import', 'flowtype', 'jsx-a11y', 'react', 'react-hooks'],

env: {
browser: true,
commonjs: true,
es6: true,
jest: true,
node: true,
},

parserOptions: {
ecmaVersion: 2018,
sourceType: 'module',
ecmaFeatures: {
jsx: true,
},
},

settings: {
react: {
version: 'detect',
},
},
plugins: ['import', 'flowtype', 'jsx-a11y', 'react-hooks'],

overrides: [
{
Expand Down Expand Up @@ -269,8 +245,6 @@ module.exports = {
ignore: [],
},
],
'react/jsx-uses-react': 'warn',
'react/jsx-uses-vars': 'warn',
'react/no-danger-with-children': 'warn',
// Disabled because of undesirable warnings
// See https://github.com/facebook/create-react-app/issues/5204 for
Expand Down
4 changes: 3 additions & 1 deletion packages/eslint-config-react-app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,9 @@
"url": "https://github.com/facebook/create-react-app/issues"
},
"files": [
"index.js"
"base.js",
"index.js",
"jest.js"
],
"peerDependencies": {
"@typescript-eslint/eslint-plugin": "^4.0.0",
Expand Down
3 changes: 3 additions & 0 deletions packages/react-scripts/config/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -362,6 +362,9 @@ module.exports = function (webpackEnv) {
formatter: require.resolve('react-dev-utils/eslintFormatter'),
eslintPath: require.resolve('eslint'),
resolvePluginsRelativeTo: __dirname,
baseConfig: {
extends: [require.resolve('eslint-config-react-app/base')],
},
},
loader: require.resolve('eslint-loader'),
},
Expand Down

0 comments on commit ef5bf6a

Please sign in to comment.