Skip to content

Add YAML linting to CI#2355

Merged
GabrielAnca merged 4 commits into
masterfrom
gabriel.anca/add-yaml-linter
Jun 16, 2026
Merged

Add YAML linting to CI#2355
GabrielAnca merged 4 commits into
masterfrom
gabriel.anca/add-yaml-linter

Conversation

@GabrielAnca

@GabrielAnca GabrielAnca commented Jun 12, 2026

Copy link
Copy Markdown
Contributor

Adds a YAML linting step to GitHub Actions CI to catch YAML syntax errors before they reach GitLab. This would have prevented the .gitlab-ci.yml syntax error we shipped recently ("${CI_PROJECT_DIR}/..." assume-role is invalid YAML).

Uses eslint-plugin-yml (1M weekly downloads, actively maintained) via a new yarn lint:yaml script. Linting covers all YAML files in the repo via eslint-plugin-yml's flat/standard ruleset, with a few rules tuned:

  • yml/quotes and yml/plain-scalar disabled — existing files use mixed quoting intentionally and the two rules conflict with each other
  • prettier/prettier disabled for YAML — Prettier's single-quote preference clashes with YAML conventions across too many files
  • yml/no-empty-mapping-value disabled

I added specific fixture files added to globalIgnores to prevent intentionally invalid files from failing CI.

Also bumps actions/checkout from v6.0.2 to v6.0.3 across all CI jobs

Happy to address the exceptions I made in separate PRs. I wanted to avoid making this one too complex.

@datadog-prod-us1-5

This comment has been minimized.

@GabrielAnca GabrielAnca added the chores Related to the CI or developer experience label Jun 12, 2026
@GabrielAnca GabrielAnca changed the title Add yamllint to CI Add YAML linting to CI Jun 15, 2026
@GabrielAnca
GabrielAnca force-pushed the gabriel.anca/add-yaml-linter branch 5 times, most recently from b9657e8 to 9eb3cdc Compare June 15, 2026 10:47
@GabrielAnca
GabrielAnca force-pushed the gabriel.anca/add-yaml-linter branch from 9eb3cdc to 7db08f7 Compare June 15, 2026 10:47
Comment thread eslint.config.mjs
'packages/datadog-ci/shims/injected-plugin-submodules.js',
'packages/datadog-ci/shims/intl-collator.js',
'bin/*.js',
'.github/dependabot.yml',

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This file is commented out entirely. So it's invalid YAML

Comment thread eslint.config.mjs
...yml.configs['flat/standard'],
{
files: yamlFiles,
extends: [tseslint.configs.disableTypeChecked],

@GabrielAnca GabrielAnca Jun 15, 2026

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This avoids running TS checks on yaml files. If we don't do this, TypeScript lint fails on yaml files.

Disabling TS tests in yaml files using the extends directive is the recommended approach, even though I think it's not super easy to follow. Being able to do something at the level where we introduce the conflict tseslint.configs.recommendedTypeChecked would be better, but the current solution would be even harder to read (tseslint.configs.recommendedTypeChecked.map((config) => config.files ? config : {...config, files: tsFiles}))

@GabrielAnca
GabrielAnca marked this pull request as ready for review June 15, 2026 13:47
@GabrielAnca
GabrielAnca requested review from a team as code owners June 15, 2026 13:47
@GabrielAnca
GabrielAnca merged commit 36742bd into master Jun 16, 2026
33 checks passed
@GabrielAnca
GabrielAnca deleted the gabriel.anca/add-yaml-linter branch June 16, 2026 07:51
@GabrielAnca GabrielAnca mentioned this pull request Jun 17, 2026
@GabrielAnca GabrielAnca added the datadog-ci For PRs spanning multiple commands, and repo-wide changes label Jun 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

chores Related to the CI or developer experience datadog-ci For PRs spanning multiple commands, and repo-wide changes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants