Skip to content

import/no-unresolved doesn't support package.json exports field #2853

Description

@polarstoat

Using the base Airbnb config with ESLint, I'm getting false positives for packages that definitely are installed and working from the import/no-unresolved rule:

  3:18  error    Unable to resolve path to module 'conf'  import/no-unresolved

This seems to occur with packages whose package.json file has an exports field but no main field (of which sindresorhus/conf is an example).

import-js/eslint-plugin-import#1810 discusses support for this, but appears to be blocked by browserify/resolve#224.

As currently the rule does not work correctly with packages that only use an exports perhaps it should be turned off? Node has supported exports as an alternative to main as a package entry point for many years now, but until this is fixed upstream with eslint-plugin-import I think it might be best to avoid using it.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions