Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release 2.1.0 #647

Merged
merged 28 commits into from
Nov 3, 2016
Merged
Show file tree
Hide file tree
Changes from 26 commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
ee02fef
fix lint errors
toshafed Sep 21, 2016
f7f768b
add resolve configs for webpack2 (since 2.1.0-beta.23)
toshafed Sep 21, 2016
cf59fe0
updated webpack resolver to allow passing a config object
Sep 22, 2016
0437e5c
added example of passing webpack config object to the webpack resolver
Sep 22, 2016
8e0c88d
set configPath to null if explicit config is discovered (for later co…
benmosher Oct 6, 2016
64059b0
Merge branch 'webpack-explicit-config'
benmosher Oct 6, 2016
404f506
Merge remote-tracking branch 'origin/static-require-crash'
benmosher Oct 6, 2016
2b7e64f
Merge branch 'release'
benmosher Oct 11, 2016
c787026
(#609) Make prefer-default-export count re-exported default exports
jfmengels Oct 11, 2016
001b8de
chore(package): update babel-register to version 6.16.3
greenkeeperio-bot Sep 29, 2016
d9605a0
Merge branch 'resolve-config' (#569)
benmosher Oct 13, 2016
3262aba
[New] `no-extraneous-dependencies`: check both the absolute and relat…
ljharb Oct 18, 2016
2cbd801
absenteeism disclaimer
benmosher Oct 18, 2016
34bf9bd
chore(package): update doctrine to version 1.5.0
greenkeeperio-bot Oct 13, 2016
de0dbe5
newline-after-import with decorators (#595)
lukekarrys Oct 22, 2016
edbb570
chore(package): update mocha to version 3.1.2
greenkeeperio-bot Oct 22, 2016
afe0a3a
Add `no-named-default` rule (#596)
ntdb Nov 2, 2016
c640615
chore(package): update cross-env to version 3.1.0 (#606)
greenkeeperio-bot Nov 2, 2016
024a8a7
Fixed documentation for the default values for the `order` rule (fix…
jfmengels Oct 12, 2016
162155e
Merge remote-tracking branch 'ljharb/use_cwd'
benmosher Nov 2, 2016
cf42834
changelog: rule link fixes
benmosher Nov 2, 2016
2602b5d
Add deprecated flags to imports-first metadata (#625)
randycoulman Nov 2, 2016
954db1a
bump v2.1.0
benmosher Nov 2, 2016
53cd2cd
Revert "absenteeism disclaimer"
benmosher Nov 2, 2016
bf0c8e2
bump resolvers/webpack/v0.7.0
benmosher Nov 2, 2016
1186409
first draft of release steps in `RELEASE.md`
benmosher Nov 2, 2016
29bc56e
Ignoring flow type exports (#639)
jakubsta Nov 3, 2016
7205904
Merge remote-tracking branch 'origin/master' into release-2.1.0
benmosher Nov 3, 2016
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 20 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,17 @@ This change log adheres to standards from [Keep a CHANGELOG](http://keepachangel
## [Unreleased]


## [2.1.0] - 2016-11-02
### Added
- Add [`no-named-default`] rule: style-guide rule to report use of unnecessarily named default imports
- [`no-extraneous-dependencies`]: check globs against CWD + absolute path ([#602] + [#630], thanks [@ljharb])

### Fixed
- [`prefer-default-export`] handles re-exported default exports ([#609])
- Fix crash when using [`newline-after-import`] with decorators ([#592])
- Properly report [`newline-after-import`] when next line is a decorator
- Fixed documentation for the default values for the [`order`] rule ([#601])

## [2.0.1] - 2016-10-06
### Fixed
- Fixed code that relied on removed dependencies. ([#604])
Expand Down Expand Up @@ -328,6 +339,7 @@ for info on changes for earlier releases.
[`no-amd`]: ./docs/rules/no-amd.md
[`namespace`]: ./docs/rules/namespace.md
[`no-namespace`]: ./docs/rules/no-namespace.md
[`no-named-default`]: ./docs/rules/no-named-default.md
[`no-named-as-default`]: ./docs/rules/no-named-as-default.md
[`no-named-as-default-member`]: ./docs/rules/no-named-as-default-member.md
[`no-extraneous-dependencies`]: ./docs/rules/no-extraneous-dependencies.md
Expand All @@ -351,6 +363,7 @@ for info on changes for earlier releases.
[`no-unassigned-import`]: ./docs/rules/no-unassigned-import.md
[`unambiguous`]: ./docs/rules/unambiguous.md

[#630]: https://github.com/benmosher/eslint-plugin-import/pull/630
[#586]: https://github.com/benmosher/eslint-plugin-import/pull/586
[#578]: https://github.com/benmosher/eslint-plugin-import/pull/578
[#568]: https://github.com/benmosher/eslint-plugin-import/pull/568
Expand Down Expand Up @@ -399,10 +412,14 @@ 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

[#609]: https://github.com/benmosher/eslint-plugin-import/issues/609
[#604]: https://github.com/benmosher/eslint-plugin-import/issues/604
[#602]: https://github.com/benmosher/eslint-plugin-import/issues/602
[#601]: https://github.com/benmosher/eslint-plugin-import/issues/601
[#592]: https://github.com/benmosher/eslint-plugin-import/issues/592
[#577]: https://github.com/benmosher/eslint-plugin-import/issues/577
[#570]: https://github.com/benmosher/eslint-plugin-import/issues/570
[#567]: https://github.com/benmosher/eslint-plugin-import/issues/567
[#567]: https://github.com/benmosher/eslint-plugin-import/issues/567
[#566]: https://github.com/benmosher/eslint-plugin-import/issues/566
[#545]: https://github.com/benmosher/eslint-plugin-import/issues/545
[#530]: https://github.com/benmosher/eslint-plugin-import/issues/530
Expand Down Expand Up @@ -448,7 +465,8 @@ 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.0.1...HEAD
[Unreleased]: https://github.com/benmosher/eslint-plugin-import/compare/v2.1.0...HEAD
[2.1.0]: https://github.com/benmosher/eslint-plugin-import/compare/v2.0.1...v2.1.0
[2.0.1]: https://github.com/benmosher/eslint-plugin-import/compare/v2.0.0...v2.0.1
[2.0.0]: https://github.com/benmosher/eslint-plugin-import/compare/v1.16.0...v2.0.0
[1.16.0]: https://github.com/benmosher/eslint-plugin-import/compare/v1.15.0...v1.16.0
Expand Down
6 changes: 4 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,9 @@ This plugin intends to support linting of ES2015+ (ES6+) import/export syntax, a
* Enforce a convention in module import order ([`order`])
* Enforce a newline after import statements ([`newline-after-import`])
* Prefer a default export if module exports a single name ([`prefer-default-export`])
* Limit the maximum number of dependencies a module can have. ([`max-dependencies`])
* Forbid unassigned imports. ([`no-unassigned-import`])
* Limit the maximum number of dependencies a module can have ([`max-dependencies`])
* Forbid unassigned imports ([`no-unassigned-import`])
* Forbid named default exports ([`no-named-default`])

[`first`]: ./docs/rules/first.md
[`no-duplicates`]: ./docs/rules/no-duplicates.md
Expand All @@ -85,6 +86,7 @@ This plugin intends to support linting of ES2015+ (ES6+) import/export syntax, a
[`prefer-default-export`]: ./docs/rules/prefer-default-export.md
[`max-dependencies`]: ./docs/rules/max-dependencies.md
[`no-unassigned-import`]: ./docs/rules/no-unassigned-import.md
[`no-named-default`]: ./docs/rules/no-named-default.md

## Installation

Expand Down
55 changes: 55 additions & 0 deletions RELEASE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
# Release steps

1. create a `release-[x.y.z]` branch from tip of `master` (or whatever release commit)

```bash
git checkout master && git pull && git checkout -b release-2.1.0
```

2. bump `package.json` + update CHANGELOG version links for all releasing packages (i.e., root + any resolvers)

In changelog for core plugin, normally leave [Unreleased] but update its link at the bottom
to be rooted at the new version's tag, and add a link for the new version rooted
at last version's tag.

```markdown
[Unreleased]: https://github.com/benmosher/eslint-plugin-import/compare/v2.0.1...HEAD
[2.0.1]: https://github.com/benmosher/eslint-plugin-import/compare/v2.0.0...v2.0.1
```

becomes

```markdown
[Unreleased]: https://github.com/benmosher/eslint-plugin-import/compare/v2.1.0...HEAD
[2.1.0]: https://github.com/benmosher/eslint-plugin-import/compare/v2.0.1...v2.1.0
[2.0.1]: https://github.com/benmosher/eslint-plugin-import/compare/v2.0.0...v2.0.1
```

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.

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

I like this because it
- lists all commits in the release
- provides a commentary location to discuss the release
- builds in CI and provides test results

4. iterate on feedback
- handle other issues
- merge more PRs
- fix issues in changelog/docs

5. `npm publish` from `release-[x.y.z]` branch
- don't forget resolvers!

6. tag commit (`v[x.y.z]`)
- again, not forgetting resolvers, if needed (`resolvers/[name]/v[t.u.v]`)

7. merge `release-[x.y.z]` into `release` (
- ideally fast-forward, probably with Git CLI instead of Github

8. merge `release` into `master`

Done!
27 changes: 27 additions & 0 deletions docs/rules/no-named-default.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# no-named-default

Reports use of a default export as a locally named import.

Rationale: the syntax exists to import default exports expressively, let's use it.

## Rule Details

Given:
```js
// foo.js
export default 'foo';
export const bar = 'baz';
```

...these would be valid:
```js
import foo from './foo.js';
import foo, { bar } from './foo.js';
```

...and these would be reported:
```js
// message: Using exported name 'bar' as identifier for default export.
import { default as foo } from './foo.js';
import { default as foo, bar } from './foo.js';
```
2 changes: 1 addition & 1 deletion docs/rules/order.md
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ How groups are defined, and the order to respect. `groups` must be an array of `
// Then the rest: internal and external type
]
```
The default value is `["builtin", "external", "internal", "parent", "sibling", "index"]`.
The default value is `["builtin", "external", "parent", "sibling", "index"]`.

You can set the options like this:

Expand Down
10 changes: 5 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "eslint-plugin-import",
"version": "2.0.1",
"version": "2.1.0",
"description": "Import with sanity.",
"engines": {
"node": ">=4"
Expand Down Expand Up @@ -51,10 +51,10 @@
"babel-eslint": "next",
"babel-plugin-istanbul": "^2.0.1",
"babel-preset-es2015-argon": "latest",
"babel-register": "6.9.0",
"babel-register": "6.16.3",
"chai": "^3.4.0",
"coveralls": "^2.11.4",
"cross-env": "^3.0.0",
"cross-env": "^3.1.0",
"eslint": "3.x",
"eslint-import-resolver-node": "file:./resolvers/node",
"eslint-import-resolver-webpack": "file:./resolvers/webpack",
Expand All @@ -64,7 +64,7 @@
"gulp-babel": "6.1.2",
"istanbul": "^0.4.0",
"linklocal": "^2.6.0",
"mocha": "^2.2.1",
"mocha": "^3.1.2",
"nyc": "^8.3.0",
"redux": "^3.0.4",
"rimraf": "2.5.2",
Expand All @@ -78,7 +78,7 @@
"builtin-modules": "^1.1.1",
"contains-path": "^0.1.0",
"debug": "^2.2.0",
"doctrine": "1.3.x",
"doctrine": "1.5.0",
"eslint-import-resolver-node": "^0.2.0",
"eslint-module-utils": "^1.0.0",
"has": "^1.0.1",
Expand Down
1 change: 0 additions & 1 deletion resolvers/webpack/.babelrc

This file was deleted.

9 changes: 9 additions & 0 deletions resolvers/webpack/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@ This change log adheres to standards from [Keep a CHANGELOG](http://keepachangel
## Unreleased


## 0.7.0
### Added
- Support for explicit Webpack config object in `.eslintrc.*`. ([#572], thanks [@jameslnewell])
- Added `resolve.modules` to configs for webpack2 support ([#569], thanks [@toshafed])

## 0.6.0 - 2016-09-13
### Added
- support for config-as-function ([#533], thanks [@grahamb])
Expand Down Expand Up @@ -63,6 +68,8 @@ This change log adheres to standards from [Keep a CHANGELOG](http://keepachangel
- `interpret` configs (such as `.babel.js`).
Thanks to [@gausie] for the initial PR ([#164], ages ago! 😅) and [@jquense] for tests ([#278]).

[#572]: https://github.com/benmosher/eslint-plugin-import/pull/572
[#569]: https://github.com/benmosher/eslint-plugin-import/pull/569
[#533]: https://github.com/benmosher/eslint-plugin-import/pull/533
[#413]: https://github.com/benmosher/eslint-plugin-import/pull/413
[#377]: https://github.com/benmosher/eslint-plugin-import/pull/377
Expand All @@ -89,3 +96,5 @@ This change log adheres to standards from [Keep a CHANGELOG](http://keepachangel
[@Rogeres]: https://github.com/Rogeres
[@Kovensky]: https://github.com/Kovensky
[@grahamb]: https://github.com/grahamb
[@jameslnewell]: https://github.com/jameslnewell
[@toshafed]: https://github.com/toshafed
14 changes: 14 additions & 0 deletions resolvers/webpack/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,3 +52,17 @@ settings:
config: 'webpack.multiple.config.js'
config-index: 1 # take the config at index 1
```

or with explicit config object:

```yaml
---
settings:
import/resolver:
webpack:
config:
resolve:
extensions:
- .js
- .jsx
```
55 changes: 35 additions & 20 deletions resolvers/webpack/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,32 +51,40 @@ exports.resolve = function (source, file, settings) {

log('Config path from settings:', configPath)

// see if we've got an absolute path
if (!configPath || !isAbsolute(configPath)) {
// if not, find ancestral package.json and use its directory as base for the path
packageDir = findRoot(path.resolve(file))
if (!packageDir) throw new Error('package not found above ' + file)
}
// see if we've got a config path, a config object, an array of config objects or a config function
if (!configPath || typeof configPath === 'string') {

// see if we've got an absolute path
if (!configPath || !isAbsolute(configPath)) {
// if not, find ancestral package.json and use its directory as base for the path
packageDir = findRoot(path.resolve(file))
if (!packageDir) throw new Error('package not found above ' + file)
}

configPath = findConfigPath(configPath, packageDir)
configPath = findConfigPath(configPath, packageDir)

log('Config path resolved to:', configPath)
if (configPath) {
webpackConfig = require(configPath)
} else {
log("No config path found relative to", file, "; using {}")
webpackConfig = {}
}

if (webpackConfig && webpackConfig.default) {
log('Using ES6 module "default" key instead of module.exports.')
webpackConfig = webpackConfig.default
}

log('Config path resolved to:', configPath)
if (configPath) {
webpackConfig = require(configPath)
} else {
log("No config path found relative to", file, "; using {}")
webpackConfig = {}
webpackConfig = configPath
configPath = null
}

if (typeof webpackConfig === 'function') {
webpackConfig = webpackConfig()
}

if (webpackConfig && webpackConfig.default) {
log('Using ES6 module "default" key instead of module.exports.')
webpackConfig = webpackConfig.default
}

if (Array.isArray(webpackConfig)) {
if (typeof configIndex !== 'undefined' && webpackConfig.length > configIndex) {
webpackConfig = webpackConfig[configIndex]
Expand Down Expand Up @@ -107,9 +115,14 @@ exports.resolve = function (source, file, settings) {

function createResolveSync(configPath, webpackConfig) {
var webpackRequire
, basedir = null

if (typeof configPath === 'string') {
basedir = path.dirname(configPath)
}

try {
var webpackFilename = resolve.sync('webpack', { basedir: path.dirname(configPath) })
var webpackFilename = resolve.sync('webpack', { basedir })
var webpackResolveOpts = { basedir: path.dirname(webpackFilename) }

webpackRequire = function (id) {
Expand Down Expand Up @@ -184,13 +197,15 @@ function createWebpack1ResolveSync(webpackRequire, resolveConfig, plugins) {
new ModuleAliasPlugin(resolveConfig.alias || {}),
makeRootPlugin(ModulesInRootPlugin, 'module', resolveConfig.root),
new ModulesInDirectoriesPlugin(
'module', resolveConfig.modulesDirectories || ['web_modules', 'node_modules']
'module',
resolveConfig.modulesDirectories || resolveConfig.modules || ['web_modules', 'node_modules']
),
makeRootPlugin(ModulesInRootPlugin, 'module', resolveConfig.fallback),
new ModuleAsFilePlugin('module'),
new ModuleAsDirectoryPlugin('module'),
new DirectoryDescriptionFilePlugin(
'package.json', ['module', 'jsnext:main'].concat(resolveConfig.packageMains || webpack1DefaultMains)
'package.json',
['module', 'jsnext:main'].concat(resolveConfig.packageMains || webpack1DefaultMains)
),
new DirectoryDefaultFilePlugin(['index']),
new FileAppendPlugin(resolveConfig.extensions || ['', '.webpack.js', '.web.js', '.js']),
Expand Down
2 changes: 1 addition & 1 deletion resolvers/webpack/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "eslint-import-resolver-webpack",
"version": "0.6.0",
"version": "0.7.0",
"description": "Resolve paths to dependencies, given a webpack.config.js. Plugin for eslint-plugin-import.",
"main": "index.js",
"scripts": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@ export default {
alias: {
'foo': path.join(__dirname, 'some', 'goofy', 'path', 'foo.js'),
},
modules: [
path.join(__dirname, 'src'),
path.join(__dirname, 'fallback'),
'node_modules',
'bower_components',
],
modulesDirectories: ['node_modules', 'bower_components'],
root: path.join(__dirname, 'src'),
fallback: path.join(__dirname, 'fallback'),
Expand Down
Loading