Skip to content

Commit

Permalink
Ignore Ramda methods in rules (#1557)
Browse files Browse the repository at this point in the history
Co-authored-by: fisker Cheung <lionkay@gmail.com>
  • Loading branch information
JounQin and fisker authored Oct 21, 2021
1 parent 93b3479 commit 5f3bad5
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 0 deletions.
1 change: 1 addition & 0 deletions rules/no-array-for-each.js
Original file line number Diff line number Diff line change
Expand Up @@ -361,6 +361,7 @@ function isFixable(callExpression, {scope, functionInfo, allIdentifiers, context
const ignoredObjects = [
'React.Children',
'Children',
'R',
];

const create = context => {
Expand Down
5 changes: 5 additions & 0 deletions rules/no-array-method-this-argument.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,17 @@ const ignored = [
'_.filter',
'underscore.filter',
'Vue.filter',
'R.filter',

'lodash.find',
'_.find',
'underscore.find',
'R.find',

'lodash.findIndex',
'_.findIndex',
'underscore.findIndex',
'R.findIndex',

'lodash.flatMap',
'_.flatMap',
Expand All @@ -40,6 +43,7 @@ const ignored = [
'_.forEach',
'React.Children.forEach',
'Children.forEach',
'R.forEach',

'lodash.map',
'_.map',
Expand All @@ -48,6 +52,7 @@ const ignored = [
'Children.map',
'jQuery.map',
'$.map',
'R.map',

'lodash.some',
'_.some',
Expand Down
5 changes: 5 additions & 0 deletions test/no-array-method-this-argument.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,11 @@ test.snapshot({
'React.Children.forEach(children, () => {})',
'Children.forEach(children, () => {})',
'Vue.filter("capitalize", () => {})',
'R.filter(() => {}, [])',
'R.find(() => {}, [])',
'R.findIndex(() => {}, [])',
'R.forEach(() => {}, [])',
'R.map(() => {}, [])',
// `jQuery.find` and `jQuery.filter` don't accept second argument
'$( "li" ).filter( ":nth-child(2n)" ).css( "background-color", "red" );',
'$( "li.item-ii" ).find( "li" ).css( "background-color", "red" );',
Expand Down

0 comments on commit 5f3bad5

Please sign in to comment.