Skip to content

Commit

Permalink
Merge remote-tracking branch 'refs/remotes/benmosher/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
laysent committed Aug 21, 2017
2 parents ac3d76a + cd77133 commit 006ddeb
Show file tree
Hide file tree
Showing 45 changed files with 707 additions and 115 deletions.
5 changes: 5 additions & 0 deletions .gitignore
Expand Up @@ -34,3 +34,8 @@ node_modules
# generated output
lib/
**/.nyc_output/

# Only apps should have lockfiles
yarn.lock
package-lock.json
npm-shrinkwrap.json
1 change: 1 addition & 0 deletions .npmrc
@@ -0,0 +1 @@
package-lock=false
13 changes: 11 additions & 2 deletions .travis.yml
@@ -1,15 +1,24 @@
language: node_js
node_js:
- 4
- 6
- 7
- 8

os:
- linux
- osx

env:
- ESLINT_VERSION=2
- ESLINT_VERSION=3
- ESLINT_VERSION=4

install:
- npm -g install npm@3
- if [ ${TRAVIS_NODE_VERSION} == "4" ]; then
npm install -g npm@3;
fi
- npm install
- npm install eslint@$ESLINT_VERSION --ignore-scripts || true
# install all resolver deps
- "for resolver in ./resolvers/*; do cd $resolver && npm install && cd ../..; done"

