-
Notifications
You must be signed in to change notification settings - Fork 3.7k
[No QA] Fix prettier import sorting broken by @prettier/plugin-oxc #83008
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
Merged
Merged
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
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 hidden or 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 hidden or 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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or 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
34 changes: 34 additions & 0 deletions
34
...sort-imports/@trivago+prettier-plugin-sort-imports+6.0.2+001+add-oxc-parser-support.patch
This file contains hidden or 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,34 @@ | ||
| diff --git a/node_modules/@trivago/prettier-plugin-sort-imports/lib/src/index.js b/node_modules/@trivago/prettier-plugin-sort-imports/lib/src/index.js | ||
| index d2d7e8d..397aa3b 100644 | ||
| --- a/node_modules/@trivago/prettier-plugin-sort-imports/lib/src/index.js | ||
| +++ b/node_modules/@trivago/prettier-plugin-sort-imports/lib/src/index.js | ||
| @@ -10,6 +10,10 @@ import { createEmberParsers } from './utils/create-ember-parsers.js'; | ||
| import { createSvelteParsers } from './utils/create-svelte-parsers.js'; | ||
| const emberParsers = await createEmberParsers(); | ||
| const svelteParsers = await createSvelteParsers(); | ||
| + | ||
| +let oxcParsers = {}; | ||
| +try { oxcParsers = (await import('@prettier/plugin-oxc')).parsers; } catch {} | ||
| + | ||
| const options = { | ||
| importOrderExclude: { | ||
| type: 'path', | ||
| @@ -122,6 +126,18 @@ export default { | ||
| }, | ||
| } | ||
| : {}), | ||
| + ...(oxcParsers.oxc | ||
| + ? { | ||
| + oxc: { | ||
| + ...oxcParsers.oxc, | ||
| + preprocess: defaultPreprocessor, | ||
| + }, | ||
| + 'oxc-ts': { | ||
| + ...oxcParsers['oxc-ts'], | ||
| + preprocess: defaultPreprocessor, | ||
| + }, | ||
| + } | ||
| + : {}), | ||
| }, | ||
| options, | ||
| }; |
This file contains hidden or 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| # `@trivago/prettier-plugin-sort-imports` patches | ||
|
|
||
| ### [@trivago+prettier-plugin-sort-imports+6.0.2+001+add-oxc-parser-support.patch](@trivago+prettier-plugin-sort-imports+6.0.2+001+add-oxc-parser-support.patch) | ||
|
|
||
| - Reason: | ||
|
|
||
| ``` | ||
| @prettier/plugin-oxc registers oxc and oxc-ts parsers that override the built-in | ||
| babel and typescript parsers for JS/TS files. Since the sort-imports plugin only | ||
| attaches its import-sorting preprocess hook to babel/typescript/flow/vue parsers, | ||
| import sorting is silently skipped when OXC is active. This patch adds oxc and | ||
| oxc-ts parser entries that compose OXC's parser with the sort-imports preprocess hook. | ||
| ``` | ||
|
|
||
| - Upstream PR/issue: https://github.com/trivago/prettier-plugin-sort-imports/pull/398 | ||
| - E/App issue: https://github.com/Expensify/App/issues/82687 | ||
| - PR introducing patch: https://github.com/Expensify/App/pull/83008 |
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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
2 changes: 1 addition & 1 deletion
2
src/components/MultifactorAuthentication/Context/stateReducer.ts
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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
Oops, something went wrong.
Oops, something went wrong.
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.
Moving
@src/polyfills/PromiseWithResolversbelow other imports allows those modules to execute before the polyfill is installed, which can break test bootstrap in runtimes that do not yet providePromise.withResolversnatively (the file comment already documents this dependency for Onyx setup). This commit introduced that reordering, so the polyfill should remain the first import injest/setup.tsto avoid order-dependent initialization failures.Useful? React with 👍 / 👎.
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.
If tests still pass I think it's fine. But generally it might be right about this.