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.

Bug: Parsing error: Unexpected token 0

See original GitHub issue

Environment

Node version: v16.5.0
npm version: v7.19.1
Local ESLint version: v8.3.0 (Currently used)
Global ESLint version: Not found
Operating System: darwin 21.4.0
module.exports = {
  env: {
    browser: true,
    node: true
  },
  plugins: ['njk'],
  extends: 'eslint:recommended',
  parserOptions: {
    ecmaVersion: 13
  },
  rules: {
    indent: ['error', 2],
    'linebreak-style': ['error', 'unix'],
    quotes: ['error', 'single', { allowTemplateLiterals: true }],
    semi: ['error', 'always'],
    'no-unused-vars': 'off'
  }
};

What parser are you using?

Default (Espree)

What did you do?

Line in question:

const { blocks = [] } = rawPageItem.fields;

Red error line appears in VSCode as per below:

Screenshot 2022-07-18 at 08 05 18

What did you expect to happen?

This error to not be flagged. It happens elsewhere but not consistently. However there are other places in my code, this does not happen.

What actually happened?

Screenshot 2022-07-18 at 08 06 40

Participation

  • I am willing to submit a pull request for this issue.

Additional comments

First time reporting this, so please let me know if there is anything else I can do to help. Thanks.

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
edhendersoncommented, Jul 19, 2022

@mdjermanovic I did some digging today and removed plugin, that does indeed fix it. My thanks for all the help. Very much appreciated.

0reactions
mdjermanoviccommented, Jul 18, 2022
Screenshot 2022-07-18 at 08 06 40

This does seem to be caused by eslint-plugin-exclude-nunjucks-tags, as it replaces code with 0.

@edhenderson can you remove plugins: ['njk'] from your config file and try linting the same code again?

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 - 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 >
syntax error, unexpected token “...” : Bugs : smarty3 package ...
* This is the template parser. * It is generated from the smarty_internal_templateparser.y file * * @author Uwe Tews <email address hidden> */...
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