eslint-import-resolver-node 0.1.1 → 0.2.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/.npmignore ADDED
@@ -0,0 +1 @@
1
+ test/
@@ -0,0 +1 @@
1
+ {"/Users/ben/git/eslint-plugin-import/resolvers/node/index.js":{"path":"/Users/ben/git/eslint-plugin-import/resolvers/node/index.js","statementMap":{"1":{"start":{"line":1,"column":14},"end":{"line":1,"column":32}},"2":{"start":{"line":2,"column":11},"end":{"line":2,"column":26}},"3":{"start":{"line":3,"column":13},"end":{"line":3,"column":37}},"4":{"start":{"line":5,"column":10},"end":{"line":5,"column":64}},"5":{"start":{"line":7,"column":0},"end":{"line":7,"column":28}},"6":{"start":{"line":9,"column":0},"end":{"line":26,"column":1}},"7":{"start":{"line":10,"column":2},"end":{"line":10,"column":42}},"8":{"start":{"line":13,"column":2},"end":{"line":16,"column":3}},"9":{"start":{"line":14,"column":4},"end":{"line":14,"column":27}},"10":{"start":{"line":15,"column":4},"end":{"line":15,"column":38}},"11":{"start":{"line":18,"column":2},"end":{"line":25,"column":3}},"12":{"start":{"line":19,"column":4},"end":{"line":19,"column":59}},"13":{"start":{"line":20,"column":4},"end":{"line":20,"column":37}},"14":{"start":{"line":21,"column":4},"end":{"line":21,"column":46}},"15":{"start":{"line":23,"column":4},"end":{"line":23,"column":36}},"16":{"start":{"line":24,"column":4},"end":{"line":24,"column":27}},"17":{"start":{"line":29,"column":2},"end":{"line":39,"column":6}},"18":{"start":{"line":43,"column":2},"end":{"line":45,"column":3}},"19":{"start":{"line":44,"column":4},"end":{"line":44,"column":36}},"20":{"start":{"line":46,"column":2},"end":{"line":46,"column":12}}},"fnMap":{"1":{"name":"(anonymous_1)","decl":{"start":{"line":9,"column":18},"end":{"line":9,"column":19}},"loc":{"start":{"line":9,"column":50},"end":{"line":26,"column":1}}},"2":{"name":"opts","decl":{"start":{"line":28,"column":9},"end":{"line":28,"column":13}},"loc":{"start":{"line":28,"column":28},"end":{"line":40,"column":1}}},"3":{"name":"packageFilter","decl":{"start":{"line":42,"column":9},"end":{"line":42,"column":22}},"loc":{"start":{"line":42,"column":28},"end":{"line":47,"column":1}}}},"branchMap":{"1":{"loc":{"start":{"line":13,"column":2},"end":{"line":16,"column":3}},"type":"if","locations":[{"start":{"line":13,"column":30},"end":{"line":16,"column":3}},{"start":{"line":1,"column":0},"end":{"line":1,"column":0}}]},"2":{"loc":{"start":{"line":43,"column":2},"end":{"line":45,"column":3}},"type":"if","locations":[{"start":{"line":43,"column":26},"end":{"line":45,"column":3}},{"start":{"line":1,"column":0},"end":{"line":1,"column":0}}]}},"s":{"1":1,"2":1,"3":1,"4":1,"5":1,"6":1,"7":3,"8":3,"9":0,"10":0,"11":3,"12":3,"13":2,"14":2,"15":1,"16":1,"17":3,"18":1,"19":0,"20":1},"f":{"1":3,"2":3,"3":1},"b":{"1":[0,3],"2":[0,1]},"hash":"6c784176dfab6e499c1d7cb9d7b3007733fcd8ca"}}
package/CHANGELOG.md ADDED
@@ -0,0 +1,27 @@
1
+ # Change Log
2
+ All notable changes to this resolver will be documented in this file.
3
+ This project adheres to [Semantic Versioning](http://semver.org/).
4
+ This change log adheres to standards from [Keep a CHANGELOG](http://keepachangelog.com).
5
+
6
+ ## v0.2.3 - 2016-08-20
7
+ ### Added
8
+ - debug logging (use `DEBUG=eslint-plugin-import:resolver:node eslint [...]`)
9
+
10
+ ## v0.2.2 - 2016-07-14
11
+ ### Fixed
12
+ - Node resolver no longer declares the import plugin as a `peerDependency`. See [#437]
13
+ for a well-articulated and thoughtful expression of why this doesn't make sense.
14
+ Thanks [@jasonkarns] for the issue and the PR to fix it ([#438]).
15
+
16
+ Also, apologies to the others who expressed this before, but I never understood
17
+ what the problem was.😅
18
+
19
+ ## v0.2.1
20
+ ### Fixed
21
+ - find files with `.json` extensions (#333, thanks for noticing @jfmengels)
22
+
23
+ [#438]: https://github.com/benmosher/eslint-plugin-import/pull/438
24
+
25
+ [#437]: https://github.com/benmosher/eslint-plugin-import/issues/437
26
+
27
+ [@jasonkarns]: https://github.com/jasonkarns
package/index.js CHANGED
@@ -2,17 +2,38 @@ var resolve = require('resolve')
2
2
  , path = require('path')
3
3
  , assign = require('object-assign')
4
4
 
5
- exports.resolveImport = function resolveImport(source, file, config) {
6
- if (resolve.isCore(source)) return null
5
+ var log = require('debug')('eslint-plugin-import:resolver:node')
7
6
 
8
- return resolve.sync(source, opts(path.dirname(file), config))
7
+ exports.interfaceVersion = 2
8
+
9
+ exports.resolve = function (source, file, config) {
10
+ log('Resolving:', source, 'from:', file)
11
+ var resolvedPath
12
+
13
+ if (resolve.isCore(source)) {
14
+ log('resolved to core')
15
+ return { found: true, path: null }
16
+ }
17
+
18
+ try {
19
+ resolvedPath = resolve.sync(source, opts(file, config))
20
+ log('Resolved to:', resolvedPath)
21
+ return { found: true, path: resolvedPath }
22
+ } catch (err) {
23
+ log('resolve threw error:', err)
24
+ return { found: false }
25
+ }
9
26
  }
10
27
 
11
- function opts(basedir, config) {
12
- return assign({},
28
+ function opts(file, config) {
29
+ return assign({
30
+ // more closely matches Node (#333)
31
+ extensions: ['.js', '.json'],
32
+ },
13
33
  config,
14
34
  {
15
- basedir: basedir,
35
+ // path.resolve will handle paths relative to CWD
36
+ basedir: path.dirname(path.resolve(file)),
16
37
  packageFilter: packageFilter,
17
38
 
18
39
  })
package/package.json CHANGED
@@ -1,10 +1,10 @@
1
1
  {
2
2
  "name": "eslint-import-resolver-node",
3
- "version": "0.1.1",
3
+ "version": "0.2.3",
4
4
  "description": "Node default behavior import resolution plugin for eslint-plugin-import.",
5
5
  "main": "index.js",
6
6
  "scripts": {
7
- "test": "echo \"Error: no test specified\" && exit 1"
7
+ "test": "nyc mocha"
8
8
  },
9
9
  "repository": {
10
10
  "type": "git",
@@ -24,7 +24,13 @@
24
24
  },
25
25
  "homepage": "https://github.com/benmosher/eslint-plugin-import",
26
26
  "dependencies": {
27
+ "debug": "^2.2.0",
27
28
  "object-assign": "^4.0.1",
28
29
  "resolve": "^1.1.6"
30
+ },
31
+ "devDependencies": {
32
+ "chai": "^3.4.1",
33
+ "mocha": "^2.3.4",
34
+ "nyc": "^7.0.0"
29
35
  }
30
36
  }