Skip to content

Comments

feat: add prefer-destructuring rule#692

Open
Limerio wants to merge 5 commits intooxc-project:mainfrom
Limerio:feat/implement-prefer-destructuring
Open

feat: add prefer-destructuring rule#692
Limerio wants to merge 5 commits intooxc-project:mainfrom
Limerio:feat/implement-prefer-destructuring

Conversation

@Limerio
Copy link
Contributor

@Limerio Limerio commented Feb 16, 2026

Implemented the prefer-destructuring rule to encourage the use of destructuring in TypeScript.
#192

@Limerio
Copy link
Contributor Author

Limerio commented Feb 16, 2026

I'll fix that later!

@Limerio
Copy link
Contributor Author

Limerio commented Feb 17, 2026

The fix has been done and tested on my machine but for a weird reason a rate limiting occurred and I can't retry the workflow. Can someone from the oxc team restart a workflow run, please?

@no-yan
Copy link
Collaborator

no-yan commented Feb 17, 2026

@Limerio CI is still failing on the snapshot tests after the retry. Could you take a look at the failure details in the logs?

@Limerio
Copy link
Contributor Author

Limerio commented Feb 17, 2026

@Limerio CI is still failing on the snapshot tests after the retry. Could you take a look at the failure details in the logs?

Sure! No problem. I'll handle that.

Copy link
Contributor

@camc314 camc314 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The config shape looks incorrect - it should be a tuple:

https://typescript-eslint.io/rules/prefer-destructuring/

I think the tool we use for generating the deserialisation code might struggle to generate it - you might have to come up with some sort of other solution

@Limerio
Copy link
Contributor Author

Limerio commented Feb 17, 2026

The config shape looks incorrect - it should be a tuple:

https://typescript-eslint.io/rules/prefer-destructuring/

I think the tool we use for generating the deserialisation code might struggle to generate it - you might have to come up with some sort of other solution

Okay ! I'll try to fix that

@Limerio
Copy link
Contributor Author

Limerio commented Feb 17, 2026

I've made the changes to what you asked for. I'm not sure if you'll be happy about my changes but that's what I think "the best".
And also I haven't forget about the e2e tests. I tried again to fix it but I haven't found anything relevant. Let's see the pipeline.

@Limerio
Copy link
Contributor Author

Limerio commented Feb 17, 2026

The pipeline failed again. I'll try to find a fix later.

@Limerio Limerio requested a review from camc314 February 17, 2026 20:06
@camc314
Copy link
Contributor

camc314 commented Feb 17, 2026

The pipeline failed again. I'll try to find a fix later.

you should just need to do "just build" and then "pnpm run test -u"

i'm pretty constrained for time, but i'll look when i can.

@Limerio Limerio force-pushed the feat/implement-prefer-destructuring branch from d3f98d4 to a11e145 Compare February 17, 2026 20:15
@Limerio
Copy link
Contributor Author

Limerio commented Feb 17, 2026

The pipeline failed again. I'll try to find a fix later.

you should just need to do "just build" and then "pnpm run test -u"

i'm pretty constrained for time, but i'll look when i can.

You read in my mind that's what I did :) but thanks! Waiting for the checks.

@Limerio Limerio force-pushed the feat/implement-prefer-destructuring branch from a11e145 to d60e12c Compare February 18, 2026 12:41
@Limerio
Copy link
Contributor Author

Limerio commented Feb 18, 2026

All good!

Limerio and others added 5 commits February 21, 2026 22:40
Implemented the `prefer-destructuring` rule to encourage the use of destructuring in TypeScript.
- Introduced tuple-based configuration for `prefer_destructuring`, allowing for more flexible option handling.
- Updated schema to reflect the new array structure for options.
- Enhanced normalization logic to accommodate new tuple formats.
- Adjusted e2e snapshot to reflect changes in diagnostics.
- Updated tests for `prefer_destructuring` to utilize new tuple-based options for configuration, improving flexibility in option handling.
@Limerio Limerio force-pushed the feat/implement-prefer-destructuring branch from d60e12c to 189b35e Compare February 21, 2026 21:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants