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
fix(devkit): add missing parameter to prettier getFileInfo #9577
Conversation
This pull request is being automatically deployed with Vercel (learn more). 🔍 Inspect: https://vercel.com/nrwl/nx-dev/9gZL5Aw9ScS813StbkgwUvFwoK2m [Deployment for bb6f1ea canceled] |
0ee76ab
to
8ff0358
Compare
8ff0358
to
959dfcc
Compare
@@ -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 = { |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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,
There was a problem hiding this comment.
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
25ee660
to
11f6cf3
Compare
11f6cf3
to
bb6f1ea
Compare
Co-authored-by: Jordan CALVI <jordan.calvi.external@atos.net>
This pull request has already been merged/closed. If you experience issues related to these changes, please open a new issue referencing this pull request. |
Current Behavior
When settings "ignorePath": "./.prettierignore" inside .prettierrc file, this is ignored when running nx generator as the second parameter of prettier.getFileInfo is missing, so formatFiles always format all the files and ignore is always false.
Expected Behavior
When setting "ignorePath": "./.prettierignore" inside .prettierrc file, this configuration should be taken into account when running nx generator as the second parameter of prettier.getFileInfo, so formatFiles formatFiles that are not ignored based on the config.
Related Issue(s)
Fixes #9576