Problem/Motivation
The ESLint job in the GitLab CI pipeline fails, leaving the pipeline red.
Running Drupal core's ESLint configuration against the module reports 475 errors
and 80 warnings. Most are Prettier formatting, prefer-template,
object-shorthand, operator-linebreak and
import/* violations across the runtime, the builder store and the
JavaScript test suite.
Steps to reproduce
- Push a branch to the project repository.
- Open the pipeline and look at the ESLint job in the validate stage.
- The job exits non-zero and lists the errors.
Proposed resolution
Exclude the build artefacts instead of reformatting them. Add an
.eslintignore covering dist/ and the five files generated
from YAML. These carry a "do not edit" header, so linting them reports on a
generator's output and any reformatting is undone by the next
npm run build, npm run icons or
npm run countries. This matches the existing decision to keep
dist/* out of CSpell.
Fix everything else rather than silencing it:
- Apply Prettier formatting and the style rules across the runtime, the store
and the tests. - Remove the
'use strict'directives from the runtime IIFEs. Core
setsstrict: ["error", "never"]. - Drop the
.jsextensions from relative imports. - Move the icon helpers above
navButton, their first caller. - Replace the avatar renderer's nested ternary with an if/else chain.
- Move
_fieldErrorto a module-levelfieldError()
beside the other pure helpers. - Lift the pasted-dial handler out of its fourth level of nesting.
- Name the anonymous function expressions.
- Write out the 43
@paramtags with types and descriptions.
Disable two rules inline, each with its reason: a javascript: URL
that a test asserts is rejected, and the new Function() the test
harness uses to evaluate the IIFE runtime the way a browser does.
Resolve import/no-unresolved for vitest and
vite. CI installs only core's node modules, so the module's own dev
dependencies never resolve there and these 26 errors appear in the pipeline even
though they do not appear locally.
Remaining tasks
- Apply the fixes and add the
.eslintignore. - Resolve the
vitestandviteimport errors. - Confirm the ESLint job passes.
- Confirm the 352 JavaScript tests, phpcs and the artefact drift checks still
pass.
User interface changes
None.
API changes
None.
Data model changes
None.
Issue fork dropup-3623498
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #4
ibrahim tameme commentedComment #5
ibrahim tameme commented