-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Closed
Labels
enhancement: new plugin ruleNew rule request for eslint-pluginNew rule request for eslint-pluginhas prthere is a PR raised to close thisthere is a PR raised to close thispackage: eslint-pluginIssues related to @typescript-eslint/eslint-pluginIssues related to @typescript-eslint/eslint-plugin
Description
Preceding an optional chain with a non-null assertion is useless.
The entire point of the optional chain is that it handles the non-null case.
The non-null assertion doesn't actually change the type, and is functionally useless.
function foo(x?: { a: string }) {
return x!?.a;
}
Thinking about it, this could potentially live as an option within no-extra-non-null-assertion
, but I'm not sure if it entirely fits in there.
glen-84
Metadata
Metadata
Assignees
Labels
enhancement: new plugin ruleNew rule request for eslint-pluginNew rule request for eslint-pluginhas prthere is a PR raised to close thisthere is a PR raised to close thispackage: eslint-pluginIssues related to @typescript-eslint/eslint-pluginIssues related to @typescript-eslint/eslint-plugin