React-app-rewired: Is it possible to disable some eslint rules?

Created on 17 Apr 2020  路  2Comments  路  Source: timarney/react-app-rewired

Tried 'useEslintRc' from 'customize-cra' package, but it didnt work

Most helpful comment

Hi, I had the exact same issues with those methods and putting path in for useEslintRc resolved the issue. This was actually pretty much intuitive, since I have a monorepo set up and eslint config couldn't be found in default location. The awkward thing was that it'd work in editor, but fail during build.

All 2 comments

I'm in the process of migrating a work repository from the old react-scripts-ts to current react-scripts, so I was trying to do this during the week this week.

Like you, simply using the useEslintRc() rewire from customize-cra didn't seem to be working at first (rules I tried to turn off were not turning off). Initially, that turned out to be partly due to syntax errors in the rule I was trying to turn off, but even after fixing those it still wasn't working.

I then tried to follow the _new/experimental_ instructions on the create-react-app site here to extend the eslint config (and removed the useEslintRc at the same time). Those also didn't work, which was frustrating. I then went back to trying to use the customize-cra package and it DID work this time. The only differences I could see was that I also had the experimental EXTEND_ESLINT environment variable set and I'd changed from a json .eslintrc file to a javascript .eslintrc.js file for the definitions.

Since I'm not sure exactly what made it suddenly start working, I'll list things to test:

  • Specify the file for your config file, i.e. useEslintRc(path.resolve(__dirname, '.eslintrc.js'))
  • Make sure that your .eslintrc is valid - try running yarn eslint src/**/*.js and make sure it doesn't complain about syntax issues in your file.
  • Test setting EXTEND_ESLINT=yes in your .env file or on the command line, and retest running after that is set.
  • Try changing from a json config to a javascript config...

I'll be interested to hear if any of the above ends up sorting the issue out for you.

You'll likely also get better assistance from the customize-cra project in this case, since they are the ones who provide the useEslintRc function to enable support for extending the eslint configuration.

Hi, I had the exact same issues with those methods and putting path in for useEslintRc resolved the issue. This was actually pretty much intuitive, since I have a monorepo set up and eslint config couldn't be found in default location. The awkward thing was that it'd work in editor, but fail during build.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

srhise picture srhise  路  5Comments

windhost picture windhost  路  5Comments

xiaoxiangmoe picture xiaoxiangmoe  路  3Comments

zhihongzhong picture zhihongzhong  路  4Comments

artalar picture artalar  路  4Comments