Skip to content

Commit 4add271

Browse files
prontclaude
andcommitted
chore: pass --ignore-path .prettierignore when using git ls-files
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>
1 parent d836f16 commit 4add271

3 files changed

Lines changed: 6 additions & 4 deletions

File tree

Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -512,11 +512,11 @@ fix-markdown: ## Auto-fix markdown style issues
512512

513513
.PHONY: check-prettier
514514
check-prettier: ## Check that JS/TS/YAML/JSON files are formatted with prettier
515-
${MAYBE_ENVIRONMENT_EXEC} prettier --check $(shell git ls-files '*.yml' '*.yaml' '*.js' '*.ts' '*.tsx' '*.json')
515+
${MAYBE_ENVIRONMENT_EXEC} prettier --ignore-path .prettierignore --check $(shell git ls-files '*.yml' '*.yaml' '*.js' '*.ts' '*.tsx' '*.json')
516516

517517
.PHONY: fix-prettier
518518
fix-prettier: ## Auto-fix JS/TS/YAML/JSON formatting with prettier
519-
${MAYBE_ENVIRONMENT_EXEC} prettier --write $(shell git ls-files '*.yml' '*.yaml' '*.js' '*.ts' '*.tsx' '*.json')
519+
${MAYBE_ENVIRONMENT_EXEC} prettier --ignore-path .prettierignore --write $(shell git ls-files '*.yml' '*.yaml' '*.js' '*.ts' '*.tsx' '*.json')
520520

521521
.PHONY: check-examples
522522
check-examples: ## Check that the config/examples files are valid

vdev/src/commands/check/fmt.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,8 @@ impl Cli {
2424
.collect();
2525
if !files.is_empty() {
2626
info!("Checking prettier formatting...");
27-
let args: Vec<&str> = std::iter::once("--check")
27+
let args: Vec<&str> = ["--ignore-path", ".prettierignore", "--check"]
28+
.into_iter()
2829
.chain(files.iter().map(String::as_str))
2930
.collect();
3031
app::exec("prettier", &args, true)?;

vdev/src/commands/fmt.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,8 @@ impl Cli {
2424
.collect();
2525
if !files.is_empty() {
2626
info!("Formatting with prettier...");
27-
let args: Vec<&str> = std::iter::once("--write")
27+
let args: Vec<&str> = ["--ignore-path", ".prettierignore", "--write"]
28+
.into_iter()
2829
.chain(files.iter().map(String::as_str))
2930
.collect();
3031
app::exec("prettier", &args, true)?;

0 commit comments

Comments
 (0)