question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Parsing error: Unexpected token = (fatal)

See original GitHub issue

Tell 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:closed
  • Created 5 years ago
  • Reactions:2
  • Comments:15 (5 by maintainers)

github_iconTop GitHub Comments

2reactions
ilyavolodincommented, Feb 28, 2019

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.

1reaction
ljharbcommented, Jan 10, 2019

No, jsx parsing is enabled by the Airbnb config.

I believe this is that npm dependencies issue. Try updating eslint to the latest.

Read more comments on GitHub >

github_iconTop Results From Across the Web

ESLint Parsing error: Unexpected token - Stack Overflow
Unexpected token errors in ESLint parsing occur due to incompatibility between your development environment and ESLint's current parsing ...
Read more >
3 Easy Steps to Fix the Parsing Error Unexpected Token issue
The Parsing error unexpected token usually occurs when there is an incompatibility between the parser option and the code.
Read more >
ESLint: "Parsing error: Unexpected token" in Visual Studio Code
Unexpected token errors are caused by incompatibilities in your parser options and the code you're writing. In this case, I'm using a number...
Read more >
[ESLint] Parsing error: unexpected token - DEV Community ‍ ‍
This is a solution when I saw these errors. ... Warning: React version not specified in eslint-plugin-react settings. See https://github.com/ ...
Read more >
How To Fix - "Parsing error: Unexpected Token" in React.js or ...
Such “Unexpected token” signify a common behavioural problem – somewhere in your code a specific construct was supplied, but the system expected something ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found