Expand Down
52 changes: 51 additions & 1 deletion CHANGELOG.md
Expand Up @@ -4,8 +4,37 @@ This project adheres to [Semantic Versioning](http://semver.org/).
This change log adheres to standards from [Keep a CHANGELOG](http://keepachangelog.com).

## [Unreleased]


## [2.7.0] - 2017-07-06
### Changed
- [`no-absolute-path`] picks up speed boost, optional AMD support ([#843], thansk [@jseminck])

## [2.6.1] - 2017-06-29
### Fixed
- update bundled node resolver dependency to latest version

## [2.6.0] - 2017-06-23
### Changed
- update tests / peerDeps for ESLint 4.0 compatibility ([#871], thanks [@mastilver])
- [`memo-parser`] updated to require `filePath` on parser options as it melts
down if it's not there, now that this plugin always provides it. (see [#863])

## [2.5.0] - 2017-06-22

Re-releasing v[2.4.0] after discovering that the memory leak is isolated to the [`memo-parser`],
which is more or less experimental anyway.

### Added
- Autofixer for newline-after-import. ([#686] + [#696], thanks [@eelyafi])

## [2.4.0] - 2017-06-02 [YANKED]

Yanked due to critical issue in eslint-module-utils with cache key resulting from [#839].

### Added
- Add `filePath` into `parserOptions` passed to `parser` ([#839], thanks [@sompylasar])
- Add `allow` option to [`no-unassigned-import`] to allow for files that match the globs ([#671], [#737], thanks [@kevin940726]).

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


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

[`memo-parser`]: ./memo-parser/README.md

[#843]: https://github.com/benmosher/eslint-plugin-import/pull/843
[#871]: https://github.com/benmosher/eslint-plugin-import/pull/871
[#742]: https://github.com/benmosher/eslint-plugin-import/pull/742
[#737]: https://github.com/benmosher/eslint-plugin-import/pull/737
[#712]: https://github.com/benmosher/eslint-plugin-import/pull/712
[#696]: https://github.com/benmosher/eslint-plugin-import/pull/696
[#685]: https://github.com/benmosher/eslint-plugin-import/pull/685
[#680]: https://github.com/benmosher/eslint-plugin-import/pull/680
[#654]: https://github.com/benmosher/eslint-plugin-import/pull/654
Expand Down Expand Up @@ -446,6 +482,10 @@ for info on changes for earlier releases.
[#157]: https://github.com/benmosher/eslint-plugin-import/pull/157
[#314]: https://github.com/benmosher/eslint-plugin-import/pull/314

[#863]: https://github.com/benmosher/eslint-plugin-import/issues/863
[#839]: https://github.com/benmosher/eslint-plugin-import/issues/839
[#686]: https://github.com/benmosher/eslint-plugin-import/issues/686
[#671]: https://github.com/benmosher/eslint-plugin-import/issues/671
[#660]: https://github.com/benmosher/eslint-plugin-import/issues/660
[#653]: https://github.com/benmosher/eslint-plugin-import/issues/653
[#627]: https://github.com/benmosher/eslint-plugin-import/issues/627
Expand Down Expand Up @@ -503,7 +543,12 @@ for info on changes for earlier releases.
[#119]: https://github.com/benmosher/eslint-plugin-import/issues/119
[#89]: https://github.com/benmosher/eslint-plugin-import/issues/89

[Unreleased]: https://github.com/benmosher/eslint-plugin-import/compare/v2.3.0...HEAD
[Unreleased]: https://github.com/benmosher/eslint-plugin-import/compare/v2.7.0...HEAD
[2.7.0]: https://github.com/benmosher/eslint-plugin-import/compare/v2.6.1...v2.7.0
[2.6.1]: https://github.com/benmosher/eslint-plugin-import/compare/v2.6.0...v2.6.1
[2.6.0]: https://github.com/benmosher/eslint-plugin-import/compare/v2.5.0...v2.6.0
[2.5.0]: https://github.com/benmosher/eslint-plugin-import/compare/v2.4.0...v2.5.0
[2.4.0]: https://github.com/benmosher/eslint-plugin-import/compare/v2.3.0...v2.4.0
[2.3.0]: https://github.com/benmosher/eslint-plugin-import/compare/v2.2.0...v2.3.0
[2.2.0]: https://github.com/benmosher/eslint-plugin-import/compare/v2.1.0...v2.2.0
[2.1.0]: https://github.com/benmosher/eslint-plugin-import/compare/v2.0.1...v2.1.0
Expand Down Expand Up @@ -583,3 +628,8 @@ for info on changes for earlier releases.
[@giodamelio]: https://github.com/giodamelio
[@ntdb]: https://github.com/ntdb
[@ramasilveyra]: https://github.com/ramasilveyra
[@sompylasar]: https://github.com/sompylasar
[@kevin940726]: https://github.com/kevin940726
[@eelyafi]: https://github.com/eelyafi
[@mastilver]: https://github.com/mastilver
[@jseminck]: https://github.com/jseminck
2 changes: 1 addition & 1 deletion README.md
Expand Up @@ -145,7 +145,7 @@ In the interest of supporting both of these, v0.11 introduces resolvers.
Currently [Node] and [Webpack] resolution have been implemented, but the
resolvers are just npm packages, so [third party packages are supported](https://github.com/benmosher/eslint-plugin-import/wiki/Resolvers) (and encouraged!).

You can reference resolvers in several ways(in order of precedence):
You can reference resolvers in several ways (in order of precedence):

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

Expand Down
3 changes: 1 addition & 2 deletions RELEASE.md
Expand Up @@ -26,8 +26,7 @@
```

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

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

Expand Down
11 changes: 6 additions & 5 deletions appveyor.yml
@@ -1,8 +1,9 @@
# Test against this version of Node.js
environment:
matrix:
- nodejs_version: "7"
- nodejs_version: "8"
- nodejs_version: "6"
- nodejs_version: "4"

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

# update npm (only needed for Node 0.10)
- npm -g install npm@3
# - set PATH=%APPDATA%\npm;%PATH%

# install modules
- ps: >-
if ($env:nodejs_version -eq "4") {
npm install -g npm@3;
}
- npm install

# todo: learn how to do this for all .\resolvers\* on Windows
Expand Down
3 changes: 2 additions & 1 deletion docs/rules/newline-after-import.md
@@ -1,6 +1,7 @@
# newline-after-import

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

## Rule Details

Expand Down Expand Up @@ -76,7 +77,7 @@ const FOO = 'BAR'
{
...
"rules": {
"import/newline-after-import": [{ "count": 2 }]
"import/newline-after-import": ["error", { "count": 2 }]
}
}
```
Expand Down
21 changes: 21 additions & 0 deletions docs/rules/no-absolute-path.md
Expand Up @@ -25,3 +25,24 @@ var _ = require('lodash');
var foo = require('foo');
var foo = require('./foo');
```

### Options

By default, only ES6 imports and CommonJS `require` calls will have this rule enforced.

You may provide an options object providing true/false for any of

- `esmodule`: defaults to `true`
- `commonjs`: defaults to `true`
- `amd`: defaults to `false`

If `{ amd: true }` is provided, dependency paths for AMD-style `define` and `require`
calls will be resolved:

```js
/*eslint import/no-absolute-path: [2, { commonjs: false, amd: true }]*/
define(['/foo'], function (foo) { /*...*/ }) // reported
require(['/foo'], function (foo) { /*...*/ }) // reported

const foo = require('/foo') // ignored because of explicit `commonjs: false`
```
2 changes: 1 addition & 1 deletion docs/rules/no-extraneous-dependencies.md
Expand Up @@ -89,7 +89,7 @@ var foo = require('./foo');

import test from 'ava';
import find from 'lodash.find';
import find from 'lodash.isarray';
import isArray from 'lodash.isarray';

/* eslint import/no-extraneous-dependencies: ["error", {"peerDependencies": true}] */
import react from 'react';
Expand Down
22 changes: 22 additions & 0 deletions docs/rules/no-unassigned-import.md
Expand Up @@ -6,11 +6,24 @@ With both CommonJS' `require` and the ES6 modules' `import` syntax, it is possib

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

### Options

This rule supports the following option:

`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).

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.


## Fail

```js
import 'should'
require('should')

// In <PROJECT_ROOT>/src/app.js
import '../styles/app.css'
// {"allow": ["styles/*.css"]}
```


Expand All @@ -34,4 +47,13 @@ bar(require('foo'))
require('foo').bar
require('foo').bar()
require('foo')()

// With allow option set
import './style.css' // {"allow": ["**/*.css"]}
import 'babel-register' // {"allow": ["babel-register"]}

// In <PROJECT_ROOT>/src/app.js
import './styles/app.css'
import '../scripts/register.js'
// {"allow": ["src/styles/**", "**/scripts/*.js"]}
```
5 changes: 4 additions & 1 deletion memo-parser/index.js
Expand Up @@ -17,9 +17,12 @@ const parserOptions = {
}

exports.parse = function parse(content, options) {
// them defaults yo
options = Object.assign({}, options, parserOptions)

if (!options.filePath) {
throw new Error("no file path provided!")
}

const keyHash = crypto.createHash('sha256')
keyHash.update(content)
hashObject(options, keyHash)
Expand Down
11 changes: 8 additions & 3 deletions memo-parser/package.json
@@ -1,7 +1,9 @@
{
"name": "memo-parser",
"version": "0.1.0",
"engines": { "node": ">=4" },
"version": "0.2.0",
"engines": {
"node": ">=4"
},
"description": "Memoizing wrapper for any ESLint-compatible parser module.",
"main": "index.js",
"scripts": {
Expand All @@ -21,5 +23,8 @@
"bugs": {
"url": "https://github.com/benmosher/eslint-plugin-import/issues"
},
"homepage": "https://github.com/benmosher/eslint-plugin-import#readme"
"homepage": "https://github.com/benmosher/eslint-plugin-import#readme",
"peerDependencies": {
"eslint": ">=3.5.0"
}
}
12 changes: 6 additions & 6 deletions package.json
@@ -1,6 +1,6 @@
{
"name": "eslint-plugin-import",
"version": "2.3.0",
"version": "2.7.0",
"description": "Import with sanity.",
"engines": {
"node": ">=4"
Expand Down Expand Up @@ -56,7 +56,7 @@
"chai": "^3.4.0",
"coveralls": "^2.11.4",
"cross-env": "^4.0.0",
"eslint": "3.x",
"eslint": "2.x - 4.x",
"eslint-import-resolver-node": "file:./resolvers/node",
"eslint-import-resolver-webpack": "file:./resolvers/webpack",
"eslint-module-utils": "file:./utils",
Expand All @@ -74,15 +74,15 @@
"typescript-eslint-parser": "^2.1.0"
},
"peerDependencies": {
"eslint": "2.x - 3.x"
"eslint": "2.x - 4.x"
},
"dependencies": {
"builtin-modules": "^1.1.1",
"contains-path": "^0.1.0",
"debug": "^2.2.0",
"debug": "^2.6.8",
"doctrine": "1.5.0",
"eslint-import-resolver-node": "^0.2.0",
"eslint-module-utils": "^2.0.0",
"eslint-import-resolver-node": "^0.3.1",
"eslint-module-utils": "^2.1.1",
"has": "^1.0.1",
"lodash.cond": "^4.3.0",
"minimatch": "^3.0.3",
Expand Down
4 changes: 4 additions & 0 deletions resolvers/node/CHANGELOG.md
Expand Up @@ -6,6 +6,10 @@ This change log adheres to standards from [Keep a CHANGELOG](http://keepachangel
## Unreleased


## v0.3.1 - 2017-06-23
### Changed
- bumped `debug` dep to match other packages

## v0.3.0 - 2016-12-15
### Changed
- bumped `resolve` to fix issues with Node builtins (thanks [@SkeLLLa] and [@ljharb])
Expand Down
4 changes: 2 additions & 2 deletions resolvers/node/package.json
@@ -1,6 +1,6 @@
{
"name": "eslint-import-resolver-node",
"version": "0.3.0",
"version": "0.3.1",
"description": "Node default behavior import resolution plugin for eslint-plugin-import.",
"main": "index.js",
"files": ["index.js"],
Expand All @@ -25,7 +25,7 @@
},
"homepage": "https://github.com/benmosher/eslint-plugin-import",
"dependencies": {
"debug": "^2.2.0",
"debug": "^2.6.8",
"resolve": "^1.2.0"
},
"devDependencies": {
Expand Down
7 changes: 7 additions & 0 deletions resolvers/webpack/CHANGELOG.md
Expand Up @@ -5,6 +5,13 @@ This change log adheres to standards from [Keep a CHANGELOG](http://keepachangel

## Unreleased

## 0.8.3 - 2017-06-23
### Changed
- `debug` bumped to match others

## 0.8.2 - 2017-06-22
### Changed
- `webpack` peer dep updated to >= 1.11 (works fine with webpack 3 AFAICT)

## 0.8.1 - 2017-01-19
### Changed
Expand Down

0 comments on commit 006ddeb

Please sign in to comment.