Search code examples
reactjswebpackcreate-react-app

How to not show warnings in Create React App


I'm using create-react-app from Facebook, when it starts via 'npm start' it shows me a list of warnings, such as:

'Bla' is defined but never used
Expected '===' and instead saw '=='

I don't want to see any of these warnings, is there a way to supress them?


Solution

  • For local Eslint, add a file to your project named .eslintignore and add any directories or files you want to ignore:

    build/
    src/
    *.js
    

    Though you might as well remove it entirely at this point.


    This doesn't work with building or starting the code however, if you are using create-react-app. There is no way to disable Eslint without ejecting because it's built into react-scripts. Anytime any you build or start the server, it will run eslint using its internal configs aside from special cases defined in package.json. The only way around that is to eject or prepend each file with the disable comment as mentioned elsewhere. See this issue on Github for more information.