$ npm install eslint-import-resolver-next
The next resolver plugin for eslint-plugin-import or eslint-plugin-import-x that resolves modules with unrs-resolver.
unrs-resolver package.pnpm-workspaces.yaml.tsconfig.compilerOptions.paths or jsconfig.compilerOptions.paths.npm install -D eslint-import-resolver-next
Example config:
module.exports = {
// ... other configuration options
settings: {
"import/resolver": {
next: {
// Options for the resolver
},
},
},
};
with Mono-repo:
module.exports = {
// ... other configuration options
settings: {
"import/resolver": {
next: {
packages: ["packages/*"],
},
},
},
};
pnpm-workspaces:
module.exports = {
// ... other configuration options
settings: {
"import/resolver": {
next: {
packages: {
pnpmWorkspace: true,
includeRoot: true,
},
},
},
},
};
resolver-nextconst { createNextImportResolver } = require("eslint-import-resolver-next");
module.exports = {
// ... other configuration options
settings: {
"import-x/resolver-next": [createNextImportResolver({
// Options for the resolver
})],
},
};
roots (Array<string>): The directories to search for modules. Default: [process.cwd()].
alias (Record<string, string | string[]>): The paths alias. Default: undefined.
tsconfig (boolean | string | object): Weather to use the tsconfig.json file. Default: true.
true, the resolver will try to find the tsconfig.json file close to the source file.ConfigFileOptions.jsconfig (boolean | string | object): Weather to use the jsconfig.json file. Default: true.
true, the resolver will try to find the jsconfig.json file close to the source file.ConfigFileOptions.packages (string[] | PackageOptions): The patterns or options to search for packages. Default: undefined.
PackageOptions.bun (boolean): Weather to enable the bun support. Default: true if bun environment is detected.
true, the resolver will try to resolve bun built-in modules.All other options are passed to the unrs-resolver package. See the unrs-resolver documentation
The tsconfig and jsconfig options can have the following properties:
configFile (string): The name of the file to search for or the absolute path to the file. Default: tsconfig.json.ignore (string[]): The directories to ignore. Default: ["**/node_modules/**"].references ('auto' | string[]): Support for Typescript Project References. Default: 'auto'.
'auto', the resolver will try to find the references field in the tsconfig.json file.A folder with a package.json file is considered a package. The PackageOptions object can have the following properties:
patterns (string[]): The patterns to search for packages. Default: ["."].ignore (string[]): The directories to ignore. Default: ["**/node_modules/**", "**/bower_components/**", "**/test/**", "**/tests/**"].includeRoot (boolean): Weather to include the root directory. Default: false.pnpmWorkspace (boolean | string): Weather to use the pnpm-workspace.yaml file to find packages. Default: false.
true, the resolver will try to find the pnpm-workspace.yaml file in the package directory.pnpm-workspace.yaml file.© 2010 - cnpmjs.org x YWFE | Home | YWFE