Create a script to only run docs links ESLint rules
What does this MR do and why?
Create a script to only run docs links ESLint rules
This creates a Node script that runs ESLint with only the
local-rules/require-valid-help-page-path
and
local-rules/vue-require-valid-help-page-link-component
rules enabled.
The goal is to speed up docs-only pipelines. When we initially introduced those new linters, we started running the full-blown ESLint script in MRs that only contain docs changes: !159149 (merged). This made those pipelines significantly slower, specifically because the eslint
CI job requires the GraphQL schema to be generated before running. By introducing this more specialized script, we can run the docs-related ESLint rules in isolation, without running into the GraphQL schema bottleneck.
Here's a visualization of how the eslint-docs
CI job performs compared to the full eslint
one: https://pipeline-visualizer-gitlab-org-quality-engineeri-bcf92e4999c4df.gitlab.io/gitlab-org/gitlab/pipeline/1449652495
Note how eslint-docs
starts almost immediately, with little wait time, while eslint
needs to wait for several minutes until the GraphQL schema is available.
MR acceptance checklist
Please evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.
Screenshots or screen recordings
Screenshots are required for UI changes, and strongly recommended for all other merge requests.
Before | After |
---|---|
How to set up and validate locally
-
Make sure you have a few help page path violations by adding broken docs links to some frontend assets.
- Eg. in Javascript:
helpPagePath('this/doc/does/not/exist')
. - Eg. in a Vue template:
<help-page-link href="this/doc/does/not/exist">Link</help-page-link>
.
- Eg. in Javascript:
-
Run the script and it should only report errors related to
local-rules/require-valid-help-page-path
andlocal-rules/vue-require-valid-help-page-link-component
ESLint rules:scripts/frontend/lint_docs_links.mjs
Related to #476864 (closed)