Skip to content

Commit

Permalink
update changelog and build for publish 1.1.2
Browse files Browse the repository at this point in the history
  • Loading branch information
johvin committed Dec 8, 2018
1 parent 8374cb6 commit 1ee1a96
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 9 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Expand Up @@ -10,6 +10,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/).

### Changed
- update test case
- update coverage for node 10 & 11
- update changelog
- update usage to readme

Expand Down
12 changes: 8 additions & 4 deletions dist/README.md
@@ -1,17 +1,21 @@
# eslint-import-resolver-alias

[![Version npm][version]](http://browsenpm.org/package/eslint-import-resolver-alias)
![Version node][node]
[![Build Status][build]](https://travis-ci.org/johvin/eslint-import-resolver-alias)
[![Download][download]](https://www.npmjs.com/package/eslint-import-resolver-alias)
[![Dependencies][david]](https://david-dm.org/johvin/eslint-import-resolver-alias)
![peerDependencies][peer]
[![Coverage Status][cover]](https://coveralls.io/github/johvin/eslint-import-resolver-alias?branch=master)
[![Known Vulnerabilities][vulnerabilities]](https://snyk.io/test/npm/eslint-import-resolver-alias)
[![License][license]](https://opensource.org/licenses/MIT)

[version]: http://img.shields.io/npm/v/eslint-import-resolver-alias.svg?style=flat-square
[node]: https://img.shields.io/node/v/eslint-import-resolver-alias/latest.svg?style=flat-square
[build]: http://img.shields.io/travis/johvin/eslint-import-resolver-alias/master.svg?style=flat-square
[download]: https://img.shields.io/npm/dm/eslint-import-resolver-alias.svg?style=flat-square
[david]: https://img.shields.io/david/johvin/eslint-import-resolver-alias.svg?style=flat-square
[peer]: https://img.shields.io/david/peer/johvin/eslint-import-resolver-alias.svg?style=flat-square
[cover]: http://img.shields.io/coveralls/johvin/eslint-import-resolver-alias/master.svg?style=flat-square
[vulnerabilities]: https://snyk.io/test/npm/eslint-import-resolver-alias/badge.svg?style=flat-square
[license]: https://img.shields.io/badge/License-MIT-brightgreen.svg?style=flat-square
Expand Down Expand Up @@ -56,11 +60,11 @@ Note:

- The alias config object contains two properties, `map` and `extensions`, both of which are array types
- The item of `map` array is also array type which contains 2 string
+ The first string represents the mapped module name or path
+ The second string represents the module alias, the actual module path or name
- The `map` item `['helper', './utils/helper']` means that the modules which matches `helper` or `helper/*` will be resolved to `./utils/helper` or `./utils/helper/*` which is located relative to the `process current working directory` (almost the project root directory). See [#3](https://github.com/johvin/eslint-import-resolver-alias/issues/3)
+ The first string represents the alias of module name or path
+ The second string represents the actual module name or path
- The `map` item `['helper', './utils/helper']` means that the modules which match `helper` or `helper/*` will be resolved to `./utils/helper` or `./utils/helper/*` which are located relative to the `process current working directory` (almost the project root directory). If you just want to resolve `helper` to `./utils/helper`, use `['^helper$', './utils/helper']` instead. See [issue #3](https://github.com/johvin/eslint-import-resolver-alias/issues/3)
- The order of 'material-ui/DatePicker' and 'material-ui' cannot be reversed, otherwise the alias rule 'material-ui/DatePicker' does not work
- The default value of `extensions` property is `['.js', '.json', '.node']` if it is assigned to an empty array or not specified.
- The default value of `extensions` property is `['.js', '.json', '.node']` if it is assigned to an empty array or not specified

*If the `extensions` property is not specified, the config object can be simplified to the `map` array.*

Expand Down
6 changes: 2 additions & 4 deletions dist/index.js
Expand Up @@ -55,17 +55,15 @@ exports.resolve = (modulePath, sourceFile, config) => {

if (Array.isArray(map)) {
for (let i = 0, len = map.length; i < len; i++) {
const re = new RegExp(`(^|/)${map[i][0]}($|/)`);
const re = new RegExp(`^${map[i][0]}($|/)`);
const match = modulePath.match(re);
if (match) {
resolvePath = modulePath.replace(match[0], `${match[1]}${map[i][1]}${match[2]}`);
resolvePath = modulePath.replace(match[0], `${map[i][1]}${match[1]}`);
break;
}
}
}



// there is a relative path mapping in alias.map,
// the relative path is relative to the project root directory
if (resolvePath[0] === '.') {
Expand Down
2 changes: 1 addition & 1 deletion dist/package.json
@@ -1,6 +1,6 @@
{
"name": "eslint-import-resolver-alias",
"version": "1.1.1",
"version": "1.1.2",
"description": "a simple Node behavior import resolution plugin for eslint-plugin-import, supporting module alias.",
"main": "index.js",
"scripts": {
Expand Down

0 comments on commit 1ee1a96

Please sign in to comment.