-
-
Notifications
You must be signed in to change notification settings - Fork 763
perf(linter/plugins): remove code for renaming global values #16610
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
perf(linter/plugins): remove code for renaming global values #16610
Conversation
How to use the Graphite Merge QueueAdd either label to this PR to merge it via the merge queue:
You must have a Graphite account in order to use the merge queue. Sign up using this link. An organization admin has enabled the Graphite Merge Queue in this repository. Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue. This stack of pull requests is managed by Graphite. Learn more about stacking. |
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.
Pull request overview
This PR removes a workaround in the TypeScript plugin code that was previously needed to rename misspelled global values from "writeable" to "writable". After PR #16609 fixed the serialization in the Rust code (using #[serde(rename_all = "lowercase")] on the GlobalValue enum), the JSON now correctly contains "writable" instead of "writeable", making this TypeScript workaround obsolete.
Key Changes
- Removed the loop that renamed "writeable" to "writable" in deserialized globals
- Simplified control flow by using if-else instead of early return pattern
- Removed unused
Writabletype import fromtype-fest - Enhanced debug assertions to include array type check
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
"Writeable" is a mis-spelling. In addition: Oxlint docs say: > You may also use `"writeable"` or `true` to represent `"writable"`. [ESLint's docs](https://eslint.org/docs/v8.x/use/configure/language-options#using-configuration-files-1) state "writable" (without an "e") as the name of the option. This suggests that "writable" is the "real" name of this option, and "writeable" (with an "e") is an alias provided for backwards compat. Therefore, I think it makes more sense to call the enum variant `GlobalValue::Writable` (with the correct spelling). Main motivation is that it means globals get serialized with the right spelling, allowing removing a JS-side workaround from JS plugins code (#16610). For consistency, I've changed "writeable" to "writable" in all test cases, except for 1 test which specifically aims to check that that "legacy" spelling is accepted. https://github.com/oxc-project/oxc/blob/00c5614d1f1bb3465ba7aa5ad668a936b8ec1266/crates/oxc_linter/src/config/globals.rs#L161-L168
00c5614 to
913b1b3
Compare
4f65b42 to
74641bb
Compare
74641bb to
91d17e3
Compare
Merge activity
|
After #16609, the value of globals is serialized correctly ("writable" not "writeable"), so this workaround is no longer required. Remove it.
91d17e3 to
0241b9a
Compare
"Writeable" is a mis-spelling. In addition: Oxlint docs say: > You may also use `"writeable"` or `true` to represent `"writable"`. [ESLint's docs](https://eslint.org/docs/v8.x/use/configure/language-options#using-configuration-files-1) state "writable" (without an "e") as the name of the option. This suggests that "writable" is the "real" name of this option, and "writeable" (with an "e") is an alias provided for backwards compat. Therefore, I think it makes more sense to call the enum variant `GlobalValue::Writable` (with the correct spelling). Main motivation is that it means globals get serialized with the right spelling, allowing removing a JS-side workaround from JS plugins code (#16610). For consistency, I've changed "writeable" to "writable" in all test cases, except for 1 test which specifically aims to check that that "legacy" spelling is accepted. https://github.com/oxc-project/oxc/blob/00c5614d1f1bb3465ba7aa5ad668a936b8ec1266/crates/oxc_linter/src/config/globals.rs#L161-L168
After #16609, the value of globals is serialized correctly ("writable" not "writeable"), so this workaround is no longer required. Remove it.
…project#16609) "Writeable" is a mis-spelling. In addition: Oxlint docs say: > You may also use `"writeable"` or `true` to represent `"writable"`. [ESLint's docs](https://eslint.org/docs/v8.x/use/configure/language-options#using-configuration-files-1) state "writable" (without an "e") as the name of the option. This suggests that "writable" is the "real" name of this option, and "writeable" (with an "e") is an alias provided for backwards compat. Therefore, I think it makes more sense to call the enum variant `GlobalValue::Writable` (with the correct spelling). Main motivation is that it means globals get serialized with the right spelling, allowing removing a JS-side workaround from JS plugins code (oxc-project#16610). For consistency, I've changed "writeable" to "writable" in all test cases, except for 1 test which specifically aims to check that that "legacy" spelling is accepted. https://github.com/oxc-project/oxc/blob/00c5614d1f1bb3465ba7aa5ad668a936b8ec1266/crates/oxc_linter/src/config/globals.rs#L161-L168
…ject#16610) After oxc-project#16609, the value of globals is serialized correctly ("writable" not "writeable"), so this workaround is no longer required. Remove it.

After #16609, the value of globals is serialized correctly ("writable" not "writeable"), so this workaround is no longer required. Remove it.