Skip to content

Commit 4bbd8dc

Browse files
cexbrayatalan-agius4
authored andcommitted
fix(@angular/cli): ignore unknown files when formatting schematic changes
When schematics modify files such as .gitignore, Prettier cannot infer a parser and formatting fails. ``` npx prettier --check .gitignore [error] No parser could be inferred for file ".gitignore". ``` With ignore-unknown enabled, Prettier does not throw this parser error
1 parent a1a84da commit 4bbd8dc

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

packages/angular/cli/src/utilities/prettier.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ export async function formatFiles(cwd: string, files: Set<string>): Promise<void
4444

4545
await execFileAsync(
4646
process.execPath,
47-
[prettierCliPath, '--write', '--no-error-on-unmatched-pattern', ...files],
47+
[prettierCliPath, '--write', '--no-error-on-unmatched-pattern', '--ignore-unknown', ...files],
4848
{
4949
cwd,
5050
shell: false,

0 commit comments

Comments
 (0)