Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork2.8k
feat(eslint-plugin): [prefer-nullish-coalescing] add support for assignment expressions#10152
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
feat(eslint-plugin): [prefer-nullish-coalescing] add support for assignment expressions#10152
Uh oh!
There was an error while loading.Please reload this page.
Conversation
Thanks for the PR,@abrahamguo! 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. |
netlifybot commentedOct 15, 2024 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
✅ Deploy Preview fortypescript-eslint ready!
To edit notification comments on pull requests, go to yourNetlify site configuration. |
nx-cloudbot commentedOct 15, 2024 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
☁️ Nx Cloud ReportCI is running/has finished running commands for commit22841da. As they complete they will appear below. Click to see the status, the terminal output, and the build insights. 📂 See all runs for this CI Pipeline Execution ✅ Successfully ran 2 targetsSent with 💌 fromNxCloud. |
3dd873d
to1e3281a
Comparecodecovbot commentedOct 16, 2024 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@## main #10152 +/- ##==========================================- Coverage 86.18% 86.16% -0.02%========================================== Files 430 430 Lines 15029 15031 +2 Branches 4360 4361 +1 ==========================================- Hits 12952 12951 -1- Misses 1725 1728 +3 Partials 352 352
Flags with carried forward coverage won't be shown.Click here to find out more.
|
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.
Looks pretty reasonable! Requesting changes on keeping tests more precise. Thanks! ⚒️
@@ -171,7 +171,107 @@ export default createRule<Options, MessageIds>({ | |||
}); | |||
} | |||
// todo: rename to something more specific? |
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.
todo
What's the resolution here? FWIW I don't mind the name as-is.
@@ -197,7 +197,7 @@ function validateConfigSchema( | |||
config: TesterConfigWithDefaults, | |||
source: string, | |||
): void { | |||
validateSchema||= ajv.compile(flatConfigSchema); | |||
validateSchema??= ajv.compile(flatConfigSchema); |
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.
[Praise] Nice, a fix in the project itself!
@@ -30,31 +30,42 @@ const nullishTypes = ['null', 'undefined', 'null | undefined']; | |||
const ignorablePrimitiveTypes = ['string', 'number', 'boolean', 'bigint']; | |||
function typeValidTest( | |||
cb: (type: string) => ValidTestCase<Options> | string, | |||
cb: (type: string, equals: '' | '=') => ValidTestCase<Options> | string, |
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.
[Testing] We've been moving away from auto-generated tests. They tend to generate a huge spread of unit tests that each test ever so slightly different variations of the same thing. For example, this one now means each intricacy passed totypeValidTest
is tested under both values ofequals
.
IMO it'd be better to instead have specific targeted tests for each behavior under test.
Change request: revert any additions to these test generation functions, and instead write new tests manually.
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.
Oh LOL I did a brain fart, this is a re-application of changes. Got mixed up. LGTM, thanks!
I'd switched from |
e765033
intotypescript-eslint:mainUh oh!
There was an error while loading.Please reload this page.
##### [v8.12.0](https://github.com/typescript-eslint/typescript-eslint/blob/HEAD/packages/eslint-plugin/CHANGELOG.md#8120-2024-10-28)##### 🚀 Features- **eslint-plugin:** \[no-base-to-string] handle String() ([#10005](typescript-eslint/typescript-eslint#10005))- **eslint-plugin:** \[switch-exhaustiveness-check] add allowDefaultCaseMatchUnionMember option ([#9954](typescript-eslint/typescript-eslint#9954))- **eslint-plugin:** \[consistent-indexed-object-style] report mapped types ([#10160](typescript-eslint/typescript-eslint#10160))- **eslint-plugin:** \[prefer-nullish-coalescing] add support for assignment expressions ([#10152](typescript-eslint/typescript-eslint#10152))##### ❤️ Thank You- Abraham Guo- Kim Sang Du [@developer-bandi](https://github.com/developer-bandi)- Kirk Waiblinger [@kirkwaiblinger](https://github.com/kirkwaiblinger)- YeonJuan [@yeonjuan](https://github.com/yeonjuan)You can read about our [versioning strategy](https://main--typescript-eslint.netlify.app/users/versioning) and [releases](https://main--typescript-eslint.netlify.app/users/releases) on our website.
Uh oh!
There was an error while loading.Please reload this page.
PR Checklist
Overview
Re-applies#5234, while accounting for updates made since to
prefer-nullish-coalescing
.Commits:
LogicalExpression
listener intocheckAssignmentOrLogicalExpression
checkAssignmentOrLogicalExpression
to support assignmentsdeclare const
s todeclare let
s — it is not clear to me why@JoshuaKGoldberg did this infeat(eslint-plugin): [prefer-nullish-coalescing]: add support for assignment expressions #5234, but I have done it