Skip to content

Commit

Permalink
Merge pull request #12 from ramda/bugfix
Browse files Browse the repository at this point in the history
Bugfix for map and bump version
  • Loading branch information
haskellcamargo authored Dec 4, 2017
2 parents 237fd77 + b471863 commit 1a63925
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 4 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ Configure it in `package.json`.
"ramda/compose-simplification": "error",
"ramda/cond-simplification": "error",
"ramda/either-simplification": "error",
"ramda/eq-by-simplification": "error",
"ramda/filter-simplification": "error",
"ramda/if-else-simplification": "error",
"ramda/map-simplification": "error",
Expand Down Expand Up @@ -66,6 +67,7 @@ Configure it in `package.json`.
- `compose-simplification` - Detects when a function that has the same behavior already exists
- `cond-simplification` - Forbids using `cond` when `ifElse`, `either` or `both` fits
- `either-simplification` - Suggests transforming negated `either` conditions on negated `both`
- `eq-by-simplification` - Forbids `eqBy(prop(_))` and suggests `eqProps`
- `filter-simplification` - Forbids using negated `filter` and suggests `reject`
- `if-else-simplification` - Suggests `when` and `unless` when it is possible to replace
- `map-simplification` - Forbids `map(prop(_))` and suggests `pluck`
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "eslint-plugin-ramda",
"version": "2.2.0",
"version": "2.3.0",
"description": "ESLint rules for use with Ramda",
"license": "MIT",
"keywords": [
Expand Down
10 changes: 8 additions & 2 deletions rules/map-simplification.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,14 @@ const create = context => ({
arguments: R.both(
R.propSatisfies(R.lt(0), 'length'),
R.propSatisfies(R.either(
isCalling({ name: 'prop' }),
isCalling({ name: 'pickAll' })
isCalling({
name: 'prop',
arguments: R.propEq('length', 1)
}),
isCalling({
name: 'pickAll',
arguments: R.propEq('length', 1)
})
), 0)
)
});
Expand Down
4 changes: 3 additions & 1 deletion test/map-simplification.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,9 @@ ruleTester.run('map-simplification', rule, {
'map(doubleMe, [1, 2, 3])',
'R.map(transformer, list)',
'R.map(R.inc, [1, 2, 3])',
'project([\'name\', \'age\'])'
'project([\'name\', \'age\'])',
'map(prop(__, {}))',
'map(pickAll(__, items))'
],
invalid: [
{
Expand Down

0 comments on commit 1a63925

Please sign in to comment.