Use oxfmt to format code#2973
Conversation
|
Thanks for the pull request, @bradenmacdonald! This repository is currently maintained by Once you've gone through the following steps feel free to tag them in a comment and let them know that your changes are ready for engineering review. 🔘 Get product approvalIf you haven't already, check this list to see if your contribution needs to go through the product review process.
🔘 Provide contextTo help your reviewers and other members of the community understand the purpose and larger context of your changes, feel free to add as much of the following information to the PR description as you can:
🔘 Get a green buildIf one or more checks are failing, continue working on your changes until this is no longer the case and your build turns green. 🔘 Update the status of your PRYour PR is currently marked as a draft. After completing the steps above, update its status by clicking "Ready for Review", or removing "WIP" from the title, as appropriate. Where can I find more information?If you'd like to get more details on all aspects of the review process for open source pull requests (OSPRs), check out the following resources: When can I expect my changes to be merged?Our goal is to get community contributions seen and reviewed as efficiently as possible. However, the amount of time that it takes to review and merge a PR can vary significantly based on factors such as:
💡 As a result it may take up to several weeks or months to complete a review and merge your PR. |
bf5d120 to
59c992f
Compare
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## master #2973 +/- ##
==========================================
- Coverage 95.56% 95.47% -0.09%
==========================================
Files 1349 1349
Lines 31155 31062 -93
Branches 7064 6897 -167
==========================================
- Hits 29773 29657 -116
- Misses 1320 1342 +22
- Partials 62 63 +1 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
Based on this diff, I am not recommending adopting oxfmt at this time, as it creates too large of diff and is too prescriptive. I think a better approach will be to use ESlint Stylistic only for code formatting, and oxlint for linting. |
| ModalPopup, | ||
| useToggle, | ||
| } from '@openedx/paragon'; | ||
| import { ActionRow, Card, Form, Icon, IconButton, ModalPopup, useToggle } from '@openedx/paragon'; |
There was a problem hiding this comment.
I don't like that oxfmt forces imports to be on one line, if they could possibly fit on one line, even if the author chose to have them on individual lines.
| proctoredExamSettingsUrl={proctoredExamSettingsUrl} | ||
| showOtherSettings | ||
| > | ||
| <HelpSidebar courseId={courseId} proctoredExamSettingsUrl={proctoredExamSettingsUrl} showOtherSettings> |
There was a problem hiding this comment.
Another example of forcing one line when the author preferred multiple lines for readability.
Description
This is a preview PR to show what the diff would look like if we wanted to switch from using eslint checks to oxmft as our code formatter.
There are rather a lot of changes, because oxfmt is designed to copy prettier, not eslint's formatter. Since we weren't using prettier, it results in quite a lot of changes. Changing the resulting format is not possible as neither prettier nor oxfmt support many options (on purpose).
The main philosophical difference is that prettier/oxfmt always put things on one line if it's possible without going over the line length, whereas eslint allowed you to "choose" to use a multi-line format or not for each thing, at your discretion.