Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: resolve CI build failure #9640

Merged
merged 1 commit into from
Sep 16, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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