Abhay
Abhay

Reputation: 31

ESLINT_NO_DEV_ERRORS flag not working in Typescript project

I'm working on a project using the following:

  1. Yarn
  2. Typescript
  3. Create React App
  4. ESLint
  5. Make (Makefile)
  6. Fish shell

When developing, I frequently get ESLint errors they stop my project from compiling. I run my project using make run, which just calls yarn start. I wanted to create a new make command that lets me run my project while setting all ESLint errors to warnings.

Luckily, Create React App seems to have something for this exact setting, an env variable called ESLINT_NO_DEV_ERRORS. I created a .env file in my root directory, and set ESLINT_NO_DEV_ERRORS=true in that file.

However, when I do make run aka yarn start, it completely ignores that flag and still raises errors. To debug, I printed the env variables in public/index.html. My custom env variable was set, but the ESLINT_NO DEV_ERRORS was not (screenshot attached). The documentation says that it does not need to be prefixed with REACT_APP_ like other custom environment variables.

Any ideas or suggestions?

Upvotes: 3

Views: 3643

Answers (1)

Atav32
Atav32

Reputation: 1812

Could also try using

  • TSC_COMPILE_ON_ERROR=true
  • DISABLE_ESLINT_PLUGIN=true

https://create-react-app.dev/docs/advanced-configuration/

Webpack advanced configuration environment variables

However, depending on your dependency version, there might be a bug where some of the environment variables are ignored. You could try downgrading create-react-app to <4.0.

Read through this issue for the full context, https://github.com/facebook/create-react-app/issues/9887.

Upvotes: 2

Related Questions