-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Open
Labels
awaiting responseIssues waiting for a reply from the OP or another partyIssues waiting for a reply from the OP or another partyenhancement: plugin rule optionNew rule option for an existing eslint-plugin ruleNew rule option for an existing eslint-plugin rulepackage: eslint-pluginIssues related to @typescript-eslint/eslint-pluginIssues related to @typescript-eslint/eslint-plugin
Description
Before You File a Proposal Please Confirm You Have Done The Following...
- I have searched for related issues and found none that match my proposal.
- I have searched the current rule list and found no rules that match my proposal.
- I have read the FAQ and my problem is not listed.
My proposal is suitable for this project
- I believe my proposal would be useful to the broader TypeScript community (meaning it is not a niche proposal).
Link to the rule's documentation
https://typescript-eslint.io/rules/no-unnecessary-condition/#options
Description
Our project gets a lot of false positives related to Unnecessary conditional
due to incomplete types in our project. It would be great if we could enable only the "Unnecessary optional chain" errors to aid us in incremental migration.
Fail
This should still flag as `Unnecessary optional chain on a non-nullish value.`
const option = courseSelect.selectedOptions[0];
if (option) {
copyForm.action = option?.dataset.copyUrl ?? '';
Pass
This should still be allowed (previously: ``Unnecessary conditional, comparison is always true, since `"expire" === "expire"` is true.``):
if (action === 'set_total') {
explanation =
'Updating the total time limit will set the given amount of time for the assessment based on when the assessment was started.';
} else if (action === 'expire') {
explanation =
'This will expire the time limit and students will be unable to submit any further answers.';
}
Additional Info
No response
Metadata
Metadata
Assignees
Labels
awaiting responseIssues waiting for a reply from the OP or another partyIssues waiting for a reply from the OP or another partyenhancement: plugin rule optionNew rule option for an existing eslint-plugin ruleNew rule option for an existing eslint-plugin rulepackage: eslint-pluginIssues related to @typescript-eslint/eslint-pluginIssues related to @typescript-eslint/eslint-plugin