eslint-plugin-lodash
Advanced tools
Comparing version 1.3.0 to 1.4.0
@@ -11,4 +11,27 @@ # Change Log | ||
[unreleased]: https://github.com/wix/eslint-plugin-lodash/compare/v1.2.2...HEAD | ||
[unreleased]: https://github.com/wix/eslint-plugin-lodash/compare/v1.4.0...HEAD | ||
## [1.4.0] - 2016-03-13 | ||
### Added | ||
- Added `recommended` and `v3` plugin configurations. ([`a1da5a4`][a1da5a4]) | ||
[a1da5a4]: https://github.com/wix/eslint-plugin-lodash/commit/a1da5a404fadc38b072292b7bc296f908b5a6576 | ||
[1.4.0]: https://github.com/wix/eslint-plugin-lodash/compare/v1.4.0...v1.3.0 | ||
## [1.3.0] - 2016-03-10 | ||
### Added | ||
- Added option for exceptions to the rule `prefer-lodash-method`. ([`6a3e2cc`][6a3e2cc]) | ||
### Fixed | ||
- Fixed a false-positive for `prefer-lodash-chain` where the callback uses lodash. ([`ed42798`][ed42798]) | ||
- Misc. Documentation fixes. ([`262c942`][262c942], [`f896337`][f896337]) | ||
[6a3e2cc]: https://github.com/wix/eslint-plugin-lodash/commit/6a3e2cc6f49e6d907316d7659de09bc1c6f95665 | ||
[ed42798]: https://github.com/wix/eslint-plugin-lodash/commit/ed4279898b40b8f9f12552d89b2ec61aa2ca6c12 | ||
[262c942]: https://github.com/wix/eslint-plugin-lodash/commit/262c942cc6b131f78b85aa7c8afddf85f14406e5 | ||
[f896337]: https://github.com/wix/eslint-plugin-lodash/commit/f8963378b76cfbe76967ce91260eb1c4d78a0118 | ||
[1.3.0]: https://github.com/wix/eslint-plugin-lodash/compare/v1.3.0...v1.2.2 | ||
## [1.2.2] - 2016-03-02 | ||
@@ -15,0 +38,0 @@ ### Fixed |
80
index.js
@@ -13,3 +13,81 @@ 'use strict'; | ||
})), | ||
rulesConfig: _.zipObject(rules, _.times(rules.length, _.constant(0))) | ||
configs: { | ||
recommended: { | ||
rules: { | ||
'lodash/callback-binding': 2, | ||
'lodash/chain-style': [2, 'as-needed'], | ||
'lodash/collection-return': 2, | ||
'lodash/identity-shorthand': [2, 'always'], | ||
'lodash/matches-prop-shorthand': [2, 'always'], | ||
'lodash/matches-shorthand': [2, 'always', 3], | ||
'lodash/no-commit': 2, | ||
'lodash/no-double-unwrap': 2, | ||
'lodash/no-extra-args': 2, | ||
'lodash/no-single-chain': 2, | ||
'lodash/path-style': [2, 'as-needed'], | ||
'lodash/prefer-chain': [2, 3], | ||
'lodash/prefer-compact': 2, | ||
'lodash/prefer-constant': 2, | ||
'lodash/prefer-filter': [2, 3], | ||
'lodash/prefer-flat-map': '2', | ||
'lodash/prefer-get': [2, 3], | ||
'lodash/prefer-invoke-map': 2, | ||
'lodash/prefer-is-nil': 2, | ||
'lodash/prefer-lodash-chain': 2, | ||
'lodash/prefer-lodash-method': 2, | ||
'lodash/prefer-lodash-typecheck': 2, | ||
'lodash/prefer-map': 2, | ||
'lodash/prefer-matches': [2, 3], | ||
'lodash/prefer-noop': 2, | ||
'lodash/prefer-over-quantifier': 2, | ||
'lodash/prefer-reject': [2, 3], | ||
'lodash/prefer-startswith': 2, | ||
'lodash/prefer-thru': 2, | ||
'lodash/prefer-times': 2, | ||
'lodash/prefer-wrapper-method': 2, | ||
'lodash/preferred-alias': 2, | ||
'lodash/prop-shorthand': [2, 'always'], | ||
'lodash/unwrap': 2 | ||
} | ||
}, | ||
v3: { | ||
settings: { | ||
lodash: { | ||
version: 3 | ||
} | ||
}, | ||
rules: { | ||
'lodash/callback-binding': 2, | ||
'lodash/chain-style': [2, 'as-needed'], | ||
'lodash/collection-return': 2, | ||
'lodash/identity-shorthand': [2, 'always'], | ||
'lodash/matches-prop-shorthand': [2, 'always'], | ||
'lodash/matches-shorthand': [2, 'always', 3], | ||
'lodash/no-commit': 2, | ||
'lodash/no-double-unwrap': 2, | ||
'lodash/no-extra-args': 2, | ||
'lodash/no-single-chain': 2, | ||
'lodash/path-style': [2, 'as-needed'], | ||
'lodash/prefer-chain': [2, 3], | ||
'lodash/prefer-compact': 2, | ||
'lodash/prefer-constant': 2, | ||
'lodash/prefer-filter': [2, 3], | ||
'lodash/prefer-get': [2, 3], | ||
'lodash/prefer-lodash-chain': 2, | ||
'lodash/prefer-lodash-method': 2, | ||
'lodash/prefer-lodash-typecheck': 2, | ||
'lodash/prefer-map': 2, | ||
'lodash/prefer-matches': [2, 3], | ||
'lodash/prefer-noop': 2, | ||
'lodash/prefer-reject': [2, 3], | ||
'lodash/prefer-startswith': 2, | ||
'lodash/prefer-thru': 2, | ||
'lodash/prefer-times': 2, | ||
'lodash/prefer-wrapper-method': 2, | ||
'lodash/preferred-alias': 2, | ||
'lodash/prop-shorthand': [2, 'always'], | ||
'lodash/unwrap': 2 | ||
} | ||
} | ||
} | ||
}; |
{ | ||
"name": "eslint-plugin-lodash", | ||
"version": "1.3.0", | ||
"version": "1.4.0", | ||
"author": "Omer Ganim <ganimomer@gmail.com>", | ||
@@ -5,0 +5,0 @@ "description": "Lodash specific linting rules for ESLint", |
@@ -20,3 +20,3 @@ ESLint-Plugin-Lodash | ||
Add `plugins` section and specify ESLint-Plugin-Lodash as a plugin. | ||
Add a `plugins` section and specify ESLint-Plugin-Lodash as a plugin. | ||
You can additionally add settings for the plugin. | ||
@@ -29,89 +29,23 @@ | ||
* __version__: specifies the major Lodash Version you are using (default is `4`). | ||
If you wish to use this plugin with Lodash v3, change this value to 3. | ||
If you wish to use this plugin with Lodash v3, this value should be `3`. (on by default in the config `v3`) | ||
Finally, enable all of the rules that you would like to use. | ||
## Recommended configuration | ||
This plugin exports a `recommended` configuration that enforces all the rules. You can configure the plugin as follows: | ||
```json | ||
{ | ||
"plugins": ["lodash"], | ||
"rules": { | ||
"lodash/callback-binding": 2, | ||
"lodash/chain-style": [2, "as-needed"], | ||
"lodash/collection-return": 2, | ||
"lodash/identity-shorthand": [2, "always"], | ||
"lodash/matches-prop-shorthand": [2, "always"], | ||
"lodash/matches-shorthand": [2, "always", 3], | ||
"lodash/no-commit": 2, | ||
"lodash/no-double-unwrap": 2, | ||
"lodash/no-extra-args": 2, | ||
"lodash/no-single-chain": 2, | ||
"lodash/path-style": [2, "as-needed"], | ||
"lodash/prefer-chain": [2, 3], | ||
"lodash/prefer-compact": 2, | ||
"lodash/prefer-constant": 2, | ||
"lodash/prefer-filter": [2, 3], | ||
"lodash/prefer-flat-map": "2", | ||
"lodash/prefer-get": [2, 3], | ||
"lodash/prefer-invoke-map": 2, | ||
"lodash/prefer-is-nil": 2, | ||
"lodash/prefer-lodash-chain": 2, | ||
"lodash/prefer-lodash-method": 2, | ||
"lodash/prefer-lodash-typecheck": 2, | ||
"lodash/prefer-map": 2, | ||
"lodash/prefer-matches": [2, 3], | ||
"lodash/prefer-noop": 2, | ||
"lodash/prefer-over-quantifier": 2, | ||
"lodash/prefer-reject": [2, 3], | ||
"lodash/prefer-startswith": 2, | ||
"lodash/prefer-thru": 2, | ||
"lodash/prefer-times": 2, | ||
"lodash/prefer-wrapper-method": 2, | ||
"lodash/preferred-alias": 2, | ||
"lodash/prop-shorthand": [2, "always"], | ||
"lodash/unwrap": 2 | ||
} | ||
"extends": ["plugin:lodash/recommended"] | ||
} | ||
``` | ||
## Configuration for Using with Lodash v3 | ||
Out of the box, this plugin supports the use of Lodash v4. To use with Lodash v3, the config needs to specify the version in the `settings`, and can't use some rules. | ||
The plugin also exports a `v3` config for ease of use. | ||
## Configuration for Using with Lodash v3 | ||
Out of the box, this plugin supports the use of Lodash v4. To use with Lodash v3, the config needs to specify the version in the `settings`, and can't use some rules: | ||
```json | ||
{ | ||
"settings": { | ||
"lodash": { | ||
"version": 3 | ||
} | ||
}, | ||
"rules": { | ||
"lodash/callback-binding": 2, | ||
"lodash/chain-style": [2, "as-needed"], | ||
"lodash/collection-return": 2, | ||
"lodash/identity-shorthand": [2, "always"], | ||
"lodash/matches-prop-shorthand": [2, "always"], | ||
"lodash/matches-shorthand": [2, "always", 3], | ||
"lodash/no-commit": 2, | ||
"lodash/no-double-unwrap": 2, | ||
"lodash/no-extra-args": 2, | ||
"lodash/no-single-chain": 2, | ||
"lodash/path-style": [2, "as-needed"], | ||
"lodash/prefer-chain": [2, 3], | ||
"lodash/prefer-compact": 2, | ||
"lodash/prefer-constant": 2, | ||
"lodash/prefer-filter": [2, 3], | ||
"lodash/prefer-get": [2, 3], | ||
"lodash/prefer-lodash-chain": 2, | ||
"lodash/prefer-lodash-method": 2, | ||
"lodash/prefer-lodash-typecheck": 2, | ||
"lodash/prefer-map": 2, | ||
"lodash/prefer-matches": [2, 3], | ||
"lodash/prefer-noop": 2, | ||
"lodash/prefer-reject": [2, 3], | ||
"lodash/prefer-startswith": 2, | ||
"lodash/prefer-thru": 2, | ||
"lodash/prefer-times": 2, | ||
"lodash/prefer-wrapper-method": 2, | ||
"lodash/preferred-alias": 2, | ||
"lodash/prop-shorthand": [2, "always"], | ||
"lodash/unwrap": 2 | ||
} | ||
"plugins": ["lodash"], | ||
"extends": ["plugin:lodash/v3"] | ||
} | ||
@@ -160,3 +94,3 @@ ``` | ||
* [prefer-times](docs/rules/prefer-times.md): Prefer `_.times` over `_.map` without using the iteratee's arguments. | ||
* [prefer-startswth](docs/rules/prefer-startswith.md): Prefer `_.startsWith` over `a.indexOf(b) === 0`. | ||
* [prefer-startswith](docs/rules/prefer-startswith.md): Prefer `_.startsWith` over `a.indexOf(b) === 0`. | ||
* [prefer-noop](docs/rules/prefer-noop.md): Prefer `_.noop` over empty functions. | ||
@@ -163,0 +97,0 @@ * [prefer-constant](docs/rules/prefer-constant.md): Prefer `_.constant` over functions returning literals. |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
120892
2882
117