Skip to content

Commit 006ddeb

Browse files
committed
Merge remote-tracking branch 'refs/remotes/benmosher/master'
2 parents ac3d76a + cd77133 commit 006ddeb

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+707
-115
lines changed

.gitignore

+5
Original file line numberDiff line numberDiff line change
@@ -34,3 +34,8 @@ node_modules
3434
# generated output
3535
lib/
3636
**/.nyc_output/
37+
38+
# Only apps should have lockfiles
39+
yarn.lock
40+
package-lock.json
41+
npm-shrinkwrap.json

.npmrc

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
package-lock=false

.travis.yml

+11-2
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,24 @@
11
language: node_js
22
node_js:
3+
- 4
34
- 6
4-
- 7
5+
- 8
56

67
os:
78
- linux
89
- osx
910

11+
env:
12+
- ESLINT_VERSION=2
13+
- ESLINT_VERSION=3
14+
- ESLINT_VERSION=4
15+
1016
install:
11-
- npm -g install npm@3
17+
- if [ ${TRAVIS_NODE_VERSION} == "4" ]; then
18+
npm install -g npm@3;
19+
fi
1220
- npm install
21+
- npm install eslint@$ESLINT_VERSION --ignore-scripts || true
1322
# install all resolver deps
1423
- "for resolver in ./resolvers/*; do cd $resolver && npm install && cd ../..; done"
1524

CHANGELOG.md

