Skip to content

chore(dev): add repo-wide prettier config for YAML, JS, TS, and JSON#25082

Open
pront wants to merge 10 commits intomasterfrom
pront-prettier-repo-wide
Open

chore(dev): add repo-wide prettier config for YAML, JS, TS, and JSON#25082
pront wants to merge 10 commits intomasterfrom
pront-prettier-repo-wide

Conversation

@pront
Copy link
Copy Markdown
Member

@pront pront commented Mar 31, 2026

Summary

Why

Vector currently has no project-wide formatting standard for YAML, JavaScript, TypeScript, or JSON files. A small prettier config existed under website/ but it only covered website assets, and even there it caused problems with Go template syntax in Hugo HTML files (see #24460 review).

Meanwhile, contributors working on GitHub Actions workflows, Kubernetes manifests, config examples, and scripts each follow their own formatting conventions. This leads to noisy diffs where formatting changes get mixed into functional changes, making code review harder and git blame less useful.

More importantly, editors and IDEs (Zed, VS Code, JetBrains) all support prettier out of the box and will auto-format files on save when they find a .prettierrc.json in the project root. Without a repo-wide config, editor auto-formatting either does nothing (no config found) or produces results that differ between contributors.

What this PR does

  1. Adds a root .prettierrc.json that editors auto-detect. Settings match what the website was already using (2-space indent, single quotes, no semicolons, 120 char width).

  2. Adds .prettierignore to skip files where prettier cannot work safely:

    • Hugo HTML templates (Go template {{ }} syntax breaks prettier, as discussed in chore(website): add prettier formatting #24460)
    • Hugo JS assets that embed Go template syntax (app.js, dd-browser-logs-rum.js)
    • Hugo layouts directory (.json files with Go template syntax)
    • Config examples using VRL triple-quoted strings (''')
    • Generated files, build artifacts, lock files, CUE files
  3. Removes website/.prettierrc.json (superseded by the root config). The Go template plugin reference is no longer needed since HTML files are excluded.

  4. Adds make check-prettier and make fix-prettier targets for CI and local use.

  5. Formats all 252 existing files to establish a clean baseline. Changes are purely cosmetic:

    • Quote style normalization (double to single, matching singleQuote: true)
    • Trailing whitespace cleanup
    • Inline array expansion (one item per line for readability)
    • Consistent indentation

Safety

An audit was performed specifically on GitHub Actions workflow YAML to ensure prettier does not break CI:

  • Block scalars (|, >) in run: blocks are preserved exactly as-is
  • ${{ }} expressions are not modified
  • if: conditionals are not reformatted or split
  • Shell scripts inside run: blocks are not reflowed
  • All changes in workflow files are limited to quote style and whitespace

Vector configuration

N/A - tooling/formatting change only.

How did you test this PR?

  • Ran npx prettier@latest --check across all targeted files - passes clean
  • Audited diffs on GitHub Actions workflows (integration.yml, publish.yml, k8s_e2e.yml, release.yml) to verify no behavioral changes
  • Verified .prettierignore correctly excludes Hugo templates, Go-template JS, VRL triple-quoted configs, and generated files
  • Confirmed editors (Zed) auto-detect the root .prettierrc.json

Change Type

  • Bug fix
  • New feature
  • Dependencies
  • Non-functional (chore, refactoring, docs)
  • Performance

Is this a breaking change?

  • Yes
  • No

Does this PR include user facing changes?

  • Yes. Please add a changelog fragment based on our guidelines.
  • No. A maintainer will apply the no-changelog label to this PR.

References

🤖 Generated with Claude Code

@github-actions github-actions bot added domain: ci Anything related to Vector's CI environment domain: releasing Anything related to releasing Vector domain: core Anything related to core crates i.e. vector-core, core-common, etc and removed domain: releasing Anything related to releasing Vector labels Mar 31, 2026
@pront pront added the no-changelog Changes in this PR do not need user-facing explanations in the release changelog label Mar 31, 2026
@pront pront changed the title chore: add repo-wide prettier config for YAML, JS, TS, and JSON chore(dev): add repo-wide prettier config for YAML, JS, TS, and JSON Mar 31, 2026
@pront pront marked this pull request as ready for review March 31, 2026 19:59
@pront pront requested review from a team as code owners March 31, 2026 19:59
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 0b1d069fe2

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@github-actions github-actions bot added the domain: vdev Anything related to the vdev tooling label Mar 31, 2026
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 00968747f4

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Add a root .prettierrc.json (auto-detected by Zed, VS Code, JetBrains)
and .prettierignore to skip Hugo templates, generated files, and VRL
configs with triple-quoted strings.

- Pin prettier@3.5.3 in prepare.sh and .github/actions/setup
- Integrate prettier into vdev check fmt / vdev fmt
- Add check-prettier and fix-prettier Makefile targets
- Add prettier path filter in changes.yml so check-fmt triggers on
  YAML/JS/TS/JSON changes
- Remove website/.prettierrc.json (superseded by root config)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@pront pront force-pushed the pront-prettier-repo-wide branch from 4fe8f0f to 2345072 Compare March 31, 2026 21:08
pront and others added 3 commits March 31, 2026 17:16
Run make fix-prettier to establish a consistent formatting baseline.
Changes are purely cosmetic: whitespace cleanup, quote normalization,
and array formatting.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…-wide

# Conflicts:
#	.github/workflows/ci-integration-review.yml
#	.github/workflows/integration.yml
Shell globs expand to include untracked directories. Use git ls-files
to only format tracked files, consistent with how markdownlint works.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
chatgpt-codex-connector[bot]

This comment was marked as outdated.

pront and others added 2 commits March 31, 2026 17:23
When prettier receives explicit file paths it skips .prettierignore.
Pass --ignore-path explicitly so exclusions (lib/codecs/tests/data,
config examples with VRL triple-quotes, Hugo build output, etc.) are
still respected.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@pront pront force-pushed the pront-prettier-repo-wide branch from 2345072 to ceb3ffc Compare March 31, 2026 21:44
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: ceb3ffcefc

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@pront pront marked this pull request as draft March 31, 2026 22:34
pront and others added 3 commits March 31, 2026 18:36
Running prettier with all tracked files in a single invocation can
exceed macOS ARG_MAX (262 KB) since this repo has ~4400 matching paths.
Invoke prettier once per extension type instead.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Move info! inside the loop so each extension type logs its own
progress line.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@pront pront marked this pull request as ready for review April 1, 2026 16:43
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 79fa556a16

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

- Remove unused vendor/ entry from .prettierignore
- Deduplicate PRETTIER_EXTENSIONS constant between fmt and check/fmt

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@pront pront enabled auto-merge April 1, 2026 17:44
@pront pront added this pull request to the merge queue Apr 1, 2026
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Apr 1, 2026
@thomasqueirozb thomasqueirozb added this pull request to the merge queue Apr 1, 2026
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Apr 1, 2026
@thomasqueirozb thomasqueirozb added this pull request to the merge queue Apr 1, 2026
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Apr 1, 2026
@thomasqueirozb thomasqueirozb added this pull request to the merge queue Apr 1, 2026
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Apr 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

domain: ci Anything related to Vector's CI environment domain: core Anything related to core crates i.e. vector-core, core-common, etc domain: vdev Anything related to the vdev tooling no-changelog Changes in this PR do not need user-facing explanations in the release changelog

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants