Commit 1b97ad9
committed
feat(no-unnecessary-condition): improve diagnostics (#1092)
Part of #677.
Improves no-unnecessary-condition diagnostics by:
- narrowing primary spans to the decisive operator or optional-chain token
- labeling relevant operands and expressions with their effective types
- improving static comparison, callback, type-guard, and nullish diagnostics
- adding focused range and regression coverage with updated snapshots
Test: go test ./internal/rules/no_unnecessary_condition1 parent 1abf9a5 commit 1b97ad9
4 files changed
Lines changed: 1545 additions & 246 deletions
File tree
- e2e/__snapshots__
- internal
- rule_tester/__snapshots__
- rules/no_unnecessary_condition
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
474 | 474 | | |
475 | 475 | | |
476 | 476 | | |
| 477 | + | |
| 478 | + | |
| 479 | + | |
| 480 | + | |
| 481 | + | |
| 482 | + | |
| 483 | + | |
| 484 | + | |
| 485 | + | |
477 | 486 | | |
478 | 487 | | |
479 | 488 | | |
| |||
2201 | 2210 | | |
2202 | 2211 | | |
2203 | 2212 | | |
| 2213 | + | |
| 2214 | + | |
| 2215 | + | |
| 2216 | + | |
| 2217 | + | |
| 2218 | + | |
| 2219 | + | |
| 2220 | + | |
| 2221 | + | |
| 2222 | + | |
| 2223 | + | |
| 2224 | + | |
| 2225 | + | |
| 2226 | + | |
| 2227 | + | |
| 2228 | + | |
2204 | 2229 | | |
2205 | 2230 | | |
2206 | 2231 | | |
2207 | 2232 | | |
2208 | 2233 | | |
2209 | | - | |
2210 | | - | |
| 2234 | + | |
| 2235 | + | |
2211 | 2236 | | |
2212 | 2237 | | |
2213 | 2238 | | |
| |||
0 commit comments