The plan is to make sure contrib modules use ESLint and fix all errors they have. We want all Drupal JS to be as clean as possible. For that we need to make sure the big modules are using it and fix their JS, the smaller modules should follow afterwards.

  1. Find a contrib module with a lot of users and check it for any eslint errors
  2. Check if a 8.0.x version is in development
  3. Search the queue for "ESLint errors"
  4. If there is nothing, create a new issue with the template below
  5. (bonus) Make a patch!

Remember, we're not here to judge the JS of the module, we're here to make sure it's following standards. That's it. Be nice!

Then create a new issue following this template, replace <project> with the name of the contrib module you're working on:

Title <project> ESLint errors
Type Task
Version Any 8.x dev version
Tags JavaScript clean-up
Parent issue 2490140 Very important, otherwise we can't track things properly
Body
As of Drupal 8 all JS needs to follow our <a href="https://www.drupal.org/node/172169">JavaScript coding standards</a>. For this we use <a href="https://www.drupal.org/node/1955232">ESLint</a> to check most of our standards.

Here is the summary of running ESLint on this module JS: 
<strong>✖ XXX problems (YYY errors, ZZZ warnings)</strong>

Attached is the full list of errors found by ESLint. 
Files The output of eslint in a <project>-eslint-output.txt file.

Obtained by running (from the Drupal root or with Drupal .eslintrc config file)eslint modules/<project> > <project>-eslint-output.txt

See #2490142: Panels Eslint errors for an example.

Special cases

Sometimes some rules needs to be changed for specific modules (if they use a third party library and they need to use a new global variable), in that case the module can create it's own .eslintrc turning some rules on or off and adding global variables they require. When ESLint runs, all the configuration files present in the directory tree are merged together: see Configuration Cascading and Hierarchy for more details.

Cookies points

Following modules are already linted and do not need to be checked:

  • Display Suite

Comments

nod_’s picture

Issue summary: View changes
nod_’s picture

Issue summary: View changes
nod_’s picture

Issue summary: View changes
nod_’s picture

Issue summary: View changes
nod_’s picture

Issue tags: +Novice
nod_’s picture

Issue summary: View changes
rteijeiro’s picture

Issue summary: View changes
nod_’s picture

Issue summary: View changes

Added direction for module-specific ESLint configuration.

nod_’s picture

Issue summary: View changes
Bès’s picture

Display suite module version 8.x-2.x and Edit UI are ok this day.

nod_’s picture

Issue summary: View changes

Couple of issues are up for grabs if anyone is interested in Novice JS issues in contrib:

#2491207: CAPTCHA ESLint errors
#2491215: External Links ESLint errors
#2491219: Flag ESLint errors
#2491233: IMCE ESLint errors

pfrenssen’s picture

Thanks for this initiative! The patch for Scheduler in #2490956: Scheduler ESLint errors has been accepted.

hass’s picture

Is it possible that automated test results get's a new tab like the current PHP 5.4 MySQL tab that show the ESLint test results? Like we had this in past with coder review. Coder review was highly buggy and caused lots of fails warnings plus is implemented some custom rules from one developer and not the real core rules, but maybe ESLint will not be that buggy.

I have not found a single ESLint online validator what makes the validation a real pain.

nod_’s picture

Klausi added it to pareview.sh #230771-20: Provide basic javascript syntax and comment review but I don't know about the testbot. I'm expecting that to be possible/available when the new testbot stuff lands.

droplet’s picture

haha, for anybody who doesn't own an editor with ESLint validation features :)

http://kayleung.github.io/eslint-drupal/demo/

(
I've updated to Drupal ESLint Config:
https://github.com/KayLeung/eslint-drupal/blob/gh-pages/js/app/eslint.json
)

droplet’s picture

Loading from URL:

http://kayleung.github.io/eslint-drupal/demo/?url={REMOTE-JS-FILE-URL}

eg:
http://kayleung.github.io/eslint-drupal/demo/?url=http://cgit.drupalcode...

** Log out github, browsers prevent loading mixed http / https contents **

nod_’s picture

Brace for impact, we'll soon have warning enabled for valid JSDoc.

Version: 8.0.x-dev » 8.1.x-dev

Drupal 8.0.6 was released on April 6 and is the final bugfix release for the Drupal 8.0.x series. Drupal 8.0.x will not receive any further development aside from security fixes. Drupal 8.1.0-rc1 is now available and sites should prepare to update to 8.1.0.

Bug reports should be targeted against the 8.1.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.2.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.1.x-dev » 8.2.x-dev

Drupal 8.1.9 was released on September 7 and is the final bugfix release for the Drupal 8.1.x series. Drupal 8.1.x will not receive any further development aside from security fixes. Drupal 8.2.0-rc1 is now available and sites should prepare to upgrade to 8.2.0.

Bug reports should be targeted against the 8.2.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.3.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

mradcliffe’s picture

Issue tags: -Novice

I'm going to remove the Novice tag because this is now a Meta task.

Version: 8.2.x-dev » 8.3.x-dev

Drupal 8.2.6 was released on February 1, 2017 and is the final full bugfix release for the Drupal 8.2.x series. Drupal 8.2.x will not receive any further development aside from critical and security fixes. Sites should prepare to update to 8.3.0 on April 5, 2017. (Drupal 8.3.0-alpha1 is available for testing.)

Bug reports should be targeted against the 8.3.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.4.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.