AssertionError: ImportDeclaration should appear when the mode is ES6 and in the module context
See original GitHub issue“version”: “1.8.0” “escope”: “^3.2.0”
This issue is coming from escope in general (feel free to redirect there instead), though not sure which config option in eslint exists to enable modules mode (other than ecmaFeatures: { modules: true }
which we already use).
We use ESLintTester
(which seems is deprecated now, so maybe issue can be related as well). Trying to test the:
import Foo from 'Foo';
// Or type
import type Bar from 'Bar';
Fails with the assertion in the escope:
- AssertionError: ImportDeclaration should appear when the mode is ES6 and in the module context.
at Referencer.ImportDeclaration (scripts/lint/eslint/node_modules/eslint/node_modules/escope/lib/referencer.js:711:17)
at Referencer.Visitor.visit (scripts/lint/eslint/node_modules/eslint/node_modules/escope/node_modules/esrecurse/esrecurse.js:109:34)
at Referencer.Visitor.visitChildren (scripts/lint/eslint/node_modules/eslint/node_modules/escope/node_modules/esrecurse/esrecurse.js:88:38)
at Referencer.Program (scripts/lint/eslint/node_modules/eslint/node_modules/escope/lib/referencer.js:539:22)
at Referencer.Visitor.visit (scripts/lint/eslint/node_modules/eslint/node_modules/escope/node_modules/esrecurse/esrecurse.js:109:34)
at Object.analyze (scripts/lint/eslint/node_modules/eslint/node_modules/escope/lib/index.js:130:16)
at EventEmitter.module.exports.api.verify (scripts/lint/eslint/node_modules/eslint/lib/eslint.js:736:35)
at runRuleForItem (scripts/lint/eslint/node_modules/eslint/lib/testers/rule-tester.js:265:34)
at testInvalidTemplate (scripts/lint/eslint/node_modules/eslint/lib/testers/rule-tester.js:302:26)
at Spec.<anonymous> (scripts/lint/eslint/node_modules/eslint/lib/testers/rule-tester.js:370:21)
Is it a known issue? I didn’t find other config options to allow import
in the tests.
Thanks!
Issue Analytics
- State:
- Created 8 years ago
- Comments:16 (3 by maintainers)
Top Results From Across the Web
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 >importdeclaration should appear when the mode is es6 and in ...
Line 0: Parsing error: ImportDeclaration should appear when the mode is ES6 and in the module context. Luckily, I have already posted a...
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-config-light - npm Package Health Analysis - Snyk
AssertionError : ImportDeclaration should appear when the mode is ES6 and in the module context.
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
I follow doc to add following options in
.eslintrc.json
file, and the issue is gonehttps://eslint.org/docs/user-guide/configuring#specifying-parser-options
adding the following lines in
.eslintrc
fixed the issue in my side.