Eslint-plugin-import: import/order fails after updating a dependency (redux-saga)

Created on 6 Apr 2017  路  5Comments  路  Source: benmosher/eslint-plugin-import

When using [email protected] everything is fine
But fails when using [email protected]

I think the reason for this to fails is this PR: https://github.com/redux-saga/redux-saga/pull/895


Error message:

./userSaga import should occur before import of redux-saga/effects import/order

Code:

import { fork } from 'redux-saga/effects';

import connectionFlow from './userSaga';
imporexport ordering

Most helpful comment

As a temporary workaround, one can add redux-saga/effects to import/core-modules.
That will make it at least higher that internal modules in the imports list.

Example:

    settings: {
        'import/core-modules': [
            'redux-saga/effects',
        ]
    },

All 5 comments

I can confirm this issue is happening to me as well. redux-saga removed the redux-saga/effects.js file, so it freaks out eslint-plugin-import.

It's probably due to the fact that redux-saga/effects.js was replaced with a package.json file with a relative path as a main field ? (naive guess, currently looking into it).

Edit:
It's because importType.isExternalPath is trying to find
node_modules/redux-saga/effects
Inside the resolved path which actually is
<project_path>/node_modules/redux-saga/es/effects.js
to correctly mark is as an external module

Working on a fix.

Any update on this one? Cheers

Also facing this issue. To add, it's peculiar that the linter reports this as a warning from the import/order plugin, but my editor integration reports it (more appropriately?) as "Unable to resolve path to module 'redux-saga/effects'. (import/no-unresolved). This appears to compound the original issue because it's not possible to workaround the warning while the fix is resolved by simply disabling eslint on the line of the redux-saga/effects import

import { put, call, takeEvery } from 'redux-saga/effects'; // eslint-disable-line  <- doesn't help

It still causes warnings for other imports in the file, namely from import/order.

As a temporary workaround, one can add redux-saga/effects to import/core-modules.
That will make it at least higher that internal modules in the imports list.

Example:

    settings: {
        'import/core-modules': [
            'redux-saga/effects',
        ]
    },
Was this page helpful?
0 / 5 - 0 ratings

Related issues

migueloller picture migueloller  路  3Comments

pcorpet picture pcorpet  路  3Comments

ljharb picture ljharb  路  3Comments

yutin1987 picture yutin1987  路  3Comments

silvenon picture silvenon  路  3Comments