0.6.0 • Published 10 years ago
eslint-plugin-lodash3 v0.6.0
ESLint-plugin-lodash3
Lodash3 specific linting rules for ESLint
Installation
Install ESLint either locally or globally.
npm install eslintIf you installed ESLint globally, you have to install lodash3 plugin globally too. Otherwise, install it locally.
$ npm install eslint-plugin-lodash3Configuration
Add plugins section and specify ESLint-plugin-lodash3 as a plugin.
{
"plugins": ["lodash3"]
}Finally, enable all of the rules that you would like to use.
{
"rules": {
"lodash3/prop-shorthand": 2,
"lodash3/matches-shorthand": [2, "always", 3],
"lodash3/matches-prop-shorthand": [2, "always"],
"lodash3/prefer-chain": [2, 3],
"lodash3/preferred-alias": 2,
"lodash3/no-single-chain": 2,
"lodash3/prefer-reject": [2, 3],
"lodash3/prefer-filter": [2, 3],
"lodash3/no-unnecessary-bind": 2,
"lodash3/unwrap": 2,
"lodash3/prefer-compact": 2,
"lodash3/no-double-unwrap": 2,
"lodash3/prefer-map": 2,
"lodash3/prefer-wrapper-method": 2,
"lodash3/prefer-invoke": 2,
"lodash3/prefer-thru": 2,
"lodash3/prefer-lodash-chain": 2,
"lodash3/prefer-lodash-method": 2,
"lodash3/prefer-lodash-typecheck": 2,
"lodash3/no-commit": 2,
"lodash3/prefer-get": [2, 3],
"lodash3/collection-return": 2,
"lodash3/prefer-matches": [2, 3],
"lodash3/prefer-times": 2,
"lodash3/prefer-startswith": 2,
"lodash3/prefer-noop": 2,
"lodash3/prefer-constant": 2,
"lodash3/chain-style": [2, "as-needed"]
}
}List of supported rules
- prop-shorthand: Prefer property shorthand syntax
- matches-prop-shorthand: Prefer matches property shorthand syntax
- matches-shorthand: Prefer matches shorthand syntax
- preferred-alias: Preferred aliases
- prefer-chain: Prefer chain over nested lodash calls
- no-single-chain: Prevent chaining syntax for single method, e.g.
_(x).map().value() - prefer-reject: Prefer
_.rejectover filter with!(expression)orx.prop1 !== value - prefer-filter: Prefer
_.filterover_.forEachwith anifstatement inside. - no-unnecessary-bind: Prefer passing
thisArgover binding. - unwrap: Prevent chaining without evaluation via
value()or non-chainable methods likemax()., - prefer-compact: Prefer
_.compactover_.filterfor only truthy values. - no-double-unwrap: Do not use
.value()on chains that have already ended (e.g. withmax()orreduce()) - prefer-map: Prefer
_.mapover_.forEachwith apushinside. - prefer-wrapper-method: Prefer using array and string methods in the chain and not the initial value, e.g.
_(str).split(' ')... - prefer-invoke: Prefer using
_.invokeover_.mapwith a method call inside. - prefer-thru: Prefer using
_.prototype.thruin the chain and not call functions in the initial value, e.g._(x).thru(f).map(g)... - prefer-lodash-chain: Prefer using Lodash chains (e.g.
_.map) over native and mixed chains. - prefer-lodash-method: Prefer using Lodash collection methods (e.g.
_.map) over native array methods. - prefer-lodash-typecheck: Prefer using
_.is*methods overtypeofandinstanceofchecks when applicable. - no-commit: Do not use
.commit()on chains that should end with.value() - prefer-get: Prefer using
_.getor_.hasover expression chains likea && a.b && a.b.c. - collection-return: Always return a value in iteratees of lodash collection methods that aren't
forEach. - prefer-matches: Prefer
_.matchesover conditions likea.foo === 1 && a.bar === 2 && a.baz === 3. - prefer-times: Prefer
_.timesover_.mapwithout using the iteratee's arguments. - prefer-startswth: Prefer
_.startsWithovera.indexOf(b) === 0. - prefer-noop: Prefer
_.noopover empty functions. - prefer-constant: Prefer
_.constantover functions returning literals. - chain-style: Enforce a specific chain style: explicit, implicit, or explicit only when necessary.
License
ESLint-plugin-lodash3 is licensed under the MIT License.
0.6.0
10 years ago
0.5.2
10 years ago
0.5.1
10 years ago
0.5.0
10 years ago
0.4.1
10 years ago
0.4.0
10 years ago
0.3.0
10 years ago
0.2.1
10 years ago
0.2.0
10 years ago
0.1.15
10 years ago
0.1.14
10 years ago
0.1.13
10 years ago
0.1.12
10 years ago
0.1.11
10 years ago
0.1.10
10 years ago
0.1.9
10 years ago
0.1.8
10 years ago
0.1.7
10 years ago
0.1.6
10 years ago
0.1.5
10 years ago
0.1.4
10 years ago
0.1.3
10 years ago
0.1.2
10 years ago
0.1.1
10 years ago
0.1.0
10 years ago
0.0.2
10 years ago
0.0.0
10 years ago