Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
jonathanj opened this issue Feb 19, 2019 · 3 comments

Comments

@jonathanj
Copy link

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.

@tomzmtl
Copy link

tomzmtl commented Dec 18, 2019

Having the same issue but with import/order, where

import { call, select, put } from "redux-saga/effects"
import { something } from "../api/something"

Flags the second line with a warning:

`../api/something` import should occur before import of `redux-saga/effects` : eslint(import/order)

My import/order rules config:

"import/order": [
  "warn",
  {
    "newlines-between": "never"
  }
],

The warning disappears if the first import is changed to "redux-saga"

@hegde-codes
Copy link

Any updates?

@ljharb
Copy link
Member

ljharb commented Apr 17, 2020

@hegde-codes nope, nobody's submitted a PR yet.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

4 participants