Change record status: 
Project: 
Introduced in branch: 
8.4.x
Introduced in version: 
8.4.0
Description: 

Previous JavaScript linting standards have been deprecated in favor of the more modern AirBnB standards. Their rules are more strict than ours, which is a good move for our codebase. The previous standards are contained in /core/.eslintrc.legacy.json.

How to configure your project for eslint

Core - ECMAScript 5 (legacy)

Run eslint based on legacy standards using the following shell command from the Drupal root directory:

cd core
yarn install
./node_modules/.bin/eslint --no-ignore --no-eslintrc --config=.eslintrc.legacy.json --ext=.js .

Core - ECMAScript 6

Run and automatically fix es6.js files using the following commands:

cd core
yarn install
yarn run lint:core-js

Non-Core - ECMAScript 5 (legacy)

If you wish to continue to utilize the legacy standards, you can run the legacy standards by running the following command from the root of the module you want to scan:

PATH/TO/DRUPAL_ROOT/core/node_modules/.bin/eslint --no-eslintrc -c=PATH/TO/DRUPAL_ROOT/core/.eslintrc.legacy.json --ext=.js .

Non-Core - ECMAScript 6

Extend /path/to/core/.eslintrc.json in your module, theme or project .eslintrc.json file. The path to the core eslint configuration file may differ depending on your project directory.

Core Patch Contributor Workflow

See #2815083 for more detailed information about developing core JavaScript.

Impacts: 
Module developers
Themers

Comments

andrewmacpherson’s picture

I've started a handbook page: Javascript Developer tools for Drupal core. It will gather details of the JS dev tools from this change record (and others). It still needs work, contributions welcome.