1 | # eslint-import-resolver-node
|
2 |
|
3 | [![npm](https://img.shields.io/npm/v/eslint-import-resolver-node.svg)](https://www.npmjs.com/package/eslint-import-resolver-node)
|
4 |
|
5 | Default Node-style module resolution plugin for [`eslint-plugin-import`](https://www.npmjs.com/package/eslint-plugin-import).
|
6 |
|
7 | Published separately to allow pegging to a specific version in case of breaking
|
8 | changes.
|
9 |
|
10 | Config is passed directly through to [`resolve`](https://www.npmjs.com/package/resolve#resolve-sync-id-opts) as options:
|
11 |
|
12 | ```yaml
|
13 | settings:
|
14 | import/resolver:
|
15 | node:
|
16 | extensions:
|
17 | # if unset, default is just '.js', but it must be re-added explicitly if set
|
18 | - .js
|
19 | - .jsx
|
20 | - .es6
|
21 | - .coffee
|
22 |
|
23 | paths:
|
24 | # an array of absolute paths which will also be searched
|
25 | # think NODE_PATH
|
26 | - /usr/local/share/global_modules
|
27 |
|
28 | # this is technically for identifying `node_modules` alternate names
|
29 | moduleDirectory:
|
30 |
|
31 | - node_modules # defaults to 'node_modules', but...
|
32 | - bower_components
|
33 |
|
34 | - project/src # can add a path segment here that will act like
|
35 | # a source root, for in-project aliasing (i.e.
|
36 | # `import MyStore from 'stores/my-store'`)
|
37 | ```
|
38 |
|
39 | or to use the default options:
|
40 |
|
41 | ```yaml
|
42 | settings:
|
43 | import/resolver: node
|
44 | ```
|