-
-
Notifications
You must be signed in to change notification settings - Fork 32.5k
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
[test] Introduce prettier into CI pipeline #12564
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Do we run prettier twice here? Would it be faster to run it once and to execute
git diff --exit-code
?Also, I think that we scope the new check to the TypeScript files :).
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.
find
always did pipe*.d.ts
and*.tsx
to theprettier
script.eslint
only processesjsx?
files though as far as I know.I was never really a fan of
eslint-plugin-prettier
. Mostly this comes down to personal preference but also some actual minor issues:eslint
has no parser forts
files which makeseslint --fix
witheslint-plugin-prettier
useless for ts files.eslint-plugin-prettier
allowsprettier
configuration with.eslintrc
which is ignored by ide plugins.prettier:files
is just a helper method at the moment which lists files that should be formatted. It is not actually runningprettier --write
.prettier --write
should never be used in a CI environment. That's the hole purpose of--list-different
. Combine--write
withgit diff
while reducing I/O operations.It was intended that the new check enforces a consistent code style across ts and js file. Just like the existing
prettier
scripts already formatstsx?
files.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.
Now I understood what you mean. Since we run prettier via
eslint
we would run it here again on alljsx?
files. I removedeslint-plugin-prettier
to removed this redundancy.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.
I never used that. I have never been satisfied with the output.
Most people configure their editor to run eslint. The advantage of this plugin is that you know up front that you need to run prettier, it's just like another eslint rule. At least, it's my workflow. I don't automatically run prettier on save. This data is interesting: https://npm-stat.com/charts.html?package=eslint-plugin-prettier&package=prettier.
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.
Well prettier supports more than
jsx?
while eslint only runs onjsx?
. Typescript support might explain some difference.I didn't think about editor integration though and while I also don't use formatOnSave I do frequently press the format hotkey.