dgraham / eslint-plugin-jquery

Disallow jQuery functions with native equivalents.
MIT License
209 stars 22 forks source link

Update no-attr rule for setting attributes #16

Closed sharkykh closed 6 years ago

sharkykh commented 6 years ago

This PR updates the no-attr rule to differentiate between getting an attribute and setting its value:

// Error: Prefer getAttribute to $.attr
$('node').attr('name');
// Error: Prefer setAttribute to $.attr
$('node').attr('name', 'random');

Updated the tests to reflect that as well.

Fixes #15