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.

get Parsing error: The keyword 'import' is reserved

See original GitHub issue
module.exports = {
  parser: '@typescript-eslint/parser',
  plugins: ['@typescript-eslint/eslint-plugin'],
  extends: [
    'plugin:@typescript-eslint/recommended',
    'plugin:import/recommended',
    'plugin:import/typescript',
    'plugin:react/recommended',
    'plugin:react-hooks/recommended',
    'plugin:react/jsx-runtime',
    'plugin:prettier/recommended',
  ],
  settings: {
    'import/resolver': {
      typescript: {
        project: 'tsconfig.json',
      },
    },
    react: {
      createClass: 'createReactClass', // Regex for Component Factory to use,
      // default to "createReactClass"
      pragma: 'React', // Pragma to use, default to "React"
      fragment: 'Fragment', // Fragment to use (may be a property of <pragma>), default to "Fragment"
      version: 'detect', // React version. "detect" automatically picks the version you have installed.
      // You can also use `16.0`, `16.3`, etc, if you want to override the detected value.
      // default to latest and warns if missing
      // It will default to "detect" in the future
      flowVersion: '0.53', // Flow version
    },
  },
  env: {
    browser: true,
    node: true,
    jest: true,
  },
  overrides: [
    {
      files: ['*.ts', '*.tsx'],
      parserOptions: {
        project: 'tsconfig.json',
        sourceType: 'module',
        ecmaVersion: 2020,
      },
    },
  ],
}

this is my eslint.config.js, I had add .vscode in my project. when use eslint V7 this is right.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:9 (5 by maintainers)

github_iconTop GitHub Comments

2reactions
dbaeumercommented, Dec 1, 2021

Works with the eslint.useESLintClass setting capture

0reactions
WebCaiQingChongcommented, Dec 2, 2021

it works for me,thank you very mach.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Parsing Error The Keyword import is Reserved (SublimeLinter ...
The eslint option that solves the "The keyword import is reserved" error is parserOptions.sourceType . Setting ...
Read more >
Parsing error: The keyword 'import' is reserved #67 - GitHub
For some reason eslint is saying import is wrong. It might be related to this issue jsx-eslint/eslint-plugin-react#447 (comment)
Read more >
JavaScript : Parsing Error The Keyword import is Reserved ...
JavaScript : Parsing Error The Keyword import is Reserved (SublimeLinter-contrib-eslint) [ Gift : Animated Search Engine ...
Read more >
[Solved]-Parsing error: The keyword 'import' is reserved-Reactjs
Coding example for the question Parsing error: The keyword 'import' is reserved-Reactjs.
Read more >
“ESLint: Parsing error: The keyword 'import' is reserved” Code ...
Answers related to “ESLint: Parsing error: The keyword 'import' is reserved”. javascript reserved words · Unexpected reserved word 'await'. python reserved ...
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