Automatically fixing warnings with eslint

As the exhaustive dependencies rule is quite simple and straightforward to fix, we can automatically let eslint fix it.

To do so, we need to pass the --fix flag to eslint. Using npm run, we can pass flags by using an additional -- as a separator, as follows:

> npm run lint -- --fix

After running the preceding command, we can run npm run lint again, and we are going to see that all warnings have automatically been fixed:

No warnings after letting eslint fix them

As we can see, eslint not only warns us about problems, it can even fix some of them automatically for us!

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.141.24.134