Search code examples
reactjstypescripteslinttypescript-eslint

How to force a compilation and ignore @typescript-eslint errors?


I'm currently working on a React project, initiated with Create React App. Currently, to compile, I am using the default command npm run start which runs react-scripts start.

I have a bunch of @typescript-eslint rules that force me to have a clean code before delivering it and deploy it. However, while I'm developing, I may have some unused variables and still want to compile to see if something else works.

Is there a command to force the compilation, while ignoring some or all @typescript-eslint rules?


Solution

  • This is a CRA configuration that can be overwritten. In an .env file, you can add these variables

    TSC_COMPILE_ON_ERROR=true
    ESLINT_NO_DEV_ERRORS=true
    

    Here is the full list https://create-react-app.dev/docs/advanced-configuration/