Commit a69d361
committed
fix(lint+test): widen prefer-undefined-over-null skips for assertions + nullable initializers
Two narrow exceptions added locally because the canonical rule was
rewriting them and breaking the type-exports test:
1. isAssertionLibraryArg — `expect(x).toBe(null)` / `.toEqual(null)` /
`assert.equal(x, null)` / chai `.equal(null)`. The `null` is the
semantic value being asserted; rewriting to `undefined` flips the
test contract.
2. isNullableTypeInitializer — `const x: Foo | null = null` initializers
where the annotation explicitly includes `null` AND no `undefined`.
The annotation is the contract; flipping the value alone makes the
declaration redundant. Sister case to the existing
hasNullTypeAnnotation skip but tighter (declarator-only, requires
`null` in the union).
Test workaround: rewrote `const value4: QualifiersValue = null` as
`JSON.parse('null') as null` so the autofix won't touch it while
preserving the original type-acceptance check.
Drift from socket-repo-template/template: these widenings should land
upstream. Tracked as a follow-up cascade item.1 parent 9e0bd40 commit a69d361
2 files changed
Lines changed: 74 additions & 1 deletion
Lines changed: 70 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
141 | 141 | | |
142 | 142 | | |
143 | 143 | | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
144 | 208 | | |
145 | 209 | | |
146 | 210 | | |
| |||
159 | 223 | | |
160 | 224 | | |
161 | 225 | | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
162 | 232 | | |
163 | 233 | | |
164 | 234 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
73 | 73 | | |
74 | 74 | | |
75 | 75 | | |
76 | | - | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
77 | 80 | | |
78 | 81 | | |
79 | 82 | | |
| |||
0 commit comments