question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

EXTEND_ESLINT=true not working

See original GitHub issue

Describe the bug

Actually it re-opens https://github.com/facebook/create-react-app/issues/9047 I created .env file in root directory with EXTEND_ESLINT=true then created .eslintrc.json file with my config for eslint but while running npm start this config doesn’t work!

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 “no-unused-vars”: [“error”]
  4. Try to check if the rule is working. In App.tsx I added const a= '';

Expected behavior

Expect it will consider rules from .eslintrc.json and fail to build app.

Actual behavior

Ignoring rules from .eslintrc.json

Reproducible demo

https://github.com/Barik85/reproduce_issue_eslintrc

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:12
  • Comments:11 (1 by maintainers)

github_iconTop GitHub Comments

17reactions
tobiaskrauscommented, Jun 22, 2020

I quote an answer from #9007 :

I think this is caused by how react-scripts handles ESLint cache. By default, cache is set to true. If you set it to false, any change to eslint rules will be honoured every time. The setting is in node_modules/react-scripts/config/webpack.config.js:

use: [
  {
    options: {
      cache: true, // You can set it to false
      formatter: require.resolve('react-dev-utils/eslintFormatter'),
      eslintPath: require.resolve('eslint'),
      resolvePluginsRelativeTo: __dirname,
      // @remove-on-eject-begin
      ignore: isExtendingEslintConfig,
      baseConfig: isExtendingEslintConfig
        ? undefined
        : {
            extends: [require.resolve('eslint-config-react-app')],
          },
      useEslintrc: isExtendingEslintConfig,
      // @remove-on-eject-end
    },

and if this is your problem, I hope that my proposal #9085 would be accepted, and someone could implement it.

7reactions
lafecommented, Aug 10, 2020

From our point of view, the issue is still present.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Extending ESLint config not working · Issue #7510 - GitHub
I was just coming to file this same issue. The problem is that we're checking the extends property for react-app , but by...
Read more >
create-react-app — how to set EXTEND_ESLINT to true?
In the project root directory, you can create the .env file with EXTEND_ESLINT set to true so as to extend the ESLint config:...
Read more >
Configuration Files - ESLint - Pluggable JavaScript Linter
A pluggable and configurable linter tool for identifying and reporting on patterns in JavaScript. Maintain your code quality with ease.
Read more >
Auto Format with ESLint and Prettier for React TypeScript Project
ESLint is a linter that finds problems in your code and shows errors and warnings. ... formatOnSave": true, // Prettier auto format on...
Read more >
How to Format Code on Save in VS Code with ESlint
ESLint Still Not Formatting on Save? ... If you already have the ESLint extension installed, VS Code may show a prompt asking if...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found