eslint-plugin-no-jquery
Advanced tools
Comparing version
# eslint-plugin-no-jquery release history | ||
## v2.3.2 | ||
* Rule fix: Add fixer for `no-is-function` (Ed Sanders) | ||
* Rule fix: Follow-up #186: Actually merge `no-undelegate` into `no-delegate` (Ed Sanders) | ||
โ | ||
* Docs: Soften and make clearer the language for `no-class-state` (James D. Forrester) | ||
* Docs: Explain `no-global-selector` restriction more clearly (James D. Forrester) | ||
โ | ||
* Release: Update devDependencies (Ed Sanders) | ||
โ | ||
* Code: Remove non-existent $.fn.parse from tests (Ed Sanders) | ||
## v2.3.1 | ||
@@ -4,0 +20,0 @@ * New feature: Show deprecation message in linting errors (Ed Sanders) |
{ | ||
"name": "eslint-plugin-no-jquery", | ||
"version": "2.3.1", | ||
"version": "2.3.2", | ||
"description": "Disallow jQuery functions with native equivalents.", | ||
@@ -31,5 +31,5 @@ "repository": { | ||
"eslint": "^6.4.0", | ||
"eslint-config-wikimedia": "^0.14.3", | ||
"eslint-config-wikimedia": "^0.15.0", | ||
"eslint-plugin-rulesdir": "^0.1.0", | ||
"mocha": "^6.2.0" | ||
"mocha": "^7.1.0" | ||
}, | ||
@@ -36,0 +36,0 @@ "bugs": { |
@@ -34,3 +34,3 @@ 'use strict'; | ||
node: node, | ||
message: 'Don\'t query the DOM for state information' | ||
message: 'Where possible, maintain application state in JS to avoid slower DOM queries' | ||
} ); | ||
@@ -37,0 +37,0 @@ } |
@@ -6,4 +6,9 @@ 'use strict'; | ||
module.exports = utils.createCollectionMethodRule( | ||
'delegate', | ||
'Prefer `$.on`/`EventTarget#addEventListener` to `$.delegate`' | ||
[ 'delegate', 'undelegate' ], | ||
( node ) => node === true ? | ||
'Prefer `$.on`/`$.off` or `EventTarget#addEventListener`/`removeEventListener`' : ( | ||
node.callee.property.name === 'delegate' ? | ||
'Prefer $.on/EventTarget#addEventListener to $.delegate' : | ||
'Prefer $.off/EventTarget#removeEventListener to $.undelegate' | ||
) | ||
); |
@@ -65,3 +65,3 @@ 'use strict'; | ||
node: node, | ||
message: 'Global selectors are not allowed' | ||
message: 'Avoid queries which search the entire DOM. Keep DOM nodes in memory where possible.' | ||
} ); | ||
@@ -68,0 +68,0 @@ } |
@@ -7,3 +7,13 @@ 'use strict'; | ||
'isFunction', | ||
'Prefer `typeof` to `$.isFunction`' | ||
'Prefer `typeof` to `$.isFunction`', | ||
{ | ||
fixable: 'code', | ||
fix: function ( node, fixer ) { | ||
const calleeRange = node.callee.range; | ||
return [ | ||
fixer.replaceTextRange( [ calleeRange[ 0 ], calleeRange[ 1 ] + 1 ], 'typeof ' ), | ||
fixer.replaceTextRange( [ node.range[ 1 ] - 1, node.range[ 1 ] ], ' === "function"' ) | ||
]; | ||
} | ||
} | ||
); |
76303
0.5%99
-1%1924
-0.88%