jQuery ESLint Config
raw JSON → 3.0.2 verified Sat Apr 25 auth: no javascript
ESLint shareable config that enforces the jQuery JavaScript code style, compatible with ESLint's semantic versioning policy. The latest stable version is 3.0.2 released Apr 2022. It follows the spirit of the jQuery code style guide without strict adherence, allowing some flexibility. This config extends ESLint's recommended rules and overrides to align with jQuery conventions. It is intended for projects that follow or are close to the jQuery coding style. The package has no runtime dependencies and is used via the ESLint extends mechanism.
Common errors
error Error: Failed to load config "jquery" to extend from. ↓
cause Package not installed or not found in node_modules.
fix
Run
npm install --save-dev eslint-config-jquery and ensure it's in your project root. error Warning: The "eslint-config-jquery" package has been deprecated. ↓
cause Outdated version; check for newer or maintained alternative.
fix
Update to latest version with
npm update eslint-config-jquery. Warnings
breaking Major version bumps may introduce new rules that cause lint failures. ↓
fix Review changelog before upgrading; use `--fix` to auto-correct where possible.
gotcha The config uses global variables assumed by jQuery plugins, which may conflict with modern module bundlers. ↓
fix Use `env: { browser: true }` or explicitly define globals in ESLint config.
Install
npm install eslint-config-jquery yarn add eslint-config-jquery pnpm add eslint-config-jquery Imports
- jquery config wrong
{ "extends": "eslint-config-jquery" }correct{ "extends": "jquery" } - default import wrong
import jqueryConfig from 'eslint-config-jquery';correctconst jqueryConfig = require('eslint-config-jquery');
Quickstart
// .eslintrc.json
{
"extends": "jquery"
}
// Or in .eslintrc.js
module.exports = {
extends: 'jquery'
};