webhook-action/node_modules/eslint-plugin-github/lib/rules/array-foreach.js

21 lines
458 B
JavaScript
Raw Normal View History

module.exports = {
meta: {
2022-11-10 10:43:16 +00:00
type: 'suggestion',
docs: {
description: 'enforce `for..of` loops over `Array.forEach`',
2024-03-28 02:00:41 +00:00
url: require('../url')(module),
2022-11-10 10:43:16 +00:00
},
2024-03-28 02:00:41 +00:00
schema: [],
},
create(context) {
return {
CallExpression(node) {
if (node.callee.property && node.callee.property.name === 'forEach') {
2022-11-10 10:43:16 +00:00
context.report({node, message: 'Prefer for...of instead of Array.forEach'})
}
2024-03-28 02:00:41 +00:00
},
}
2024-03-28 02:00:41 +00:00
},
}