Tried 'useEslintRc' from 'customize-cra' package, but it didnt work
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:
useEslintRc(path.resolve(__dirname, '.eslintrc.js'))yarn eslint src/**/*.js and make sure it doesn't complain about syntax issues in your file.EXTEND_ESLINT=yes in your .env file or on the command line, and retest running after that is set.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.
Most helpful comment
Hi, I had the exact same issues with those methods and putting path in for
useEslintRcresolved 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.