šŸš€ Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more →
Socket
Sign inDemoInstall
Socket

eslint-plugin-no-jquery

Package Overview
Dependencies
Maintainers
3
Versions
17
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

eslint-plugin-no-jquery

Disallow jQuery functions with native equivalents.

2.2.0
Source
npm
Version published
Weekly downloads
114K
-21.05%
Maintainers
3
Weekly downloads
Ā 
Created
Source

eslint-plugin-no-jquery

Disallow jQuery functions, with suggestions for native equivalents where possible.

Originally a fork of eslint-plugin-jquery.

Installation

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.

Usage

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 are profiles for jQuery 3.4.x+ environments (deprecated-3.4), 3.0.x+ (deprecated-3.0), and several others for completeness. Deprecation profiles are cumulative, so include all the rules for jQuery versions below them.

Alternatively, you can pick out rules individually (see below).

Settings

The following global settings can be used under the "no-jquery" property to configure the linter:

  • variablePattern - An array of aliases for the jQuery constructor. Defaults to [ "$", "jQuery" ]
  • constructorAliases - Regular expression pattern for matching jQuery variables. Defaults to "^\\$."
{
  "settings": {
    "no-jquery": {
        "variablePattern": [ "$", "jQuery" ],
        "constructorAliases": "^\\$.|^element$"
    }
  },
  "plugins": [
    "no-jquery"
  ]

Rules

Development

npm install
npm test

To update documentation after modifying a rule or its tests, use

npm run doc

License

Distributed under the MIT license. See LICENSE for details.

Keywords

eslint

FAQs

Package last updated on 30 Sep 2019

Did you know?

Socket

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.

Install

Related posts