import-js/eslint-plugin-import

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

Open

#1,291 opened on Feb 19, 2019

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

Repository metrics

Stars
 (4,946 stars)
PR merge metrics
 (Avg merge 138d 22h) (3 merged PRs in 30d)

Description

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.

Contributor guide