re: How To Set Up ESLint, TypeScript, Prettier with Create React App VIEW POST


I read things more carefully and realized I misunderstood what exactly CRA was complaining about. It didn't like the fact that I installed a different version of ESLint, but once I swapped it for CRA's version, it was fine.

However, I noticed that you don't install ESLint in this article at all? How are you calling it in your scripts then? Is it installed globally?


You get ESLint for free when you install CRA so there's no need to install it in your package.json. I have experienced the same warning you're describing here when attempting to install my own version of ESLint. I uninstalled ESLint in my package.json and everything seems to be running as expected. I'm not sure regarding the restriction of ESLint configs, I have always been able to successfully set up lint configs though in the past opted for TSLint

It's worth nothing that this configuration was tested with the following versions of react/react-dom and react scripts

    "react": "^16.8.6",
    "react-dom": "^16.8.6",
    "react-scripts": "2.1.8"

It could work to just keep using ESLint installed through CRA, but the VSCode ESLint extension doesn't seem to pick it up, of it's not listed among your dependencies. Plus, I don't think it's a good practice to reference a dependency in your code that you don't install manually... But can work for sure.

I agree, there should be some concern over this if a dependency higher up in the tree you don't have control over happens to change than dependent libraries downline could potentially cause issues. This is also the case when using any libraries that depend on Jest as well which also comes prepackaged with CRA. Given that these libraries are the new standard for TS linting with ESLint with full community support my hope is that there will be reasonable support for the latest versions of ESLint. I will mention up above as well this will be solved with CRA 3.0 that will include these libraries OOTB.

code of conduct - report abuse