import-js/eslint-plugin-import

Incorrect import group for npm module and local file with same name in same folder

Open

#1,027 建立於 2018年2月20日

在 GitHub 查看
 (0 留言) (2 反應) (0 負責人)JavaScript (4,946 star) (1,540 fork)batch import
bughelp wantedimport/export ordering

描述

When I have a local file in the same folder with the same name of an npm module, the import/order rule detects the import group incorrectly.

My eslint rule config

'import/order': [
  'error',
  {
    groups: [['builtin', 'external'], 'internal', 'parent', ['sibling', 'index']],
    'newlines-between': 'always',
  },
]

My folder structure:

api/ test,js join-monster.js

join-monster is also a package installed in package.json

test.js

import { merge } from 'lodash';
import joinMonster from 'join-monster';

eslint gives this error

E:\Dropbox\Programming\evercare\api\src\app\api\test.js
  1:1  error  There should be at least one empty line between import groups  import/order

I would expect that it should realize 'join-monster' refers to the npm module and './join-monster' refers to the local file.

貢獻者指南