Skip to content

Enhancement: [prefer-nullish-coalescing] Add runtime check for strictNullChecks being enabled #5995

Closed
@JoshuaKGoldberg

Description

@JoshuaKGoldberg

Before You File a Proposal Please Confirm You Have Done The Following...

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/prefer-nullish-coalescing

Description

Following up from #5748 (comment):

We should give [prefer-nullish-coalescing] the same treatment as rules like strict-boolean-expressions where the rule will explicitly error if you don't have the option turned on.

https://typescript-eslint.io/rules/strict-boolean-expressions/#allowruletorunwithoutstrictnullchecksiknowwhatiamdoing

I would say we can do that change without a breaking change because the rule is LITERALLY useless without the option.

Fail

n/a

Pass

n/a

Additional Info

#5988 added docs; now let's add a runtime check. 🚀

Metadata

Metadata

Assignees

No one assigned

    Labels

    accepting prsGo ahead, send a pull request that resolves this issueenhancement: plugin rule optionNew rule option for an existing eslint-plugin rulegood first issueGood for newcomerspackage: eslint-pluginIssues related to @typescript-eslint/eslint-plugin

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions