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.
- Find a contrib module with a lot of users and check it for any eslint errors
- Check if a 8.0.x version is in development
- Search the queue for "ESLint errors"
- If there is nothing, create a new issue with the template below
- (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 |
|
|
| Files | The output of eslint in a <project>-eslint-output.txt file.
Obtained by running (from the Drupal root or with Drupal |
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
Comment #1
nod_Comment #2
nod_Comment #3
nod_Comment #4
nod_Comment #5
nod_Comment #6
nod_Comment #7
rteijeiro commentedComment #8
nod_Added direction for module-specific ESLint configuration.
Comment #9
nod_Comment #10
bès commentedDisplay suite module version 8.x-2.x and Edit UI are ok this day.
Comment #11
nod_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
Comment #12
pfrenssenThanks for this initiative! The patch for Scheduler in #2490956: Scheduler ESLint errors has been accepted.
Comment #13
hass commentedIs 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.
Comment #14
nod_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.
Comment #15
droplet commentedhaha, 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
)
Comment #16
droplet commentedLoading 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 **
Comment #17
nod_Brace for impact, we'll soon have warning enabled for valid JSDoc.
Comment #20
mradcliffeI'm going to remove the Novice tag because this is now a Meta task.
Comment #29
nod_This was helpful in raising awareness. Further progress should take a different form like creating and advertising a nom package with Drupal core eslint rules.