Registry / testing / eslint-config-drupal

eslint-config-drupal

JSON →
library5.0.2jsnpmunverified

ESLint shareable config for Drupal JavaScript. Stable v5.0.2 (2021) targets Drupal 9 standards; infrequent releases. Provides a single `drupal` config that enforces Drupal's coding style and best practices. Unlike generic ESLint configs, it is tailored for Drupal's contributed module and theme development, including proper handling of Drupal's global variables and jQuery patterns. Requires ESLint as a peer dependency.

npm install eslint-config-drupal
INSTALL
IMPORT
SIG · ESLINT-CONFIG-DRUP
E
eslint-config-drupal
testingjavascriptv5.0.2
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18226 runs
build_error
glibc
node 18226 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

config
import in .eslintrc.json: { "extends": ["drupal"] }
import { drupal } from 'eslint-config-drupal'
No JS import; use ESLint extends field.
drupal
extends: ['drupal']
extends: ['eslint-config-drupal']
ESLint resolves package name automatically.
drupal-strict
extends: ['drupal', 'drupal-strict']
extends: ['drupal-strict']
Strict variant available only in v5.

Setup ESLint with Drupal config using .eslintrc.json extends field and run linting.

// .eslintrc.json { "extends": [ "drupal" ], "rules": { "no-console": "warn" } } // In terminal: npx eslint yourfile.js
Debug
Known issues
gotchaPackage only works with ESLint 5.x; newer ESLint versions may cause incompatibilities.
fix
Pin ESLint to 5.x or use eslint-config-drupal v6+
affects: >=5.0.0
gotchaRequires manual installation of Drupal-specific globals (e.g., Drupal, jQuery) via environment or additional config.
fix
Add `"env": { "browser": true, "jquery": true }` or define globals.
affects: *
deprecatedDeprecated default rule `prefer-destructuring` warns for array destructuring, which conflicts with Drupal's coding style.
fix
Set `'prefer-destructuring': ['warn', { array: false }]`
affects: >=5.0.0
Errors
Common errors & fixes
Error: Cannot find module 'eslint-config-drupal'
Package not installed or ESLint cannot resolve it.
fix
Run `npm install --save-dev eslint-config-drupal eslint` and ensure node_modules is present.
ESLint configuration in .eslintrc.json is invalid: "extends": "drupal"
Valued string instead of array.
fix
Use `["drupal"]` instead of `"drupal"`.
Upgrade
Version history
5.0.2latest on npm
Audit
Dependencies
eslintrequiredpeer dependency
Agent activity
2 hits · last 30 days
node
2
Resources
eslint-config-drupal — npm install eslint-config-drupal · libregistry