
Security News
MCP Community Begins Work on Official MCP Metaregistry
The MCP community is launching an official registry to standardize AI tool discovery and let agents dynamically find and install MCP servers.
eslint-plugin-no-jquery
Advanced tools
Disallow jQuery functions, with suggestions for native equivalents where possible.
Originally a fork of eslint-plugin-jquery.
You'll first need to install ESLint:
npm install eslint --save-dev
Next, install eslint-plugin-no-jquery
:
npm install eslint-plugin-no-jquery --save-dev
Note: If you installed ESLint globally (using the -g
flag) then you must also install eslint-plugin-no-jquery
globally.
Add no-jquery
to the plugins section of your .eslintrc
configuration file. You can omit the eslint-plugin-
prefix:
{
"extends": "plugin:no-jquery/deprecated",
"plugins": [
"no-jquery"
]
}
The pre-set profile plugin:no-jquery/deprecated
includes all known deprecated and removed code, and is updated as new releases of jQuery come out. You can instead use profiles targetting specific versions of jQuery if you know the environment in which your code will operate. There is a profile for jQuery 3.5.x+ environments (deprecated-3.5
), and profiles for other minor releases that include deprecations (deprecated-3.4
, deprecated-1.10
etc.). Deprecation profiles are cumulative, so they include all the rules for jQuery versions below them.
Alternatively, you can pick out rules individually (see below).
The following global settings can be used under the no-jquery
property to configure the linter:
constructorAliases
- An array of aliases for the jQuery constructor. Defaults to [ "$", "jQuery" ]
.variablePattern
- Regular expression pattern for matching jQuery variables. Defaults to "^\\$."
. This pattern can be enforced with the no-jquery/variable-pattern
rule.collectionReturningPlugins
- An object describing the return types of jQuery plugins. Keys are plugin method names, and values can be one of:
'always'
a plugin which always returns a jQuery collection.
$bar = $foo.stop()
'accessor'
a plugin which only returns a jQuery collection when an argument is given.
w = $foo.width()
, $bar = $foo.width( 200 )
'valueAccessor'
a plugin which only returns a jQuery collection when more than one argument is given.
w = $foo.css( 'width' )
, $bar = $foo.css( 'width', '1em' )
'never'
(default) a plugin which never returns a jQuery collection.
arr = $foo.toArray()
{
"settings": {
"no-jquery": {
"constructorAliases": [ "$", "jQuery" ],
"variablePattern": "^\\$.|^element$",
"collectionReturningPlugins": {
"datePicker": "always"
}
}
},
"plugins": [
"no-jquery"
]
}
Where rules are included in the pre-set profiles slim
or deprecated-X.X
it is indicated below. Where rules are included with options this is indicated with a †
.
no-jquery/no-ajax
slim
no-jquery/no-ajax-events
slim
no-jquery/no-and-self
1.8
no-jquery/no-animate
slim
no-jquery/no-animate-toggle
slim
no-jquery/no-attr
no-jquery/no-bind
3.0
no-jquery/no-box-model
1.3
no-jquery/no-browser
1.3
no-jquery/no-camel-case
3.3
no-jquery/no-class
no-jquery/no-class-state
no-jquery/no-clone
no-jquery/no-closest
no-jquery/no-constructor-attributes
no-jquery/no-contains
no-jquery/no-context-prop
1.10
no-jquery/no-css
no-jquery/no-data
no-jquery/no-deferred
no-jquery/no-delegate
3.0
no-jquery/no-each
no-jquery/no-each-collection
no-jquery/no-each-util
no-jquery/no-error
no-jquery/no-error-shorthand
1.8
no-jquery/no-event-shorthand
3.5
, 3.3†
no-jquery/no-extend
no-jquery/no-fade
slim
no-jquery/no-filter
no-jquery/no-find
no-jquery/no-find-collection
no-jquery/no-find-util
no-jquery/no-fx-interval
3.0
no-jquery/no-global-eval
no-jquery/no-global-selector
no-jquery/no-grep
no-jquery/no-has
no-jquery/no-hold-ready
3.2
no-jquery/no-html
no-jquery/no-in-array
no-jquery/no-is
no-jquery/no-is-array
3.2
no-jquery/no-is-empty-object
no-jquery/no-is-function
3.3
no-jquery/no-is-numeric
3.3
no-jquery/no-is-plain-object
no-jquery/no-is-window
3.3
no-jquery/no-live
1.7
no-jquery/no-load
slim
no-jquery/no-load-shorthand
1.8
no-jquery/no-map
no-jquery/no-map-collection
no-jquery/no-map-util
no-jquery/no-merge
no-jquery/no-node-name
3.2
no-jquery/no-noop
no-jquery/no-now
3.3
no-jquery/no-on-ready
1.8
no-jquery/no-param
no-jquery/no-parent
no-jquery/no-parents
no-jquery/no-parse-html
no-jquery/no-parse-html-literal
no-jquery/no-parse-json
3.0
no-jquery/no-parse-xml
slim
no-jquery/no-prop
no-jquery/no-proxy
3.3
no-jquery/no-ready
no-jquery/no-ready-shorthand
3.0
no-jquery/no-selector-prop
1.7
no-jquery/no-serialize
no-jquery/no-size
1.8
no-jquery/no-sizzle
3.4†
no-jquery/no-slide
slim
no-jquery/no-sub
1.7
no-jquery/no-submit
no-jquery/no-support
1.9
no-jquery/no-text
no-jquery/no-trigger
no-jquery/no-trim
3.5
no-jquery/no-type
3.3
no-jquery/no-unique
3.0
no-jquery/no-unload-shorthand
1.8
no-jquery/no-val
no-jquery/no-visibility
no-jquery/no-when
no-jquery/no-wrap
no-jquery/variable-pattern
no-jquery/no-die
(use no-jquery/no-live
)no-jquery/no-hide
(use no-jquery/no-visibility
)no-jquery/no-show
(use no-jquery/no-visibility
)no-jquery/no-toggle
(use no-jquery/no-visibility
)no-jquery/no-unbind
(use no-jquery/no-bind
)no-jquery/no-undelegate
(use no-jquery/no-delegate
)npm install
npm test
To update documentation after modifying a rule or its tests, use
npm run doc
To run a specific test or tests:
npm run testpath tests/rules/no-ajax
Distributed under the MIT license. See LICENSE for details.
FAQs
Disallow jQuery functions with native equivalents.
The npm package eslint-plugin-no-jquery receives a total of 108,168 weekly downloads. As such, eslint-plugin-no-jquery popularity was classified as popular.
We found that eslint-plugin-no-jquery demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
The MCP community is launching an official registry to standardize AI tool discovery and let agents dynamically find and install MCP servers.
Research
Security News
Socket uncovers an npm Trojan stealing crypto wallets and BullX credentials via obfuscated code and Telegram exfiltration.
Research
Security News
Malicious npm packages posing as developer tools target macOS Cursor IDE users, stealing credentials and modifying files to gain persistent backdoor access.