ImportDeclaration should appear when the mode is ES6 and in the module context
See original GitHub issueI’m using @typescript-eslint/parser in eslint for tsx files. I have this code in .tsx file:
import React from 'react';
export class Wallboard extends React.Component<{ meetupGroups: [string] }> {
constructor(props: Readonly<{ meetupGroups: [string] }>) {
super(props);
}
render(): React.ReactElement {
return <div>{'ksi'}</div>;
}
}
and this configuration (+ big webpack configuration):
{
"parser": "babel-eslint",
"extends": [
"@jetbrains",
"@jetbrains/eslint-config/browser",
"@jetbrains/eslint-config/es6",
"@jetbrains/eslint-config/node",
"@jetbrains/eslint-config/react",
"@jetbrains/eslint-config/angular",
"@jetbrains/eslint-config/test"
],
"overrides": [
{
"files": ["**/*.ts", "**/*.tsx"],
"parser": "@typescript-eslint/parser",
"plugins": ["@typescript-eslint"],
"extends": [
"@jetbrains",
"@jetbrains/eslint-config/browser",
"@jetbrains/eslint-config/es6",
"@jetbrains/eslint-config/node",
"@jetbrains/eslint-config/react",
"@jetbrains/eslint-config/angular",
"@jetbrains/eslint-config/test"
],
"settings": {
"import/resolver": {
"node": {
"extensions": [".js",".jsx",".ts",".tsx"]
}
}
}
}
]
}
and I get this error:
/Users/psuwala/projects/hs3/event-monitor/src/components/Wallboard.tsx 0:0 error Parsing error: ImportDeclaration should appear when the mode is ES6 and in the module context
I pinpointed that it comes from here:
of course if I remove this.scopeManager.isModule()
it will work.
Any idea if it is possible to override it? Or is it typescript-eslint misuse?
Issue Analytics
- State:
- Created 4 years ago
- Comments:6 (3 by maintainers)
Top Results From Across the Web
ImportDeclaration should appear when the mode is ES6 and ...
This issue is coming from escope in general (feel free to redirect there instead), though not sure which config option in eslint exists...
Read more >Atom & eslint update : ImportDeclaration should appear when ...
But now, I have got an error on eslint check : AssertionError: ImportDeclaration should appear when the mode is ES6 and in the...
Read more >Parsing error: ImportDeclaration should appear when the ...
Appears to be a problem with the babel eslint package but cant quite figure ... should appear when the mode is ES6 and...
Read more >"Parsing error: ImportDeclaration should appear ... - Issuehunt
"Parsing error: ImportDeclaration should appear when the mode is ES6 and in the module context." in update to 0.45.0 #615. muziejus posted onGitHub....
Read more >eslint parsing error: importdeclaration should appear when the ...
Atom & eslint update : ImportDeclaration should appear when the mode is ES6 and in the module context. Asked Mar 12, 2016 •...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
for anyone else following https://json.schemastore.org/eslintrc.json
dont use
ecmaVersion: latest
use
ecmaVersion: 12
or something elseApologies for the lack of clarity about having to put this config in
parserOptions
-what you did is what I was suggesting (ESLint accepts2015
or6
). 👍