eslint-config-drupal-bundle v2.0.7
Eslint with Drupal style

Note: with Drupal 9.x moving to eslint greater than 5.x this setup of having a globally installed plugins and configs will not work under eslint 6+ without major effort setting it up per project. As such if you need the changes provided in eslint 6+ it probably better to web/core yarn install the modules with just have eslint and prettier installed globally or running them from their node_modules path.
see:
- ESLint cannot find global install
- Migrating to ESLint v6.0.0: Plugins and shareable configs are no longer affected by ESLint’s location
ESLint bundled with the original Airbnb Style and prettier/recommended configs. Global installation is supported! No struggle with peer dependencies, easily integrates with your code editors.
See airbnb/javascript and prettier/eslint for more information.
See instructions for WebStorm, VSCode, Sublime Text and Atom
Installation
Install it globally:
yarn global add eslint-config-drupal-bundleor
npm -g install eslint-config-drupal-bundleYou can install it locally as well:
yarn global add eslint-config-drupal-bundleor
npm install --save-dev eslint-config-drupal-bundleSetup your IDE / Editor:
Usage
You can now run feature packed eslint from any directory:
eslint -vCreate .eslintrc file in your project. Setup your IDE / Editor. And be smart!
ES6, ES7, React, JSX, async/await - all new features supported by default 👍
ESLint inside
You shouldn't add eslint to your dependencies. It's bundled with this package, just specify the path if you need.
Here is an example for eslint-loader:
{
loader: 'eslint-loader',
options: {
eslintPath: 'eslint-config-drupal-bundle/node_modules/eslint',
}
},WebStorm
File ➤ Settings / Default Settings ➤ Languages and Frameworks ➤ JavaScript ➤ Code Quality Tools ➤ ESLint

Global installation in not necessary for WebStorm, but it is handy for the "Default Settings".
VSCode
Install this package globally (or locally)
Go to: View -> Extension or press
CTRL + SHIFT + XSearch for ESLint extension, click it and press "Install" button
Press "Reload" button or reopen the editor
Go to: File -> Preferences -> Settings
Add ESLint path to your workspace settings (do not use
~):{ "eslint.nodePath": "/home/username/.nvm/versions/node/v10.5.0/lib/node_modules/eslint-config-drupal-bundle/node_modules/eslint", }Relative path for local installation:
{ "eslint.nodePath": "node_modules/eslint-config-drupal-bundle/node_modules/eslint", }Create
.eslintrc.jsfile inside your working project root:process.chdir(__dirname); module.exports = { extends: [ 'drupal-bundle', ], };
Sublime Text 3
Install this package globally
Go to: Preferences -> Package Control -> install package
Install SublimeLinter
Install SublimeLinter-contrib-eslint
Run:
npm bin -g... and copy the path
Go to: Tools -> SublimeLinter -> Open User Settings
Paste the path to NodeJS installation folder inside "paths" for your OS and save:
"paths": { "linux": [ "~/.nvm/versions/node/v8.8.1/bin" ], "osx": [], "windows": ["%AppData%\\npm"] },Create
.eslintrcfile inside your working project:{ "extends": ["drupal-bundle"] }Restart Sublime Text
Go to Tools -> SublimeLinter -> Lint this view
You can switch to squiggly underline mark style from Tools. Have fun!

Atom
Install this package globally
Go to: Edit -> Preferences -> Install
Install Linter
Install linter-eslint
Run:
npm prefix -g... copy the prefix path
Go to: Preferences -> Packages -> linter-eslint -> Settings
a) Check "Use global ESLint installation" option at the bottom
b) Paste the prefix path to the field "Global Node Installation Path" and append:
/lib/node_modules/eslint-config-drupal-bundle
Create
.eslintrcfile inside your working project:{ "extends": ["drupal-bundle"] }Press
Ctrl + Shift + P-> enter "lint" -> click "Linter:Lint"
Custom Config
Add your own rules to the .eslintrc file in your project folder. Note: you may want to add root: true to your project.eslintrc to limit eslint looking up parent directories for additional configs.
Credit
All credit to doasync and the original eslint-config-airbnb-bundle of which this is a fork just adding extra config/dependencies of prettier to have function under Drupal 8.6+.