Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(eslint-plugin): add checks for unnecessary optional chains
This adds type checking around the the new optional-chaining feature. With this, it becomes invalid to start an optional chain when the base value is known to be not-nullish. ```js // Good declare const foo: string | null; declare const bar: null : (() => {}); foo?.length; foo?.slice(); bar?.(); // Bad declare const baz: string; declare const qux: (() => {}); baz?.length; baz?.slice(); baz.slice?.(); qux?.(); ```
- Loading branch information
1 parent
3ddf1a2
commit e74bea4
Showing
2 changed files
with
260 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters