question
Recently, I found a problem when using react native to develop an app:
Error details:
As you can see, this is the correct way of writing jsx, and there is no grammatical error, but eslint still reports an error, which roughly means unexpected symbols <
. It can be inferred that eslint is not correct It is caused by parsing the jsx syntax. Although the program can run normally, it is really unbearable for obsessive-compulsive disorder.
analyze
Reason: The development environment is not compatible with ESLint's current parsing capabilities
Solution: parse with babel-eslint
solve
Installbabel-eslint
npm install babel-eslint --save-dev
Add in .eslintrc.js
parse: 'babel-eslint'
Problem solved, error cleared.