Skip to content

Commit 5f3bad5

Browse files
JounQinfisker
andauthored
Ignore Ramda methods in rules (#1557)
Co-authored-by: fisker Cheung <lionkay@gmail.com>
1 parent 93b3479 commit 5f3bad5

File tree

3 files changed

+11
-0
lines changed

3 files changed

+11
-0
lines changed

rules/no-array-for-each.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -361,6 +361,7 @@ function isFixable(callExpression, {scope, functionInfo, allIdentifiers, context
361361
const ignoredObjects = [
362362
'React.Children',
363363
'Children',
364+
'R',
364365
];
365366

366367
const create = context => {

rules/no-array-method-this-argument.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,14 +24,17 @@ const ignored = [
2424
'_.filter',
2525
'underscore.filter',
2626
'Vue.filter',
27+
'R.filter',
2728

2829
'lodash.find',
2930
'_.find',
3031
'underscore.find',
32+
'R.find',
3133

3234
'lodash.findIndex',
3335
'_.findIndex',
3436
'underscore.findIndex',
37+
'R.findIndex',
3538

3639
'lodash.flatMap',
3740
'_.flatMap',
@@ -40,6 +43,7 @@ const ignored = [
4043
'_.forEach',
4144
'React.Children.forEach',
4245
'Children.forEach',
46+
'R.forEach',
4347

4448
'lodash.map',
4549
'_.map',
@@ -48,6 +52,7 @@ const ignored = [
4852
'Children.map',
4953
'jQuery.map',
5054
'$.map',
55+
'R.map',
5156

5257
'lodash.some',
5358
'_.some',

test/no-array-method-this-argument.mjs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,11 @@ test.snapshot({
2525
'React.Children.forEach(children, () => {})',
2626
'Children.forEach(children, () => {})',
2727
'Vue.filter("capitalize", () => {})',
28+
'R.filter(() => {}, [])',
29+
'R.find(() => {}, [])',
30+
'R.findIndex(() => {}, [])',
31+
'R.forEach(() => {}, [])',
32+
'R.map(() => {}, [])',
2833
// `jQuery.find` and `jQuery.filter` don't accept second argument
2934
'$( "li" ).filter( ":nth-child(2n)" ).css( "background-color", "red" );',
3035
'$( "li.item-ii" ).find( "li" ).css( "background-color", "red" );',

0 commit comments

Comments
 (0)