Parsing error: Unexpected token = (fatal)
See original GitHub issueTell us about your environment
- ESLint Version: 5.9.0
- Node Version: 8.12.0
- npm Version: 6.4.1
What parser (default, Babel-ESLint, etc.) are you using? default
Please show your full configuration:
Configuration
module.exports = {
"extends": "airbnb",
"env": {
"jest": true,
},
};
When writing components for a react project I am working on I have noticed a strange issue occuring with regards to linting. It seems to flag the first use of ‘=’ as a Parsing error in the editor. Yet when running the project there is nothing reported and the views work without issue. For instance below is the code for my Footer component:
import React, { Component } from 'react';
import FontAwesome from 'react-fontawesome';
import PropTypes from 'prop-types';
class Footer extends Component {
render() {
return (
<footer className='footer'>
<div className='footer__links'></div>
</footer>
)
}
Using the above example it is flagging the parsing error on the ‘=’ in <footer className='footer'>
this is the same for all of my components.
This issue appears when using running the following command in the command line:
./node_modules/.bin/eslint components/footer.js
It also appears in the realtime linters in both Atom and VS Code.
What did you expect to happen?
I do not expect to see this error.
What actually happened? Please include the actual, raw output from ESLint.
I get the following error:
/Users/user/project/components/footer.js
8:24 error Parsing error: Unexpected token =
✖ 1 problem (1 error, 0 warnings)
Are you willing to submit a pull request to fix this bug? If I can make the time to track down the problem and fix it I will.
Issue Analytics
- State:
- Created 5 years ago
- Reactions:2
- Comments:15 (5 by maintainers)
Top GitHub Comments
It looks like this might be an issue with NPM dependency management. Unfortunately, npm does have a few issues in a way it handles multiple instances of the same dependencies with different versions. And we can’t really do anything to fix that, since it’s usually are related to specific user’s installation.
No, jsx parsing is enabled by the Airbnb config.
I believe this is that npm dependencies issue. Try updating eslint to the latest.