{"id":19504,"library":"eslint-config-drupal","title":"eslint-config-drupal","description":"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.","status":"maintenance","version":"5.0.2","language":"javascript","source_language":"en","source_url":"https://github.com/theodoreb/eslint-config-drupal","tags":["javascript","eslint","eslintconfig","drupal"],"install":[{"cmd":"npm install eslint-config-drupal","lang":"bash","label":"npm"},{"cmd":"yarn add eslint-config-drupal","lang":"bash","label":"yarn"},{"cmd":"pnpm add eslint-config-drupal","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"peer dependency","package":"eslint","optional":false}],"imports":[{"note":"No JS import; use ESLint extends field.","wrong":"import { drupal } from 'eslint-config-drupal'","symbol":"config","correct":"import in .eslintrc.json: { \"extends\": [\"drupal\"] }"},{"note":"ESLint resolves package name automatically.","wrong":"extends: ['eslint-config-drupal']","symbol":"drupal","correct":"extends: ['drupal']"},{"note":"Strict variant available only in v5.","wrong":"extends: ['drupal-strict']","symbol":"drupal-strict","correct":"extends: ['drupal', 'drupal-strict']"}],"quickstart":{"code":"// .eslintrc.json\n{\n  \"extends\": [\n    \"drupal\"\n  ],\n  \"rules\": {\n    \"no-console\": \"warn\"\n  }\n}\n\n// In terminal:\nnpx eslint yourfile.js","lang":"javascript","description":"Setup ESLint with Drupal config using .eslintrc.json extends field and run linting."},"warnings":[{"fix":"Pin ESLint to 5.x or use eslint-config-drupal v6+","message":"Package only works with ESLint 5.x; newer ESLint versions may cause incompatibilities.","severity":"gotcha","affected_versions":">=5.0.0"},{"fix":"Add `\"env\": { \"browser\": true, \"jquery\": true }` or define globals.","message":"Requires manual installation of Drupal-specific globals (e.g., Drupal, jQuery) via environment or additional config.","severity":"gotcha","affected_versions":"*"},{"fix":"Set `'prefer-destructuring': ['warn', { array: false }]`","message":"Deprecated default rule `prefer-destructuring` warns for array destructuring, which conflicts with Drupal's coding style.","severity":"deprecated","affected_versions":">=5.0.0"}],"env_vars":null,"last_verified":"2026-04-25T00:00:00.000Z","next_check":"2026-07-24T00:00:00.000Z","problems":[{"fix":"Run `npm install --save-dev eslint-config-drupal eslint` and ensure node_modules is present.","cause":"Package not installed or ESLint cannot resolve it.","error":"Error: Cannot find module 'eslint-config-drupal'"},{"fix":"Use `[\"drupal\"]` instead of `\"drupal\"`.","cause":"Valued string instead of array.","error":"ESLint configuration in .eslintrc.json is invalid: \"extends\": \"drupal\""}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}