]> git.proxmox.com Git - pve-eslint.git/blob - eslint/tests/lib/rules/no-constant-binary-expression.js
import 8.41.0 source
[pve-eslint.git] / eslint / tests / lib / rules / no-constant-binary-expression.js
1 /**
2 * @fileoverview Tests for no-constant-binary-expression rule.
3 * @author Jordan Eldredge <https://jordaneldredge.com>
4 */
5
6 "use strict";
7
8 //------------------------------------------------------------------------------
9 // Requirements
10 //------------------------------------------------------------------------------
11
12 const rule = require("../../../lib/rules/no-constant-binary-expression");
13 const { RuleTester } = require("../../../lib/rule-tester");
14
15 //------------------------------------------------------------------------------
16 // Tests
17 //------------------------------------------------------------------------------
18
19 const ruleTester = new RuleTester({ parserOptions: { ecmaVersion: 2021, ecmaFeatures: { jsx: true } } });
20
21 ruleTester.run("no-constant-binary-expression", rule, {
22 valid: [
23
24 // While this _would_ be a constant condition in React, ESLint has a policy of not attributing any specific behavior to JSX.
25 "<p /> && foo",
26 "<></> && foo",
27 "<p /> ?? foo",
28 "<></> ?? foo",
29 "arbitraryFunction(n) ?? foo",
30 "foo.Boolean(n) ?? foo",
31 "(x += 1) && foo",
32 "`${bar}` && foo",
33 "bar && foo",
34 "delete bar.baz && foo",
35 "true ? foo : bar", // We leave ConditionalExpression for `no-constant-condition`.
36 "new Foo() == true",
37 "foo == true",
38 "`${foo}` == true",
39 "`${foo}${bar}` == true",
40 "`0${foo}` == true",
41 "`00000000${foo}` == true",
42 "`0${foo}.000` == true",
43 "[n] == true",
44
45 "delete bar.baz === true",
46
47 "foo.Boolean(true) && foo",
48 "function Boolean(n) { return n; }; Boolean(x) ?? foo",
49 "function String(n) { return n; }; String(x) ?? foo",
50 "function Number(n) { return n; }; Number(x) ?? foo",
51 "function Boolean(n) { return Math.random(); }; Boolean(x) === 1",
52 "function Boolean(n) { return Math.random(); }; Boolean(1) == true",
53
54 "new Foo() === x",
55 "x === new someObj.Promise()",
56 "Boolean(foo) === true",
57 "function foo(undefined) { undefined ?? bar;}",
58 "function foo(undefined) { undefined == true;}",
59 "function foo(undefined) { undefined === true;}",
60 "[...arr, 1] == true",
61 "[,,,] == true",
62 { code: "new Foo() === bar;", globals: { Foo: "writable" } },
63 "(foo && true) ?? bar",
64 "foo ?? null ?? bar",
65 "a ?? (doSomething(), undefined) ?? b",
66 "a ?? (something = null) ?? b"
67 ],
68 invalid: [
69
70 // Error messages
71 { code: "[] && greeting", errors: [{ message: "Unexpected constant truthiness on the left-hand side of a `&&` expression." }] },
72 { code: "[] || greeting", errors: [{ message: "Unexpected constant truthiness on the left-hand side of a `||` expression." }] },
73 { code: "[] ?? greeting", errors: [{ message: "Unexpected constant nullishness on the left-hand side of a `??` expression." }] },
74 { code: "[] == true", errors: [{ message: "Unexpected constant binary expression. Compares constantly with the right-hand side of the `==`." }] },
75 { code: "true == []", errors: [{ message: "Unexpected constant binary expression. Compares constantly with the left-hand side of the `==`." }] },
76 { code: "[] != true", errors: [{ message: "Unexpected constant binary expression. Compares constantly with the right-hand side of the `!=`." }] },
77 { code: "[] === true", errors: [{ message: "Unexpected constant binary expression. Compares constantly with the right-hand side of the `===`." }] },
78 { code: "[] !== true", errors: [{ message: "Unexpected constant binary expression. Compares constantly with the right-hand side of the `!==`." }] },
79
80 // Motivating examples from the original proposal https://github.com/eslint/eslint/issues/13752
81 { code: "!foo == null", errors: [{ messageId: "constantBinaryOperand" }] },
82 { code: "!foo ?? bar", errors: [{ messageId: "constantShortCircuit" }] },
83 { code: "(a + b) / 2 ?? bar", errors: [{ messageId: "constantShortCircuit" }] },
84 { code: "String(foo.bar) ?? baz", errors: [{ messageId: "constantShortCircuit" }] },
85 { code: '"hello" + name ?? ""', errors: [{ messageId: "constantShortCircuit" }] },
86 { code: '[foo?.bar ?? ""] ?? []', errors: [{ messageId: "constantShortCircuit" }] },
87
88 // Logical expression with constant truthiness
89 { code: "true && hello", errors: [{ messageId: "constantShortCircuit" }] },
90 { code: "true || hello", errors: [{ messageId: "constantShortCircuit" }] },
91 { code: "true && foo", errors: [{ messageId: "constantShortCircuit" }] },
92 { code: "'' && foo", errors: [{ messageId: "constantShortCircuit" }] },
93 { code: "100 && foo", errors: [{ messageId: "constantShortCircuit" }] },
94 { code: "+100 && foo", errors: [{ messageId: "constantShortCircuit" }] },
95 { code: "-100 && foo", errors: [{ messageId: "constantShortCircuit" }] },
96 { code: "~100 && foo", errors: [{ messageId: "constantShortCircuit" }] },
97 { code: "/[a-z]/ && foo", errors: [{ messageId: "constantShortCircuit" }] },
98 { code: "Boolean([]) && foo", errors: [{ messageId: "constantShortCircuit" }] },
99 { code: "Boolean() && foo", errors: [{ messageId: "constantShortCircuit" }] },
100 { code: "Boolean([], n) && foo", errors: [{ messageId: "constantShortCircuit" }] },
101 { code: "({}) && foo", errors: [{ messageId: "constantShortCircuit" }] },
102 { code: "[] && foo", errors: [{ messageId: "constantShortCircuit" }] },
103 { code: "(() => {}) && foo", errors: [{ messageId: "constantShortCircuit" }] },
104 { code: "(function() {}) && foo", errors: [{ messageId: "constantShortCircuit" }] },
105 { code: "(class {}) && foo", errors: [{ messageId: "constantShortCircuit" }] },
106 { code: "(class { valueOf() { return x; } }) && foo", errors: [{ messageId: "constantShortCircuit" }] },
107 { code: "(class { [x]() { return x; } }) && foo", errors: [{ messageId: "constantShortCircuit" }] },
108 { code: "new Foo() && foo", errors: [{ messageId: "constantShortCircuit" }] },
109
110 // (boxed values are always truthy)
111 { code: "new Boolean(unknown) && foo", errors: [{ messageId: "constantShortCircuit" }] },
112 { code: "(bar = false) && foo", errors: [{ messageId: "constantShortCircuit" }] },
113 { code: "(bar.baz = false) && foo", errors: [{ messageId: "constantShortCircuit" }] },
114 { code: "(bar[0] = false) && foo", errors: [{ messageId: "constantShortCircuit" }] },
115 { code: "`hello ${hello}` && foo", errors: [{ messageId: "constantShortCircuit" }] },
116 { code: "void bar && foo", errors: [{ messageId: "constantShortCircuit" }] },
117 { code: "!true && foo", errors: [{ messageId: "constantShortCircuit" }] },
118 { code: "typeof bar && foo", errors: [{ messageId: "constantShortCircuit" }] },
119 { code: "(bar, baz, true) && foo", errors: [{ messageId: "constantShortCircuit" }] },
120 { code: "undefined && foo", errors: [{ messageId: "constantShortCircuit" }] },
121
122 // Logical expression with constant nullishness
123 { code: "({}) ?? foo", errors: [{ messageId: "constantShortCircuit" }] },
124 { code: "([]) ?? foo", errors: [{ messageId: "constantShortCircuit" }] },
125 { code: "(() => {}) ?? foo", errors: [{ messageId: "constantShortCircuit" }] },
126 { code: "(function() {}) ?? foo", errors: [{ messageId: "constantShortCircuit" }] },
127 { code: "(class {}) ?? foo", errors: [{ messageId: "constantShortCircuit" }] },
128 { code: "new Foo() ?? foo", errors: [{ messageId: "constantShortCircuit" }] },
129 { code: "1 ?? foo", errors: [{ messageId: "constantShortCircuit" }] },
130 { code: "/[a-z]/ ?? foo", errors: [{ messageId: "constantShortCircuit" }] },
131 { code: "`${''}` ?? foo", errors: [{ messageId: "constantShortCircuit" }] },
132 { code: "(a = true) ?? foo", errors: [{ messageId: "constantShortCircuit" }] },
133 { code: "(a += 1) ?? foo", errors: [{ messageId: "constantShortCircuit" }] },
134 { code: "(a -= 1) ?? foo", errors: [{ messageId: "constantShortCircuit" }] },
135 { code: "(a *= 1) ?? foo", errors: [{ messageId: "constantShortCircuit" }] },
136 { code: "(a /= 1) ?? foo", errors: [{ messageId: "constantShortCircuit" }] },
137 { code: "(a %= 1) ?? foo", errors: [{ messageId: "constantShortCircuit" }] },
138 { code: "(a <<= 1) ?? foo", errors: [{ messageId: "constantShortCircuit" }] },
139 { code: "(a >>= 1) ?? foo", errors: [{ messageId: "constantShortCircuit" }] },
140 { code: "(a >>>= 1) ?? foo", errors: [{ messageId: "constantShortCircuit" }] },
141 { code: "(a |= 1) ?? foo", errors: [{ messageId: "constantShortCircuit" }] },
142 { code: "(a ^= 1) ?? foo", errors: [{ messageId: "constantShortCircuit" }] },
143 { code: "(a &= 1) ?? foo", errors: [{ messageId: "constantShortCircuit" }] },
144 { code: "undefined ?? foo", errors: [{ messageId: "constantShortCircuit" }] },
145 { code: "!bar ?? foo", errors: [{ messageId: "constantShortCircuit" }] },
146 { code: "void bar ?? foo", errors: [{ messageId: "constantShortCircuit" }] },
147 { code: "typeof bar ?? foo", errors: [{ messageId: "constantShortCircuit" }] },
148 { code: "+bar ?? foo", errors: [{ messageId: "constantShortCircuit" }] },
149 { code: "-bar ?? foo", errors: [{ messageId: "constantShortCircuit" }] },
150 { code: "~bar ?? foo", errors: [{ messageId: "constantShortCircuit" }] },
151 { code: "++bar ?? foo", errors: [{ messageId: "constantShortCircuit" }] },
152 { code: "bar++ ?? foo", errors: [{ messageId: "constantShortCircuit" }] },
153 { code: "--bar ?? foo", errors: [{ messageId: "constantShortCircuit" }] },
154 { code: "bar-- ?? foo", errors: [{ messageId: "constantShortCircuit" }] },
155 { code: "(x == y) ?? foo", errors: [{ messageId: "constantShortCircuit" }] },
156 { code: "(x + y) ?? foo", errors: [{ messageId: "constantShortCircuit" }] },
157 { code: "(x / y) ?? foo", errors: [{ messageId: "constantShortCircuit" }] },
158 { code: "(x instanceof String) ?? foo", errors: [{ messageId: "constantShortCircuit" }] },
159 { code: "(x in y) ?? foo", errors: [{ messageId: "constantShortCircuit" }] },
160 { code: "Boolean(x) ?? foo", errors: [{ messageId: "constantShortCircuit" }] },
161 { code: "String(x) ?? foo", errors: [{ messageId: "constantShortCircuit" }] },
162 { code: "Number(x) ?? foo", errors: [{ messageId: "constantShortCircuit" }] },
163
164 // Binary expression with comparison to null
165 { code: "({}) != null", errors: [{ messageId: "constantBinaryOperand" }] },
166 { code: "({}) == null", errors: [{ messageId: "constantBinaryOperand" }] },
167 { code: "null == ({})", errors: [{ messageId: "constantBinaryOperand" }] },
168 { code: "({}) == undefined", errors: [{ messageId: "constantBinaryOperand" }] },
169 { code: "undefined == ({})", errors: [{ messageId: "constantBinaryOperand" }] },
170
171 // Binary expression with loose comparison to boolean
172 { code: "({}) != true", errors: [{ messageId: "constantBinaryOperand" }] },
173 { code: "({}) == true", errors: [{ messageId: "constantBinaryOperand" }] },
174 { code: "([]) == true", errors: [{ messageId: "constantBinaryOperand" }] },
175 { code: "([a, b]) == true", errors: [{ messageId: "constantBinaryOperand" }] },
176 { code: "(() => {}) == true", errors: [{ messageId: "constantBinaryOperand" }] },
177 { code: "(function() {}) == true", errors: [{ messageId: "constantBinaryOperand" }] },
178 { code: "void foo == true", errors: [{ messageId: "constantBinaryOperand" }] },
179 { code: "typeof foo == true", errors: [{ messageId: "constantBinaryOperand" }] },
180 { code: "![] == true", errors: [{ messageId: "constantBinaryOperand" }] },
181 { code: "true == class {}", errors: [{ messageId: "constantBinaryOperand" }] },
182 { code: "true == 1", errors: [{ messageId: "constantBinaryOperand" }] },
183 { code: "undefined == true", errors: [{ messageId: "constantBinaryOperand" }] },
184 { code: "true == undefined", errors: [{ messageId: "constantBinaryOperand" }] },
185 { code: "`hello` == true", errors: [{ messageId: "constantBinaryOperand" }] },
186 { code: "/[a-z]/ == true", errors: [{ messageId: "constantBinaryOperand" }] },
187 { code: "({}) == Boolean({})", errors: [{ messageId: "constantBinaryOperand" }] },
188 { code: "({}) == Boolean()", errors: [{ messageId: "constantBinaryOperand" }] },
189 { code: "({}) == Boolean(() => {}, foo)", errors: [{ messageId: "constantBinaryOperand" }] },
190
191 // Binary expression with strict comparison to boolean
192 { code: "({}) !== true", errors: [{ messageId: "constantBinaryOperand" }] },
193 { code: "({}) == !({})", errors: [{ messageId: "constantBinaryOperand" }] },
194 { code: "({}) === true", errors: [{ messageId: "constantBinaryOperand" }] },
195 { code: "([]) === true", errors: [{ messageId: "constantBinaryOperand" }] },
196 { code: "(function() {}) === true", errors: [{ messageId: "constantBinaryOperand" }] },
197 { code: "(() => {}) === true", errors: [{ messageId: "constantBinaryOperand" }] },
198 { code: "!{} === true", errors: [{ messageId: "constantBinaryOperand" }] },
199 { code: "typeof n === true", errors: [{ messageId: "constantBinaryOperand" }] },
200 { code: "void n === true", errors: [{ messageId: "constantBinaryOperand" }] },
201 { code: "+n === true", errors: [{ messageId: "constantBinaryOperand" }] },
202 { code: "-n === true", errors: [{ messageId: "constantBinaryOperand" }] },
203 { code: "~n === true", errors: [{ messageId: "constantBinaryOperand" }] },
204 { code: "true === true", errors: [{ messageId: "constantBinaryOperand" }] },
205 { code: "1 === true", errors: [{ messageId: "constantBinaryOperand" }] },
206 { code: "'hello' === true", errors: [{ messageId: "constantBinaryOperand" }] },
207 { code: "/[a-z]/ === true", errors: [{ messageId: "constantBinaryOperand" }] },
208 { code: "undefined === true", errors: [{ messageId: "constantBinaryOperand" }] },
209 { code: "(a = {}) === true", errors: [{ messageId: "constantBinaryOperand" }] },
210 { code: "(a += 1) === true", errors: [{ messageId: "constantBinaryOperand" }] },
211 { code: "(a -= 1) === true", errors: [{ messageId: "constantBinaryOperand" }] },
212 { code: "(a *= 1) === true", errors: [{ messageId: "constantBinaryOperand" }] },
213 { code: "(a %= 1) === true", errors: [{ messageId: "constantBinaryOperand" }] },
214 { code: "(a ** b) === true", errors: [{ messageId: "constantBinaryOperand" }] },
215 { code: "(a << b) === true", errors: [{ messageId: "constantBinaryOperand" }] },
216 { code: "(a >> b) === true", errors: [{ messageId: "constantBinaryOperand" }] },
217 { code: "(a >>> b) === true", errors: [{ messageId: "constantBinaryOperand" }] },
218 { code: "--a === true", errors: [{ messageId: "constantBinaryOperand" }] },
219 { code: "a-- === true", errors: [{ messageId: "constantBinaryOperand" }] },
220 { code: "++a === true", errors: [{ messageId: "constantBinaryOperand" }] },
221 { code: "a++ === true", errors: [{ messageId: "constantBinaryOperand" }] },
222 { code: "(a + b) === true", errors: [{ messageId: "constantBinaryOperand" }] },
223 { code: "(a - b) === true", errors: [{ messageId: "constantBinaryOperand" }] },
224 { code: "(a * b) === true", errors: [{ messageId: "constantBinaryOperand" }] },
225 { code: "(a / b) === true", errors: [{ messageId: "constantBinaryOperand" }] },
226 { code: "(a % b) === true", errors: [{ messageId: "constantBinaryOperand" }] },
227 { code: "(a | b) === true", errors: [{ messageId: "constantBinaryOperand" }] },
228 { code: "(a ^ b) === true", errors: [{ messageId: "constantBinaryOperand" }] },
229 { code: "(a & b) === true", errors: [{ messageId: "constantBinaryOperand" }] },
230 { code: "Boolean(0) === Boolean(1)", errors: [{ messageId: "constantBinaryOperand" }] },
231 { code: "true === String(x)", errors: [{ messageId: "constantBinaryOperand" }] },
232 { code: "true === Number(x)", errors: [{ messageId: "constantBinaryOperand" }] },
233 { code: "Boolean(0) == !({})", errors: [{ messageId: "constantBinaryOperand" }] },
234
235 // Binary expression with strict comparison to null
236 { code: "({}) !== null", errors: [{ messageId: "constantBinaryOperand" }] },
237 { code: "({}) === null", errors: [{ messageId: "constantBinaryOperand" }] },
238 { code: "([]) === null", errors: [{ messageId: "constantBinaryOperand" }] },
239 { code: "(() => {}) === null", errors: [{ messageId: "constantBinaryOperand" }] },
240 { code: "(function() {}) === null", errors: [{ messageId: "constantBinaryOperand" }] },
241 { code: "(class {}) === null", errors: [{ messageId: "constantBinaryOperand" }] },
242 { code: "new Foo() === null", errors: [{ messageId: "constantBinaryOperand" }] },
243 { code: "`` === null", errors: [{ messageId: "constantBinaryOperand" }] },
244 { code: "1 === null", errors: [{ messageId: "constantBinaryOperand" }] },
245 { code: "'hello' === null", errors: [{ messageId: "constantBinaryOperand" }] },
246 { code: "/[a-z]/ === null", errors: [{ messageId: "constantBinaryOperand" }] },
247 { code: "true === null", errors: [{ messageId: "constantBinaryOperand" }] },
248 { code: "null === null", errors: [{ messageId: "constantBinaryOperand" }] },
249 { code: "a++ === null", errors: [{ messageId: "constantBinaryOperand" }] },
250 { code: "++a === null", errors: [{ messageId: "constantBinaryOperand" }] },
251 { code: "--a === null", errors: [{ messageId: "constantBinaryOperand" }] },
252 { code: "a-- === null", errors: [{ messageId: "constantBinaryOperand" }] },
253 { code: "!a === null", errors: [{ messageId: "constantBinaryOperand" }] },
254 { code: "typeof a === null", errors: [{ messageId: "constantBinaryOperand" }] },
255 { code: "delete a === null", errors: [{ messageId: "constantBinaryOperand" }] },
256 { code: "void a === null", errors: [{ messageId: "constantBinaryOperand" }] },
257 { code: "undefined === null", errors: [{ messageId: "constantBinaryOperand" }] },
258 { code: "(x = {}) === null", errors: [{ messageId: "constantBinaryOperand" }] },
259 { code: "(x += y) === null", errors: [{ messageId: "constantBinaryOperand" }] },
260 { code: "(x -= y) === null", errors: [{ messageId: "constantBinaryOperand" }] },
261 { code: "(a, b, {}) === null", errors: [{ messageId: "constantBinaryOperand" }] },
262
263 // Binary expression with strict comparison to undefined
264 { code: "({}) !== undefined", errors: [{ messageId: "constantBinaryOperand" }] },
265 { code: "({}) === undefined", errors: [{ messageId: "constantBinaryOperand" }] },
266 { code: "([]) === undefined", errors: [{ messageId: "constantBinaryOperand" }] },
267 { code: "(() => {}) === undefined", errors: [{ messageId: "constantBinaryOperand" }] },
268 { code: "(function() {}) === undefined", errors: [{ messageId: "constantBinaryOperand" }] },
269 { code: "(class {}) === undefined", errors: [{ messageId: "constantBinaryOperand" }] },
270 { code: "new Foo() === undefined", errors: [{ messageId: "constantBinaryOperand" }] },
271 { code: "`` === undefined", errors: [{ messageId: "constantBinaryOperand" }] },
272 { code: "1 === undefined", errors: [{ messageId: "constantBinaryOperand" }] },
273 { code: "'hello' === undefined", errors: [{ messageId: "constantBinaryOperand" }] },
274 { code: "/[a-z]/ === undefined", errors: [{ messageId: "constantBinaryOperand" }] },
275 { code: "true === undefined", errors: [{ messageId: "constantBinaryOperand" }] },
276 { code: "null === undefined", errors: [{ messageId: "constantBinaryOperand" }] },
277 { code: "a++ === undefined", errors: [{ messageId: "constantBinaryOperand" }] },
278 { code: "++a === undefined", errors: [{ messageId: "constantBinaryOperand" }] },
279 { code: "--a === undefined", errors: [{ messageId: "constantBinaryOperand" }] },
280 { code: "a-- === undefined", errors: [{ messageId: "constantBinaryOperand" }] },
281 { code: "!a === undefined", errors: [{ messageId: "constantBinaryOperand" }] },
282 { code: "typeof a === undefined", errors: [{ messageId: "constantBinaryOperand" }] },
283 { code: "delete a === undefined", errors: [{ messageId: "constantBinaryOperand" }] },
284 { code: "void a === undefined", errors: [{ messageId: "constantBinaryOperand" }] },
285 { code: "undefined === undefined", errors: [{ messageId: "constantBinaryOperand" }] },
286 { code: "(x = {}) === undefined", errors: [{ messageId: "constantBinaryOperand" }] },
287 { code: "(x += y) === undefined", errors: [{ messageId: "constantBinaryOperand" }] },
288 { code: "(x -= y) === undefined", errors: [{ messageId: "constantBinaryOperand" }] },
289 { code: "(a, b, {}) === undefined", errors: [{ messageId: "constantBinaryOperand" }] },
290
291 /*
292 * If both sides are newly constructed objects, we can tell they will
293 * never be equal, even with == equality.
294 */
295 { code: "[a] == [a]", errors: [{ messageId: "bothAlwaysNew" }] },
296 { code: "[a] != [a]", errors: [{ messageId: "bothAlwaysNew" }] },
297 { code: "({}) == []", errors: [{ messageId: "bothAlwaysNew" }] },
298
299 // Comparing to always new objects
300 { code: "x === {}", errors: [{ messageId: "alwaysNew" }] },
301 { code: "x !== {}", errors: [{ messageId: "alwaysNew" }] },
302 { code: "x === []", errors: [{ messageId: "alwaysNew" }] },
303 { code: "x === (() => {})", errors: [{ messageId: "alwaysNew" }] },
304 { code: "x === (function() {})", errors: [{ messageId: "alwaysNew" }] },
305 { code: "x === (class {})", errors: [{ messageId: "alwaysNew" }] },
306 { code: "x === new Boolean()", errors: [{ messageId: "alwaysNew" }] },
307 { code: "x === new Promise()", env: { es6: true }, errors: [{ messageId: "alwaysNew" }] },
308 { code: "x === new WeakSet()", env: { es6: true }, errors: [{ messageId: "alwaysNew" }] },
309 { code: "x === (foo, {})", errors: [{ messageId: "alwaysNew" }] },
310 { code: "x === (y = {})", errors: [{ messageId: "alwaysNew" }] },
311 { code: "x === (y ? {} : [])", errors: [{ messageId: "alwaysNew" }] },
312 { code: "x === /[a-z]/", errors: [{ messageId: "alwaysNew" }] },
313
314 // It's not obvious what this does, but it compares the old value of `x` to the new object.
315 { code: "x === (x = {})", errors: [{ messageId: "alwaysNew" }] },
316
317 { code: "window.abc && false && anything", errors: [{ messageId: "constantShortCircuit" }] },
318 { code: "window.abc || true || anything", errors: [{ messageId: "constantShortCircuit" }] },
319 { code: "window.abc ?? 'non-nullish' ?? anything", errors: [{ messageId: "constantShortCircuit" }] }
320 ]
321 });