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): [prefer-nullish-coalescing]: add support for assignment expressions#5234

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

Conversation

JoshuaKGoldberg
Copy link
Member

PR Checklist

Overview

Adds||= to??= support to the rule by reusing much of the existing rule's logic.

Note that this is a breaking change, as it targets a significant new area of syntax. We'll probably have to wait until 6.X to merge. 😕

omril1 reacted with rocket emoji
@JoshuaKGoldbergJoshuaKGoldberg added the breaking changeThis change will require a new major version to be released labelJun 23, 2022
@nx-cloud
Copy link

nx-cloudbot commentedJun 23, 2022
edited
Loading

☁️ Nx Cloud Report

CI is running/has finished running commands for commit9678f6c. 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 46 targets

Sent with 💌 fromNxCloud.

@typescript-eslint
Copy link
Contributor

Thanks for the PR,@JoshuaKGoldberg!

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. As a thank you, your profile/company logo will be added to our main README which receives thousands of unique visitorsper day.

@netlify
Copy link

netlifybot commentedJun 23, 2022
edited
Loading

Deploy Preview fortypescript-eslint ready!

NameLink
🔨 Latest commit4b965a4
🔍 Latest deploy loghttps://app.netlify.com/sites/typescript-eslint/deploys/6358780652472d0008e0c8e0
😎 Deploy Previewhttps://deploy-preview-5234--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 settings.

@codecov
Copy link

codecovbot commentedJun 23, 2022
edited
Loading

Codecov Report

Merging#5234 (9678f6c) intov6 (c4e0d86) willincrease coverage by0.11%.
The diff coverage is100.00%.

Additional details and impacted files
@@            Coverage Diff             @@##               v6    #5234      +/-   ##==========================================+ Coverage   91.33%   91.44%   +0.11%==========================================  Files         361      355       -6       Lines       12044    12060      +16       Branches     3506     3531      +25     ==========================================+ Hits        11000    11028      +28+ Misses        748      733      -15- Partials      296      299       +3
FlagCoverage Δ
unittest91.44% <100.00%> (+0.11%)⬆️

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

Impacted FilesCoverage Δ
...lint-plugin/src/rules/prefer-nullish-coalescing.ts100.00% <100.00%> (ø)
packages/scope-manager/src/analyze.ts57.89% <0.00%> (-7.49%)⬇️
packages/scope-manager/src/ScopeManager.ts77.21% <0.00%> (-2.54%)⬇️
packages/typescript-estree/src/convert.ts97.59% <0.00%> (-0.30%)⬇️
...ackages/scope-manager/src/referencer/Referencer.ts95.90% <0.00%> (-0.07%)⬇️
packages/utils/src/ts-eslint/CLIEngine.ts33.33% <0.00%> (ø)
packages/utils/src/eslint-utils/RuleCreator.ts75.00% <0.00%> (ø)
...ges/typescript-estree/src/create-program/shared.ts83.33% <0.00%> (ø)
...pt-estree/src/create-program/createWatchProgram.ts78.06% <0.00%> (ø)
...-estree/src/create-program/createProjectProgram.ts93.47% <0.00%> (ø)
... and14 more

@JoshuaKGoldbergJoshuaKGoldberg marked this pull request as ready for reviewJune 23, 2022 16:27
@jakebailey
Copy link
Collaborator

jakebailey commentedJun 23, 2022
edited
Loading

Thanks for working on this! I'm currently running this on the TS codebase (as in some benchmarks, even our downleveled code for?? with explicitundefined/null checks is faster than the boolean conversion;benchmark). I'll just pull this into my local fork for now, if it's not going in any time soon.

(I have to fork in order to skip the rule when the left side is potentially a string/number/boolean; applying the fixes from this rule without review breaks a few things as the behavior is not equivalent.)

JoshuaKGoldberg reacted with rocket emoji

@bradzacher
Copy link
Member

note that technicallya ||= b is equivalent toa || (a = b), nota = a || b.
(similarlya ??= b isa ?? (a = b), nota = a ?? b)

This is a very slight difference that makes them marginally faster because you only assign if it's required.

@bradzacherbradzacher changed the base branch frommain tov6October 26, 2022 01:42
@bradzacherbradzacher added this to the6.0.0 milestoneOct 26, 2022
@bradzacherbradzacher changed the titlefeat(eslint-plugin) [prefer-nullish-coalescing]: add support for assignment expressionsfeat(eslint-plugin): [prefer-nullish-coalescing]: add support for assignment expressionsNov 16, 2022
@bradzacherbradzacher merged commitb8c65fd intotypescript-eslint:v6Nov 16, 2022
@JoshuaKGoldbergJoshuaKGoldberg deleted the prefer-nullish-coalescing-assignments branchNovember 16, 2022 13:23
bradzacher pushed a commit that referenced this pull requestNov 23, 2022
…ignment expressions (#5234)BREAKING CHANGE:Adds an additional class of checks to the rule
@github-actionsgithub-actionsbot locked asresolvedand limited conversation to collaboratorsNov 24, 2022
Sign up for freeto subscribe to this conversation on GitHub. Already have an account?Sign in.
Reviewers

@bradzacherbradzacherbradzacher approved these changes

Assignees
No one assigned
Labels
breaking changeThis change will require a new major version to be released
Projects
None yet
Milestone
6.0.0
Development

Successfully merging this pull request may close these issues.

Enhancement: [prefer-nullish-coalescing] recognize "||="
3 participants
@JoshuaKGoldberg@jakebailey@bradzacher

[8]ページ先頭

©2009-2025 Movatter.jp