Blame view

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