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

  1. Push a branch to the project repository.
  2. Open the pipeline and look at the ESLint job in the validate stage.
  3. 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
    sets strict: ["error", "never"].
  • Drop the .js extensions 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 _fieldError to a module-level fieldError()
    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 @param tags 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 vitest and vite import 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

Command icon 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

ibrahim tameme created an issue. See original summary.

ibrahim tameme’s picture

Status: Active » Needs review
ibrahim tameme’s picture

Status: Needs review » Fixed

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.