eslint-import-resolver-next
v0.3.1
Published
The next resolver for `eslint-plugin-import` or `eslint-plugin-import-x`
Downloads
729
Maintainers
Readme
eslint-import-resolver-next
The next resolver plugin for eslint-plugin-import
or eslint-plugin-import-x
that resolves modules with oxc-resolver
.
Features
- Resolves modules using the
oxc-resolver
package. - Support mono-repos and
pnpm-workspaces.yaml
. - Support paths alias defined in
tsconfig.compilerOptions.paths
orjsconfig.compilerOptions.paths
.
Usage
- Install the package:
npm install -D eslint-import-resolver-next
- Add it as a resolver to your ESLint configuration.
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,
},
},
},
},
};
Options
roots
(Array): The directories to search for modules. Default:["."]
.alias
(Record<string, string | string[]>): The paths alias. Default:undefined
.- The alias can be set as relative paths. relative paths are resolved from the package directory.
tsconfig
(boolean | string | object): Weather to use thetsconfig.json
file. Default:true
.- If
true
, the resolver will try to find thetsconfig.json
file in the package directory. - If a string, the resolver will try to find the file in the specified path.
- If an object, see the
tsconfig
option in theoxc-resolver
package.
- If
jsconfig
(boolean | string | object): Weather to use thejsconfig.json
file. Default:true
.- If
true
, the resolver will try to find thejsconfig.json
file in the package directory. - If a string, the resolver will try to find the file in the specified path.
- If an object, see the
jsconfig
option in theoxc-resolver
package.
- If
packages
(string[] | PackageOptions): The directories to search for packages. Default:undefined
.- If an array, the resolver will search for packages in the specified directories.
- If an object, see the
PackageOptions
.
All other options are passed to the oxc-resolver
package. See the oxc-resolver documentation
PackageOptions
patterns
(string[]): The patterns to search for packages. Default:["."]
.ignore
(string[]): The directories to ignore. Default:["**/node_modules/**", "**/test/**", "**/tests/**"]
.includeRoot
(boolean): Weather to include the root directory. Default:false
.pnpmWorkspace
(boolean | string): Weather to use thepnpm-workspace.yaml
file to find packages. Default:false
.- If
true
, the resolver will try to find thepnpm-workspace.yaml
file in the package directory. - If a string, define the path to the
pnpm-workspace.yaml
file.
- If