Research
Security News
Malicious npm Package Targets Solana Developers and Hijacks Funds
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
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 config plugin:no-jquery/recommended
includes the recommended rule no-jquery/variable-pattern
which is required for method rules to work correctly.
The config 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 configs targeting specific versions of jQuery if you know the environment in which your code will operate. There is a config for all minor versions from 1.0 to 3.6 (deprecated-1.0
, ..., deprecated-3.7
). Deprecation configs are cumulative, so they include all the rules for jQuery versions below them.
The config plugin:no-jquery/slim
includes all features excluded from the official "slim" build of jQuery, specifically the ajax and effects modules.
The config plugin:no-jquery/all
includes all methods and utilies and should be used when you are aiming to remove all jQuery usage from your code.
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"
]
}
Rules with options are indicated with ⚙️. Rules which are fixable are indicated with 🔧.
Where rules are included in the configs recommended
, slim
, all
or deprecated-X.X
it is indicated below. Where rules are included in a config with non-default options this is indicated with a †
.
no-jquery/no-ajax
slim
, all
no-jquery/no-ajax-events
slim
no-jquery/no-and-self
🔧 1.8
no-jquery/no-animate
⚙️ slim
, all
no-jquery/no-animate-toggle
slim
no-jquery/no-append-html
no-jquery/no-attr
all
no-jquery/no-bind
3.0
, all
no-jquery/no-box-model
1.3
no-jquery/no-browser
1.3
no-jquery/no-camel-case
3.3
, all
no-jquery/no-class
all
no-jquery/no-class-state
no-jquery/no-clone
all
no-jquery/no-closest
all
no-jquery/no-constructor-attributes
no-jquery/no-contains
all
no-jquery/no-context-prop
1.10
no-jquery/no-css
all
no-jquery/no-data
all
no-jquery/no-deferred
all
no-jquery/no-delegate
3.0
, all
no-jquery/no-done-fail
all
no-jquery/no-each
no-jquery/no-each-collection
all
no-jquery/no-each-util
all
no-jquery/no-error
🔧 all
no-jquery/no-error-shorthand
🔧 1.8
no-jquery/no-escape-selector
🔧 all
no-jquery/no-event-shorthand
⚙️ 🔧 3.5
, 3.3†
, all
no-jquery/no-extend
⚙️ 🔧 all
no-jquery/no-fade
slim
, all
no-jquery/no-filter
all
no-jquery/no-find
no-jquery/no-find-collection
all
no-jquery/no-find-util
all
no-jquery/no-fx
slim
no-jquery/no-fx-interval
3.0
no-jquery/no-global-eval
all
no-jquery/no-global-selector
⚙️no-jquery/no-grep
all
no-jquery/no-has
all
no-jquery/no-hold-ready
3.2
, all
no-jquery/no-html
⚙️ all
no-jquery/no-in-array
all
no-jquery/no-is
all
no-jquery/no-is-array
🔧 3.2
, all
no-jquery/no-is-empty-object
all
no-jquery/no-is-function
🔧 3.3
, all
no-jquery/no-is-numeric
3.3
, all
no-jquery/no-is-plain-object
all
no-jquery/no-is-window
3.3
, all
no-jquery/no-jquery-constructor
all
no-jquery/no-live
1.7
, all
no-jquery/no-load
slim
, all
no-jquery/no-load-shorthand
🔧 1.8
no-jquery/no-map
no-jquery/no-map-collection
all
no-jquery/no-map-util
all
no-jquery/no-merge
all
no-jquery/no-node-name
3.2
, all
no-jquery/no-noop
🔧 all
no-jquery/no-now
🔧 3.3
, all
no-jquery/no-on-ready
🔧 1.8
no-jquery/no-other-methods
all
no-jquery/no-other-utils
all
no-jquery/no-param
all
no-jquery/no-parent
all
no-jquery/no-parents
all
no-jquery/no-parse-html
all
no-jquery/no-parse-html-literal
⚙️ 🔧no-jquery/no-parse-json
🔧 3.0
, all
no-jquery/no-parse-xml
🔧 slim
, all
no-jquery/no-prop
all
no-jquery/no-proxy
🔧 3.3
, all
no-jquery/no-ready
no-jquery/no-ready-shorthand
🔧 3.0
, all
no-jquery/no-selector-prop
1.7
no-jquery/no-serialize
all
no-jquery/no-size
🔧 1.8
, all
no-jquery/no-sizzle
⚙️ 3.4†
no-jquery/no-slide
slim
, all
no-jquery/no-sub
1.7
, all
no-jquery/no-support
1.9
no-jquery/no-text
all
no-jquery/no-trigger
all
no-jquery/no-trim
3.5
, all
no-jquery/no-type
3.3
, all
no-jquery/no-unique
🔧 3.0
, all
no-jquery/no-unload-shorthand
🔧 1.8
no-jquery/no-val
all
no-jquery/no-visibility
all
no-jquery/no-when
all
no-jquery/no-wrap
all
no-jquery/variable-pattern
recommended
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-submit
(use no-jquery/no-event-shorthand
)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 132,943 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.
Research
Security News
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
Security News
Research
Socket researchers have discovered malicious npm packages targeting crypto developers, stealing credentials and wallet data using spyware delivered through typosquats of popular cryptographic libraries.
Security News
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.