Skip to content

Commit fc878a6

Browse files
committed
Update no-attr.js
Account for `.attr('attribute', value)`
1 parent 353e03b commit fc878a6

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

rules/no-attr.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,10 @@ module.exports = function(context) {
99
if (node.callee.property.name !== 'attr') return
1010

1111
if (utils.isjQuery(node)) {
12+
const getOrSet = node.arguments.length === 2 ? 'set' : 'get'
1213
context.report({
1314
node: node,
14-
message: 'Prefer getAttribute to $.attr'
15+
message: `Prefer ${getOrSet}Attribute to $.attr`
1516
})
1617
}
1718
}

0 commit comments

Comments
 (0)