import-js / eslint-plugin-import

ESLint plugin with rules that help validate proper imports.
MIT License
5.4k stars 1.54k forks source link

ImportDeclaration should appear when the mode is ES6 and in the module context. #961

Closed sibelius closed 6 years ago

sibelius commented 6 years ago

AssertionError [ERR_ASSERTION]: ImportDeclaration should appear when the mode is ES6 and in the module context.

    at Referencer.ImportDeclaration (app/node_modules/escope/lib/referencer.js:591:34)
    at Referencer.Visitor.visit (app/node_modules/esrecurse/esrecurse.js:122:34)
    at Referencer.Visitor.visitChildren (app/node_modules/esrecurse/esrecurse.js:101:38)
    at Referencer.Program (app/node_modules/escope/lib/referencer.js:419:18)
    at Referencer.Visitor.visit (app/node_modules/esrecurse/esrecurse.js:122:34)
    at Object.analyze (app/node_modules/escope/lib/index.js:153:16)
    at EventEmitter.module.exports.api.verify (app/node_modules/eslint/lib/eslint.js:892:35)
    at processText (app/node_modules/eslint/lib/cli-engine.js:264:31)
    at CLIEngine.executeOnText (app/node_modules/eslint/lib/cli-engine.js:754:26)
    at ESLintPlugin.getErrors (/Applications/WebStorm 2017.1 EAP.app/Contents/plugins/JavaScriptLanguage/languageService/eslint/bin/eslint-plugin.js:83:32)
Process finished with exit code -1

bug here

import type { TagInput } from './__generated__/TagMutation.graphql';

sibelius commented 6 years ago

fixed here

"parserOptions": {
    "ecmaVersion": 6,
    "sourceType": "module",
    "ecmaFeatures": {
      "modules": true
    }
  }