Problem/Motivation
At #3417410: Set up to date the gitlab-ci.yml configuration we did the necessary changes to have running Gitlab CI on the Examples module.
In there, we noticed that Examples is not passing the Eslint checks and we have several errors on the final report.
We'd need to fix them to have the project meeting the default eslint checks.
Initial report with all the issues detected can be found at: https://git.drupalcode.org/issue/examples-3417410/-/jobs/699835
The final goal is to have all the Eslint checks in green for every single sub-module on the Examples project and being one step closer to have a base pipeline with everything in green.
Proposed resolution
For every child issue on this meta:
- Follow the instructions from "How to run eslint locally for the examples module" to have Eslint running locally and being able to simulate the errors we got from Gitlab but locally.
- Run Eslint against the target sub-module
- Fix the issues found and make a MR with the fixes.
How to run Eslint locally for the examples module
At https://www.drupal.org/docs/develop/standards/javascript-coding-standard... it explains how to run Eslint for our custom modules. However these instructions seem to differ in terms of configuration if we compare them with how it is run by default by Gitlab CI.
Following you have the detailed instructions to replicate the steps done by Gitlab CI and get the same errors if any.
- Go to the location where you have the examples module locally, in this case:
cd [FULL-PATH-TO-EXAMPLES-MODULE] - Create a symlink with core/.prettierrc.json :
ln -s [FULL-PATH-TO-DRUPAL]/core/.prettierrc.json . - Init a .prettierignore with just '*.yml':
echo '*.yml' > .prettierignore - Run eslint in the same way Gitlab CI does:
[FULL-PATH-TO-DRUPAL]/core/node_modules/.bin/eslint --no-error-on-unmatched-pattern --ignore-pattern="*.es6.js" --resolve-plugins-relative-to=[FULL-PATH-TO-DRUPAL]/core --ext=.js,.yml [PATH-AGAINST-RUN-ESLINT]
Comments
Comment #2
jlbellidoComment #3
jlbellidoComment #4
jlbellidoComment #5
jlbellidoComment #6
jlbellidoComment #7
jlbellidoComment #8
jlbellidoComment #9
jlbellidoWhile I worked on #3417513: Pass ESLint validations: Testing Example I noticed that I got different errors locally than the ones reported by eslint when it is run by Gitlab CI.
After checking how it is run by default on Gitlab, I'm updating the instructions about how to run the eslint locally because it diffiers from what it is written at https://www.drupal.org/docs/develop/standards/javascript-coding-standard... and it could lead to confusions on the different child issues.
Comment #10
jlbellidoComment #11
jlbellidoI've just seen we have a different .eslintrc configuration if we compare it with the one from Drupal core. Would we need to align ours with the new version from core? I'm not experienced on this kind of tasks but it seems to me than most of the errors we see on the reporting might be caused by this misalignment?
Comment #12
smustgrave commentedSo not sure the need to break up into separate tickets. Know on other modules we just knocked out in a single issue.
Unless one of the maintainers requested it
Comment #13
avpadernoComment #14
avpaderno