chore(dev): add repo-wide prettier config for YAML, JS, TS, and JSON#25082
chore(dev): add repo-wide prettier config for YAML, JS, TS, and JSON#25082
Conversation
There was a problem hiding this comment.
💡 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".
There was a problem hiding this comment.
💡 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>
4fe8f0f to
2345072
Compare
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>
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>
2345072 to
ceb3ffc
Compare
There was a problem hiding this comment.
💡 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".
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>
There was a problem hiding this comment.
💡 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>
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.jsonin 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
Adds a root
.prettierrc.jsonthat editors auto-detect. Settings match what the website was already using (2-space indent, single quotes, no semicolons, 120 char width).Adds
.prettierignoreto skip files where prettier cannot work safely:{{ }}syntax breaks prettier, as discussed in chore(website): add prettier formatting #24460)app.js,dd-browser-logs-rum.js).jsonfiles with Go template syntax)''')Removes
website/.prettierrc.json(superseded by the root config). The Go template plugin reference is no longer needed since HTML files are excluded.Adds
make check-prettierandmake fix-prettiertargets for CI and local use.Formats all 252 existing files to establish a clean baseline. Changes are purely cosmetic:
singleQuote: true)Safety
An audit was performed specifically on GitHub Actions workflow YAML to ensure prettier does not break CI:
|,>) inrun:blocks are preserved exactly as-is${{ }}expressions are not modifiedif:conditionals are not reformatted or splitrun:blocks are not reflowedVector configuration
N/A - tooling/formatting change only.
How did you test this PR?
npx prettier@latest --checkacross all targeted files - passes cleanintegration.yml,publish.yml,k8s_e2e.yml,release.yml) to verify no behavioral changes.prettierignorecorrectly excludes Hugo templates, Go-template JS, VRL triple-quoted configs, and generated files.prettierrc.jsonChange Type
Is this a breaking change?
Does this PR include user facing changes?
no-changeloglabel to this PR.References
🤖 Generated with Claude Code