import-js/eslint-plugin-import

[import/no-unresolved] not working for index.js

オープン

#1,292 opened on 2019/02/19

 (16 件のコメント) (13 件のリアクション) (0 人の担当者)JavaScript (1,549 件のフォーク)batch import
bughelp wanted

Repository metrics

Stars
 (5,939 個のスター)
PR merge metrics
 (平均マージ 138d 22h) (30d で 3 merged PRs)

説明

similar but different: https://github.com/benmosher/eslint-plugin-import/issues/1124

file struct:

utils/
    index.js
components/
    Foo.jsx
.eslintrc.js
webpack.config.js

utils/index.js:

export function getPromise () { return 42; }

components/Foo.jsx:

import { getPromise } from 'utils';

.eslintrc:

{
  "parser": "babel-eslint",
  "plugins": [
    "import",
  ],
  "settings": {
    "import/resolver": {
      "webpack": {
        "config": path.resolve(__dirname, "webpack.config.js"),
      }
    },
  },
  "rules": {
    "import/no-unresolved": ["error", {commonjs: true, caseSensitive: true}],
    // ...
  }
}

webpack.config.js:

{
  context: root,
  resolve: {
    modules: [root, 'node_modules'],
    extensions: ['.js', '.jsx', '.json', '.coffee', '.cjsx'],
  },
  // ...
}

versions: all are latest

コントリビューターガイド