Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(devkit): add missing parameter to prettier getFileInfo #9577

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions packages/devkit/src/generators/format-files.ts
Expand Up @@ -32,7 +32,7 @@ export async function formatFiles(tree: Tree): Promise<void> {
await Promise.all(
Array.from(files).map(async (file) => {
const systemPath = path.join(tree.root, file.path);
let options: Prettier.Options = {
let options: any = {
Copy link
Member

Choose a reason for hiding this comment

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

There's probably a different type we can use here. Can you try Prettier.FileInfoOptions?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Error: packages/devkit/src/generators/format-files.ts:36:9 - error TS2322: Type '{ filepath: string; }' is not assignable to type 'FileInfoOptions'.
  Object literal may only specify known properties, and 'filepath' does not exist in type 'FileInfoOptions'.

36         filepath: systemPath,

Copy link
Member

Choose a reason for hiding this comment

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

Ah, yes. Try Prettier.Options & Prettier.FileInfoOptions

filepath: systemPath,
};

Expand All @@ -47,7 +47,7 @@ export async function formatFiles(tree: Tree): Promise<void> {
...resolvedOptions,
};

const support = await prettier.getFileInfo(systemPath);
const support = await prettier.getFileInfo(systemPath, options);
if (support.ignored || !support.inferredParser) {
return;
}
Expand Down