refactor(useExportType): dedup code - #10681
Conversation
🦋 Changeset detectedLatest commit: 206c7fc The changes in this PR will be included in the next version bump. This PR includes changesets to release 13 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
✅ Organic activityNo automation signals detected in the analyzed events. This is an automated analysis by AgentScan |
| i Using export type allows compilers to safely drop exports of types without looking for their definition. | ||
|
|
||
| i Safe fix: Extract types into a new export. | ||
| i Safe fix: Separate types into a new export. |
There was a problem hiding this comment.
Using Separate instead of Extract is better because this matches the docs.
ecea055 to
38d256c
Compare
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: ⛔ Files ignored due to path filters (1)
📒 Files selected for processing (6)
✅ Files skipped from review due to trivial changes (1)
🚧 Files skipped from review as they are similar to previous changes (2)
WalkthroughA generic
Possibly related PRs
Suggested reviewers
🚥 Pre-merge checks | ✅ 4✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
Merging this PR will not alter performance
Warning Please fix the performance issues or acknowledge them on CodSpeed. Performance Changes
Tip Investigate this regression by commenting Comparing Footnotes |
ematipico
left a comment
There was a problem hiding this comment.
Remove Split and use either. The rest are nits, but I think the loop I flagged needs to be changed
This PR contains the following updates: | Package | Type | Update | Change | |---|---|---|---| | [@biomejs/biome](https://biomejs.dev) ([source](https://github.com/biomejs/biome/tree/HEAD/packages/@biomejs/biome)) | imports | patch | [`2.5.0` -> `2.5.1`](https://renovatebot.com/diffs/npm/@biomejs%2fbiome/2.5.0/2.5.1) | --- ### Release Notes <details> <summary>biomejs/biome (@​biomejs/biome)</summary> ### [`v2.5.1`](https://github.com/biomejs/biome/blob/HEAD/packages/@​biomejs/biome/CHANGELOG.md#251) [Compare Source](https://github.com/biomejs/biome/compare/@biomejs/biome@2.5.0...@biomejs/biome@2.5.1) ##### Patch Changes - [#​10722](biomejs/biome#10722) [`f8a303d`](biomejs/biome@f8a303d) Thanks [@​denbezrukov](https://github.com/denbezrukov)! - Fixed CSS formatter output for comments between import media queries. ```diff -@​import url("print.css") print, -/* comment */ -screen; +@​import url("print.css") print, /* comment */ screen; ``` - [#​10738](biomejs/biome#10738) [`9fdc560`](biomejs/biome@9fdc560) Thanks [@​JamBalaya56562](https://github.com/JamBalaya56562)! - Fixed [#​9899](biomejs/biome#9899): the `json` and `json-pretty` reporters now escape backslashes in a diagnostic's `location.path`. Previously, paths containing backslashes (such as Windows-style paths) were emitted unescaped, producing invalid JSON. ```diff - "path": "src\account\setup-passkey.tsx", + "path": "src\\account\\setup-passkey.tsx", ``` - [#​10626](biomejs/biome#10626) [`5f837df`](biomejs/biome@5f837df) Thanks [@​tom-groves](https://github.com/tom-groves)! - Fixed [#​10625](biomejs/biome#10625): `biome migrate` no longer emits an invalid trailing comma when a renamed rule (such as `noConsoleLog` → `noConsole`) is the last member of its rule group. Previously this produced malformed output that aborted the migration of a strict-JSON `biome.json` with a parsing error. - [#​10535](biomejs/biome#10535) [`c245f9d`](biomejs/biome@c245f9d) Thanks [@​Mokto](https://github.com/Mokto)! - Fixed a false positive in [`noUnusedVariables`](https://biomejs.dev/linter/rules/no-unused-variables/) for Svelte files where variables referenced inside `{@​html expr}` blocks were incorrectly reported as unused. - [#​10668](biomejs/biome#10668) [`a0f197e`](biomejs/biome@a0f197e) Thanks [@​Netail](https://github.com/Netail)! - The `biome init` command has been updated to include a more up-to-date URL to [the first-party extensions page](https://biomejs.dev/editors/first-party-extensions/). - [#​10667](biomejs/biome#10667) [`d8c3e87`](biomejs/biome@d8c3e87) Thanks [@​Netail](https://github.com/Netail)! - Fixed [#​10664](biomejs/biome#10664): [useErrorCause](https://biomejs.dev/linter/rules/use-error-cause/) now correctly detects a shorthand property. - [#​10696](biomejs/biome#10696) [`ef2373f`](biomejs/biome@ef2373f) Thanks [@​ematipico](https://github.com/ematipico)! - Fixed [#​9566](biomejs/biome#9566). Improved how the Biome Language Server loads multiple configuration files inside a workspace. - [#​10705](biomejs/biome#10705) [`4ccb410`](biomejs/biome@4ccb410) Thanks [@​ematipico](https://github.com/ematipico)! - Fixed [#​10652](biomejs/biome#10652). Biome plugins are now properly filtered when using `--only` and `--skip` flags. - [#​10669](biomejs/biome#10669) [`aa0a6eb`](biomejs/biome@aa0a6eb) Thanks [@​Netail](https://github.com/Netail)! - Fixed [#​10651](biomejs/biome#10651): [useInlineScriptId](https://biomejs.dev/linter/rules/use-inline-script-id/) now correctly trims trivia to detect if an id attribute has been set. - [#​10689](biomejs/biome#10689) [`844b1be`](biomejs/biome@844b1be) Thanks [@​ematipico](https://github.com/ematipico)! - Fixed [#​10658](biomejs/biome#10658). The issue was caused by the "Go-to definition" editor feature, which was enabled by default. The feature is now **disabled by default**. To work, the feature triggers the scanner to build the module graph. This caused memory leak issues in cases where Biome starts in the home directory to modify files. If you relied on this new feature, you must now turn on using the \[editor settings] of the extension e.g. [Zed](https://biomejs.dev/reference/zed/#goto_definition) and [VSCode](https://biomejs.dev/reference/vscode/#biomegotodefinition). - [#​10695](biomejs/biome#10695) [`043fbb5`](biomejs/biome@043fbb5) Thanks [@​ematipico](https://github.com/ematipico)! - Fixed [#​10674](biomejs/biome#10674). Biome now throws an error when the field `level` is missing from a rule option. - [#​10712](biomejs/biome#10712) [`5941df2`](biomejs/biome@5941df2) Thanks [@​Conaclos](https://github.com/Conaclos)! - Improved the diagnostic and the documentation of [`useFlatMap`](https://biomejs.dev/linter/rules/use-flat-map/). - [#​10615](biomejs/biome#10615) [`23814f1`](biomejs/biome@23814f1) Thanks [@​qwertycxz](https://github.com/qwertycxz)! - Improved the DX the JSON schema when it's used by certain code editors like VSCode. - [#​10688](biomejs/biome#10688) [`ec69489`](biomejs/biome@ec69489) Thanks [@​ematipico](https://github.com/ematipico)! - Fixed a bug where the Biome Daemon did not correctly shut down when the editor was closed during an in-progress operation, especially while scanning. - [#​10701](biomejs/biome#10701) [`6c2e0d7`](biomejs/biome@6c2e0d7) Thanks [@​ematipico](https://github.com/ematipico)! - Fixed [#​10694](biomejs/biome#10694). The Biome Language Server no longer prints an error when the user hovers a variable imported from node\_modules. - [#​10681](biomejs/biome#10681) [`888515b`](biomejs/biome@888515b) Thanks [@​Conaclos](https://github.com/Conaclos)! - Fixed [`useExportType`](https://biomejs.dev/linter/rules/use-export-type/) that reported useless details in some diagnostics. - [#​10220](biomejs/biome#10220) [`3694a13`](biomejs/biome@3694a13) Thanks [@​theBGuy](https://github.com/theBGuy)! - Fixed [`useAnchorContent`](https://biomejs.dev/linter/rules/use-anchor-content/) false positive for `<a>` elements used as render prop values (e.g. `render={<a href="..." />}`), a pattern where the receiving component renders its children inside the anchor element. - [#​10702](biomejs/biome#10702) [`98823fb`](biomejs/biome@98823fb) Thanks [@​ematipico](https://github.com/ematipico)! - Fixed [#​10612](biomejs/biome#10612). The Biome parser now correctly parses processing instructions. The following SVG doesn't throw errors anymore: ```svg <?xml version="1.0" encoding="UTF-8" ?> <svg></svg> ``` </details> --- ### Configuration 📅 **Schedule**: (UTC) - Branch creation - At any time (no schedule defined) - Automerge - At any time (no schedule defined) 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box --- This PR has been generated by [Mend Renovate](https://github.com/renovatebot/renovate). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0My4yMzQuMCIsInVwZGF0ZWRJblZlciI6IjQzLjIzNC4wIiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6W119--> Reviewed-on: https://git.oirnoir.dev/OIRNOIR/YouTube-Helper-Server/pulls/21
This PR contains the following updates: | Package | Type | Update | Change | |---|---|---|---| | [@biomejs/biome](https://biomejs.dev) ([source](https://github.com/biomejs/biome/tree/HEAD/packages/@biomejs/biome)) | imports | patch | [`2.5.0` -> `2.5.1`](https://renovatebot.com/diffs/npm/@biomejs%2fbiome/2.5.0/2.5.1) | --- ### Release Notes <details> <summary>biomejs/biome (@​biomejs/biome)</summary> ### [`v2.5.1`](https://github.com/biomejs/biome/blob/HEAD/packages/@​biomejs/biome/CHANGELOG.md#251) [Compare Source](https://github.com/biomejs/biome/compare/@biomejs/biome@2.5.0...@biomejs/biome@2.5.1) ##### Patch Changes - [#​10722](biomejs/biome#10722) [`f8a303d`](biomejs/biome@f8a303d) Thanks [@​denbezrukov](https://github.com/denbezrukov)! - Fixed CSS formatter output for comments between import media queries. ```diff -@​import url("print.css") print, -/* comment */ -screen; +@​import url("print.css") print, /* comment */ screen; ``` - [#​10738](biomejs/biome#10738) [`9fdc560`](biomejs/biome@9fdc560) Thanks [@​JamBalaya56562](https://github.com/JamBalaya56562)! - Fixed [#​9899](biomejs/biome#9899): the `json` and `json-pretty` reporters now escape backslashes in a diagnostic's `location.path`. Previously, paths containing backslashes (such as Windows-style paths) were emitted unescaped, producing invalid JSON. ```diff - "path": "src\account\setup-passkey.tsx", + "path": "src\\account\\setup-passkey.tsx", ``` - [#​10626](biomejs/biome#10626) [`5f837df`](biomejs/biome@5f837df) Thanks [@​tom-groves](https://github.com/tom-groves)! - Fixed [#​10625](biomejs/biome#10625): `biome migrate` no longer emits an invalid trailing comma when a renamed rule (such as `noConsoleLog` → `noConsole`) is the last member of its rule group. Previously this produced malformed output that aborted the migration of a strict-JSON `biome.json` with a parsing error. - [#​10535](biomejs/biome#10535) [`c245f9d`](biomejs/biome@c245f9d) Thanks [@​Mokto](https://github.com/Mokto)! - Fixed a false positive in [`noUnusedVariables`](https://biomejs.dev/linter/rules/no-unused-variables/) for Svelte files where variables referenced inside `{@​html expr}` blocks were incorrectly reported as unused. - [#​10668](biomejs/biome#10668) [`a0f197e`](biomejs/biome@a0f197e) Thanks [@​Netail](https://github.com/Netail)! - The `biome init` command has been updated to include a more up-to-date URL to [the first-party extensions page](https://biomejs.dev/editors/first-party-extensions/). - [#​10667](biomejs/biome#10667) [`d8c3e87`](biomejs/biome@d8c3e87) Thanks [@​Netail](https://github.com/Netail)! - Fixed [#​10664](biomejs/biome#10664): [useErrorCause](https://biomejs.dev/linter/rules/use-error-cause/) now correctly detects a shorthand property. - [#​10696](biomejs/biome#10696) [`ef2373f`](biomejs/biome@ef2373f) Thanks [@​ematipico](https://github.com/ematipico)! - Fixed [#​9566](biomejs/biome#9566). Improved how the Biome Language Server loads multiple configuration files inside a workspace. - [#​10705](biomejs/biome#10705) [`4ccb410`](biomejs/biome@4ccb410) Thanks [@​ematipico](https://github.com/ematipico)! - Fixed [#​10652](biomejs/biome#10652). Biome plugins are now properly filtered when using `--only` and `--skip` flags. - [#​10669](biomejs/biome#10669) [`aa0a6eb`](biomejs/biome@aa0a6eb) Thanks [@​Netail](https://github.com/Netail)! - Fixed [#​10651](biomejs/biome#10651): [useInlineScriptId](https://biomejs.dev/linter/rules/use-inline-script-id/) now correctly trims trivia to detect if an id attribute has been set. - [#​10689](biomejs/biome#10689) [`844b1be`](biomejs/biome@844b1be) Thanks [@​ematipico](https://github.com/ematipico)! - Fixed [#​10658](biomejs/biome#10658). The issue was caused by the "Go-to definition" editor feature, which was enabled by default. The feature is now **disabled by default**. To work, the feature triggers the scanner to build the module graph. This caused memory leak issues in cases where Biome starts in the home directory to modify files. If you relied on this new feature, you must now turn on using the \[editor settings] of the extension e.g. [Zed](https://biomejs.dev/reference/zed/#goto_definition) and [VSCode](https://biomejs.dev/reference/vscode/#biomegotodefinition). - [#​10695](biomejs/biome#10695) [`043fbb5`](biomejs/biome@043fbb5) Thanks [@​ematipico](https://github.com/ematipico)! - Fixed [#​10674](biomejs/biome#10674). Biome now throws an error when the field `level` is missing from a rule option. - [#​10712](biomejs/biome#10712) [`5941df2`](biomejs/biome@5941df2) Thanks [@​Conaclos](https://github.com/Conaclos)! - Improved the diagnostic and the documentation of [`useFlatMap`](https://biomejs.dev/linter/rules/use-flat-map/). - [#​10615](biomejs/biome#10615) [`23814f1`](biomejs/biome@23814f1) Thanks [@​qwertycxz](https://github.com/qwertycxz)! - Improved the DX the JSON schema when it's used by certain code editors like VSCode. - [#​10688](biomejs/biome#10688) [`ec69489`](biomejs/biome@ec69489) Thanks [@​ematipico](https://github.com/ematipico)! - Fixed a bug where the Biome Daemon did not correctly shut down when the editor was closed during an in-progress operation, especially while scanning. - [#​10701](biomejs/biome#10701) [`6c2e0d7`](biomejs/biome@6c2e0d7) Thanks [@​ematipico](https://github.com/ematipico)! - Fixed [#​10694](biomejs/biome#10694). The Biome Language Server no longer prints an error when the user hovers a variable imported from node\_modules. - [#​10681](biomejs/biome#10681) [`888515b`](biomejs/biome@888515b) Thanks [@​Conaclos](https://github.com/Conaclos)! - Fixed [`useExportType`](https://biomejs.dev/linter/rules/use-export-type/) that reported useless details in some diagnostics. - [#​10220](biomejs/biome#10220) [`3694a13`](biomejs/biome@3694a13) Thanks [@​theBGuy](https://github.com/theBGuy)! - Fixed [`useAnchorContent`](https://biomejs.dev/linter/rules/use-anchor-content/) false positive for `<a>` elements used as render prop values (e.g. `render={<a href="..." />}`), a pattern where the receiving component renders its children inside the anchor element. - [#​10702](biomejs/biome#10702) [`98823fb`](biomejs/biome@98823fb) Thanks [@​ematipico](https://github.com/ematipico)! - Fixed [#​10612](biomejs/biome#10612). The Biome parser now correctly parses processing instructions. The following SVG doesn't throw errors anymore: ```svg <?xml version="1.0" encoding="UTF-8" ?> <svg></svg> ``` </details> --- ### Configuration 📅 **Schedule**: (UTC) - Branch creation - At any time (no schedule defined) - Automerge - At any time (no schedule defined) 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box --- This PR has been generated by [Mend Renovate](https://github.com/renovatebot/renovate). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0My4yMzQuMCIsInVwZGF0ZWRJblZlciI6IjQzLjIzNC4wIiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6W119--> Reviewed-on: https://git.oirnoir.dev/OIRNOIR/YouTube-Helper-Client/pulls/8
Summary
Follow-up of #10561 that deduplicates code.
I added a new utility function
split_separated_listinbiome_analyzethat allows splitting a list into two lists based on a function.This allowed me to reduce some duplications in
useExportTypeanduseImportType.I solved the duplication I talked in a comment by adding a new node union
AnyJsExportSpecifierand by removing useless diagnostic details (the detail reported that an export with atypekeyword was a type).Test Plan
Expecting a green CI.
Docs
No user-facing changes.