Skip to content

Commit fc1a38c

Browse files
committed
Merge branch 'update_core'
2 parents 86360b9 + 1d66d6d commit fc1a38c

File tree

16 files changed

+309
-70
lines changed

16 files changed

+309
-70
lines changed

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ sudo: false
22
language: node_js
33
node_js:
44
- "4"
5-
- "5"
65
- "6"
6+
- "8"
77
- "node"
88
script:
99
- "npm run cov"

CHANGELOG.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,19 +4,38 @@ All notable changes to this project will be documented in this file.
44
The format is based on [Keep a Changelog](http://keepachangelog.com/)
55
and this project adheres to [Semantic Versioning](http://semver.org/).
66

7+
## [Unreleased]
8+
### Added
9+
- add builtin modules resolve test case and relevant dependencies
10+
11+
### Fixed
12+
- fix the bug that inner function `resolveLookupPaths` resolve `/node_modules` as `//node_modules`
13+
- update core modules for Node.js 8/9/...
14+
15+
### Changed
16+
- add peerDependencies, repository, bugs, homepage config items to package.json
17+
- update readme
18+
- update changelog
19+
- update travis config
20+
- add release script to complete preparation before publish
21+
22+
723
## [1.0.3] - 2017-01-12
824
### Fixed
925
- fix the bug that the path like /path/to/node_modules/node_modules is excluded from the lookup paths
1026

27+
1128
## [1.0.2] - 2017-01-05
1229
### Changed
1330
- fix the bug that it's unable to resolve non-relative path modules when current working directory is subdirectory of the project root directory.
1431

32+
1533
## [1.0.1] - 2016-12-29
1634
### Changed
1735
- remove package `resolve` to fix the bug caused by format changing of the internal file core.json of resolve 1.1.7
1836
- add bug description and solution to README.md
1937

38+
2039
## [1.0.0] - 2016-12-23
2140
### Added
2241
- support resolve node modules with alias config

README.md

Lines changed: 34 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,49 +1,69 @@
11
# eslint-import-resolver-alias
22

3-
[![Version npm][version]](http://browsenpm.org/package/eslint-import-resolver-alias)[![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)[![Coverage Status][cover]](https://coveralls.io/github/johvin/eslint-import-resolver-alias?branch=master)
3+
[![Version npm][version]](http://browsenpm.org/package/eslint-import-resolver-alias)
4+
[![Build Status][build]](https://travis-ci.org/johvin/eslint-import-resolver-alias)
5+
[![Download][download]](https://www.npmjs.com/package/eslint-import-resolver-alias)
6+
[![Dependencies][david]](https://david-dm.org/johvin/eslint-import-resolver-alias)
7+
[![Coverage Status][cover]](https://coveralls.io/github/johvin/eslint-import-resolver-alias?branch=master)
8+
[![Known Vulnerabilities][vulnerabilities]](https://snyk.io/test/npm/eslint-import-resolver-alias)
9+
[![License][license]](https://opensource.org/licenses/MIT)
410

511
[version]: http://img.shields.io/npm/v/eslint-import-resolver-alias.svg?style=flat-square
612
[build]: http://img.shields.io/travis/johvin/eslint-import-resolver-alias/master.svg?style=flat-square
7-
[download]: https://img.shields.io/npm/dt/eslint-import-resolver-alias.svg?style=flat-square
13+
[download]: https://img.shields.io/npm/dm/eslint-import-resolver-alias.svg?style=flat-square
814
[david]: https://img.shields.io/david/johvin/eslint-import-resolver-alias.svg?style=flat-square
915
[cover]: http://img.shields.io/coveralls/johvin/eslint-import-resolver-alias/master.svg?style=flat-square
16+
[vulnerabilities]: https://snyk.io/test/npm/eslint-import-resolver-alias/badge.svg?style=flat-square
17+
[license]: https://img.shields.io/badge/License-MIT-brightgreen.svg?style=flat-square
1018

1119

12-
This is a simple Node module import resolution plugin for [`eslint-plugin-import`](https://www.npmjs.com/package/eslint-plugin-import), which supports module alias.
20+
This is a simple Node.js module import resolution plugin for [`eslint-plugin-import`](https://www.npmjs.com/package/eslint-plugin-import), which supports module alias and native Node.js module import.
1321

14-
## Example
22+
23+
## Installation
24+
25+
Prerequisites: Node.js >=4.x and corresponding version of npm.
26+
27+
```shell
28+
npm install eslint-plugin-import eslint-import-resolver-alias --save-dev
29+
```
30+
31+
32+
## Usage
33+
34+
Pass this resolver and its parameters to `eslint-plugin-import` using your `eslint` config file, `.eslintrc` or `.eslintrc.js`.
1535

1636
```js
37+
// .eslintrc.js
1738
module.exports = {
1839
settings: {
1940
'import/resolver': {
2041
'alias': [
2142
['babel-polyfill', 'babel-polyfill/dist/polyfill.min.js'],
43+
['helper', './utils/helper'],
2244
['material-ui/DatePicker', '../custom/DatePicker'],
2345
['material-ui', 'material-ui-ie10']
24-
]
46+
],
47+
// node: true
2548
}
2649
}
2750
};
2851
```
2952

30-
3153
Note:
3254

3355
- The items of alias config array is also array which contains 2 string
34-
+ The first string represents the mapped module
35-
+ The second string represents the module alias
36-
- The order of 'material-ui/DatePicker' and 'material-ui' cannot be reversed, otherwise the alias rule 'material-ui/DatePicker' does not work.
37-
38-
## Note
39-
40-
`eslint-import-resolver-alias` 1.0.0 depends on part of `resolve` 1.1.7 which changes its format from 1.2.0 and the resolve dependency is resolved as ^1.1.7 in package.json dependencies settings. So update `eslint-import-resolver-alias` to 1.0.1 is the correct way.
56+
+ The first string represents the mapped module name or path
57+
+ The second string represents the module alias, the actual module path os module name
58+
- The config item `['helper', './utils/helper']` means that the module `helper/*` will be resolved to `./utils/helper/*`. See [#3](https://github.com/johvin/eslint-import-resolver-alias/issues/3)
59+
- The order of 'material-ui/DatePicker' and 'material-ui' cannot be reversed, otherwise the alias rule 'material-ui/DatePicker' does not work
60+
- when the config is an empty array or not an array, the resolver falls back to native Node.js module import
4161

4262
## CHANGELOG
4363

4464
[`CHANGELOG`](./CHANGELOG.md)
4565

46-
## References:
66+
## References
4767

4868
- eslint-plugin-import/no-extraneous-dependencies
4969
- eslint-plugin-import/no-unresolved

build/release.js

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
const fs = require('fs');
2+
const adjustMD = require('adjust-md-for-publish');
3+
4+
function copyFile(filename) {
5+
fs.writeFileSync(`dist/${filename}`, fs.readFileSync(filename));
6+
}
7+
8+
adjustMD({
9+
filename: 'README.md',
10+
destname: 'dist/README.md',
11+
filterSection: [
12+
'CHANGELOG',
13+
'References'
14+
]
15+
});
16+
17+
[
18+
'core.js',
19+
'index.js',
20+
'package.json'
21+
].forEach(copyFile);
22+
23+
console.log('\n release is ready !!!');

core.js

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

core.json

Lines changed: 0 additions & 40 deletions
This file was deleted.

dist/.npmignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
NOTE.md

dist/NOTE.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# NOTE
2+
3+
The `dist` folder contains the standalone build for guideline, however files here are not checked-in whenever there are changes in the source code. If you are on the `dev` branch, files here are **NOT** up to date. Only the `master` branch contains the built files for the latest stable version.

dist/README.md

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
# eslint-import-resolver-alias
2+
3+
[![Version npm][version]](http://browsenpm.org/package/eslint-import-resolver-alias)
4+
[![Build Status][build]](https://travis-ci.org/johvin/eslint-import-resolver-alias)
5+
[![Download][download]](https://www.npmjs.com/package/eslint-import-resolver-alias)
6+
[![Dependencies][david]](https://david-dm.org/johvin/eslint-import-resolver-alias)
7+
[![Coverage Status][cover]](https://coveralls.io/github/johvin/eslint-import-resolver-alias?branch=master)
8+
[![Known Vulnerabilities][vulnerabilities]](https://snyk.io/test/npm/eslint-import-resolver-alias)
9+
[![License][license]](https://opensource.org/licenses/MIT)
10+
11+
[version]: http://img.shields.io/npm/v/eslint-import-resolver-alias.svg?style=flat-square
12+
[build]: http://img.shields.io/travis/johvin/eslint-import-resolver-alias/master.svg?style=flat-square
13+
[download]: https://img.shields.io/npm/dm/eslint-import-resolver-alias.svg?style=flat-square
14+
[david]: https://img.shields.io/david/johvin/eslint-import-resolver-alias.svg?style=flat-square
15+
[cover]: http://img.shields.io/coveralls/johvin/eslint-import-resolver-alias/master.svg?style=flat-square
16+
[vulnerabilities]: https://snyk.io/test/npm/eslint-import-resolver-alias/badge.svg?style=flat-square
17+
[license]: https://img.shields.io/badge/License-MIT-brightgreen.svg?style=flat-square
18+
19+
20+
This is a simple Node.js module import resolution plugin for [`eslint-plugin-import`](https://www.npmjs.com/package/eslint-plugin-import), which supports module alias and native Node.js module import.
21+
22+
23+
## Installation
24+
25+
Prerequisites: Node.js >=4.x and corresponding version of npm.
26+
27+
```shell
28+
npm install eslint-plugin-import eslint-import-resolver-alias --save-dev
29+
```
30+
31+
32+
## Usage
33+
34+
Pass this resolver and its parameters to `eslint-plugin-import` using your `eslint` config file, `.eslintrc` or `.eslintrc.js`.
35+
36+
```js
37+
// .eslintrc.js
38+
module.exports = {
39+
settings: {
40+
'import/resolver': {
41+
'alias': [
42+
['babel-polyfill', 'babel-polyfill/dist/polyfill.min.js'],
43+
['helper', './utils/helper'],
44+
['material-ui/DatePicker', '../custom/DatePicker'],
45+
['material-ui', 'material-ui-ie10']
46+
],
47+
// node: true
48+
}
49+
}
50+
};
51+
```
52+
53+
Note:
54+
55+
- The items of alias config array is also array which contains 2 string
56+
+ The first string represents the mapped module name or path
57+
+ The second string represents the module alias, the actual module path os module name
58+
- The config item `['helper', './utils/helper']` means that the module `helper/*` will be resolved to `./utils/helper/*`. See [#3](https://github.com/johvin/eslint-import-resolver-alias/issues/3)
59+
- The order of 'material-ui/DatePicker' and 'material-ui' cannot be reversed, otherwise the alias rule 'material-ui/DatePicker' does not work
60+
- when the config is an empty array or not an array, the resolver falls back to native Node.js module import

dist/core.js

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)