import-js/eslint-plugin-import

Support for named import pattern in import/named

Open

#1 583 ouverte le 26 déc. 2019

Voir sur GitHub
 (4 commentaires) (3 réactions) (0 assignés)JavaScript (1 540 forks)batch import
bughelp wanted

Métriques du dépôt

Stars
 (4 946 stars)
Métriques de merge PR
 (Merge moyen 138j 22h) (3 PRs mergées en 30 j)

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

Guide contributeur