-
Notifications
You must be signed in to change notification settings - Fork 465
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
Feature/pass filename to prettier #620
Feature/pass filename to prettier #620
Conversation
Based on the name of the currently formatted file, prettier is now able to use different parsers on a filecollection containing mixing resources such as js/html/css and the like by peeking at the actual filename.
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.
Awesome! File
is meant to really be optional and nullable, so some changes are needed for that, but otherwise looks good.
lib/src/main/java/com/diffplug/spotless/npm/PrettierFormatterStep.java
Outdated
Show resolved
Hide resolved
and create a separate instance dedicated to support filenames
(and since we already handle the "empty" filename correctly, there is nothing to done)
@@ -38,7 +38,8 @@ void install() { | |||
} | |||
|
|||
Process start() { | |||
return npm("start"); | |||
// adding --scripts-prepend-node-path=true due to https://github.com/diffplug/spotless/issues/619#issuecomment-648018679 | |||
return npm("start", "--scripts-prepend-node-path=true"); |
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.
As a reaction to the discussion in #619 - make sure we always use the node binary associated with the npm binary we use.
…epends on: - the content that gets passed in - the filename - the content which is expected And that's it - there's no filename in and different filename out. So there should only be 3 arguments, not 4. Also brought format to be consistent with StepHarness.
…o need to bring in that complexity.
I made some tweaks to |
Awesome, thank you for that - the changes make sense and reducing the degrees of freedom in |
Published in maven |
Here is my take for fixing #448 - pass the filename into prettier to let it choose the correct formatter on its own.