eslint-import-resolver-babel-module-alias
Advanced tools
Comparing version 1.0.3 to 1.0.4
{ | ||
"name": "eslint-import-resolver-babel-module-alias", | ||
"version": "1.0.3", | ||
"version": "1.0.4", | ||
"main": "src/index.js", | ||
@@ -34,2 +34,3 @@ "description": "babel-plugin-module-alias resolver for eslint-plugin-import", | ||
"json5": "^0.5.0", | ||
"object-assign": "^4.0.1", | ||
"resolve": "^1.1.7" | ||
@@ -39,16 +40,13 @@ }, | ||
"chai": "^3.5.0", | ||
"condition-node-version": "^1.3.0", | ||
"condition-circle": "^1.2.0", | ||
"eslint": "^2.8.0", | ||
"eslint-config-airbnb-base": "^1.0.4", | ||
"eslint-config-airbnb-base": "^3.0.0", | ||
"eslint-plugin-import": "^1.6.0", | ||
"lodash": "^4.11.1", | ||
"mocha": "^2.4.5", | ||
"nyc": "^6.4.3", | ||
"semantic-release": "^4.3.5" | ||
}, | ||
"release": { | ||
"verifyConditions": { | ||
"path": "condition-node-version", | ||
"node": ">=6.0.0", | ||
"verbose": true | ||
} | ||
"verifyConditions": "condition-circle" | ||
}, | ||
@@ -58,5 +56,7 @@ "scripts": { | ||
"pretest": "npm run lint", | ||
"test": "mocha", | ||
"test": "nyc mocha && nyc report --reporter=lcov", | ||
"test:suite": "mocha", | ||
"test:watch": "mocha -w", | ||
"semantic-release": "semantic-release pre && npm publish && semantic-release post" | ||
} | ||
} |
@@ -1,2 +0,3 @@ | ||
# eslint-import-resolver-babel-module-alias [![Build Status][travis-image]][travis-url] [![npm][npm-version-image]]() | ||
# eslint-import-resolver-babel-module-alias | ||
![npm][npm-version-image] [![Build Status][ci-image]][ci-url] [![Coverage Status][coverage-image]][coverage-url] | ||
@@ -45,6 +46,8 @@ A [babel-plugin-module-alias][module-alias] resolver for [eslint-plugin-import][eslint-plugin-import] | ||
[travis-image]: https://travis-ci.org/tleunen/eslint-import-resolver-babel-module-alias.svg?branch=master | ||
[travis-url]: https://travis-ci.org/tleunen/eslint-import-resolver-babel-module-alias | ||
[ci-image]: https://circleci.com/gh/tleunen/eslint-import-resolver-babel-module-alias.svg?style=shield | ||
[ci-url]: https://circleci.com/gh/tleunen/eslint-import-resolver-babel-module-alias | ||
[coverage-image]: https://codecov.io/gh/tleunen/eslint-import-resolver-babel-module-alias/branch/master/graph/badge.svg | ||
[coverage-url]: https://codecov.io/gh/tleunen/eslint-import-resolver-babel-module-alias | ||
[npm-version-image]: https://img.shields.io/npm/v/eslint-import-resolver-babel-module-alias.svg | ||
[module-alias]: https://github.com/tleunen/babel-plugin-module-alias | ||
[eslint-plugin-import]: https://github.com/benmosher/eslint-plugin-import |
@@ -6,5 +6,6 @@ const path = require('path'); | ||
const mapModule = require('babel-plugin-module-alias').mapModule; | ||
const assign = require('object-assign'); | ||
function getMappingFromBabel(start) { | ||
if (!start) return []; | ||
if (start === '/') return []; | ||
@@ -26,2 +27,10 @@ const babelrc = path.join(start, '.babelrc'); | ||
function opts(file, config) { | ||
return assign( | ||
{}, | ||
config, | ||
{ basedir: path.dirname(file) } | ||
); | ||
} | ||
exports.interfaceVersion = 2; | ||
@@ -38,3 +47,3 @@ | ||
*/ | ||
exports.resolve = (source, file/* , config */) => { | ||
exports.resolve = (source, file, config) => { | ||
const mapping = getMappingFromBabel(process.cwd()).reduce((memo, e) => { | ||
@@ -51,5 +60,3 @@ memo[e.expose] = e.src; // eslint-disable-line no-param-reassign | ||
found: true, | ||
path: resolve.sync(src, { | ||
basedir: path.dirname(file) | ||
}) | ||
path: resolve.sync(src, opts(file, config)), | ||
}; | ||
@@ -56,0 +63,0 @@ } catch (e) { |
Sorry, the diff of this file is not supported yet
53
7217
4
9
55
+ Addedobject-assign@^4.0.1
+ Addedobject-assign@4.1.1(transitive)