-
Notifications
You must be signed in to change notification settings - Fork 3.7k
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
chore: use prettier instead of clang-format #7014
Conversation
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.
Two questions, but overall lgtm and I'm happy to get rid of our use of that random clang-format
github action.
// Assign 'this' to a variable for use in the tooltip closure below. | ||
const thisBlock = this; | ||
this.setTooltip(function () { | ||
this.setTooltip(() => { |
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.
Did prettier rewrite this into an arrow function, or did you do that?
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 did this, to resolve lint errors related to redefining this
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.
Oh good. I was not stoked about automated rewriting of functions into arrow functions.
if (context.payload.pull_request === undefined) { | ||
throw new Error("Can't get pull_request payload. " + | ||
'Check a request reviewer event was triggered.'); | ||
- name: Assign requested reviewer |
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.
Prettier changed indentation in a bunch of yaml files. Please confirm that it's still file/the indentation is irrelevant.
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.
Yup, I ran two of them through a yaml validator/formatter and they pass, and the old contents are reformatted to look like the new contents
LGTM once you fix conflicts |
2a33086
to
370f0da
Compare
I've fixed conflicts, re-run prettier after rebasing, and removed the requirement of |
The basics
npm run format
andnpm run lint
The details
Resolves
Fixes #6993 (by using prettier instead of clang-format)
Proposed Changes
This PR best reviewed commit-by-commit:
core/
blocks/
Behavior Before Change
Behavior After Change
No actual behavior changes.
Notable format changes:
function
keyword in anonymous functions. This makes it consistent that there is always a space after thefunction
keyword just like every other keywordReason for Changes
Clang-format doesn't handle TypeScript well. We were having to disable it entirely in the
blocks/
directory. Indeed, there is even an issue where we note something that clang-format mangled. Prettier handles this better and is more readable.Test Coverage
Tests pass. Manual inspection of files. I spot-checked several hundred files for formatting problems.
Pushed a commit with bad format to make sure the github action worked and it did.
Documentation
Additional Information