Sitelet https://github.com/import-js/eslint-plugin-import/issues/720
Skip to content

False positives in import/no-unresolved when command is run from path not correctly cased #720

Description

@hnilsen

I was getting a lot of false positives like this:

   1:34  error  Casing of react does not match the underlying filesystem                                            import/no-unresolved
   2:25  error  Casing of react-redux does not match the underlying filesystem                                      import/no-unresolved
   3:27  error  Casing of redux-form does not match the underlying filesystem                                       import/no-unresolved

In Windows, you have a case-insensitive file system which enables you to enter directories regardless of their casing. I.e. the path: C:\Git\projects\myproject\src can be entered like this:

cd C:\
cd git <-- this is the culprit
cd projects
cd myproject
cd src
npm run eslint

When using your lint rule import/no-unresolved, this will crash with the above false positives. They will disappear of you go into the directory Git instead of git.

I think the lint rule should not go further back than the level where the package.json is. This problem will appear when you're using either PowerShell or Bash. And it was a huge pain to figure out...

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions