import-js/eslint-plugin-import

Linter mistakenly assumes global module is a parent directory of the project

开放

#1,291 创建于 2019年2月19日

 (3 条评论) (5 个反应) (0 位负责人)JavaScript (1,549 个派生)batch import
bughelp wanted

仓库指标

星标
 (5,938 个星标)
PR 合并指标
 (平均合并 138天 22小时) (30 天内合并 3 个 PR)

描述

I have code doing an import like:

import {all} from 'redux-saga/effects';
import {REHYDRATE} from 'redux-persist/constants';

Producing the linter errors below:

1:25  error  Relative imports from parent directories are not allowed. Please either pass what you're importing through at runtime (dependency injection), move `session.js` to same directory as `redux-persist/constants` or consider making `redux-persist/constants` a package  import/no-relative-parent-imports

11:8  error  Relative imports from parent directories are not allowed. Please either pass what you're importing through at runtime (dependency injection), move `index.js` to same directory as `redux-saga/effects` or consider making `redux-saga/effects` a package  import/no-relative-parent-imports

Clearly the suggested resolution in the error doesn't make sense but I'm not sure why it thinks this should be the case. #793 has some similarities but I'm not sure if those are superficial or real.

贡献者指南