Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

feat(eslint-plugin): add new extended ruleprefer-destructuring#7117

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged

Conversation

@seiyab
Copy link
Contributor

@seiyabseiyab commentedJun 18, 2023
edited
Loading

PR Checklist

Overview

Add a new base rule extension@typescript-eslint/prefer-destructuring to resolve following issues.

#723 requests two things: 1. keep type annotation, 2. add an option to allow non-destructuring assignment for type annotated ones.
For the first one, I just disable auto fixer for declaration with type annotation, rather than providing correct auto fix. It's just because difficulty and maitainability.
For the second one, I addenforceForDeclarationWithTypeAnnotation option. I set default valuefalse because I agree with "annotations on destructured variables aren't very pretty" in the issue.

#1931 requests type-aware version and I have implemented it for numeric index access for non-iterable object, that is the only case reported in the issue (excluding comments that are duplication of#723).
There is a notable thing for it. I treated numeric index access for non-iterable object as renamed one. So it is affected byenforceForRenamedProperties option.

chalkygames123 reacted with heart emoji
@typescript-eslint
Copy link
Contributor

Thanks for the PR,@seiyab!

typescript-eslint is a 100% community driven project, and we are incredibly grateful that you are contributing to that community.

The core maintainers work on this in their personal time, so please understand that it may not be possible for them to review your work immediately.

Thanks again!


🙏Please, if you or your company is finding typescript-eslint valuable, help us sustain the project by sponsoring it transparently onhttps://opencollective.com/typescript-eslint.

@netlify
Copy link

netlifybot commentedJun 18, 2023
edited
Loading

Deploy Preview fortypescript-eslint ready!

NameLink
🔨 Latest commit77b6704
🔍 Latest deploy loghttps://app.netlify.com/sites/typescript-eslint/deploys/64da426db8f1bd0008bf99dc
😎 Deploy Previewhttps://deploy-preview-7117--typescript-eslint.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to yourNetlify site configuration.

@seiyabseiyab changed the titlePrefer destructuringAdd prefer destructuring extensionJun 18, 2023
@nx-cloud
Copy link

nx-cloudbot commentedJun 18, 2023
edited
Loading

☁️ Nx Cloud Report

CI is running/has finished running commands for commit77b6704. As they complete they will appear below. Click to see the status, the terminal output, and the build insights.

📂 See all runs for this branch


✅ Successfully ran 37 targets

Sent with 💌 fromNxCloud.

@seiyabseiyab changed the titleAdd prefer destructuring extensionfeat(eslint-plugin): add new extended ruleprefer-destructuringJun 20, 2023
@seiyabseiyab marked this pull request as ready for reviewJune 20, 2023 13:35
@codecov
Copy link

codecovbot commentedJun 20, 2023
edited
Loading

Codecov Report

Merging#7117 (77b6704) intomain (479f9f6) willincrease coverage by0.06%.
The diff coverage is100.00%.

Additional details and impacted files
@@            Coverage Diff             @@##             main    #7117      +/-   ##==========================================+ Coverage   85.25%   85.31%   +0.06%==========================================  Files         386      387       +1       Lines       13358    13417      +59       Branches     3943     3962      +19     ==========================================+ Hits        11388    11447      +59  Misses       1593     1593                Partials      377      377
FlagCoverage Δ
unittest85.31% <100.00%> (+0.06%)⬆️

Flags with carried forward coverage won't be shown.Click here to find out more.

Files ChangedCoverage Δ
...ckages/eslint-plugin/src/util/getESLintCoreRule.ts75.00% <ø> (ø)
...es/eslint-plugin/src/rules/prefer-destructuring.ts100.00% <100.00%> (ø)

@JoshuaKGoldberg
Copy link
Member

I also took the liberty of merging in frommain, sincev6 was merged & changed a few internals after this PR was sent. Cheers!

@seiyab
Copy link
ContributorAuthor

I have responded to your requests🚀

JoshuaKGoldberg reacted with rocket emoji

@JoshuaKGoldbergJoshuaKGoldberg removed the awaiting responseIssues waiting for a reply from the OP or another party labelAug 12, 2023
JoshuaKGoldberg
JoshuaKGoldberg previously approved these changesAug 12, 2023
Copy link
Member

@JoshuaKGoldbergJoshuaKGoldberg left a comment

Choose a reason for hiding this comment

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

LGTM, thanks for both sending & updating it (with so many tests)! 🔥

I'll defer to an additional review from @typescript-eslint/triage-team because this is the first instance I can find of callingbaseRule.create in two different potential ways.

seiyab reacted with heart emoji
@JoshuaKGoldbergJoshuaKGoldberg added the 1 approval>=1 team member has approved this PR; we're now leaving it open for more reviews before we merge labelAug 12, 2023
- naming of options- using nullish coalescing assignment
@seiyab
Copy link
ContributorAuthor

seiyab commentedAug 14, 2023
edited
Loading

Thank you for your review.
I have responded to#7117 (comment) and#7117 (comment)but I'm wondering whycreate(context, [enabledTypes, options = {}]) { get uncovered renaming a variable.

@seiyab
Copy link
ContributorAuthor

@JoshuaKGoldberg
Could you tell me the current status?

@JoshuaKGoldberg
Copy link
Member

JoshuaKGoldberg commentedOct 11, 2023
edited
Loading

Heh, I was hoping for an additional review, but it seems that everyone is slammed right now. Let's merge as-is 😄. Thanks for the ping!

seiyab reacted with heart emoji

Copy link
Member

@JoshuaKGoldbergJoshuaKGoldberg left a comment

Choose a reason for hiding this comment

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

Large ship with caption 'it's shipping time'

seiyab reacted with rocket emoji
@JoshuaKGoldbergJoshuaKGoldberg merged commit3c6379b intotypescript-eslint:mainOct 11, 2023
@github-actionsgithub-actionsbot locked asresolvedand limited conversation to collaboratorsOct 19, 2023
Sign up for freeto subscribe to this conversation on GitHub. Already have an account?Sign in.

Reviewers

@JoshuaKGoldbergJoshuaKGoldbergJoshuaKGoldberg approved these changes

@rubiesontheskyrubiesontheskyAwaiting requested review from rubiesonthesky

Assignees

No one assigned

Labels

1 approval>=1 team member has approved this PR; we're now leaving it open for more reviews before we mergeenhancement: new base rule extensionNew base rule extension required to handle a TS specific case

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

4 participants

@seiyab@JoshuaKGoldberg@rubiesonthesky@bradzacher

[8]ページ先頭

©2009-2025 Movatter.jp