import-js/eslint-plugin-import

Support for named import pattern in import/named

Open

#1,583 opened on Dec 26, 2019

View on GitHub
 (4 comments) (3 reactions) (0 assignees)JavaScript (4,946 stars) (1,540 forks)batch import
bughelp wanted

Description

Given:

// ./foo.js
export const foo = "I'm so foo"

The following Es6 syntax is considered invalid:

// ./bar.js
import { foo as bar } from './foo'

Error:

ESLint: foo not found in './foo'(import/named)

However, the following is considered valid

// ./bar.js
import * as bar from './foo'

is it done intentionally? And if so, do we have an option to disable errors?

My configuration:

{
    "env": {
        "browser": true,
        "jest": true
    },
    "parserOptions": {
        "sourceType": "module",
        "ecmaFeatures": {
            "jsx": true
        }
    },
    "extends": [
        "airbnb",
        "plugin:prettier/recommended"
    ],
    "plugins": [
        "react"
    ],
    "rules": {
        "class-methods-use-this": 0,
        "import/no-named-as-default": 0,
        "react/jsx-filename-extension": [
            "error",
            {
                "extensions": [
                    ".js",
                    ".jsx"
                ]
            }
        ]
    }
}

Eslint version: v6.8.0

Contributor guide