P
P
profcat2020-06-28 14:27:53
React
profcat, 2020-06-28 14:27:53

How to set up Eslint in create-react-app?

The goal is to simply add a few rules to the rules and settings that are already in CRA out of the box. As a result:

1. According to the documentation, CRA set the global variable EXTEND_ESLINT = true, and immediately the code fell with an error, saying that in one of the files keyword 'export' is reserved. It seems that there is an expansion, then why does the config break out of the box?

2. I tried to fix it by denoting various settings in package.json, then in .eslintrc, then renamed it to .eslintrc.json. In all these configs, I expanded / did not expand "react-app", played with ecmaVersion and sourceType, changed the environment settings, it didn't really help. All the same error.

I'm setting up Eslint config for the first time, maybe my cant. Three hours of googling gave no ideas.

Is it possible to somehow set up a linter without pain in CRA? No eject and preferably no third party dependencies

Answer the question

In order to leave comments, you need to log in

1 answer(s)
P
profcat, 2020-06-28
@profcat

8 hours passed, probably not in vain.
https://github.com/facebook/create-react-app/issue...
In short, CRA cached some left config and couldn't find my custom one.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question