Overview

While fixing issue #3566392: Keep Canvas' own `.prettierrc.json` only for linting JS, ignore it for linting CSS, we discovered that the stylelint CI job has two critical issues:

  1. Limited scope: It only runs linting for CSS files in the root-level /css folder, completely missing CSS files in other directories like /ui.
  2. Configuration Update: The CI pipeline uses .prettierrc.json from Drupal core. Ensure it uses project's own configuration.

Steps to reproduce

  • Create an MR and make any css files and you'll see styelint CI job is triggerd.
  • Observe that it logs following:
    4 sources checked
      /builds/issue/canvas/web/modules/custom/canvas/css/autocomplete.extend.css
      /builds/issue/canvas/web/modules/custom/canvas/css/canvas-cta.css
      /builds/issue/canvas/web/modules/custom/canvas/css/menu-icons.css
      /builds/issue/canvas/web/modules/custom/canvas/css/navigation-override.css
    
  • Note in above logs the CSS files in /css directory are only included and potentially other directories are not included. Ex: /ui directory.

Proposed resolution

  • Investigate why the stylelint CI job is limited to the root /css folder.
  • Update the stylelint CI configuration to:
    • Include CSS files from all directories (including css files from /ui directory).
    • Use Canvas project's .prettierrc.json configuration instead of Drupal core.
  • Fix any linting errors discovered in the newly-scanned directories
  • Verify that the updated CI job successfully checks all CSS files across the project using the correct configuration.
  • Update documentation if needed.

Issue fork canvas-3569963

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

vishalkhode created an issue. See original summary.

vishalkhode’s picture

Title: The stylelint CI only checks /css directory and uses drupal core .stylelintrc.json configuration instead of canvas. » The stylelint CI only checks /css directory and uses drupal core .prettierrc.json configuration instead of canvas.
Issue summary: View changes

wim leers’s picture

Component: … to be triaged » Project management
Issue tags: +DX (Developer Experience)

Thanks! This should help us go faster in the future :)

penyaskito’s picture

Status: Active » Needs work

NW because there's a MR, but conflicting. IICR this was fixed somewhere else (didn't verify)?