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-drupalVerified import paths — ran on the pinned version, not inferred.
Setup ESLint with Drupal config using .eslintrc.json extends field and run linting.
Pin ESLint to 5.x or use eslint-config-drupal v6+
Add `"env": { "browser": true, "jquery": true }` or define globals.Set `'prefer-destructuring': ['warn', { array: false }]`Run `npm install --save-dev eslint-config-drupal eslint` and ensure node_modules is present.
Use `["drupal"]` instead of `"drupal"`.