+51-1
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,37 @@ This project adheres to [Semantic Versioning](http://semver.org/).
44
This change log adheres to standards from [Keep a CHANGELOG](http://keepachangelog.com).
55

66
## [Unreleased]
7+
8+
9+
## [2.7.0] - 2017-07-06
10+
### Changed
11+
- [`no-absolute-path`] picks up speed boost, optional AMD support ([#843], thansk [@jseminck])
12+
13+
## [2.6.1] - 2017-06-29
14+
### Fixed
15+
- update bundled node resolver dependency to latest version
16+
17+
## [2.6.0] - 2017-06-23
18+
### Changed
19+
- update tests / peerDeps for ESLint 4.0 compatibility ([#871], thanks [@mastilver])
20+
- [`memo-parser`] updated to require `filePath` on parser options as it melts
21+
down if it's not there, now that this plugin always provides it. (see [#863])
22+
23+
## [2.5.0] - 2017-06-22
24+
25+
Re-releasing v[2.4.0] after discovering that the memory leak is isolated to the [`memo-parser`],
26+
which is more or less experimental anyway.
27+
28+
### Added
29+
- Autofixer for newline-after-import. ([#686] + [#696], thanks [@eelyafi])
30+
31+
## [2.4.0] - 2017-06-02 [YANKED]
32+
33+
Yanked due to critical issue in eslint-module-utils with cache key resulting from [#839].
34+
735
### Added
836
- Add `filePath` into `parserOptions` passed to `parser` ([#839], thanks [@sompylasar])
37+
- Add `allow` option to [`no-unassigned-import`] to allow for files that match the globs ([#671], [#737], thanks [@kevin940726]).
938

1039
## [2.3.0] - 2017-05-18
1140
### Added
@@ -20,6 +49,7 @@ This change log adheres to standards from [Keep a CHANGELOG](http://keepachangel
2049
### Fixed
2150
- attempt to fix crash in [`no-mutable-exports`]. ([#660])
2251
- "default is a reserved keyword" in no-maned-default tests by locking down babylon to 6.15.0 (#756, thanks @gmathieu)
52+
- support scoped modules containing non word characters
2353

2454

2555
## [2.2.0] - 2016-11-07
@@ -389,8 +419,14 @@ for info on changes for earlier releases.
389419
[`unambiguous`]: ./docs/rules/unambiguous.md
390420
[`no-anonymous-default-export`]: ./docs/rules/no-anonymous-default-export.md
391421

422+
[`memo-parser`]: ./memo-parser/README.md
423+
424+
[#843]: https://github.com/benmosher/eslint-plugin-import/pull/843
425+
[#871]: https://github.com/benmosher/eslint-plugin-import/pull/871
392426
[#742]: https://github.com/benmosher/eslint-plugin-import/pull/742
427+
[#737]: https://github.com/benmosher/eslint-plugin-import/pull/737
393428
[#712]: https://github.com/benmosher/eslint-plugin-import/pull/712
429+
[#696]: https://github.com/benmosher/eslint-plugin-import/pull/696
394430
[#685]: https://github.com/benmosher/eslint-plugin-import/pull/685
395431
[#680]: https://github.com/benmosher/eslint-plugin-import/pull/680
396432
[#654]: https://github.com/benmosher/eslint-plugin-import/pull/654
@@ -446,6 +482,10 @@ for info on changes for earlier releases.
446482
[#157]: https://github.com/benmosher/eslint-plugin-import/pull/157
447483
[#314]: https://github.com/benmosher/eslint-plugin-import/pull/314
448484

485+
[#863]: https://github.com/benmosher/eslint-plugin-import/issues/863
486+
[#839]: https://github.com/benmosher/eslint-plugin-import/issues/839
487+
[#686]: https://github.com/benmosher/eslint-plugin-import/issues/686
488+
[#671]: https://github.com/benmosher/eslint-plugin-import/issues/671
449489
[#660]: https://github.com/benmosher/eslint-plugin-import/issues/660
450490
[#653]: https://github.com/benmosher/eslint-plugin-import/issues/653
451491
[#627]: https://github.com/benmosher/eslint-plugin-import/issues/627
@@ -503,7 +543,12 @@ for info on changes for earlier releases.
503543
[#119]: https://github.com/benmosher/eslint-plugin-import/issues/119
504544
[#89]: https://github.com/benmosher/eslint-plugin-import/issues/89
505545

506-
[Unreleased]: https://github.com/benmosher/eslint-plugin-import/compare/v2.3.0...HEAD
546+
[Unreleased]: https://github.com/benmosher/eslint-plugin-import/compare/v2.7.0...HEAD
547+
[2.7.0]: https://github.com/benmosher/eslint-plugin-import/compare/v2.6.1...v2.7.0
548+
[2.6.1]: https://github.com/benmosher/eslint-plugin-import/compare/v2.6.0...v2.6.1
549+
[2.6.0]: https://github.com/benmosher/eslint-plugin-import/compare/v2.5.0...v2.6.0
550+
[2.5.0]: https://github.com/benmosher/eslint-plugin-import/compare/v2.4.0...v2.5.0
551+
[2.4.0]: https://github.com/benmosher/eslint-plugin-import/compare/v2.3.0...v2.4.0
507552
[2.3.0]: https://github.com/benmosher/eslint-plugin-import/compare/v2.2.0...v2.3.0
508553
[2.2.0]: https://github.com/benmosher/eslint-plugin-import/compare/v2.1.0...v2.2.0
509554
[2.1.0]: https://github.com/benmosher/eslint-plugin-import/compare/v2.0.1...v2.1.0
@@ -583,3 +628,8 @@ for info on changes for earlier releases.
583628
[@giodamelio]: https://github.com/giodamelio
584629
[@ntdb]: https://github.com/ntdb
585630
[@ramasilveyra]: https://github.com/ramasilveyra
631+
[@sompylasar]: https://github.com/sompylasar
632+
[@kevin940726]: https://github.com/kevin940726
633+
[@eelyafi]: https://github.com/eelyafi
634+
[@mastilver]: https://github.com/mastilver
635+
[@jseminck]: https://github.com/jseminck

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ In the interest of supporting both of these, v0.11 introduces resolvers.
145145
Currently [Node] and [Webpack] resolution have been implemented, but the
146146
resolvers are just npm packages, so [third party packages are supported](https://github.com/benmosher/eslint-plugin-import/wiki/Resolvers) (and encouraged!).
147147

148-
You can reference resolvers in several ways(in order of precedence):
148+
You can reference resolvers in several ways (in order of precedence):
149149

150150
- as a conventional `eslint-import-resolver` name, like `eslint-import-resolver-foo`:
151151

RELEASE.md

+1-2
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,7 @@
2626
```
2727

2828
Generally, don't use `npm version` for this because it creates a tag, which I normally
29-
wait until signoff from all contributors (`new Set(["@jfmengels"])`) and actually
30-
`npm publish`-ing to snap the tag.
29+
wait until signoff from contributors and actually `npm publish`-ing to snap the tag.
3130

3231
3. create pull request from `release-[x.y.z]` into `release` branch
3332

appveyor.yml

+6-5
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
# Test against this version of Node.js
22
environment:
33
matrix:
4-
- nodejs_version: "7"
4+
- nodejs_version: "8"
55
- nodejs_version: "6"
6+
- nodejs_version: "4"
67

78
# platform:
89
# - x86
@@ -13,11 +14,11 @@ install:
1314
# Get the latest stable version of Node.js or io.js
1415
- ps: Install-Product node $env:nodejs_version
1516

16-
# update npm (only needed for Node 0.10)
17-
- npm -g install npm@3
18-
# - set PATH=%APPDATA%\npm;%PATH%
19-
2017
# install modules
18+
- ps: >-
19+
if ($env:nodejs_version -eq "4") {
20+
npm install -g npm@3;
21+
}
2122
- npm install
2223

2324
# todo: learn how to do this for all .\resolvers\* on Windows

docs/rules/newline-after-import.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# newline-after-import
22

33
Enforces having one or more empty lines after the last top-level import statement or require call.
4+
+(fixable) The `--fix` option on the [command line] automatically fixes problems reported by this rule.
45

56
## Rule Details
67

@@ -76,7 +77,7 @@ const FOO = 'BAR'
7677
{
7778
...
7879
"rules": {
79-
"import/newline-after-import": [{ "count": 2 }]
80+
"import/newline-after-import": ["error", { "count": 2 }]
8081
}
8182
}
8283
```

docs/rules/no-absolute-path.md

+21
Original file line numberDiff line numberDiff line change
@@ -25,3 +25,24 @@ var _ = require('lodash');
2525
var foo = require('foo');
2626
var foo = require('./foo');
2727
```
28+
29+
### Options
30+
31+
By default, only ES6 imports and CommonJS `require` calls will have this rule enforced.
32+
33+
You may provide an options object providing true/false for any of
34+
35+
- `esmodule`: defaults to `true`
36+
- `commonjs`: defaults to `true`
37+
- `amd`: defaults to `false`
38+
39+
If `{ amd: true }` is provided, dependency paths for AMD-style `define` and `require`
40+
calls will be resolved:
41+
42+
```js
43+
/*eslint import/no-absolute-path: [2, { commonjs: false, amd: true }]*/
44+
define(['/foo'], function (foo) { /*...*/ }) // reported
45+
require(['/foo'], function (foo) { /*...*/ }) // reported
46+
47+
const foo = require('/foo') // ignored because of explicit `commonjs: false`
48+
```

docs/rules/no-extraneous-dependencies.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ var foo = require('./foo');
8989

9090
import test from 'ava';
9191
import find from 'lodash.find';
92-
import find from 'lodash.isarray';
92+
import isArray from 'lodash.isarray';
9393

9494
/* eslint import/no-extraneous-dependencies: ["error", {"peerDependencies": true}] */
9595
import react from 'react';

docs/rules/no-unassigned-import.md

+22
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,24 @@ With both CommonJS' `require` and the ES6 modules' `import` syntax, it is possib
66

77
This rule aims to remove modules with side-effects by reporting when a module is imported but not assigned.
88

9+
### Options
10+
11+
This rule supports the following option:
12+
13+
`allow`: An Array of globs. The files that match any of these patterns would be ignored/allowed by the linter. This can be useful for some build environments (e.g. css-loader in webpack).
14+
15+
Note that the globs start from the where the linter is executed (usually project root), but not from each file that includes the source. Learn more in both the pass and fail examples below.
16+
17+
918
## Fail
1019

1120
```js
1221
import 'should'
1322
require('should')
23+
24+
// In <PROJECT_ROOT>/src/app.js
25+
import '../styles/app.css'
26+
// {"allow": ["styles/*.css"]}
1427
```
1528

1629

@@ -34,4 +47,13 @@ bar(require('foo'))
3447
require('foo').bar
3548
require('foo').bar()
3649
require('foo')()
50+
51+
// With allow option set
52+
import './style.css' // {"allow": ["**/*.css"]}
53+
import 'babel-register' // {"allow": ["babel-register"]}
54+
55+
// In <PROJECT_ROOT>/src/app.js
56+
import './styles/app.css'
57+
import '../scripts/register.js'
58+
// {"allow": ["src/styles/**", "**/scripts/*.js"]}
3759
```

memo-parser/index.js

+4-1
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,12 @@ const parserOptions = {
1717
}
1818

1919
exports.parse = function parse(content, options) {
20-
// them defaults yo
2120
options = Object.assign({}, options, parserOptions)
2221

22+
if (!options.filePath) {
23+
throw new Error("no file path provided!")
24+
}
25+
2326
const keyHash = crypto.createHash('sha256')
2427
keyHash.update(content)
2528
hashObject(options, keyHash)

memo-parser/package.json

+8-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
{
22
"name": "memo-parser",
3-
"version": "0.1.0",
4-
"engines": { "node": ">=4" },
3+
"version": "0.2.0",
4+
"engines": {
5+
"node": ">=4"
6+
},
57
"description": "Memoizing wrapper for any ESLint-compatible parser module.",
68
"main": "index.js",
79
"scripts": {
@@ -21,5 +23,8 @@
2123
"bugs": {
2224
"url": "https://github.com/benmosher/eslint-plugin-import/issues"
2325
},
24-
"homepage": "https://github.com/benmosher/eslint-plugin-import#readme"
26+
"homepage": "https://github.com/benmosher/eslint-plugin-import#readme",
27+
"peerDependencies": {
28+
"eslint": ">=3.5.0"
29+
}
2530
}

package.json

+6-6
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "eslint-plugin-import",
3-
"version": "2.3.0",
3+
"version": "2.7.0",
44
"description": "Import with sanity.",
55
"engines": {
66
"node": ">=4"
@@ -56,7 +56,7 @@
5656
"chai": "^3.4.0",
5757
"coveralls": "^2.11.4",
5858
"cross-env": "^4.0.0",
59-
"eslint": "3.x",
59+
"eslint": "2.x - 4.x",
6060
"eslint-import-resolver-node": "file:./resolvers/node",
6161
"eslint-import-resolver-webpack": "file:./resolvers/webpack",
6262
"eslint-module-utils": "file:./utils",
@@ -74,15 +74,15 @@
7474
"typescript-eslint-parser": "^2.1.0"
7575
},
7676
"peerDependencies": {
77-
"eslint": "2.x - 3.x"
77+
"eslint": "2.x - 4.x"
7878
},
7979
"dependencies": {
8080
"builtin-modules": "^1.1.1",
8181
"contains-path": "^0.1.0",
82-
"debug": "^2.2.0",
82+
"debug": "^2.6.8",
8383
"doctrine": "1.5.0",
84-
"eslint-import-resolver-node": "^0.2.0",
85-
"eslint-module-utils": "^2.0.0",
84+
"eslint-import-resolver-node": "^0.3.1",
85+
"eslint-module-utils": "^2.1.1",
8686
"has": "^1.0.1",
8787
"lodash.cond": "^4.3.0",
8888
"minimatch": "^3.0.3",

resolvers/node/CHANGELOG.md

+4
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@ This change log adheres to standards from [Keep a CHANGELOG](http://keepachangel
66
## Unreleased
77

88

9+
## v0.3.1 - 2017-06-23
10+
### Changed
11+
- bumped `debug` dep to match other packages
12+
913
## v0.3.0 - 2016-12-15
1014
### Changed
1115
- bumped `resolve` to fix issues with Node builtins (thanks [@SkeLLLa] and [@ljharb])

resolvers/node/package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "eslint-import-resolver-node",
3-
"version": "0.3.0",
3+
"version": "0.3.1",
44
"description": "Node default behavior import resolution plugin for eslint-plugin-import.",
55
"main": "index.js",
66
"files": ["index.js"],
@@ -25,7 +25,7 @@
2525
},
2626
"homepage": "https://github.com/benmosher/eslint-plugin-import",
2727
"dependencies": {
28-
"debug": "^2.2.0",
28+
"debug": "^2.6.8",
2929
"resolve": "^1.2.0"
3030
},
3131
"devDependencies": {

resolvers/webpack/CHANGELOG.md

+7
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,13 @@ This change log adheres to standards from [Keep a CHANGELOG](http://keepachangel
55

66
## Unreleased
77

8+
## 0.8.3 - 2017-06-23
9+
### Changed
10+
- `debug` bumped to match others
11+
12+
## 0.8.2 - 2017-06-22
13+
### Changed
14+
- `webpack` peer dep updated to >= 1.11 (works fine with webpack 3 AFAICT)
815

916
## 0.8.1 - 2017-01-19
1017
### Changed

0 commit comments

Comments
 (0)