eslint-import-resolver-exports

v1.0.0-beta.5
`package.json` `exports` field resolver for `eslint-plugin-import`

eslint-import-resolver-exports

This package adds package.json#exports support to eslint-plugin-import using the resolve.exports package.

Usage

Install with npm install -D eslint-import-resolver-exports and add it as a resolver to your ESLint configuration. You should always include another resolver (e.g. eslint-import-resolver-node or eslint-import-resolver-typescript) since this resolver only supports package.json#exports and not the other Node.js resolution features.

Example config:

module.exports = {
  // ... other configuration options
  settings: {
    "import/resolver": {
      typescript: {
        project: [__dirname + "/tsconfig.json"],
      },
      exports: {
        // Accepts the same options as the `resolve.exports` package
        // See: https://github.com/lukeed/resolve.exports#optionsunsafe

        // All optional, default values are shown

        // Add "require" field to the conditions
        require: false,
        // Add "browser" field to the conditions
        browser: false,
        // List of additional/custom conditions
        conditions: [],
        // Ignore everything except the `conditions` option
        unsafe: false,
      },
    },
  },
};

Credits and license

npm i eslint-import-resolver-exports

Metadata

  • MIT
  • Whatever
  • Fatih Aygün
  • released 2/24/2023

Downloads

Maintainers