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

EXTEND_ESLINT=true not working #9047

Closed
Barik85 opened this issue May 22, 2020 · 3 comments
Closed

EXTEND_ESLINT=true not working #9047

Barik85 opened this issue May 22, 2020 · 3 comments

Comments

@Barik85
Copy link

Barik85 commented May 22, 2020

Describe the bug

I created .env file in root directory with EXTEND_ESLINT=true
then created .eslint.json file with my config for eslint
but while running npm start this config doesn't work!
So I had to run npm run eject
in file '/config/webpack.config.js' on the line 38 I have found
const isExtendingEslintConfig = process.env.EXTEND_ESLINT === 'true';
but this variable never used.
So on line 339 I just added useEslintrc: isExtendingEslintConfig, and it begans work correctly!

            {
              options: {
                cache: true,
                formatter: require.resolve('react-dev-utils/eslintFormatter'),
                eslintPath: require.resolve('eslint'),
                resolvePluginsRelativeTo: __dirname,
                useEslintrc: isExtendingEslintConfig,
              },
              loader: require.resolve('eslint-loader'),
            },
          ],

Did you try recovering your dependencies?

(Write your answer here.)

Which terms did you search for in User Guide?

(Write your answer here if relevant.)

Environment

(paste the output of the command here.)

Steps to reproduce

  1. npx create-react-app my-app --template typescript
  2. add .env file in root directory with EXTEND_ESLINT=true
  3. add .eslint.json with some rules, for example "react/jsx-props-no-spreading": [0]
  4. Try to check if the rule is working. In my case it's not!

Expected behavior

Expect it will consider rules from .eslintrc.json

Actual behavior

Ignoring rules from .eslintrc.json

Reproducible demo

(Paste the link to an example project and exact instructions to reproduce the issue.)

@mrmckeb
Copy link
Contributor

mrmckeb commented May 27, 2020

I'll take a look at this for you in the coming days.

@mrmckeb
Copy link
Contributor

mrmckeb commented May 28, 2020

Hi @Barik85,

I see that code is used, but removed on eject.

ignore: isExtendingEslintConfig,
baseConfig: isExtendingEslintConfig
? undefined
: {
extends: [require.resolve('eslint-config-react-app')],
},
useEslintrc: isExtendingEslintConfig,

The issue in your case seems to be that you used .eslint.json, as it works for me with .eslintrc.json - but if that's not the case, please re-open with a small reproduction and I'll dig deeper :)

@GapMAX
Copy link

GapMAX commented Jul 20, 2020

Hi @Barik85,

I see that code is used, but removed on eject.

ignore: isExtendingEslintConfig,
baseConfig: isExtendingEslintConfig
? undefined
: {
extends: [require.resolve('eslint-config-react-app')],
},
useEslintrc: isExtendingEslintConfig,

The issue in your case seems to be that you used .eslint.json, as it works for me with .eslintrc.json - but if that's not the case, please re-open with a small reproduction and I'll dig deeper :)

Why removed it on eject?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants