File tree Expand file tree Collapse file tree 4 files changed +0
-117
lines changed
Expand file tree Collapse file tree 4 files changed +0
-117
lines changed Original file line number Diff line number Diff line change @@ -216,31 +216,6 @@ const create = context => {
216216 }
217217 } ) ;
218218
219- // `foo ?? undefined`
220- context . on ( 'Identifier' , node => {
221- if (
222- isUndefined ( node )
223- && node . parent . type === 'LogicalExpression'
224- && node . parent . operator === '??'
225- && node . parent . right === node
226- ) {
227- return getProblem (
228- node ,
229- fixer => {
230- const logicalExpression = node . parent ;
231- const operatorToken = sourceCode . getTokenBefore ( node , token => token . value === logicalExpression . operator ) ;
232- const tokenBeforeOperatorToken = sourceCode . getTokenBefore ( operatorToken ) ;
233-
234- return fixer . removeRange ( [
235- sourceCode . getRange ( tokenBeforeOperatorToken ) [ 1 ] ,
236- sourceCode . getRange ( logicalExpression ) [ 1 ] ,
237- ] ) ;
238- } ,
239- /* CheckFunctionReturnType */ false ,
240- ) ;
241- }
242- } ) ;
243-
244219 if ( ! options . checkArguments ) {
245220 return ;
246221 }
Original file line number Diff line number Diff line change @@ -497,19 +497,3 @@ test.snapshot({
497497 } ,
498498 ] ,
499499} ) ;
500-
501- // `foo ?? undefined`
502- test . snapshot ( {
503- valid : [
504- 'foo || undefined' ,
505- 'foo && undefined' ,
506- 'foo ?? null' ,
507- 'undefined ?? foo' ,
508- ] ,
509- invalid : [
510- 'foo ?? undefined' ,
511- '(( (( foo )) ?? (( undefined )) ))' ,
512- 'foo ?? null ?? undefined' ,
513- 'call(foo ?? undefined,)' ,
514- ] ,
515- } ) ;
Original file line number Diff line number Diff line change @@ -697,79 +697,3 @@ Generated by [AVA](https://avajs.dev).
697697 Output:␊
698698 1 | function a({foo}?) {}␊
699699 `
700-
701- ## invalid(1): foo ?? undefined
702-
703- > Input
704-
705- `␊
706- 1 | foo ?? undefined␊
707- `
708-
709- > Error 1/1
710-
711- `␊
712- Message:␊
713- > 1 | foo ?? undefined␊
714- | ^^^^^^^^^ Do not use useless \`undefined\`.␊
715- ␊
716- Output:␊
717- 1 | foo␊
718- `
719-
720- ## invalid(2): (( (( foo )) ?? (( undefined )) ))
721-
722- > Input
723-
724- `␊
725- 1 | (( (( foo )) ?? (( undefined )) ))␊
726- `
727-
728- > Error 1/1
729-
730- `␊
731- Message:␊
732- > 1 | (( (( foo )) ?? (( undefined )) ))␊
733- | ^^^^^^^^^ Do not use useless \`undefined\`.␊
734- ␊
735- Output:␊
736- 1 | (( (( foo )) ))␊
737- `
738-
739- ## invalid(3): foo ?? null ?? undefined
740-
741- > Input
742-
743- `␊
744- 1 | foo ?? null ?? undefined␊
745- `
746-
747- > Error 1/1
748-
749- `␊
750- Message:␊
751- > 1 | foo ?? null ?? undefined␊
752- | ^^^^^^^^^ Do not use useless \`undefined\`.␊
753- ␊
754- Output:␊
755- 1 | foo ?? null␊
756- `
757-
758- ## invalid(4): call(foo ?? undefined,)
759-
760- > Input
761-
762- `␊
763- 1 | call(foo ?? undefined,)␊
764- `
765-
766- > Error 1/1
767-
768- `␊
769- Message:␊
770- > 1 | call(foo ?? undefined,)␊
771- | ^^^^^^^^^ Do not use useless \`undefined\`.␊
772- ␊
773- Output:␊
774- 1 | call(foo,)␊
775- `
You can’t perform that action at this time.
0 commit comments