From 7201c29e4ddfa50a6a76c89e2db46d26c5b98ffc Mon Sep 17 00:00:00 2001 From: Joshua Chen Date: Mon, 3 Jun 2024 22:30:40 +0800 Subject: [PATCH 1/8] feat(typescript-estree): restrict variable declarator definite/init combinations --- .../const-destructure-no-init/fixture.ts | 1 + .../snapshots/1-TSESTree-Error.shot | 3 + .../snapshots/2-Babel-Error.shot | 3 + .../snapshots/3-Alignment-Error.shot | 3 + .../const-destructure-type-no-init/fixture.ts | 1 + .../snapshots/1-TSESTree-Error.shot | 3 + .../snapshots/2-Babel-Error.shot | 3 + .../snapshots/3-Alignment-Error.shot | 3 + .../_error_/const-id-definite-init/fixture.ts | 1 + .../snapshots/1-TSESTree-Error.shot | 8 ++ .../snapshots/2-Babel-Error.shot | 3 + .../snapshots/3-Alignment-Error.shot | 3 + .../const-id-definite-no-init/fixture.ts | 1 + .../snapshots/1-TSESTree-Error.shot | 8 ++ .../snapshots/2-Babel-Error.shot | 3 + .../snapshots/3-Alignment-Error.shot | 3 + .../const-id-definite-type-init/fixture.ts | 1 + .../snapshots/1-TSESTree-Error.shot | 8 ++ .../snapshots/2-Babel-Error.shot | 3 + .../snapshots/3-Alignment-Error.shot | 3 + .../const-id-definite-type-no-init/fixture.ts | 1 + .../snapshots/1-TSESTree-Error.shot | 8 ++ .../snapshots/2-Babel-Error.shot | 3 + .../snapshots/3-Alignment-Error.shot | 3 + .../_error_/const-id-no-init/fixture.ts | 1 + .../snapshots/1-TSESTree-Error.shot | 3 + .../snapshots/2-Babel-Error.shot | 3 + .../snapshots/3-Alignment-Error.shot | 3 + .../_error_/const-id-type-no-init/fixture.ts | 1 + .../snapshots/1-TSESTree-Error.shot | 3 + .../snapshots/2-Babel-Error.shot | 3 + .../snapshots/3-Alignment-Error.shot | 3 + .../fixture.ts | 1 + .../snapshots/1-TSESTree-Error.shot | 8 ++ .../snapshots/2-Babel-Error.shot | 3 + .../snapshots/3-Alignment-Error.shot | 3 + .../declare-const-id-definite-init/fixture.ts | 1 + .../snapshots/1-TSESTree-Error.shot | 8 ++ .../snapshots/2-Babel-Error.shot | 2 +- .../snapshots/3-Alignment-Error.shot | 3 + .../fixture.ts | 1 + .../snapshots/1-TSESTree-Error.shot | 8 ++ .../snapshots/2-Babel-Error.shot | 3 + .../snapshots/3-Alignment-Error.shot | 3 + .../fixture.ts | 1 + .../snapshots/1-TSESTree-Error.shot | 8 ++ .../snapshots/2-Babel-Error.shot | 3 + .../snapshots/3-Alignment-Error.shot | 3 + .../fixture.ts | 1 + .../snapshots/1-TSESTree-Error.shot | 8 ++ .../snapshots/2-Babel-Error.shot | 3 + .../snapshots/3-Alignment-Error.shot | 3 + .../declare-const-id-type-init/fixture.ts | 1 + .../snapshots/1-TSESTree-Error.shot | 8 ++ .../snapshots/2-Babel-Error.shot | 3 + .../snapshots/3-Alignment-Error.shot | 3 + .../declare-let-destructure-init/fixture.ts | 1 + .../snapshots/1-TSESTree-Error.shot | 8 ++ .../snapshots/2-Babel-Error.shot | 3 + .../snapshots/3-Alignment-Error.shot | 3 + .../fixture.ts | 1 + .../snapshots/1-TSESTree-Error.shot | 8 ++ .../snapshots/2-Babel-Error.shot | 3 + .../snapshots/3-Alignment-Error.shot | 3 + .../declare-let-id-definite-init/fixture.ts | 1 + .../snapshots/1-TSESTree-Error.shot | 8 ++ .../snapshots/2-Babel-Error.shot | 3 + .../snapshots/3-Alignment-Error.shot | 3 + .../fixture.ts | 1 + .../snapshots/1-TSESTree-Error.shot | 8 ++ .../snapshots/2-Babel-Error.shot | 3 + .../snapshots/3-Alignment-Error.shot | 3 + .../fixture.ts | 1 + .../snapshots/1-TSESTree-Error.shot | 8 ++ .../snapshots/2-Babel-Error.shot | 3 + .../snapshots/3-Alignment-Error.shot | 3 + .../fixture.ts | 1 + .../snapshots/1-TSESTree-Error.shot | 8 ++ .../snapshots/2-Babel-Error.shot | 3 + .../snapshots/3-Alignment-Error.shot | 3 + .../_error_/declare-let-id-init/fixture.ts | 1 + .../snapshots/1-TSESTree-Error.shot | 8 ++ .../snapshots/2-Babel-Error.shot | 3 + .../snapshots/3-Alignment-Error.shot | 2 +- .../declare-let-id-type-init/fixture.ts | 1 + .../snapshots/1-TSESTree-Error.shot | 8 ++ .../snapshots/2-Babel-Error.shot | 3 + .../snapshots/3-Alignment-Error.shot | 3 + .../declare-using-destructure-init/fixture.ts | 1 + .../snapshots/1-TSESTree-Error.shot | 8 ++ .../snapshots/2-Babel-Error.shot | 3 + .../snapshots/3-Alignment-Error.shot | 3 + .../fixture.ts | 1 + .../snapshots/1-TSESTree-Error.shot | 8 ++ .../snapshots/2-Babel-Error.shot | 3 + .../snapshots/3-Alignment-Error.shot | 3 + .../fixture.ts | 1 + .../snapshots/1-TSESTree-Error.shot | 8 ++ .../snapshots/2-Babel-Error.shot | 3 + .../snapshots/3-Alignment-Error.shot | 3 + .../fixture.ts | 1 + .../snapshots/1-TSESTree-Error.shot | 8 ++ .../snapshots/2-Babel-Error.shot | 3 + .../snapshots/3-Alignment-Error.shot | 3 + .../declare-using-id-definite-init/fixture.ts | 1 + .../snapshots/1-TSESTree-Error.shot | 8 ++ .../snapshots/2-Babel-Error.shot | 3 + .../snapshots/3-Alignment-Error.shot | 3 + .../fixture.ts | 1 + .../snapshots/1-TSESTree-Error.shot | 8 ++ .../snapshots/2-Babel-Error.shot | 3 + .../snapshots/3-Alignment-Error.shot | 3 + .../fixture.ts | 1 + .../snapshots/1-TSESTree-Error.shot | 8 ++ .../snapshots/2-Babel-Error.shot | 3 + .../snapshots/3-Alignment-Error.shot | 3 + .../fixture.ts | 1 + .../snapshots/1-TSESTree-Error.shot | 8 ++ .../snapshots/2-Babel-Error.shot | 3 + .../snapshots/3-Alignment-Error.shot | 3 + .../_error_/declare-using-id-init/fixture.ts | 1 + .../snapshots/1-TSESTree-Error.shot | 8 ++ .../snapshots/2-Babel-Error.shot | 3 + .../snapshots/3-Alignment-Error.shot | 3 + .../declare-using-id-no-init/fixture.ts | 1 + .../snapshots/1-TSESTree-Error.shot | 4 +- .../snapshots/2-Babel-Error.shot | 3 + .../snapshots/3-Alignment-Error.shot | 3 + .../declare-using-id-type-init/fixture.ts | 1 + .../snapshots/1-TSESTree-Error.shot | 8 ++ .../snapshots/2-Babel-Error.shot | 3 + .../snapshots/3-Alignment-Error.shot | 3 + .../declare-using-id-type-no-init/fixture.ts | 1 + .../snapshots/1-TSESTree-Error.shot | 8 ++ .../snapshots/2-Babel-Error.shot | 3 + .../snapshots/3-Alignment-Error.shot | 3 + .../declare-var-destructure-init/fixture.ts | 1 + .../snapshots/1-TSESTree-Error.shot | 8 ++ .../snapshots/2-Babel-Error.shot | 3 + .../snapshots/3-Alignment-Error.shot | 3 + .../fixture.ts | 1 + .../snapshots/1-TSESTree-Error.shot | 8 ++ .../snapshots/2-Babel-Error.shot | 3 + .../snapshots/3-Alignment-Error.shot | 3 + .../declare-var-id-definite-init/fixture.ts | 1 + .../snapshots/1-TSESTree-Error.shot | 8 ++ .../snapshots/2-Babel-Error.shot | 3 + .../snapshots/3-Alignment-Error.shot | 3 + .../fixture.ts | 1 + .../snapshots/1-TSESTree-Error.shot | 8 ++ .../snapshots/2-Babel-Error.shot | 3 + .../snapshots/3-Alignment-Error.shot | 3 + .../fixture.ts | 1 + .../snapshots/1-TSESTree-Error.shot | 8 ++ .../snapshots/2-Babel-Error.shot | 3 + .../snapshots/3-Alignment-Error.shot | 3 + .../fixture.ts | 1 + .../snapshots/1-TSESTree-Error.shot | 8 ++ .../snapshots/2-Babel-Error.shot | 3 + .../snapshots/3-Alignment-Error.shot | 3 + .../_error_/declare-var-id-init/fixture.ts | 1 + .../snapshots/1-TSESTree-Error.shot | 8 ++ .../snapshots/2-Babel-Error.shot | 3 + .../snapshots/3-Alignment-Error.shot | 3 + .../declare-var-id-type-init/fixture.ts | 1 + .../snapshots/1-TSESTree-Error.shot | 8 ++ .../snapshots/2-Babel-Error.shot | 3 + .../snapshots/3-Alignment-Error.shot | 3 + .../_error_/declare-with-using/fixture.ts | 1 - .../let-destructure-no-init/fixture.ts | 1 + .../snapshots/1-TSESTree-Error.shot | 3 + .../snapshots/2-Babel-Error.shot | 3 + .../snapshots/3-Alignment-Error.shot | 3 + .../let-destructure-type-no-init/fixture.ts | 1 + .../snapshots/1-TSESTree-Error.shot | 3 + .../snapshots/2-Babel-Error.shot | 3 + .../snapshots/3-Alignment-Error.shot | 3 + .../_error_/let-id-definite-init/fixture.ts | 1 + .../snapshots/1-TSESTree-Error.shot | 8 ++ .../snapshots/2-Babel-Error.shot | 3 + .../snapshots/3-Alignment-Error.shot | 3 + .../let-id-definite-no-init/fixture.ts | 1 + .../snapshots/1-TSESTree-Error.shot | 8 ++ .../snapshots/2-Babel-Error.shot | 3 + .../snapshots/3-Alignment-Error.shot | 3 + .../let-id-definite-type-init/fixture.ts | 1 + .../snapshots/1-TSESTree-Error.shot | 8 ++ .../snapshots/2-Babel-Error.shot | 3 + .../snapshots/3-Alignment-Error.shot | 3 + .../missing-id-without-value/fixture.ts | 1 - .../snapshots/1-Babel-Error.shot | 3 - .../snapshots/1-TSESTree-Error.shot | 8 -- .../snapshots/2-Alignment-Error.shot | 3 - .../snapshots/2-Babel-Error.shot | 3 - .../snapshots/3-Alignment-Error.shot | 3 - .../_error_/missing-value-in-using/fixture.ts | 1 - .../snapshots/1-TSESTree-Error.shot | 8 -- .../snapshots/2-Babel-Error.shot | 3 - .../snapshots/3-Alignment-Error.shot | 3 - .../fixture.ts | 1 - .../snapshots/1-TSESTree-Error.shot | 8 -- .../snapshots/2-Babel-Error.shot | 3 - .../snapshots/3-Alignment-Error.shot | 3 - .../_error_/using-destructure-init/fixture.ts | 1 + .../snapshots/1-TSESTree-Error.shot | 8 ++ .../snapshots/2-Babel-Error.shot | 3 + .../snapshots/3-Alignment-Error.shot | 3 + .../using-destructure-no-init/fixture.ts | 1 + .../snapshots/1-TSESTree-Error.shot | 8 ++ .../snapshots/2-Babel-Error.shot | 3 + .../snapshots/3-Alignment-Error.shot | 3 + .../using-destructure-type-init/fixture.ts | 1 + .../snapshots/1-TSESTree-Error.shot | 8 ++ .../snapshots/2-Babel-Error.shot | 3 + .../snapshots/3-Alignment-Error.shot | 3 + .../using-destructure-type-no-init/fixture.ts | 1 + .../snapshots/1-TSESTree-Error.shot | 8 ++ .../snapshots/2-Babel-Error.shot | 3 + .../snapshots/3-Alignment-Error.shot | 3 + .../_error_/using-id-definite-init/fixture.ts | 1 + .../snapshots/1-TSESTree-Error.shot | 8 ++ .../snapshots/2-Babel-Error.shot | 3 + .../snapshots/3-Alignment-Error.shot | 3 + .../using-id-definite-no-init/fixture.ts | 1 + .../snapshots/1-TSESTree-Error.shot | 8 ++ .../snapshots/2-Babel-Error.shot | 3 + .../snapshots/3-Alignment-Error.shot | 3 + .../using-id-definite-type-init/fixture.ts | 1 + .../snapshots/1-TSESTree-Error.shot | 8 ++ .../snapshots/2-Babel-Error.shot | 3 + .../snapshots/3-Alignment-Error.shot | 3 + .../using-id-definite-type-no-init/fixture.ts | 1 + .../snapshots/1-TSESTree-Error.shot | 8 ++ .../snapshots/2-Babel-Error.shot | 3 + .../snapshots/3-Alignment-Error.shot | 3 + .../_error_/using-id-no-init/fixture.ts | 1 + .../snapshots/1-TSESTree-Error.shot | 8 ++ .../snapshots/2-Babel-Error.shot | 3 + .../snapshots/3-Alignment-Error.shot | 3 + .../_error_/using-id-type-no-init/fixture.ts | 1 + .../snapshots/1-TSESTree-Error.shot | 8 ++ .../snapshots/2-Babel-Error.shot | 3 + .../snapshots/3-Alignment-Error.shot | 3 + .../var-destructure-no-init/fixture.ts | 1 + .../snapshots/1-TSESTree-Error.shot | 3 + .../snapshots/2-Babel-Error.shot | 3 + .../snapshots/3-Alignment-Error.shot | 3 + .../var-destructure-type-no-init/fixture.ts | 1 + .../snapshots/1-TSESTree-Error.shot | 3 + .../snapshots/2-Babel-Error.shot | 3 + .../snapshots/3-Alignment-Error.shot | 3 + .../_error_/var-id-definite-init/fixture.ts | 1 + .../snapshots/1-TSESTree-Error.shot | 8 ++ .../snapshots/2-Babel-Error.shot | 3 + .../snapshots/3-Alignment-Error.shot | 3 + .../var-id-definite-no-init/fixture.ts | 1 + .../snapshots/1-TSESTree-Error.shot | 8 ++ .../snapshots/2-Babel-Error.shot | 3 + .../snapshots/3-Alignment-Error.shot | 3 + .../var-id-definite-type-init/fixture.ts | 1 + .../snapshots/1-TSESTree-Error.shot | 8 ++ .../snapshots/2-Babel-Error.shot | 3 + .../snapshots/3-Alignment-Error.shot | 3 + .../const-destructure-init/fixture.ts | 1 + .../snapshots/1-TSESTree-AST.shot | 101 ++++++++++++++ .../snapshots/2-TSESTree-Tokens.shot | 76 +++++++++++ .../snapshots/3-Babel-AST.shot | 92 +++++++++++++ .../snapshots/4-Babel-Tokens.shot | 76 +++++++++++ .../snapshots/5-AST-Alignment-AST.shot | 105 +++++++++++++++ .../snapshots/6-AST-Alignment-Tokens.shot | 6 + .../const-destructure-type-init/fixture.ts | 1 + .../snapshots/1-TSESTree-AST.shot | 119 +++++++++++++++++ .../snapshots/2-TSESTree-Tokens.shot | 96 ++++++++++++++ .../snapshots/3-Babel-AST.shot | 110 ++++++++++++++++ .../snapshots/4-Babel-Tokens.shot | 96 ++++++++++++++ .../snapshots/5-AST-Alignment-AST.shot | 123 ++++++++++++++++++ .../snapshots/6-AST-Alignment-Tokens.shot | 6 + .../fixtures/const-id-init/fixture.ts | 1 + .../snapshots/1-TSESTree-AST.shot | 24 ++-- .../snapshots/2-TSESTree-Tokens.shot | 26 ++-- .../snapshots/3-Babel-AST.shot | 24 ++-- .../snapshots/4-Babel-Tokens.shot | 56 ++++++++ .../snapshots/5-AST-Alignment-AST.shot | 24 ++-- .../snapshots/6-AST-Alignment-Tokens.shot | 2 +- .../fixtures/const-id-type-init/fixture.ts | 1 + .../snapshots/1-TSESTree-AST.shot | 80 ++++++++++++ .../snapshots/2-TSESTree-Tokens.shot | 76 +++++++++++ .../snapshots/3-Babel-AST.shot | 76 +++++++++++ .../snapshots/4-Babel-Tokens.shot | 76 +++++++++++ .../snapshots/5-AST-Alignment-AST.shot | 84 ++++++++++++ .../snapshots/6-AST-Alignment-Tokens.shot | 6 + .../fixtures/const-with-value/fixture.ts | 1 - .../fixtures/const-without-value/fixture.ts | 1 - .../declare-const-destructure-init/fixture.ts | 1 + .../snapshots/1-TSESTree-AST.shot | 101 ++++++++++++++ .../snapshots/2-TSESTree-Tokens.shot | 86 ++++++++++++ .../snapshots/3-Babel-AST.shot | 93 +++++++++++++ .../snapshots/4-Babel-Tokens.shot | 86 ++++++++++++ .../snapshots/5-AST-Alignment-AST.shot | 105 +++++++++++++++ .../snapshots/6-AST-Alignment-Tokens.shot | 6 + .../fixture.ts | 1 + .../snapshots/1-TSESTree-AST.shot | 91 +++++++++++++ .../snapshots/2-TSESTree-Tokens.shot | 66 ++++++++++ .../snapshots/3-Babel-AST.shot | 83 ++++++++++++ .../snapshots/4-Babel-Tokens.shot | 66 ++++++++++ .../snapshots/5-AST-Alignment-AST.shot | 95 ++++++++++++++ .../snapshots/6-AST-Alignment-Tokens.shot | 6 + .../fixture.ts | 1 + .../snapshots/1-TSESTree-AST.shot | 109 ++++++++++++++++ .../snapshots/2-TSESTree-Tokens.shot | 86 ++++++++++++ .../snapshots/3-Babel-AST.shot | 101 ++++++++++++++ .../snapshots/4-Babel-Tokens.shot | 86 ++++++++++++ .../snapshots/5-AST-Alignment-AST.shot | 113 ++++++++++++++++ .../snapshots/6-AST-Alignment-Tokens.shot | 6 + .../fixtures/declare-const-id-init/fixture.ts | 1 + .../snapshots/1-TSESTree-AST.shot | 32 ++--- .../snapshots/2-TSESTree-Tokens.shot | 66 ++++++++++ .../snapshots/3-Babel-AST.shot | 31 ++--- .../snapshots/4-Babel-Tokens.shot | 66 ++++++++++ .../snapshots/5-AST-Alignment-AST.shot | 32 ++--- .../snapshots/6-AST-Alignment-Tokens.shot | 6 + .../declare-const-id-no-init/fixture.ts | 1 + .../snapshots/1-TSESTree-AST.shot | 52 ++++++++ .../snapshots/2-TSESTree-Tokens.shot | 46 +++++++ .../snapshots/3-Babel-AST.shot | 49 +++++++ .../snapshots/4-Babel-Tokens.shot | 46 +++++++ .../snapshots/5-AST-Alignment-AST.shot | 56 ++++++++ .../snapshots/6-AST-Alignment-Tokens.shot | 6 + .../declare-const-id-type-no-init/fixture.ts | 1 + .../snapshots/1-TSESTree-AST.shot | 70 ++++++++++ .../snapshots/2-TSESTree-Tokens.shot | 66 ++++++++++ .../snapshots/3-Babel-AST.shot | 67 ++++++++++ .../snapshots/4-Babel-Tokens.shot | 66 ++++++++++ .../snapshots/5-AST-Alignment-AST.shot | 74 +++++++++++ .../snapshots/6-AST-Alignment-Tokens.shot | 6 + .../fixture.ts | 1 + .../snapshots/1-TSESTree-AST.shot | 91 +++++++++++++ .../snapshots/2-TSESTree-Tokens.shot | 66 ++++++++++ .../snapshots/3-Babel-AST.shot | 83 ++++++++++++ .../snapshots/4-Babel-Tokens.shot | 66 ++++++++++ .../snapshots/5-AST-Alignment-AST.shot | 95 ++++++++++++++ .../snapshots/6-AST-Alignment-Tokens.shot | 72 ++++++++++ .../fixture.ts | 1 + .../snapshots/1-TSESTree-AST.shot | 109 ++++++++++++++++ .../snapshots/2-TSESTree-Tokens.shot | 86 ++++++++++++ .../snapshots/3-Babel-AST.shot | 101 ++++++++++++++ .../snapshots/4-Babel-Tokens.shot | 86 ++++++++++++ .../snapshots/5-AST-Alignment-AST.shot | 113 ++++++++++++++++ .../snapshots/6-AST-Alignment-Tokens.shot | 92 +++++++++++++ .../declare-let-id-no-init/fixture.ts | 1 + .../snapshots/1-TSESTree-AST.shot | 18 +-- .../snapshots/2-TSESTree-Tokens.shot | 14 +- .../snapshots/3-Babel-AST.shot | 18 +-- .../snapshots/4-Babel-Tokens.shot | 14 +- .../snapshots/5-AST-Alignment-AST.shot | 18 +-- .../snapshots/6-AST-Alignment-Tokens.shot | 14 +- .../declare-let-id-type-no-init/fixture.ts | 1 + .../snapshots/1-TSESTree-AST.shot | 70 ++++++++++ .../snapshots/2-TSESTree-Tokens.shot | 66 ++++++++++ .../snapshots/3-Babel-AST.shot | 67 ++++++++++ .../snapshots/4-Babel-Tokens.shot | 66 ++++++++++ .../snapshots/5-AST-Alignment-AST.shot | 74 +++++++++++ .../snapshots/6-AST-Alignment-Tokens.shot | 72 ++++++++++ .../fixture.ts | 1 + .../snapshots/1-TSESTree-AST.shot | 91 +++++++++++++ .../snapshots/2-TSESTree-Tokens.shot | 66 ++++++++++ .../snapshots/3-Babel-AST.shot | 83 ++++++++++++ .../snapshots/4-Babel-Tokens.shot | 66 ++++++++++ .../snapshots/5-AST-Alignment-AST.shot | 95 ++++++++++++++ .../snapshots/6-AST-Alignment-Tokens.shot | 6 + .../fixture.ts | 1 + .../snapshots/1-TSESTree-AST.shot | 109 ++++++++++++++++ .../snapshots/2-TSESTree-Tokens.shot | 86 ++++++++++++ .../snapshots/3-Babel-AST.shot | 101 ++++++++++++++ .../snapshots/4-Babel-Tokens.shot | 86 ++++++++++++ .../snapshots/5-AST-Alignment-AST.shot | 113 ++++++++++++++++ .../snapshots/6-AST-Alignment-Tokens.shot | 6 + .../declare-var-id-no-init/fixture.ts | 1 + .../snapshots/1-TSESTree-AST.shot | 52 ++++++++ .../snapshots/2-TSESTree-Tokens.shot | 46 +++++++ .../snapshots/3-Babel-AST.shot | 49 +++++++ .../snapshots/4-Babel-Tokens.shot | 46 +++++++ .../snapshots/5-AST-Alignment-AST.shot | 36 ++--- .../snapshots/6-AST-Alignment-Tokens.shot | 6 + .../declare-var-id-type-no-init/fixture.ts | 1 + .../snapshots/1-TSESTree-AST.shot | 70 ++++++++++ .../snapshots/2-TSESTree-Tokens.shot | 66 ++++++++++ .../snapshots/3-Babel-AST.shot | 67 ++++++++++ .../snapshots/4-Babel-Tokens.shot | 66 ++++++++++ .../snapshots/5-AST-Alignment-AST.shot | 74 +++++++++++ .../snapshots/6-AST-Alignment-Tokens.shot | 6 + .../fixtures/declare/fixture.ts | 1 - .../fixtures/generate-fixtures.mjs | 43 ++++++ .../fixtures/let-destructure-init/fixture.ts | 1 + .../snapshots/1-TSESTree-AST.shot | 101 ++++++++++++++ .../snapshots/2-TSESTree-Tokens.shot | 76 +++++++++++ .../snapshots/3-Babel-AST.shot | 92 +++++++++++++ .../snapshots/4-Babel-Tokens.shot | 76 +++++++++++ .../snapshots/5-AST-Alignment-AST.shot | 105 +++++++++++++++ .../snapshots/6-AST-Alignment-Tokens.shot | 82 ++++++++++++ .../let-destructure-type-init/fixture.ts | 1 + .../snapshots/1-TSESTree-AST.shot | 119 +++++++++++++++++ .../snapshots/2-TSESTree-Tokens.shot | 96 ++++++++++++++ .../snapshots/3-Babel-AST.shot | 110 ++++++++++++++++ .../snapshots/4-Babel-Tokens.shot | 96 ++++++++++++++ .../snapshots/5-AST-Alignment-AST.shot | 123 ++++++++++++++++++ .../snapshots/6-AST-Alignment-Tokens.shot | 102 +++++++++++++++ .../let-id-definite-type-no-init/fixture.ts | 1 + .../snapshots/1-TSESTree-AST.shot | 70 ++++++++++ .../snapshots/2-TSESTree-Tokens.shot | 66 ++++++++++ .../snapshots/3-Babel-AST.shot | 67 ++++++++++ .../snapshots/4-Babel-Tokens.shot | 66 ++++++++++ .../snapshots/5-AST-Alignment-AST.shot | 74 +++++++++++ .../snapshots/6-AST-Alignment-Tokens.shot | 72 ++++++++++ .../fixtures/let-id-init/fixture.ts | 1 + .../snapshots/1-TSESTree-AST.shot | 14 +- .../snapshots/2-TSESTree-Tokens.shot | 14 +- .../snapshots/3-Babel-AST.shot | 14 +- .../snapshots/4-Babel-Tokens.shot | 14 +- .../snapshots/5-AST-Alignment-AST.shot | 14 +- .../snapshots/6-AST-Alignment-Tokens.shot | 26 ++-- .../fixtures/let-id-no-init/fixture.ts | 1 + .../snapshots/1-TSESTree-AST.shot | 18 +-- .../snapshots/2-TSESTree-Tokens.shot | 14 +- .../snapshots/3-Babel-AST.shot | 18 +-- .../snapshots/4-Babel-Tokens.shot | 14 +- .../snapshots/5-AST-Alignment-AST.shot | 18 +-- .../snapshots/6-AST-Alignment-Tokens.shot | 14 +- .../fixtures/let-id-type-init/fixture.ts | 1 + .../snapshots/1-TSESTree-AST.shot | 80 ++++++++++++ .../snapshots/2-TSESTree-Tokens.shot | 76 +++++++++++ .../snapshots/3-Babel-AST.shot | 76 +++++++++++ .../snapshots/4-Babel-Tokens.shot | 76 +++++++++++ .../snapshots/5-AST-Alignment-AST.shot | 84 ++++++++++++ .../snapshots/6-AST-Alignment-Tokens.shot | 82 ++++++++++++ .../fixtures/let-id-type-no-init/fixture.ts | 1 + .../snapshots/1-TSESTree-AST.shot | 70 ++++++++++ .../snapshots/2-TSESTree-Tokens.shot} | 38 +++--- .../snapshots/3-Babel-AST.shot | 66 ++++++++++ .../snapshots/4-Babel-Tokens.shot} | 38 +++--- .../snapshots/5-AST-Alignment-AST.shot | 74 +++++++++++ .../snapshots/6-AST-Alignment-Tokens.shot | 62 +++++++++ .../fixtures/let-with-value/fixture.ts | 1 - .../fixtures/let-without-value/fixture.ts | 1 - .../fixtures/using-id-init/fixture.ts | 1 + .../snapshots/1-TSESTree-AST.shot | 62 +++++++++ .../snapshots/2-TSESTree-Tokens.shot | 56 ++++++++ .../using-id-init/snapshots/3-Babel-AST.shot | 58 +++++++++ .../snapshots/4-Babel-Tokens.shot} | 26 ++-- .../snapshots/5-AST-Alignment-AST.shot | 66 ++++++++++ .../snapshots/6-AST-Alignment-Tokens.shot | 2 +- .../fixtures/using-id-type-init/fixture.ts | 1 + .../snapshots/1-TSESTree-AST.shot | 80 ++++++++++++ .../snapshots/2-TSESTree-Tokens.shot | 76 +++++++++++ .../snapshots/3-Babel-AST.shot | 76 +++++++++++ .../snapshots/4-Babel-Tokens.shot | 76 +++++++++++ .../snapshots/5-AST-Alignment-AST.shot | 84 ++++++++++++ .../snapshots/6-AST-Alignment-Tokens.shot | 6 + .../fixtures/using-with-value/fixture.ts | 1 - .../fixtures/var-destructure-init/fixture.ts | 1 + .../snapshots/1-TSESTree-AST.shot | 101 ++++++++++++++ .../snapshots/2-TSESTree-Tokens.shot | 76 +++++++++++ .../snapshots/3-Babel-AST.shot | 92 +++++++++++++ .../snapshots/4-Babel-Tokens.shot | 76 +++++++++++ .../snapshots/5-AST-Alignment-AST.shot | 105 +++++++++++++++ .../snapshots/6-AST-Alignment-Tokens.shot | 6 + .../var-destructure-type-init/fixture.ts | 1 + .../snapshots/1-TSESTree-AST.shot | 119 +++++++++++++++++ .../snapshots/2-TSESTree-Tokens.shot | 96 ++++++++++++++ .../snapshots/3-Babel-AST.shot | 110 ++++++++++++++++ .../snapshots/4-Babel-Tokens.shot | 96 ++++++++++++++ .../snapshots/5-AST-Alignment-AST.shot | 123 ++++++++++++++++++ .../snapshots/6-AST-Alignment-Tokens.shot | 6 + .../var-id-definite-type-no-init/fixture.ts | 1 + .../snapshots/1-TSESTree-AST.shot | 70 ++++++++++ .../snapshots/2-TSESTree-Tokens.shot | 66 ++++++++++ .../snapshots/3-Babel-AST.shot | 67 ++++++++++ .../snapshots/4-Babel-Tokens.shot | 66 ++++++++++ .../snapshots/5-AST-Alignment-AST.shot | 74 +++++++++++ .../snapshots/6-AST-Alignment-Tokens.shot | 6 + .../fixtures/var-id-init/fixture.ts | 1 + .../snapshots/1-TSESTree-AST.shot | 14 +- .../snapshots/2-TSESTree-Tokens.shot} | 14 +- .../snapshots/3-Babel-AST.shot | 14 +- .../snapshots/4-Babel-Tokens.shot | 14 +- .../snapshots/5-AST-Alignment-AST.shot | 14 +- .../snapshots/6-AST-Alignment-Tokens.shot | 2 +- .../fixtures/var-id-no-init/fixture.ts | 1 + .../snapshots/1-TSESTree-AST.shot | 18 +-- .../snapshots/2-TSESTree-Tokens.shot | 14 +- .../snapshots/3-Babel-AST.shot | 18 +-- .../snapshots/4-Babel-Tokens.shot | 14 +- .../snapshots/5-AST-Alignment-AST.shot | 18 +-- .../snapshots/6-AST-Alignment-Tokens.shot | 2 +- .../fixtures/var-id-type-init/fixture.ts | 1 + .../snapshots/1-TSESTree-AST.shot | 80 ++++++++++++ .../snapshots/2-TSESTree-Tokens.shot | 76 +++++++++++ .../snapshots/3-Babel-AST.shot | 76 +++++++++++ .../snapshots/4-Babel-Tokens.shot | 76 +++++++++++ .../snapshots/5-AST-Alignment-AST.shot | 84 ++++++++++++ .../snapshots/6-AST-Alignment-Tokens.shot | 6 + .../fixtures/var-id-type-no-init/fixture.ts | 1 + .../snapshots/1-TSESTree-AST.shot | 70 ++++++++++ .../snapshots/2-TSESTree-Tokens.shot | 34 ++--- .../snapshots/3-Babel-AST.shot | 66 ++++++++++ .../snapshots/4-Babel-Tokens.shot | 34 ++--- .../snapshots/5-AST-Alignment-AST.shot | 74 +++++++++++ .../snapshots/6-AST-Alignment-Tokens.shot | 2 +- .../fixtures/var-with-value/fixture.ts | 1 - .../snapshots/1-TSESTree-AST.shot | 62 --------- .../var-with-value/snapshots/3-Babel-AST.shot | 58 --------- .../fixtures/var-without-value/fixture.ts | 1 - .../declaration/VariableDeclaration/spec.ts | 90 +++++++++---- .../snapshots/1-TSESTree-Error.shot | 11 +- .../snapshots/3-Alignment-Error.shot | 2 +- .../src/special/VariableDeclarator/spec.ts | 52 ++++++-- .../tests/fixtures-with-differences-ast.shot | 42 ++++-- .../fixtures-with-differences-errors.shot | 26 +++- .../fixtures-with-differences-tokens.shot | 14 +- packages/eslint-plugin/src/rules/indent.ts | 2 +- packages/typescript-estree/src/convert.ts | 68 +++++++++- 521 files changed, 13088 insertions(+), 669 deletions(-) create mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/const-destructure-no-init/fixture.ts create mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/const-destructure-no-init/snapshots/1-TSESTree-Error.shot create mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/const-destructure-no-init/snapshots/2-Babel-Error.shot create mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/const-destructure-no-init/snapshots/3-Alignment-Error.shot create mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/const-destructure-type-no-init/fixture.ts create mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/const-destructure-type-no-init/snapshots/1-TSESTree-Error.shot create mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/const-destructure-type-no-init/snapshots/2-Babel-Error.shot create mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/const-destructure-type-no-init/snapshots/3-Alignment-Error.shot create mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/const-id-definite-init/fixture.ts create mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/const-id-definite-init/snapshots/1-TSESTree-Error.shot create mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/const-id-definite-init/snapshots/2-Babel-Error.shot create mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/const-id-definite-init/snapshots/3-Alignment-Error.shot create mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/const-id-definite-no-init/fixture.ts create mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/const-id-definite-no-init/snapshots/1-TSESTree-Error.shot create mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/const-id-definite-no-init/snapshots/2-Babel-Error.shot create mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/const-id-definite-no-init/snapshots/3-Alignment-Error.shot create mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/const-id-definite-type-init/fixture.ts create mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/const-id-definite-type-init/snapshots/1-TSESTree-Error.shot create mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/const-id-definite-type-init/snapshots/2-Babel-Error.shot create mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/const-id-definite-type-init/snapshots/3-Alignment-Error.shot create mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/const-id-definite-type-no-init/fixture.ts create mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/const-id-definite-type-no-init/snapshots/1-TSESTree-Error.shot create mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/const-id-definite-type-no-init/snapshots/2-Babel-Error.shot create mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/const-id-definite-type-no-init/snapshots/3-Alignment-Error.shot create mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/const-id-no-init/fixture.ts create mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/const-id-no-init/snapshots/1-TSESTree-Error.shot create mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/const-id-no-init/snapshots/2-Babel-Error.shot create mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/const-id-no-init/snapshots/3-Alignment-Error.shot create mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/const-id-type-no-init/fixture.ts create mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/const-id-type-no-init/snapshots/1-TSESTree-Error.shot create mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/const-id-type-no-init/snapshots/2-Babel-Error.shot create mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/const-id-type-no-init/snapshots/3-Alignment-Error.shot create mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-const-destructure-type-init/fixture.ts create mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-const-destructure-type-init/snapshots/1-TSESTree-Error.shot create mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-const-destructure-type-init/snapshots/2-Babel-Error.shot create mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-const-destructure-type-init/snapshots/3-Alignment-Error.shot create mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-const-id-definite-init/fixture.ts create mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-const-id-definite-init/snapshots/1-TSESTree-Error.shot rename packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/{declare-with-using => declare-const-id-definite-init}/snapshots/2-Babel-Error.shot (57%) create mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-const-id-definite-init/snapshots/3-Alignment-Error.shot create mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-const-id-definite-no-init/fixture.ts create mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-const-id-definite-no-init/snapshots/1-TSESTree-Error.shot create mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-const-id-definite-no-init/snapshots/2-Babel-Error.shot create mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-const-id-definite-no-init/snapshots/3-Alignment-Error.shot create mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-const-id-definite-type-init/fixture.ts create mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-const-id-definite-type-init/snapshots/1-TSESTree-Error.shot create mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-const-id-definite-type-init/snapshots/2-Babel-Error.shot create mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-const-id-definite-type-init/snapshots/3-Alignment-Error.shot create mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-const-id-definite-type-no-init/fixture.ts create mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-const-id-definite-type-no-init/snapshots/1-TSESTree-Error.shot create mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-const-id-definite-type-no-init/snapshots/2-Babel-Error.shot create mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-const-id-definite-type-no-init/snapshots/3-Alignment-Error.shot create mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-const-id-type-init/fixture.ts create mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-const-id-type-init/snapshots/1-TSESTree-Error.shot create mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-const-id-type-init/snapshots/2-Babel-Error.shot create mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-const-id-type-init/snapshots/3-Alignment-Error.shot create mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-let-destructure-init/fixture.ts create mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-let-destructure-init/snapshots/1-TSESTree-Error.shot create mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-let-destructure-init/snapshots/2-Babel-Error.shot create mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-let-destructure-init/snapshots/3-Alignment-Error.shot create mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-let-destructure-type-init/fixture.ts create mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-let-destructure-type-init/snapshots/1-TSESTree-Error.shot create mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-let-destructure-type-init/snapshots/2-Babel-Error.shot create mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-let-destructure-type-init/snapshots/3-Alignment-Error.shot create mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-let-id-definite-init/fixture.ts create mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-let-id-definite-init/snapshots/1-TSESTree-Error.shot create mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-let-id-definite-init/snapshots/2-Babel-Error.shot create mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-let-id-definite-init/snapshots/3-Alignment-Error.shot create mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-let-id-definite-no-init/fixture.ts create mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-let-id-definite-no-init/snapshots/1-TSESTree-Error.shot create mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-let-id-definite-no-init/snapshots/2-Babel-Error.shot create mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-let-id-definite-no-init/snapshots/3-Alignment-Error.shot create mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-let-id-definite-type-init/fixture.ts create mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-let-id-definite-type-init/snapshots/1-TSESTree-Error.shot create mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-let-id-definite-type-init/snapshots/2-Babel-Error.shot create mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-let-id-definite-type-init/snapshots/3-Alignment-Error.shot create mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-let-id-definite-type-no-init/fixture.ts create mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-let-id-definite-type-no-init/snapshots/1-TSESTree-Error.shot create mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-let-id-definite-type-no-init/snapshots/2-Babel-Error.shot create mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-let-id-definite-type-no-init/snapshots/3-Alignment-Error.shot create mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-let-id-init/fixture.ts create mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-let-id-init/snapshots/1-TSESTree-Error.shot create mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-let-id-init/snapshots/2-Babel-Error.shot rename packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/{declare-with-using => declare-let-id-init}/snapshots/3-Alignment-Error.shot (65%) create mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-let-id-type-init/fixture.ts create mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-let-id-type-init/snapshots/1-TSESTree-Error.shot create mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-let-id-type-init/snapshots/2-Babel-Error.shot create mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-let-id-type-init/snapshots/3-Alignment-Error.shot create mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-using-destructure-init/fixture.ts create mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-using-destructure-init/snapshots/1-TSESTree-Error.shot create mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-using-destructure-init/snapshots/2-Babel-Error.shot create mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-using-destructure-init/snapshots/3-Alignment-Error.shot create mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-using-destructure-no-init/fixture.ts create mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-using-destructure-no-init/snapshots/1-TSESTree-Error.shot create mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-using-destructure-no-init/snapshots/2-Babel-Error.shot create mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-using-destructure-no-init/snapshots/3-Alignment-Error.shot create mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-using-destructure-type-init/fixture.ts create mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-using-destructure-type-init/snapshots/1-TSESTree-Error.shot create mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-using-destructure-type-init/snapshots/2-Babel-Error.shot create mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-using-destructure-type-init/snapshots/3-Alignment-Error.shot create mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-using-destructure-type-no-init/fixture.ts create mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-using-destructure-type-no-init/snapshots/1-TSESTree-Error.shot create mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-using-destructure-type-no-init/snapshots/2-Babel-Error.shot create mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-using-destructure-type-no-init/snapshots/3-Alignment-Error.shot create mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-using-id-definite-init/fixture.ts create mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-using-id-definite-init/snapshots/1-TSESTree-Error.shot create mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-using-id-definite-init/snapshots/2-Babel-Error.shot create mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-using-id-definite-init/snapshots/3-Alignment-Error.shot create mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-using-id-definite-no-init/fixture.ts create mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-using-id-definite-no-init/snapshots/1-TSESTree-Error.shot create mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-using-id-definite-no-init/snapshots/2-Babel-Error.shot create mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-using-id-definite-no-init/snapshots/3-Alignment-Error.shot create mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-using-id-definite-type-init/fixture.ts create mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-using-id-definite-type-init/snapshots/1-TSESTree-Error.shot create mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-using-id-definite-type-init/snapshots/2-Babel-Error.shot create mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-using-id-definite-type-init/snapshots/3-Alignment-Error.shot create mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-using-id-definite-type-no-init/fixture.ts create mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-using-id-definite-type-no-init/snapshots/1-TSESTree-Error.shot create mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-using-id-definite-type-no-init/snapshots/2-Babel-Error.shot create mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-using-id-definite-type-no-init/snapshots/3-Alignment-Error.shot create mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-using-id-init/fixture.ts create mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-using-id-init/snapshots/1-TSESTree-Error.shot create mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-using-id-init/snapshots/2-Babel-Error.shot create mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-using-id-init/snapshots/3-Alignment-Error.shot create mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-using-id-no-init/fixture.ts rename packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/{declare-with-using => declare-using-id-no-init}/snapshots/1-TSESTree-Error.shot (73%) create mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-using-id-no-init/snapshots/2-Babel-Error.shot create mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-using-id-no-init/snapshots/3-Alignment-Error.shot create mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-using-id-type-init/fixture.ts create mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-using-id-type-init/snapshots/1-TSESTree-Error.shot create mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-using-id-type-init/snapshots/2-Babel-Error.shot create mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-using-id-type-init/snapshots/3-Alignment-Error.shot create mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-using-id-type-no-init/fixture.ts create mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-using-id-type-no-init/snapshots/1-TSESTree-Error.shot create mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-using-id-type-no-init/snapshots/2-Babel-Error.shot create mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-using-id-type-no-init/snapshots/3-Alignment-Error.shot create mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-var-destructure-init/fixture.ts create mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-var-destructure-init/snapshots/1-TSESTree-Error.shot create mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-var-destructure-init/snapshots/2-Babel-Error.shot create mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-var-destructure-init/snapshots/3-Alignment-Error.shot create mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-var-destructure-type-init/fixture.ts create mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-var-destructure-type-init/snapshots/1-TSESTree-Error.shot create mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-var-destructure-type-init/snapshots/2-Babel-Error.shot create mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-var-destructure-type-init/snapshots/3-Alignment-Error.shot create mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-var-id-definite-init/fixture.ts create mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-var-id-definite-init/snapshots/1-TSESTree-Error.shot create mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-var-id-definite-init/snapshots/2-Babel-Error.shot create mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-var-id-definite-init/snapshots/3-Alignment-Error.shot create mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-var-id-definite-no-init/fixture.ts create mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-var-id-definite-no-init/snapshots/1-TSESTree-Error.shot create mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-var-id-definite-no-init/snapshots/2-Babel-Error.shot create mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-var-id-definite-no-init/snapshots/3-Alignment-Error.shot create mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-var-id-definite-type-init/fixture.ts create mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-var-id-definite-type-init/snapshots/1-TSESTree-Error.shot create mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-var-id-definite-type-init/snapshots/2-Babel-Error.shot create mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-var-id-definite-type-init/snapshots/3-Alignment-Error.shot create mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-var-id-definite-type-no-init/fixture.ts create mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-var-id-definite-type-no-init/snapshots/1-TSESTree-Error.shot create mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-var-id-definite-type-no-init/snapshots/2-Babel-Error.shot create mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-var-id-definite-type-no-init/snapshots/3-Alignment-Error.shot create mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-var-id-init/fixture.ts create mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-var-id-init/snapshots/1-TSESTree-Error.shot create mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-var-id-init/snapshots/2-Babel-Error.shot create mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-var-id-init/snapshots/3-Alignment-Error.shot create mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-var-id-type-init/fixture.ts create mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-var-id-type-init/snapshots/1-TSESTree-Error.shot create mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-var-id-type-init/snapshots/2-Babel-Error.shot create mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-var-id-type-init/snapshots/3-Alignment-Error.shot delete mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-with-using/fixture.ts create mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/let-destructure-no-init/fixture.ts create mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/let-destructure-no-init/snapshots/1-TSESTree-Error.shot create mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/let-destructure-no-init/snapshots/2-Babel-Error.shot create mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/let-destructure-no-init/snapshots/3-Alignment-Error.shot create mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/let-destructure-type-no-init/fixture.ts create mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/let-destructure-type-no-init/snapshots/1-TSESTree-Error.shot create mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/let-destructure-type-no-init/snapshots/2-Babel-Error.shot create mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/let-destructure-type-no-init/snapshots/3-Alignment-Error.shot create mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/let-id-definite-init/fixture.ts create mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/let-id-definite-init/snapshots/1-TSESTree-Error.shot create mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/let-id-definite-init/snapshots/2-Babel-Error.shot create mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/let-id-definite-init/snapshots/3-Alignment-Error.shot create mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/let-id-definite-no-init/fixture.ts create mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/let-id-definite-no-init/snapshots/1-TSESTree-Error.shot create mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/let-id-definite-no-init/snapshots/2-Babel-Error.shot create mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/let-id-definite-no-init/snapshots/3-Alignment-Error.shot create mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/let-id-definite-type-init/fixture.ts create mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/let-id-definite-type-init/snapshots/1-TSESTree-Error.shot create mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/let-id-definite-type-init/snapshots/2-Babel-Error.shot create mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/let-id-definite-type-init/snapshots/3-Alignment-Error.shot delete mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/missing-id-without-value/fixture.ts delete mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/missing-id-without-value/snapshots/1-Babel-Error.shot delete mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/missing-id-without-value/snapshots/1-TSESTree-Error.shot delete mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/missing-id-without-value/snapshots/2-Alignment-Error.shot delete mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/missing-id-without-value/snapshots/2-Babel-Error.shot delete mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/missing-id-without-value/snapshots/3-Alignment-Error.shot delete mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/missing-value-in-using/fixture.ts delete mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/missing-value-in-using/snapshots/1-TSESTree-Error.shot delete mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/missing-value-in-using/snapshots/2-Babel-Error.shot delete mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/missing-value-in-using/snapshots/3-Alignment-Error.shot delete mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/object-binding-patterns-in-using/fixture.ts delete mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/object-binding-patterns-in-using/snapshots/1-TSESTree-Error.shot delete mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/object-binding-patterns-in-using/snapshots/2-Babel-Error.shot delete mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/object-binding-patterns-in-using/snapshots/3-Alignment-Error.shot create mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/using-destructure-init/fixture.ts create mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/using-destructure-init/snapshots/1-TSESTree-Error.shot create mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/using-destructure-init/snapshots/2-Babel-Error.shot create mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/using-destructure-init/snapshots/3-Alignment-Error.shot create mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/using-destructure-no-init/fixture.ts create mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/using-destructure-no-init/snapshots/1-TSESTree-Error.shot create mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/using-destructure-no-init/snapshots/2-Babel-Error.shot create mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/using-destructure-no-init/snapshots/3-Alignment-Error.shot create mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/using-destructure-type-init/fixture.ts create mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/using-destructure-type-init/snapshots/1-TSESTree-Error.shot create mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/using-destructure-type-init/snapshots/2-Babel-Error.shot create mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/using-destructure-type-init/snapshots/3-Alignment-Error.shot create mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/using-destructure-type-no-init/fixture.ts create mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/using-destructure-type-no-init/snapshots/1-TSESTree-Error.shot create mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/using-destructure-type-no-init/snapshots/2-Babel-Error.shot create mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/using-destructure-type-no-init/snapshots/3-Alignment-Error.shot create mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/using-id-definite-init/fixture.ts create mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/using-id-definite-init/snapshots/1-TSESTree-Error.shot create mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/using-id-definite-init/snapshots/2-Babel-Error.shot create mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/using-id-definite-init/snapshots/3-Alignment-Error.shot create mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/using-id-definite-no-init/fixture.ts create mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/using-id-definite-no-init/snapshots/1-TSESTree-Error.shot create mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/using-id-definite-no-init/snapshots/2-Babel-Error.shot create mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/using-id-definite-no-init/snapshots/3-Alignment-Error.shot create mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/using-id-definite-type-init/fixture.ts create mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/using-id-definite-type-init/snapshots/1-TSESTree-Error.shot create mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/using-id-definite-type-init/snapshots/2-Babel-Error.shot create mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/using-id-definite-type-init/snapshots/3-Alignment-Error.shot create mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/using-id-definite-type-no-init/fixture.ts create mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/using-id-definite-type-no-init/snapshots/1-TSESTree-Error.shot create mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/using-id-definite-type-no-init/snapshots/2-Babel-Error.shot create mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/using-id-definite-type-no-init/snapshots/3-Alignment-Error.shot create mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/using-id-no-init/fixture.ts create mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/using-id-no-init/snapshots/1-TSESTree-Error.shot create mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/using-id-no-init/snapshots/2-Babel-Error.shot create mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/using-id-no-init/snapshots/3-Alignment-Error.shot create mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/using-id-type-no-init/fixture.ts create mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/using-id-type-no-init/snapshots/1-TSESTree-Error.shot create mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/using-id-type-no-init/snapshots/2-Babel-Error.shot create mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/using-id-type-no-init/snapshots/3-Alignment-Error.shot create mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/var-destructure-no-init/fixture.ts create mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/var-destructure-no-init/snapshots/1-TSESTree-Error.shot create mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/var-destructure-no-init/snapshots/2-Babel-Error.shot create mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/var-destructure-no-init/snapshots/3-Alignment-Error.shot create mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/var-destructure-type-no-init/fixture.ts create mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/var-destructure-type-no-init/snapshots/1-TSESTree-Error.shot create mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/var-destructure-type-no-init/snapshots/2-Babel-Error.shot create mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/var-destructure-type-no-init/snapshots/3-Alignment-Error.shot create mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/var-id-definite-init/fixture.ts create mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/var-id-definite-init/snapshots/1-TSESTree-Error.shot create mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/var-id-definite-init/snapshots/2-Babel-Error.shot create mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/var-id-definite-init/snapshots/3-Alignment-Error.shot create mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/var-id-definite-no-init/fixture.ts create mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/var-id-definite-no-init/snapshots/1-TSESTree-Error.shot create mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/var-id-definite-no-init/snapshots/2-Babel-Error.shot create mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/var-id-definite-no-init/snapshots/3-Alignment-Error.shot create mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/var-id-definite-type-init/fixture.ts create mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/var-id-definite-type-init/snapshots/1-TSESTree-Error.shot create mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/var-id-definite-type-init/snapshots/2-Babel-Error.shot create mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/var-id-definite-type-init/snapshots/3-Alignment-Error.shot create mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/const-destructure-init/fixture.ts create mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/const-destructure-init/snapshots/1-TSESTree-AST.shot create mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/const-destructure-init/snapshots/2-TSESTree-Tokens.shot create mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/const-destructure-init/snapshots/3-Babel-AST.shot create mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/const-destructure-init/snapshots/4-Babel-Tokens.shot create mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/const-destructure-init/snapshots/5-AST-Alignment-AST.shot create mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/const-destructure-init/snapshots/6-AST-Alignment-Tokens.shot create mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/const-destructure-type-init/fixture.ts create mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/const-destructure-type-init/snapshots/1-TSESTree-AST.shot create mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/const-destructure-type-init/snapshots/2-TSESTree-Tokens.shot create mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/const-destructure-type-init/snapshots/3-Babel-AST.shot create mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/const-destructure-type-init/snapshots/4-Babel-Tokens.shot create mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/const-destructure-type-init/snapshots/5-AST-Alignment-AST.shot create mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/const-destructure-type-init/snapshots/6-AST-Alignment-Tokens.shot create mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/const-id-init/fixture.ts rename packages/ast-spec/src/declaration/VariableDeclaration/fixtures/{const-without-value => const-id-init}/snapshots/1-TSESTree-AST.shot (67%) rename packages/ast-spec/src/declaration/VariableDeclaration/fixtures/{const-without-value => const-id-init}/snapshots/2-TSESTree-Tokens.shot (67%) rename packages/ast-spec/src/declaration/VariableDeclaration/fixtures/{const-without-value => const-id-init}/snapshots/3-Babel-AST.shot (64%) create mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/const-id-init/snapshots/4-Babel-Tokens.shot rename packages/ast-spec/src/declaration/VariableDeclaration/fixtures/{const-without-value => const-id-init}/snapshots/5-AST-Alignment-AST.shot (69%) rename packages/ast-spec/src/declaration/VariableDeclaration/fixtures/{var-with-value => const-id-init}/snapshots/6-AST-Alignment-Tokens.shot (51%) create mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/const-id-type-init/fixture.ts create mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/const-id-type-init/snapshots/1-TSESTree-AST.shot create mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/const-id-type-init/snapshots/2-TSESTree-Tokens.shot create mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/const-id-type-init/snapshots/3-Babel-AST.shot create mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/const-id-type-init/snapshots/4-Babel-Tokens.shot create mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/const-id-type-init/snapshots/5-AST-Alignment-AST.shot create mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/const-id-type-init/snapshots/6-AST-Alignment-Tokens.shot delete mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/const-with-value/fixture.ts delete mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/const-without-value/fixture.ts create mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare-const-destructure-init/fixture.ts create mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare-const-destructure-init/snapshots/1-TSESTree-AST.shot create mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare-const-destructure-init/snapshots/2-TSESTree-Tokens.shot create mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare-const-destructure-init/snapshots/3-Babel-AST.shot create mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare-const-destructure-init/snapshots/4-Babel-Tokens.shot create mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare-const-destructure-init/snapshots/5-AST-Alignment-AST.shot create mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare-const-destructure-init/snapshots/6-AST-Alignment-Tokens.shot create mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare-const-destructure-no-init/fixture.ts create mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare-const-destructure-no-init/snapshots/1-TSESTree-AST.shot create mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare-const-destructure-no-init/snapshots/2-TSESTree-Tokens.shot create mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare-const-destructure-no-init/snapshots/3-Babel-AST.shot create mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare-const-destructure-no-init/snapshots/4-Babel-Tokens.shot create mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare-const-destructure-no-init/snapshots/5-AST-Alignment-AST.shot create mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare-const-destructure-no-init/snapshots/6-AST-Alignment-Tokens.shot create mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare-const-destructure-type-no-init/fixture.ts create mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare-const-destructure-type-no-init/snapshots/1-TSESTree-AST.shot create mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare-const-destructure-type-no-init/snapshots/2-TSESTree-Tokens.shot create mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare-const-destructure-type-no-init/snapshots/3-Babel-AST.shot create mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare-const-destructure-type-no-init/snapshots/4-Babel-Tokens.shot create mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare-const-destructure-type-no-init/snapshots/5-AST-Alignment-AST.shot create mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare-const-destructure-type-no-init/snapshots/6-AST-Alignment-Tokens.shot create mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare-const-id-init/fixture.ts rename packages/ast-spec/src/declaration/VariableDeclaration/fixtures/{let-with-value => declare-const-id-init}/snapshots/1-TSESTree-AST.shot (57%) create mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare-const-id-init/snapshots/2-TSESTree-Tokens.shot rename packages/ast-spec/src/declaration/VariableDeclaration/fixtures/{let-with-value => declare-const-id-init}/snapshots/3-Babel-AST.shot (55%) create mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare-const-id-init/snapshots/4-Babel-Tokens.shot rename packages/ast-spec/src/declaration/VariableDeclaration/fixtures/{let-with-value => declare-const-id-init}/snapshots/5-AST-Alignment-AST.shot (59%) create mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare-const-id-init/snapshots/6-AST-Alignment-Tokens.shot create mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare-const-id-no-init/fixture.ts create mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare-const-id-no-init/snapshots/1-TSESTree-AST.shot create mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare-const-id-no-init/snapshots/2-TSESTree-Tokens.shot create mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare-const-id-no-init/snapshots/3-Babel-AST.shot create mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare-const-id-no-init/snapshots/4-Babel-Tokens.shot create mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare-const-id-no-init/snapshots/5-AST-Alignment-AST.shot create mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare-const-id-no-init/snapshots/6-AST-Alignment-Tokens.shot create mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare-const-id-type-no-init/fixture.ts create mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare-const-id-type-no-init/snapshots/1-TSESTree-AST.shot create mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare-const-id-type-no-init/snapshots/2-TSESTree-Tokens.shot create mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare-const-id-type-no-init/snapshots/3-Babel-AST.shot create mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare-const-id-type-no-init/snapshots/4-Babel-Tokens.shot create mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare-const-id-type-no-init/snapshots/5-AST-Alignment-AST.shot create mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare-const-id-type-no-init/snapshots/6-AST-Alignment-Tokens.shot create mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare-let-destructure-no-init/fixture.ts create mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare-let-destructure-no-init/snapshots/1-TSESTree-AST.shot create mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare-let-destructure-no-init/snapshots/2-TSESTree-Tokens.shot create mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare-let-destructure-no-init/snapshots/3-Babel-AST.shot create mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare-let-destructure-no-init/snapshots/4-Babel-Tokens.shot create mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare-let-destructure-no-init/snapshots/5-AST-Alignment-AST.shot create mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare-let-destructure-no-init/snapshots/6-AST-Alignment-Tokens.shot create mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare-let-destructure-type-no-init/fixture.ts create mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare-let-destructure-type-no-init/snapshots/1-TSESTree-AST.shot create mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare-let-destructure-type-no-init/snapshots/2-TSESTree-Tokens.shot create mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare-let-destructure-type-no-init/snapshots/3-Babel-AST.shot create mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare-let-destructure-type-no-init/snapshots/4-Babel-Tokens.shot create mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare-let-destructure-type-no-init/snapshots/5-AST-Alignment-AST.shot create mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare-let-destructure-type-no-init/snapshots/6-AST-Alignment-Tokens.shot create mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare-let-id-no-init/fixture.ts rename packages/ast-spec/src/declaration/VariableDeclaration/fixtures/{declare => declare-let-id-no-init}/snapshots/1-TSESTree-AST.shot (70%) rename packages/ast-spec/src/declaration/VariableDeclaration/fixtures/{declare => declare-let-id-no-init}/snapshots/2-TSESTree-Tokens.shot (67%) rename packages/ast-spec/src/declaration/VariableDeclaration/fixtures/{declare => declare-let-id-no-init}/snapshots/3-Babel-AST.shot (68%) rename packages/ast-spec/src/declaration/VariableDeclaration/fixtures/{declare => declare-let-id-no-init}/snapshots/4-Babel-Tokens.shot (68%) rename packages/ast-spec/src/declaration/VariableDeclaration/fixtures/{declare => declare-let-id-no-init}/snapshots/5-AST-Alignment-AST.shot (71%) rename packages/ast-spec/src/declaration/VariableDeclaration/fixtures/{declare => declare-let-id-no-init}/snapshots/6-AST-Alignment-Tokens.shot (71%) create mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare-let-id-type-no-init/fixture.ts create mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare-let-id-type-no-init/snapshots/1-TSESTree-AST.shot create mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare-let-id-type-no-init/snapshots/2-TSESTree-Tokens.shot create mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare-let-id-type-no-init/snapshots/3-Babel-AST.shot create mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare-let-id-type-no-init/snapshots/4-Babel-Tokens.shot create mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare-let-id-type-no-init/snapshots/5-AST-Alignment-AST.shot create mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare-let-id-type-no-init/snapshots/6-AST-Alignment-Tokens.shot create mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare-var-destructure-no-init/fixture.ts create mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare-var-destructure-no-init/snapshots/1-TSESTree-AST.shot create mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare-var-destructure-no-init/snapshots/2-TSESTree-Tokens.shot create mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare-var-destructure-no-init/snapshots/3-Babel-AST.shot create mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare-var-destructure-no-init/snapshots/4-Babel-Tokens.shot create mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare-var-destructure-no-init/snapshots/5-AST-Alignment-AST.shot create mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare-var-destructure-no-init/snapshots/6-AST-Alignment-Tokens.shot create mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare-var-destructure-type-no-init/fixture.ts create mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare-var-destructure-type-no-init/snapshots/1-TSESTree-AST.shot create mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare-var-destructure-type-no-init/snapshots/2-TSESTree-Tokens.shot create mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare-var-destructure-type-no-init/snapshots/3-Babel-AST.shot create mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare-var-destructure-type-no-init/snapshots/4-Babel-Tokens.shot create mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare-var-destructure-type-no-init/snapshots/5-AST-Alignment-AST.shot create mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare-var-destructure-type-no-init/snapshots/6-AST-Alignment-Tokens.shot create mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare-var-id-no-init/fixture.ts create mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare-var-id-no-init/snapshots/1-TSESTree-AST.shot create mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare-var-id-no-init/snapshots/2-TSESTree-Tokens.shot create mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare-var-id-no-init/snapshots/3-Babel-AST.shot create mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare-var-id-no-init/snapshots/4-Babel-Tokens.shot rename packages/ast-spec/src/declaration/VariableDeclaration/fixtures/{var-with-value => declare-var-id-no-init}/snapshots/5-AST-Alignment-AST.shot (51%) create mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare-var-id-no-init/snapshots/6-AST-Alignment-Tokens.shot create mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare-var-id-type-no-init/fixture.ts create mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare-var-id-type-no-init/snapshots/1-TSESTree-AST.shot create mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare-var-id-type-no-init/snapshots/2-TSESTree-Tokens.shot create mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare-var-id-type-no-init/snapshots/3-Babel-AST.shot create mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare-var-id-type-no-init/snapshots/4-Babel-Tokens.shot create mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare-var-id-type-no-init/snapshots/5-AST-Alignment-AST.shot create mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare-var-id-type-no-init/snapshots/6-AST-Alignment-Tokens.shot delete mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare/fixture.ts create mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/generate-fixtures.mjs create mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/let-destructure-init/fixture.ts create mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/let-destructure-init/snapshots/1-TSESTree-AST.shot create mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/let-destructure-init/snapshots/2-TSESTree-Tokens.shot create mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/let-destructure-init/snapshots/3-Babel-AST.shot create mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/let-destructure-init/snapshots/4-Babel-Tokens.shot create mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/let-destructure-init/snapshots/5-AST-Alignment-AST.shot create mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/let-destructure-init/snapshots/6-AST-Alignment-Tokens.shot create mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/let-destructure-type-init/fixture.ts create mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/let-destructure-type-init/snapshots/1-TSESTree-AST.shot create mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/let-destructure-type-init/snapshots/2-TSESTree-Tokens.shot create mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/let-destructure-type-init/snapshots/3-Babel-AST.shot create mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/let-destructure-type-init/snapshots/4-Babel-Tokens.shot create mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/let-destructure-type-init/snapshots/5-AST-Alignment-AST.shot create mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/let-destructure-type-init/snapshots/6-AST-Alignment-Tokens.shot create mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/let-id-definite-type-no-init/fixture.ts create mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/let-id-definite-type-no-init/snapshots/1-TSESTree-AST.shot create mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/let-id-definite-type-no-init/snapshots/2-TSESTree-Tokens.shot create mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/let-id-definite-type-no-init/snapshots/3-Babel-AST.shot create mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/let-id-definite-type-no-init/snapshots/4-Babel-Tokens.shot create mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/let-id-definite-type-no-init/snapshots/5-AST-Alignment-AST.shot create mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/let-id-definite-type-no-init/snapshots/6-AST-Alignment-Tokens.shot create mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/let-id-init/fixture.ts rename packages/ast-spec/src/declaration/VariableDeclaration/fixtures/{const-with-value => let-id-init}/snapshots/1-TSESTree-AST.shot (79%) rename packages/ast-spec/src/declaration/VariableDeclaration/fixtures/{const-with-value => let-id-init}/snapshots/2-TSESTree-Tokens.shot (75%) rename packages/ast-spec/src/declaration/VariableDeclaration/fixtures/{using-with-value => let-id-init}/snapshots/3-Babel-AST.shot (78%) rename packages/ast-spec/src/declaration/VariableDeclaration/fixtures/{using-with-value => let-id-init}/snapshots/4-Babel-Tokens.shot (76%) rename packages/ast-spec/src/declaration/VariableDeclaration/fixtures/{const-with-value => let-id-init}/snapshots/5-AST-Alignment-AST.shot (80%) rename packages/ast-spec/src/declaration/VariableDeclaration/fixtures/{let-with-value => let-id-init}/snapshots/6-AST-Alignment-Tokens.shot (71%) create mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/let-id-no-init/fixture.ts rename packages/ast-spec/src/declaration/VariableDeclaration/fixtures/{let-without-value => let-id-no-init}/snapshots/1-TSESTree-AST.shot (71%) rename packages/ast-spec/src/declaration/VariableDeclaration/fixtures/{let-without-value => let-id-no-init}/snapshots/2-TSESTree-Tokens.shot (60%) rename packages/ast-spec/src/declaration/VariableDeclaration/fixtures/{let-without-value => let-id-no-init}/snapshots/3-Babel-AST.shot (68%) rename packages/ast-spec/src/declaration/VariableDeclaration/fixtures/{let-without-value => let-id-no-init}/snapshots/4-Babel-Tokens.shot (61%) rename packages/ast-spec/src/declaration/VariableDeclaration/fixtures/{let-without-value => let-id-no-init}/snapshots/5-AST-Alignment-AST.shot (72%) rename packages/ast-spec/src/declaration/VariableDeclaration/fixtures/{let-without-value => let-id-no-init}/snapshots/6-AST-Alignment-Tokens.shot (65%) create mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/let-id-type-init/fixture.ts create mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/let-id-type-init/snapshots/1-TSESTree-AST.shot create mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/let-id-type-init/snapshots/2-TSESTree-Tokens.shot create mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/let-id-type-init/snapshots/3-Babel-AST.shot create mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/let-id-type-init/snapshots/4-Babel-Tokens.shot create mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/let-id-type-init/snapshots/5-AST-Alignment-AST.shot create mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/let-id-type-init/snapshots/6-AST-Alignment-Tokens.shot create mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/let-id-type-no-init/fixture.ts create mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/let-id-type-no-init/snapshots/1-TSESTree-AST.shot rename packages/ast-spec/src/declaration/VariableDeclaration/fixtures/{let-with-value/snapshots/4-Babel-Tokens.shot => let-id-type-no-init/snapshots/2-TSESTree-Tokens.shot} (55%) create mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/let-id-type-no-init/snapshots/3-Babel-AST.shot rename packages/ast-spec/src/declaration/VariableDeclaration/fixtures/{let-with-value/snapshots/2-TSESTree-Tokens.shot => let-id-type-no-init/snapshots/4-Babel-Tokens.shot} (51%) create mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/let-id-type-no-init/snapshots/5-AST-Alignment-AST.shot create mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/let-id-type-no-init/snapshots/6-AST-Alignment-Tokens.shot delete mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/let-with-value/fixture.ts delete mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/let-without-value/fixture.ts create mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/using-id-init/fixture.ts create mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/using-id-init/snapshots/1-TSESTree-AST.shot create mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/using-id-init/snapshots/2-TSESTree-Tokens.shot create mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/using-id-init/snapshots/3-Babel-AST.shot rename packages/ast-spec/src/declaration/VariableDeclaration/fixtures/{using-with-value/snapshots/2-TSESTree-Tokens.shot => using-id-init/snapshots/4-Babel-Tokens.shot} (68%) create mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/using-id-init/snapshots/5-AST-Alignment-AST.shot rename packages/ast-spec/src/declaration/VariableDeclaration/fixtures/{const-with-value => using-id-init}/snapshots/6-AST-Alignment-Tokens.shot (51%) create mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/using-id-type-init/fixture.ts create mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/using-id-type-init/snapshots/1-TSESTree-AST.shot create mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/using-id-type-init/snapshots/2-TSESTree-Tokens.shot create mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/using-id-type-init/snapshots/3-Babel-AST.shot create mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/using-id-type-init/snapshots/4-Babel-Tokens.shot create mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/using-id-type-init/snapshots/5-AST-Alignment-AST.shot create mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/using-id-type-init/snapshots/6-AST-Alignment-Tokens.shot delete mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/using-with-value/fixture.ts create mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/var-destructure-init/fixture.ts create mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/var-destructure-init/snapshots/1-TSESTree-AST.shot create mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/var-destructure-init/snapshots/2-TSESTree-Tokens.shot create mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/var-destructure-init/snapshots/3-Babel-AST.shot create mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/var-destructure-init/snapshots/4-Babel-Tokens.shot create mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/var-destructure-init/snapshots/5-AST-Alignment-AST.shot create mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/var-destructure-init/snapshots/6-AST-Alignment-Tokens.shot create mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/var-destructure-type-init/fixture.ts create mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/var-destructure-type-init/snapshots/1-TSESTree-AST.shot create mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/var-destructure-type-init/snapshots/2-TSESTree-Tokens.shot create mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/var-destructure-type-init/snapshots/3-Babel-AST.shot create mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/var-destructure-type-init/snapshots/4-Babel-Tokens.shot create mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/var-destructure-type-init/snapshots/5-AST-Alignment-AST.shot create mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/var-destructure-type-init/snapshots/6-AST-Alignment-Tokens.shot create mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/var-id-definite-type-no-init/fixture.ts create mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/var-id-definite-type-no-init/snapshots/1-TSESTree-AST.shot create mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/var-id-definite-type-no-init/snapshots/2-TSESTree-Tokens.shot create mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/var-id-definite-type-no-init/snapshots/3-Babel-AST.shot create mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/var-id-definite-type-no-init/snapshots/4-Babel-Tokens.shot create mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/var-id-definite-type-no-init/snapshots/5-AST-Alignment-AST.shot create mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/var-id-definite-type-no-init/snapshots/6-AST-Alignment-Tokens.shot create mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/var-id-init/fixture.ts rename packages/ast-spec/src/declaration/VariableDeclaration/fixtures/{using-with-value => var-id-init}/snapshots/1-TSESTree-AST.shot (79%) rename packages/ast-spec/src/declaration/VariableDeclaration/fixtures/{const-without-value/snapshots/4-Babel-Tokens.shot => var-id-init/snapshots/2-TSESTree-Tokens.shot} (75%) rename packages/ast-spec/src/declaration/VariableDeclaration/fixtures/{const-with-value => var-id-init}/snapshots/3-Babel-AST.shot (78%) rename packages/ast-spec/src/declaration/VariableDeclaration/fixtures/{const-with-value => var-id-init}/snapshots/4-Babel-Tokens.shot (75%) rename packages/ast-spec/src/declaration/VariableDeclaration/fixtures/{using-with-value => var-id-init}/snapshots/5-AST-Alignment-AST.shot (80%) rename packages/ast-spec/src/declaration/VariableDeclaration/fixtures/{using-with-value => var-id-init}/snapshots/6-AST-Alignment-Tokens.shot (51%) create mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/var-id-no-init/fixture.ts rename packages/ast-spec/src/declaration/VariableDeclaration/fixtures/{var-without-value => var-id-no-init}/snapshots/1-TSESTree-AST.shot (71%) rename packages/ast-spec/src/declaration/VariableDeclaration/fixtures/{var-without-value => var-id-no-init}/snapshots/2-TSESTree-Tokens.shot (60%) rename packages/ast-spec/src/declaration/VariableDeclaration/fixtures/{var-without-value => var-id-no-init}/snapshots/3-Babel-AST.shot (68%) rename packages/ast-spec/src/declaration/VariableDeclaration/fixtures/{var-without-value => var-id-no-init}/snapshots/4-Babel-Tokens.shot (60%) rename packages/ast-spec/src/declaration/VariableDeclaration/fixtures/{var-without-value => var-id-no-init}/snapshots/5-AST-Alignment-AST.shot (72%) rename packages/ast-spec/src/declaration/VariableDeclaration/fixtures/{var-without-value => var-id-no-init}/snapshots/6-AST-Alignment-Tokens.shot (51%) create mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/var-id-type-init/fixture.ts create mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/var-id-type-init/snapshots/1-TSESTree-AST.shot create mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/var-id-type-init/snapshots/2-TSESTree-Tokens.shot create mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/var-id-type-init/snapshots/3-Babel-AST.shot create mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/var-id-type-init/snapshots/4-Babel-Tokens.shot create mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/var-id-type-init/snapshots/5-AST-Alignment-AST.shot create mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/var-id-type-init/snapshots/6-AST-Alignment-Tokens.shot create mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/var-id-type-no-init/fixture.ts create mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/var-id-type-no-init/snapshots/1-TSESTree-AST.shot rename packages/ast-spec/src/declaration/VariableDeclaration/fixtures/{var-with-value => var-id-type-no-init}/snapshots/2-TSESTree-Tokens.shot (55%) create mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/var-id-type-no-init/snapshots/3-Babel-AST.shot rename packages/ast-spec/src/declaration/VariableDeclaration/fixtures/{var-with-value => var-id-type-no-init}/snapshots/4-Babel-Tokens.shot (55%) create mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/var-id-type-no-init/snapshots/5-AST-Alignment-AST.shot rename packages/ast-spec/src/declaration/VariableDeclaration/fixtures/{const-without-value => var-id-type-no-init}/snapshots/6-AST-Alignment-Tokens.shot (50%) delete mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/var-with-value/fixture.ts delete mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/var-with-value/snapshots/1-TSESTree-AST.shot delete mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/var-with-value/snapshots/3-Babel-AST.shot delete mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/fixtures/var-without-value/fixture.ts diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/const-destructure-no-init/fixture.ts b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/const-destructure-no-init/fixture.ts new file mode 100644 index 000000000000..0f10ba3cc1a1 --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/const-destructure-no-init/fixture.ts @@ -0,0 +1 @@ +const { foo }; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/const-destructure-no-init/snapshots/1-TSESTree-Error.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/const-destructure-no-init/snapshots/1-TSESTree-Error.shot new file mode 100644 index 000000000000..5b3fc94e37a2 --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/const-destructure-no-init/snapshots/1-TSESTree-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration VariableDeclaration _error_ const-destructure-no-init TSESTree - Error 1`] = `"NO ERROR"`; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/const-destructure-no-init/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/const-destructure-no-init/snapshots/2-Babel-Error.shot new file mode 100644 index 000000000000..f04996c27ff1 --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/const-destructure-no-init/snapshots/2-Babel-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration VariableDeclaration _error_ const-destructure-no-init Babel - Error 1`] = `[SyntaxError: Missing initializer in destructuring declaration. (1:13)]`; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/const-destructure-no-init/snapshots/3-Alignment-Error.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/const-destructure-no-init/snapshots/3-Alignment-Error.shot new file mode 100644 index 000000000000..3922fc150dea --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/const-destructure-no-init/snapshots/3-Alignment-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration VariableDeclaration _error_ const-destructure-no-init Error Alignment 1`] = `"Babel errored but TSESTree didn't"`; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/const-destructure-type-no-init/fixture.ts b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/const-destructure-type-no-init/fixture.ts new file mode 100644 index 000000000000..39adba918fd1 --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/const-destructure-type-no-init/fixture.ts @@ -0,0 +1 @@ +const { foo }: any; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/const-destructure-type-no-init/snapshots/1-TSESTree-Error.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/const-destructure-type-no-init/snapshots/1-TSESTree-Error.shot new file mode 100644 index 000000000000..9e1d909c04df --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/const-destructure-type-no-init/snapshots/1-TSESTree-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration VariableDeclaration _error_ const-destructure-type-no-init TSESTree - Error 1`] = `"NO ERROR"`; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/const-destructure-type-no-init/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/const-destructure-type-no-init/snapshots/2-Babel-Error.shot new file mode 100644 index 000000000000..70cf00c49b56 --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/const-destructure-type-no-init/snapshots/2-Babel-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration VariableDeclaration _error_ const-destructure-type-no-init Babel - Error 1`] = `[SyntaxError: Missing initializer in destructuring declaration. (1:18)]`; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/const-destructure-type-no-init/snapshots/3-Alignment-Error.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/const-destructure-type-no-init/snapshots/3-Alignment-Error.shot new file mode 100644 index 000000000000..91426be2a7b5 --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/const-destructure-type-no-init/snapshots/3-Alignment-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration VariableDeclaration _error_ const-destructure-type-no-init Error Alignment 1`] = `"Babel errored but TSESTree didn't"`; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/const-id-definite-init/fixture.ts b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/const-id-definite-init/fixture.ts new file mode 100644 index 000000000000..6923351e58ff --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/const-id-definite-init/fixture.ts @@ -0,0 +1 @@ +const foo! = 1; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/const-id-definite-init/snapshots/1-TSESTree-Error.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/const-id-definite-init/snapshots/1-TSESTree-Error.shot new file mode 100644 index 000000000000..eb72d50cb714 --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/const-id-definite-init/snapshots/1-TSESTree-Error.shot @@ -0,0 +1,8 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration VariableDeclaration _error_ const-id-definite-init TSESTree - Error 1`] = ` +"TSError +> 1 | const foo! = 1; + | ^^^^^^^^ Declarations with initializers cannot also have definite assignment assertions. + 2 |" +`; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/const-id-definite-init/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/const-id-definite-init/snapshots/2-Babel-Error.shot new file mode 100644 index 000000000000..0c682efc5e73 --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/const-id-definite-init/snapshots/2-Babel-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration VariableDeclaration _error_ const-id-definite-init Babel - Error 1`] = `"NO ERROR"`; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/const-id-definite-init/snapshots/3-Alignment-Error.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/const-id-definite-init/snapshots/3-Alignment-Error.shot new file mode 100644 index 000000000000..62a7d843392c --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/const-id-definite-init/snapshots/3-Alignment-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration VariableDeclaration _error_ const-id-definite-init Error Alignment 1`] = `"TSESTree errored but Babel didn't"`; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/const-id-definite-no-init/fixture.ts b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/const-id-definite-no-init/fixture.ts new file mode 100644 index 000000000000..8e2d92491c67 --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/const-id-definite-no-init/fixture.ts @@ -0,0 +1 @@ +const foo!; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/const-id-definite-no-init/snapshots/1-TSESTree-Error.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/const-id-definite-no-init/snapshots/1-TSESTree-Error.shot new file mode 100644 index 000000000000..58285ae0f6d1 --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/const-id-definite-no-init/snapshots/1-TSESTree-Error.shot @@ -0,0 +1,8 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration VariableDeclaration _error_ const-id-definite-no-init TSESTree - Error 1`] = ` +"TSError +> 1 | const foo!; + | ^^^^ Declarations with definite assignment assertions must also have type annotations. + 2 |" +`; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/const-id-definite-no-init/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/const-id-definite-no-init/snapshots/2-Babel-Error.shot new file mode 100644 index 000000000000..18d8b24f22fb --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/const-id-definite-no-init/snapshots/2-Babel-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration VariableDeclaration _error_ const-id-definite-no-init Babel - Error 1`] = `[SyntaxError: Missing initializer in const declaration. (1:10)]`; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/const-id-definite-no-init/snapshots/3-Alignment-Error.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/const-id-definite-no-init/snapshots/3-Alignment-Error.shot new file mode 100644 index 000000000000..602256d314d9 --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/const-id-definite-no-init/snapshots/3-Alignment-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration VariableDeclaration _error_ const-id-definite-no-init Error Alignment 1`] = `"Both errored"`; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/const-id-definite-type-init/fixture.ts b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/const-id-definite-type-init/fixture.ts new file mode 100644 index 000000000000..21300614b89f --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/const-id-definite-type-init/fixture.ts @@ -0,0 +1 @@ +const foo!: any = 1; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/const-id-definite-type-init/snapshots/1-TSESTree-Error.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/const-id-definite-type-init/snapshots/1-TSESTree-Error.shot new file mode 100644 index 000000000000..024f1c9c3af5 --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/const-id-definite-type-init/snapshots/1-TSESTree-Error.shot @@ -0,0 +1,8 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration VariableDeclaration _error_ const-id-definite-type-init TSESTree - Error 1`] = ` +"TSError +> 1 | const foo!: any = 1; + | ^^^^^^^^^^^^^ Declarations with initializers cannot also have definite assignment assertions. + 2 |" +`; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/const-id-definite-type-init/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/const-id-definite-type-init/snapshots/2-Babel-Error.shot new file mode 100644 index 000000000000..2e056ccfb663 --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/const-id-definite-type-init/snapshots/2-Babel-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration VariableDeclaration _error_ const-id-definite-type-init Babel - Error 1`] = `"NO ERROR"`; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/const-id-definite-type-init/snapshots/3-Alignment-Error.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/const-id-definite-type-init/snapshots/3-Alignment-Error.shot new file mode 100644 index 000000000000..a1908b0e0da5 --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/const-id-definite-type-init/snapshots/3-Alignment-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration VariableDeclaration _error_ const-id-definite-type-init Error Alignment 1`] = `"TSESTree errored but Babel didn't"`; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/const-id-definite-type-no-init/fixture.ts b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/const-id-definite-type-no-init/fixture.ts new file mode 100644 index 000000000000..7ebdfa70db11 --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/const-id-definite-type-no-init/fixture.ts @@ -0,0 +1 @@ +const foo!: any; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/const-id-definite-type-no-init/snapshots/1-TSESTree-Error.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/const-id-definite-type-no-init/snapshots/1-TSESTree-Error.shot new file mode 100644 index 000000000000..5dbf87e03df2 --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/const-id-definite-type-no-init/snapshots/1-TSESTree-Error.shot @@ -0,0 +1,8 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration VariableDeclaration _error_ const-id-definite-type-no-init TSESTree - Error 1`] = ` +"TSError +> 1 | const foo!: any; + | ^^^^^^^^^ A definite assignment assertion '!' is not permitted in this context. + 2 |" +`; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/const-id-definite-type-no-init/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/const-id-definite-type-no-init/snapshots/2-Babel-Error.shot new file mode 100644 index 000000000000..8aff2808653d --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/const-id-definite-type-no-init/snapshots/2-Babel-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration VariableDeclaration _error_ const-id-definite-type-no-init Babel - Error 1`] = `[SyntaxError: Missing initializer in const declaration. (1:15)]`; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/const-id-definite-type-no-init/snapshots/3-Alignment-Error.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/const-id-definite-type-no-init/snapshots/3-Alignment-Error.shot new file mode 100644 index 000000000000..a78b863b42f6 --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/const-id-definite-type-no-init/snapshots/3-Alignment-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration VariableDeclaration _error_ const-id-definite-type-no-init Error Alignment 1`] = `"Both errored"`; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/const-id-no-init/fixture.ts b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/const-id-no-init/fixture.ts new file mode 100644 index 000000000000..f15614ea39c3 --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/const-id-no-init/fixture.ts @@ -0,0 +1 @@ +const foo; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/const-id-no-init/snapshots/1-TSESTree-Error.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/const-id-no-init/snapshots/1-TSESTree-Error.shot new file mode 100644 index 000000000000..28f205df2e9d --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/const-id-no-init/snapshots/1-TSESTree-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration VariableDeclaration _error_ const-id-no-init TSESTree - Error 1`] = `"NO ERROR"`; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/const-id-no-init/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/const-id-no-init/snapshots/2-Babel-Error.shot new file mode 100644 index 000000000000..457d054a8c1a --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/const-id-no-init/snapshots/2-Babel-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration VariableDeclaration _error_ const-id-no-init Babel - Error 1`] = `[SyntaxError: Missing initializer in const declaration. (1:9)]`; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/const-id-no-init/snapshots/3-Alignment-Error.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/const-id-no-init/snapshots/3-Alignment-Error.shot new file mode 100644 index 000000000000..9335615cd1bc --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/const-id-no-init/snapshots/3-Alignment-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration VariableDeclaration _error_ const-id-no-init Error Alignment 1`] = `"Babel errored but TSESTree didn't"`; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/const-id-type-no-init/fixture.ts b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/const-id-type-no-init/fixture.ts new file mode 100644 index 000000000000..cb4eae0eaf4b --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/const-id-type-no-init/fixture.ts @@ -0,0 +1 @@ +const foo: any; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/const-id-type-no-init/snapshots/1-TSESTree-Error.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/const-id-type-no-init/snapshots/1-TSESTree-Error.shot new file mode 100644 index 000000000000..c488de99377d --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/const-id-type-no-init/snapshots/1-TSESTree-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration VariableDeclaration _error_ const-id-type-no-init TSESTree - Error 1`] = `"NO ERROR"`; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/const-id-type-no-init/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/const-id-type-no-init/snapshots/2-Babel-Error.shot new file mode 100644 index 000000000000..acb5282a09fa --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/const-id-type-no-init/snapshots/2-Babel-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration VariableDeclaration _error_ const-id-type-no-init Babel - Error 1`] = `[SyntaxError: Missing initializer in const declaration. (1:14)]`; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/const-id-type-no-init/snapshots/3-Alignment-Error.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/const-id-type-no-init/snapshots/3-Alignment-Error.shot new file mode 100644 index 000000000000..691e7e46dd60 --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/const-id-type-no-init/snapshots/3-Alignment-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration VariableDeclaration _error_ const-id-type-no-init Error Alignment 1`] = `"Babel errored but TSESTree didn't"`; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-const-destructure-type-init/fixture.ts b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-const-destructure-type-init/fixture.ts new file mode 100644 index 000000000000..8f52dfc7323e --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-const-destructure-type-init/fixture.ts @@ -0,0 +1 @@ +declare const { foo }: any = 1; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-const-destructure-type-init/snapshots/1-TSESTree-Error.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-const-destructure-type-init/snapshots/1-TSESTree-Error.shot new file mode 100644 index 000000000000..967b3147f6e9 --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-const-destructure-type-init/snapshots/1-TSESTree-Error.shot @@ -0,0 +1,8 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration VariableDeclaration _error_ declare-const-destructure-type-init TSESTree - Error 1`] = ` +"TSError +> 1 | declare const { foo }: any = 1; + | ^^^^^^^^^^^^^^^^ Initializers are not permitted in ambient contexts. + 2 |" +`; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-const-destructure-type-init/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-const-destructure-type-init/snapshots/2-Babel-Error.shot new file mode 100644 index 000000000000..260b5c904b93 --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-const-destructure-type-init/snapshots/2-Babel-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration VariableDeclaration _error_ declare-const-destructure-type-init Babel - Error 1`] = `[SyntaxError: Initializers are not allowed in ambient contexts. (1:29)]`; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-const-destructure-type-init/snapshots/3-Alignment-Error.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-const-destructure-type-init/snapshots/3-Alignment-Error.shot new file mode 100644 index 000000000000..c4d702bf8379 --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-const-destructure-type-init/snapshots/3-Alignment-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration VariableDeclaration _error_ declare-const-destructure-type-init Error Alignment 1`] = `"Both errored"`; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-const-id-definite-init/fixture.ts b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-const-id-definite-init/fixture.ts new file mode 100644 index 000000000000..1b7d23f68bc0 --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-const-id-definite-init/fixture.ts @@ -0,0 +1 @@ +declare const foo! = 1; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-const-id-definite-init/snapshots/1-TSESTree-Error.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-const-id-definite-init/snapshots/1-TSESTree-Error.shot new file mode 100644 index 000000000000..da5bd33af3f2 --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-const-id-definite-init/snapshots/1-TSESTree-Error.shot @@ -0,0 +1,8 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration VariableDeclaration _error_ declare-const-id-definite-init TSESTree - Error 1`] = ` +"TSError +> 1 | declare const foo! = 1; + | ^^^^^^^^ Declarations with initializers cannot also have definite assignment assertions. + 2 |" +`; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-with-using/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-const-id-definite-init/snapshots/2-Babel-Error.shot similarity index 57% rename from packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-with-using/snapshots/2-Babel-Error.shot rename to packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-const-id-definite-init/snapshots/2-Babel-Error.shot index b9ae47650d49..db44636c9eaf 100644 --- a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-with-using/snapshots/2-Babel-Error.shot +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-const-id-definite-init/snapshots/2-Babel-Error.shot @@ -1,3 +1,3 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`AST Fixtures declaration VariableDeclaration _error_ declare-with-using Babel - Error 1`] = `[SyntaxError: Missing semicolon. (1:7)]`; +exports[`AST Fixtures declaration VariableDeclaration _error_ declare-const-id-definite-init Babel - Error 1`] = `"NO ERROR"`; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-const-id-definite-init/snapshots/3-Alignment-Error.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-const-id-definite-init/snapshots/3-Alignment-Error.shot new file mode 100644 index 000000000000..3164edf2ec46 --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-const-id-definite-init/snapshots/3-Alignment-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration VariableDeclaration _error_ declare-const-id-definite-init Error Alignment 1`] = `"TSESTree errored but Babel didn't"`; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-const-id-definite-no-init/fixture.ts b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-const-id-definite-no-init/fixture.ts new file mode 100644 index 000000000000..0e814e8ce877 --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-const-id-definite-no-init/fixture.ts @@ -0,0 +1 @@ +declare const foo!; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-const-id-definite-no-init/snapshots/1-TSESTree-Error.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-const-id-definite-no-init/snapshots/1-TSESTree-Error.shot new file mode 100644 index 000000000000..4e889f2a782b --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-const-id-definite-no-init/snapshots/1-TSESTree-Error.shot @@ -0,0 +1,8 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration VariableDeclaration _error_ declare-const-id-definite-no-init TSESTree - Error 1`] = ` +"TSError +> 1 | declare const foo!; + | ^^^^ Declarations with definite assignment assertions must also have type annotations. + 2 |" +`; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-const-id-definite-no-init/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-const-id-definite-no-init/snapshots/2-Babel-Error.shot new file mode 100644 index 000000000000..8da7a670f062 --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-const-id-definite-no-init/snapshots/2-Babel-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration VariableDeclaration _error_ declare-const-id-definite-no-init Babel - Error 1`] = `"NO ERROR"`; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-const-id-definite-no-init/snapshots/3-Alignment-Error.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-const-id-definite-no-init/snapshots/3-Alignment-Error.shot new file mode 100644 index 000000000000..6db1921aea85 --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-const-id-definite-no-init/snapshots/3-Alignment-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration VariableDeclaration _error_ declare-const-id-definite-no-init Error Alignment 1`] = `"TSESTree errored but Babel didn't"`; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-const-id-definite-type-init/fixture.ts b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-const-id-definite-type-init/fixture.ts new file mode 100644 index 000000000000..3ff3b45260a0 --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-const-id-definite-type-init/fixture.ts @@ -0,0 +1 @@ +declare const foo!: any = 1; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-const-id-definite-type-init/snapshots/1-TSESTree-Error.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-const-id-definite-type-init/snapshots/1-TSESTree-Error.shot new file mode 100644 index 000000000000..e97dccf9cecb --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-const-id-definite-type-init/snapshots/1-TSESTree-Error.shot @@ -0,0 +1,8 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration VariableDeclaration _error_ declare-const-id-definite-type-init TSESTree - Error 1`] = ` +"TSError +> 1 | declare const foo!: any = 1; + | ^^^^^^^^^^^^^ Declarations with initializers cannot also have definite assignment assertions. + 2 |" +`; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-const-id-definite-type-init/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-const-id-definite-type-init/snapshots/2-Babel-Error.shot new file mode 100644 index 000000000000..9be13402f52b --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-const-id-definite-type-init/snapshots/2-Babel-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration VariableDeclaration _error_ declare-const-id-definite-type-init Babel - Error 1`] = `[SyntaxError: Initializers are not allowed in ambient contexts. (1:26)]`; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-const-id-definite-type-init/snapshots/3-Alignment-Error.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-const-id-definite-type-init/snapshots/3-Alignment-Error.shot new file mode 100644 index 000000000000..f6d6ef889dab --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-const-id-definite-type-init/snapshots/3-Alignment-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration VariableDeclaration _error_ declare-const-id-definite-type-init Error Alignment 1`] = `"Both errored"`; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-const-id-definite-type-no-init/fixture.ts b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-const-id-definite-type-no-init/fixture.ts new file mode 100644 index 000000000000..343543d573b0 --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-const-id-definite-type-no-init/fixture.ts @@ -0,0 +1 @@ +declare const foo!: any; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-const-id-definite-type-no-init/snapshots/1-TSESTree-Error.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-const-id-definite-type-no-init/snapshots/1-TSESTree-Error.shot new file mode 100644 index 000000000000..d42c50bde0ab --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-const-id-definite-type-no-init/snapshots/1-TSESTree-Error.shot @@ -0,0 +1,8 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration VariableDeclaration _error_ declare-const-id-definite-type-no-init TSESTree - Error 1`] = ` +"TSError +> 1 | declare const foo!: any; + | ^^^^^^^^^ A definite assignment assertion '!' is not permitted in this context. + 2 |" +`; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-const-id-definite-type-no-init/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-const-id-definite-type-no-init/snapshots/2-Babel-Error.shot new file mode 100644 index 000000000000..404580cf6ab3 --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-const-id-definite-type-no-init/snapshots/2-Babel-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration VariableDeclaration _error_ declare-const-id-definite-type-no-init Babel - Error 1`] = `"NO ERROR"`; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-const-id-definite-type-no-init/snapshots/3-Alignment-Error.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-const-id-definite-type-no-init/snapshots/3-Alignment-Error.shot new file mode 100644 index 000000000000..5cc830261059 --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-const-id-definite-type-no-init/snapshots/3-Alignment-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration VariableDeclaration _error_ declare-const-id-definite-type-no-init Error Alignment 1`] = `"TSESTree errored but Babel didn't"`; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-const-id-type-init/fixture.ts b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-const-id-type-init/fixture.ts new file mode 100644 index 000000000000..3a542e099c52 --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-const-id-type-init/fixture.ts @@ -0,0 +1 @@ +declare const foo: any = 1; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-const-id-type-init/snapshots/1-TSESTree-Error.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-const-id-type-init/snapshots/1-TSESTree-Error.shot new file mode 100644 index 000000000000..14e7e0c58b27 --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-const-id-type-init/snapshots/1-TSESTree-Error.shot @@ -0,0 +1,8 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration VariableDeclaration _error_ declare-const-id-type-init TSESTree - Error 1`] = ` +"TSError +> 1 | declare const foo: any = 1; + | ^^^^^^^^^^^^ Initializers are not permitted in ambient contexts. + 2 |" +`; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-const-id-type-init/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-const-id-type-init/snapshots/2-Babel-Error.shot new file mode 100644 index 000000000000..9459c80b10ce --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-const-id-type-init/snapshots/2-Babel-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration VariableDeclaration _error_ declare-const-id-type-init Babel - Error 1`] = `[SyntaxError: Initializers are not allowed in ambient contexts. (1:25)]`; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-const-id-type-init/snapshots/3-Alignment-Error.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-const-id-type-init/snapshots/3-Alignment-Error.shot new file mode 100644 index 000000000000..30f61345b549 --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-const-id-type-init/snapshots/3-Alignment-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration VariableDeclaration _error_ declare-const-id-type-init Error Alignment 1`] = `"Both errored"`; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-let-destructure-init/fixture.ts b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-let-destructure-init/fixture.ts new file mode 100644 index 000000000000..e2a91ed458fb --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-let-destructure-init/fixture.ts @@ -0,0 +1 @@ +declare let { foo } = 1; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-let-destructure-init/snapshots/1-TSESTree-Error.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-let-destructure-init/snapshots/1-TSESTree-Error.shot new file mode 100644 index 000000000000..50fea5551a2c --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-let-destructure-init/snapshots/1-TSESTree-Error.shot @@ -0,0 +1,8 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration VariableDeclaration _error_ declare-let-destructure-init TSESTree - Error 1`] = ` +"TSError +> 1 | declare let { foo } = 1; + | ^^^^^^^^^^^ Initializers are not permitted in ambient contexts. + 2 |" +`; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-let-destructure-init/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-let-destructure-init/snapshots/2-Babel-Error.shot new file mode 100644 index 000000000000..443cf3ac6485 --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-let-destructure-init/snapshots/2-Babel-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration VariableDeclaration _error_ declare-let-destructure-init Babel - Error 1`] = `[SyntaxError: Initializers are not allowed in ambient contexts. (1:22)]`; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-let-destructure-init/snapshots/3-Alignment-Error.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-let-destructure-init/snapshots/3-Alignment-Error.shot new file mode 100644 index 000000000000..b5473113f202 --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-let-destructure-init/snapshots/3-Alignment-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration VariableDeclaration _error_ declare-let-destructure-init Error Alignment 1`] = `"Both errored"`; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-let-destructure-type-init/fixture.ts b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-let-destructure-type-init/fixture.ts new file mode 100644 index 000000000000..eac65234286f --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-let-destructure-type-init/fixture.ts @@ -0,0 +1 @@ +declare let { foo }: any = 1; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-let-destructure-type-init/snapshots/1-TSESTree-Error.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-let-destructure-type-init/snapshots/1-TSESTree-Error.shot new file mode 100644 index 000000000000..e494735b8a2d --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-let-destructure-type-init/snapshots/1-TSESTree-Error.shot @@ -0,0 +1,8 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration VariableDeclaration _error_ declare-let-destructure-type-init TSESTree - Error 1`] = ` +"TSError +> 1 | declare let { foo }: any = 1; + | ^^^^^^^^^^^^^^^^ Initializers are not permitted in ambient contexts. + 2 |" +`; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-let-destructure-type-init/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-let-destructure-type-init/snapshots/2-Babel-Error.shot new file mode 100644 index 000000000000..857e2d9eab62 --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-let-destructure-type-init/snapshots/2-Babel-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration VariableDeclaration _error_ declare-let-destructure-type-init Babel - Error 1`] = `[SyntaxError: Initializers are not allowed in ambient contexts. (1:27)]`; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-let-destructure-type-init/snapshots/3-Alignment-Error.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-let-destructure-type-init/snapshots/3-Alignment-Error.shot new file mode 100644 index 000000000000..f6664ac856e3 --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-let-destructure-type-init/snapshots/3-Alignment-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration VariableDeclaration _error_ declare-let-destructure-type-init Error Alignment 1`] = `"Both errored"`; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-let-id-definite-init/fixture.ts b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-let-id-definite-init/fixture.ts new file mode 100644 index 000000000000..a1f489d309fc --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-let-id-definite-init/fixture.ts @@ -0,0 +1 @@ +declare let foo! = 1; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-let-id-definite-init/snapshots/1-TSESTree-Error.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-let-id-definite-init/snapshots/1-TSESTree-Error.shot new file mode 100644 index 000000000000..b2657c0b5577 --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-let-id-definite-init/snapshots/1-TSESTree-Error.shot @@ -0,0 +1,8 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration VariableDeclaration _error_ declare-let-id-definite-init TSESTree - Error 1`] = ` +"TSError +> 1 | declare let foo! = 1; + | ^^^^^^^^ Declarations with initializers cannot also have definite assignment assertions. + 2 |" +`; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-let-id-definite-init/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-let-id-definite-init/snapshots/2-Babel-Error.shot new file mode 100644 index 000000000000..fbf5f616cec8 --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-let-id-definite-init/snapshots/2-Babel-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration VariableDeclaration _error_ declare-let-id-definite-init Babel - Error 1`] = `[SyntaxError: Initializers are not allowed in ambient contexts. (1:19)]`; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-let-id-definite-init/snapshots/3-Alignment-Error.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-let-id-definite-init/snapshots/3-Alignment-Error.shot new file mode 100644 index 000000000000..2e9c149e2692 --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-let-id-definite-init/snapshots/3-Alignment-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration VariableDeclaration _error_ declare-let-id-definite-init Error Alignment 1`] = `"Both errored"`; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-let-id-definite-no-init/fixture.ts b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-let-id-definite-no-init/fixture.ts new file mode 100644 index 000000000000..7376001170a3 --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-let-id-definite-no-init/fixture.ts @@ -0,0 +1 @@ +declare let foo!; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-let-id-definite-no-init/snapshots/1-TSESTree-Error.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-let-id-definite-no-init/snapshots/1-TSESTree-Error.shot new file mode 100644 index 000000000000..f02b06be3841 --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-let-id-definite-no-init/snapshots/1-TSESTree-Error.shot @@ -0,0 +1,8 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration VariableDeclaration _error_ declare-let-id-definite-no-init TSESTree - Error 1`] = ` +"TSError +> 1 | declare let foo!; + | ^^^^ Declarations with definite assignment assertions must also have type annotations. + 2 |" +`; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-let-id-definite-no-init/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-let-id-definite-no-init/snapshots/2-Babel-Error.shot new file mode 100644 index 000000000000..d3a0178920f7 --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-let-id-definite-no-init/snapshots/2-Babel-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration VariableDeclaration _error_ declare-let-id-definite-no-init Babel - Error 1`] = `"NO ERROR"`; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-let-id-definite-no-init/snapshots/3-Alignment-Error.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-let-id-definite-no-init/snapshots/3-Alignment-Error.shot new file mode 100644 index 000000000000..fbd784443ba9 --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-let-id-definite-no-init/snapshots/3-Alignment-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration VariableDeclaration _error_ declare-let-id-definite-no-init Error Alignment 1`] = `"TSESTree errored but Babel didn't"`; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-let-id-definite-type-init/fixture.ts b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-let-id-definite-type-init/fixture.ts new file mode 100644 index 000000000000..ab2fd65ecd9d --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-let-id-definite-type-init/fixture.ts @@ -0,0 +1 @@ +declare let foo!: any = 1; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-let-id-definite-type-init/snapshots/1-TSESTree-Error.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-let-id-definite-type-init/snapshots/1-TSESTree-Error.shot new file mode 100644 index 000000000000..3db7e34ac8f6 --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-let-id-definite-type-init/snapshots/1-TSESTree-Error.shot @@ -0,0 +1,8 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration VariableDeclaration _error_ declare-let-id-definite-type-init TSESTree - Error 1`] = ` +"TSError +> 1 | declare let foo!: any = 1; + | ^^^^^^^^^^^^^ Declarations with initializers cannot also have definite assignment assertions. + 2 |" +`; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-let-id-definite-type-init/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-let-id-definite-type-init/snapshots/2-Babel-Error.shot new file mode 100644 index 000000000000..0e3c00d2a57f --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-let-id-definite-type-init/snapshots/2-Babel-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration VariableDeclaration _error_ declare-let-id-definite-type-init Babel - Error 1`] = `[SyntaxError: Initializers are not allowed in ambient contexts. (1:24)]`; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-let-id-definite-type-init/snapshots/3-Alignment-Error.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-let-id-definite-type-init/snapshots/3-Alignment-Error.shot new file mode 100644 index 000000000000..94b6b0c672a4 --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-let-id-definite-type-init/snapshots/3-Alignment-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration VariableDeclaration _error_ declare-let-id-definite-type-init Error Alignment 1`] = `"Both errored"`; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-let-id-definite-type-no-init/fixture.ts b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-let-id-definite-type-no-init/fixture.ts new file mode 100644 index 000000000000..327d8b094b6b --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-let-id-definite-type-no-init/fixture.ts @@ -0,0 +1 @@ +declare let foo!: any; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-let-id-definite-type-no-init/snapshots/1-TSESTree-Error.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-let-id-definite-type-no-init/snapshots/1-TSESTree-Error.shot new file mode 100644 index 000000000000..a6de8e5a9d33 --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-let-id-definite-type-no-init/snapshots/1-TSESTree-Error.shot @@ -0,0 +1,8 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration VariableDeclaration _error_ declare-let-id-definite-type-no-init TSESTree - Error 1`] = ` +"TSError +> 1 | declare let foo!: any; + | ^^^^^^^^^ A definite assignment assertion '!' is not permitted in this context. + 2 |" +`; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-let-id-definite-type-no-init/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-let-id-definite-type-no-init/snapshots/2-Babel-Error.shot new file mode 100644 index 000000000000..f47045a29f9d --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-let-id-definite-type-no-init/snapshots/2-Babel-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration VariableDeclaration _error_ declare-let-id-definite-type-no-init Babel - Error 1`] = `"NO ERROR"`; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-let-id-definite-type-no-init/snapshots/3-Alignment-Error.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-let-id-definite-type-no-init/snapshots/3-Alignment-Error.shot new file mode 100644 index 000000000000..3b542519b4f0 --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-let-id-definite-type-no-init/snapshots/3-Alignment-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration VariableDeclaration _error_ declare-let-id-definite-type-no-init Error Alignment 1`] = `"TSESTree errored but Babel didn't"`; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-let-id-init/fixture.ts b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-let-id-init/fixture.ts new file mode 100644 index 000000000000..75db6cc8e38e --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-let-id-init/fixture.ts @@ -0,0 +1 @@ +declare let foo = 1; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-let-id-init/snapshots/1-TSESTree-Error.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-let-id-init/snapshots/1-TSESTree-Error.shot new file mode 100644 index 000000000000..78ee68994a94 --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-let-id-init/snapshots/1-TSESTree-Error.shot @@ -0,0 +1,8 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration VariableDeclaration _error_ declare-let-id-init TSESTree - Error 1`] = ` +"TSError +> 1 | declare let foo = 1; + | ^^^^^^^ Initializers are not permitted in ambient contexts. + 2 |" +`; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-let-id-init/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-let-id-init/snapshots/2-Babel-Error.shot new file mode 100644 index 000000000000..c56018fe7e20 --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-let-id-init/snapshots/2-Babel-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration VariableDeclaration _error_ declare-let-id-init Babel - Error 1`] = `[SyntaxError: Initializers are not allowed in ambient contexts. (1:18)]`; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-with-using/snapshots/3-Alignment-Error.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-let-id-init/snapshots/3-Alignment-Error.shot similarity index 65% rename from packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-with-using/snapshots/3-Alignment-Error.shot rename to packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-let-id-init/snapshots/3-Alignment-Error.shot index 300960cab48d..9909ef5c38e7 100644 --- a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-with-using/snapshots/3-Alignment-Error.shot +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-let-id-init/snapshots/3-Alignment-Error.shot @@ -1,3 +1,3 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`AST Fixtures declaration VariableDeclaration _error_ declare-with-using Error Alignment 1`] = `"Both errored"`; +exports[`AST Fixtures declaration VariableDeclaration _error_ declare-let-id-init Error Alignment 1`] = `"Both errored"`; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-let-id-type-init/fixture.ts b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-let-id-type-init/fixture.ts new file mode 100644 index 000000000000..1a8bbb20307b --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-let-id-type-init/fixture.ts @@ -0,0 +1 @@ +declare let foo: any = 1; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-let-id-type-init/snapshots/1-TSESTree-Error.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-let-id-type-init/snapshots/1-TSESTree-Error.shot new file mode 100644 index 000000000000..c15461283e4d --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-let-id-type-init/snapshots/1-TSESTree-Error.shot @@ -0,0 +1,8 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration VariableDeclaration _error_ declare-let-id-type-init TSESTree - Error 1`] = ` +"TSError +> 1 | declare let foo: any = 1; + | ^^^^^^^^^^^^ Initializers are not permitted in ambient contexts. + 2 |" +`; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-let-id-type-init/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-let-id-type-init/snapshots/2-Babel-Error.shot new file mode 100644 index 000000000000..eebffed7ae15 --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-let-id-type-init/snapshots/2-Babel-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration VariableDeclaration _error_ declare-let-id-type-init Babel - Error 1`] = `[SyntaxError: Initializers are not allowed in ambient contexts. (1:23)]`; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-let-id-type-init/snapshots/3-Alignment-Error.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-let-id-type-init/snapshots/3-Alignment-Error.shot new file mode 100644 index 000000000000..46af6a948c29 --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-let-id-type-init/snapshots/3-Alignment-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration VariableDeclaration _error_ declare-let-id-type-init Error Alignment 1`] = `"Both errored"`; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-using-destructure-init/fixture.ts b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-using-destructure-init/fixture.ts new file mode 100644 index 000000000000..ef85d3d2c057 --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-using-destructure-init/fixture.ts @@ -0,0 +1 @@ +declare using { foo } = 1; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-using-destructure-init/snapshots/1-TSESTree-Error.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-using-destructure-init/snapshots/1-TSESTree-Error.shot new file mode 100644 index 000000000000..7c070dd2d4cf --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-using-destructure-init/snapshots/1-TSESTree-Error.shot @@ -0,0 +1,8 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration VariableDeclaration _error_ declare-using-destructure-init TSESTree - Error 1`] = ` +"TSError +> 1 | declare using { foo } = 1; + | ^^^^^^^ 'declare' modifier cannot appear on a 'using' declaration. + 2 |" +`; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-using-destructure-init/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-using-destructure-init/snapshots/2-Babel-Error.shot new file mode 100644 index 000000000000..ddb508f3e5aa --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-using-destructure-init/snapshots/2-Babel-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration VariableDeclaration _error_ declare-using-destructure-init Babel - Error 1`] = `[SyntaxError: Missing semicolon. (1:7)]`; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-using-destructure-init/snapshots/3-Alignment-Error.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-using-destructure-init/snapshots/3-Alignment-Error.shot new file mode 100644 index 000000000000..c2420e582164 --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-using-destructure-init/snapshots/3-Alignment-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration VariableDeclaration _error_ declare-using-destructure-init Error Alignment 1`] = `"Both errored"`; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-using-destructure-no-init/fixture.ts b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-using-destructure-no-init/fixture.ts new file mode 100644 index 000000000000..34576fc2a405 --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-using-destructure-no-init/fixture.ts @@ -0,0 +1 @@ +declare using { foo }; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-using-destructure-no-init/snapshots/1-TSESTree-Error.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-using-destructure-no-init/snapshots/1-TSESTree-Error.shot new file mode 100644 index 000000000000..8dfb56fdd14c --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-using-destructure-no-init/snapshots/1-TSESTree-Error.shot @@ -0,0 +1,8 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration VariableDeclaration _error_ declare-using-destructure-no-init TSESTree - Error 1`] = ` +"TSError +> 1 | declare using { foo }; + | ^^^^^^^ 'declare' modifier cannot appear on a 'using' declaration. + 2 |" +`; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-using-destructure-no-init/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-using-destructure-no-init/snapshots/2-Babel-Error.shot new file mode 100644 index 000000000000..994e6e12c2a5 --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-using-destructure-no-init/snapshots/2-Babel-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration VariableDeclaration _error_ declare-using-destructure-no-init Babel - Error 1`] = `[SyntaxError: Missing semicolon. (1:7)]`; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-using-destructure-no-init/snapshots/3-Alignment-Error.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-using-destructure-no-init/snapshots/3-Alignment-Error.shot new file mode 100644 index 000000000000..c6c94801c511 --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-using-destructure-no-init/snapshots/3-Alignment-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration VariableDeclaration _error_ declare-using-destructure-no-init Error Alignment 1`] = `"Both errored"`; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-using-destructure-type-init/fixture.ts b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-using-destructure-type-init/fixture.ts new file mode 100644 index 000000000000..54efe0ea58ec --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-using-destructure-type-init/fixture.ts @@ -0,0 +1 @@ +declare using { foo }: any = 1; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-using-destructure-type-init/snapshots/1-TSESTree-Error.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-using-destructure-type-init/snapshots/1-TSESTree-Error.shot new file mode 100644 index 000000000000..ee998297fcde --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-using-destructure-type-init/snapshots/1-TSESTree-Error.shot @@ -0,0 +1,8 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration VariableDeclaration _error_ declare-using-destructure-type-init TSESTree - Error 1`] = ` +"TSError +> 1 | declare using { foo }: any = 1; + | ^^^^^^^ 'declare' modifier cannot appear on a 'using' declaration. + 2 |" +`; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-using-destructure-type-init/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-using-destructure-type-init/snapshots/2-Babel-Error.shot new file mode 100644 index 000000000000..99f2324e766b --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-using-destructure-type-init/snapshots/2-Babel-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration VariableDeclaration _error_ declare-using-destructure-type-init Babel - Error 1`] = `[SyntaxError: Missing semicolon. (1:7)]`; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-using-destructure-type-init/snapshots/3-Alignment-Error.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-using-destructure-type-init/snapshots/3-Alignment-Error.shot new file mode 100644 index 000000000000..a62dc21191cc --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-using-destructure-type-init/snapshots/3-Alignment-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration VariableDeclaration _error_ declare-using-destructure-type-init Error Alignment 1`] = `"Both errored"`; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-using-destructure-type-no-init/fixture.ts b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-using-destructure-type-no-init/fixture.ts new file mode 100644 index 000000000000..547928ab0712 --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-using-destructure-type-no-init/fixture.ts @@ -0,0 +1 @@ +declare using { foo }: any; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-using-destructure-type-no-init/snapshots/1-TSESTree-Error.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-using-destructure-type-no-init/snapshots/1-TSESTree-Error.shot new file mode 100644 index 000000000000..438c0f346d2a --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-using-destructure-type-no-init/snapshots/1-TSESTree-Error.shot @@ -0,0 +1,8 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration VariableDeclaration _error_ declare-using-destructure-type-no-init TSESTree - Error 1`] = ` +"TSError +> 1 | declare using { foo }: any; + | ^^^^^^^ 'declare' modifier cannot appear on a 'using' declaration. + 2 |" +`; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-using-destructure-type-no-init/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-using-destructure-type-no-init/snapshots/2-Babel-Error.shot new file mode 100644 index 000000000000..ae05474f3388 --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-using-destructure-type-no-init/snapshots/2-Babel-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration VariableDeclaration _error_ declare-using-destructure-type-no-init Babel - Error 1`] = `[SyntaxError: Missing semicolon. (1:7)]`; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-using-destructure-type-no-init/snapshots/3-Alignment-Error.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-using-destructure-type-no-init/snapshots/3-Alignment-Error.shot new file mode 100644 index 000000000000..3a7d6f6ec007 --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-using-destructure-type-no-init/snapshots/3-Alignment-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration VariableDeclaration _error_ declare-using-destructure-type-no-init Error Alignment 1`] = `"Both errored"`; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-using-id-definite-init/fixture.ts b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-using-id-definite-init/fixture.ts new file mode 100644 index 000000000000..68effb1a5632 --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-using-id-definite-init/fixture.ts @@ -0,0 +1 @@ +declare using foo! = 1; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-using-id-definite-init/snapshots/1-TSESTree-Error.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-using-id-definite-init/snapshots/1-TSESTree-Error.shot new file mode 100644 index 000000000000..15908d3aed46 --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-using-id-definite-init/snapshots/1-TSESTree-Error.shot @@ -0,0 +1,8 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration VariableDeclaration _error_ declare-using-id-definite-init TSESTree - Error 1`] = ` +"TSError +> 1 | declare using foo! = 1; + | ^^^^^^^ 'declare' modifier cannot appear on a 'using' declaration. + 2 |" +`; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-using-id-definite-init/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-using-id-definite-init/snapshots/2-Babel-Error.shot new file mode 100644 index 000000000000..79020aaa6de2 --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-using-id-definite-init/snapshots/2-Babel-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration VariableDeclaration _error_ declare-using-id-definite-init Babel - Error 1`] = `[SyntaxError: Missing semicolon. (1:7)]`; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-using-id-definite-init/snapshots/3-Alignment-Error.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-using-id-definite-init/snapshots/3-Alignment-Error.shot new file mode 100644 index 000000000000..a072865ddc45 --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-using-id-definite-init/snapshots/3-Alignment-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration VariableDeclaration _error_ declare-using-id-definite-init Error Alignment 1`] = `"Both errored"`; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-using-id-definite-no-init/fixture.ts b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-using-id-definite-no-init/fixture.ts new file mode 100644 index 000000000000..7e2b9d7a8269 --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-using-id-definite-no-init/fixture.ts @@ -0,0 +1 @@ +declare using foo!; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-using-id-definite-no-init/snapshots/1-TSESTree-Error.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-using-id-definite-no-init/snapshots/1-TSESTree-Error.shot new file mode 100644 index 000000000000..c7f22c77828b --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-using-id-definite-no-init/snapshots/1-TSESTree-Error.shot @@ -0,0 +1,8 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration VariableDeclaration _error_ declare-using-id-definite-no-init TSESTree - Error 1`] = ` +"TSError +> 1 | declare using foo!; + | ^^^^^^^ 'declare' modifier cannot appear on a 'using' declaration. + 2 |" +`; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-using-id-definite-no-init/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-using-id-definite-no-init/snapshots/2-Babel-Error.shot new file mode 100644 index 000000000000..509a74da4e62 --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-using-id-definite-no-init/snapshots/2-Babel-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration VariableDeclaration _error_ declare-using-id-definite-no-init Babel - Error 1`] = `[SyntaxError: Missing semicolon. (1:7)]`; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-using-id-definite-no-init/snapshots/3-Alignment-Error.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-using-id-definite-no-init/snapshots/3-Alignment-Error.shot new file mode 100644 index 000000000000..b084fc0b4a89 --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-using-id-definite-no-init/snapshots/3-Alignment-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration VariableDeclaration _error_ declare-using-id-definite-no-init Error Alignment 1`] = `"Both errored"`; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-using-id-definite-type-init/fixture.ts b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-using-id-definite-type-init/fixture.ts new file mode 100644 index 000000000000..833f32d5f776 --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-using-id-definite-type-init/fixture.ts @@ -0,0 +1 @@ +declare using foo!: any = 1; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-using-id-definite-type-init/snapshots/1-TSESTree-Error.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-using-id-definite-type-init/snapshots/1-TSESTree-Error.shot new file mode 100644 index 000000000000..75b86a0f4543 --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-using-id-definite-type-init/snapshots/1-TSESTree-Error.shot @@ -0,0 +1,8 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration VariableDeclaration _error_ declare-using-id-definite-type-init TSESTree - Error 1`] = ` +"TSError +> 1 | declare using foo!: any = 1; + | ^^^^^^^ 'declare' modifier cannot appear on a 'using' declaration. + 2 |" +`; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-using-id-definite-type-init/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-using-id-definite-type-init/snapshots/2-Babel-Error.shot new file mode 100644 index 000000000000..f935ca9c90ac --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-using-id-definite-type-init/snapshots/2-Babel-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration VariableDeclaration _error_ declare-using-id-definite-type-init Babel - Error 1`] = `[SyntaxError: Missing semicolon. (1:7)]`; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-using-id-definite-type-init/snapshots/3-Alignment-Error.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-using-id-definite-type-init/snapshots/3-Alignment-Error.shot new file mode 100644 index 000000000000..2f4c9be4d31f --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-using-id-definite-type-init/snapshots/3-Alignment-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration VariableDeclaration _error_ declare-using-id-definite-type-init Error Alignment 1`] = `"Both errored"`; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-using-id-definite-type-no-init/fixture.ts b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-using-id-definite-type-no-init/fixture.ts new file mode 100644 index 000000000000..bfa8aad4a0cf --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-using-id-definite-type-no-init/fixture.ts @@ -0,0 +1 @@ +declare using foo!: any; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-using-id-definite-type-no-init/snapshots/1-TSESTree-Error.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-using-id-definite-type-no-init/snapshots/1-TSESTree-Error.shot new file mode 100644 index 000000000000..22e0da0a96d3 --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-using-id-definite-type-no-init/snapshots/1-TSESTree-Error.shot @@ -0,0 +1,8 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration VariableDeclaration _error_ declare-using-id-definite-type-no-init TSESTree - Error 1`] = ` +"TSError +> 1 | declare using foo!: any; + | ^^^^^^^ 'declare' modifier cannot appear on a 'using' declaration. + 2 |" +`; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-using-id-definite-type-no-init/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-using-id-definite-type-no-init/snapshots/2-Babel-Error.shot new file mode 100644 index 000000000000..44bac65cdc9f --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-using-id-definite-type-no-init/snapshots/2-Babel-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration VariableDeclaration _error_ declare-using-id-definite-type-no-init Babel - Error 1`] = `[SyntaxError: Missing semicolon. (1:7)]`; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-using-id-definite-type-no-init/snapshots/3-Alignment-Error.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-using-id-definite-type-no-init/snapshots/3-Alignment-Error.shot new file mode 100644 index 000000000000..7b86fc28c658 --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-using-id-definite-type-no-init/snapshots/3-Alignment-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration VariableDeclaration _error_ declare-using-id-definite-type-no-init Error Alignment 1`] = `"Both errored"`; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-using-id-init/fixture.ts b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-using-id-init/fixture.ts new file mode 100644 index 000000000000..6f6c9745d6de --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-using-id-init/fixture.ts @@ -0,0 +1 @@ +declare using foo = 1; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-using-id-init/snapshots/1-TSESTree-Error.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-using-id-init/snapshots/1-TSESTree-Error.shot new file mode 100644 index 000000000000..0599920f57ca --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-using-id-init/snapshots/1-TSESTree-Error.shot @@ -0,0 +1,8 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration VariableDeclaration _error_ declare-using-id-init TSESTree - Error 1`] = ` +"TSError +> 1 | declare using foo = 1; + | ^^^^^^^ 'declare' modifier cannot appear on a 'using' declaration. + 2 |" +`; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-using-id-init/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-using-id-init/snapshots/2-Babel-Error.shot new file mode 100644 index 000000000000..934dc2a5e11f --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-using-id-init/snapshots/2-Babel-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration VariableDeclaration _error_ declare-using-id-init Babel - Error 1`] = `[SyntaxError: Missing semicolon. (1:7)]`; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-using-id-init/snapshots/3-Alignment-Error.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-using-id-init/snapshots/3-Alignment-Error.shot new file mode 100644 index 000000000000..ca7ddb948741 --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-using-id-init/snapshots/3-Alignment-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration VariableDeclaration _error_ declare-using-id-init Error Alignment 1`] = `"Both errored"`; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-using-id-no-init/fixture.ts b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-using-id-no-init/fixture.ts new file mode 100644 index 000000000000..d9dbc88f7cfb --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-using-id-no-init/fixture.ts @@ -0,0 +1 @@ +declare using foo; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-with-using/snapshots/1-TSESTree-Error.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-using-id-no-init/snapshots/1-TSESTree-Error.shot similarity index 73% rename from packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-with-using/snapshots/1-TSESTree-Error.shot rename to packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-using-id-no-init/snapshots/1-TSESTree-Error.shot index f30f3e6d192e..59580e7c868f 100644 --- a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-with-using/snapshots/1-TSESTree-Error.shot +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-using-id-no-init/snapshots/1-TSESTree-Error.shot @@ -1,8 +1,8 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`AST Fixtures declaration VariableDeclaration _error_ declare-with-using TSESTree - Error 1`] = ` +exports[`AST Fixtures declaration VariableDeclaration _error_ declare-using-id-no-init TSESTree - Error 1`] = ` "TSError -> 1 | declare using a = 1; +> 1 | declare using foo; | ^^^^^^^ 'declare' modifier cannot appear on a 'using' declaration. 2 |" `; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-using-id-no-init/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-using-id-no-init/snapshots/2-Babel-Error.shot new file mode 100644 index 000000000000..ef22c9c081d1 --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-using-id-no-init/snapshots/2-Babel-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration VariableDeclaration _error_ declare-using-id-no-init Babel - Error 1`] = `[SyntaxError: Missing semicolon. (1:7)]`; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-using-id-no-init/snapshots/3-Alignment-Error.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-using-id-no-init/snapshots/3-Alignment-Error.shot new file mode 100644 index 000000000000..d5471d8d72e8 --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-using-id-no-init/snapshots/3-Alignment-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration VariableDeclaration _error_ declare-using-id-no-init Error Alignment 1`] = `"Both errored"`; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-using-id-type-init/fixture.ts b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-using-id-type-init/fixture.ts new file mode 100644 index 000000000000..2b976ae0971f --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-using-id-type-init/fixture.ts @@ -0,0 +1 @@ +declare using foo: any = 1; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-using-id-type-init/snapshots/1-TSESTree-Error.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-using-id-type-init/snapshots/1-TSESTree-Error.shot new file mode 100644 index 000000000000..6decffae291c --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-using-id-type-init/snapshots/1-TSESTree-Error.shot @@ -0,0 +1,8 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration VariableDeclaration _error_ declare-using-id-type-init TSESTree - Error 1`] = ` +"TSError +> 1 | declare using foo: any = 1; + | ^^^^^^^ 'declare' modifier cannot appear on a 'using' declaration. + 2 |" +`; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-using-id-type-init/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-using-id-type-init/snapshots/2-Babel-Error.shot new file mode 100644 index 000000000000..d56ea2650180 --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-using-id-type-init/snapshots/2-Babel-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration VariableDeclaration _error_ declare-using-id-type-init Babel - Error 1`] = `[SyntaxError: Missing semicolon. (1:7)]`; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-using-id-type-init/snapshots/3-Alignment-Error.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-using-id-type-init/snapshots/3-Alignment-Error.shot new file mode 100644 index 000000000000..fee95fede79a --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-using-id-type-init/snapshots/3-Alignment-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration VariableDeclaration _error_ declare-using-id-type-init Error Alignment 1`] = `"Both errored"`; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-using-id-type-no-init/fixture.ts b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-using-id-type-no-init/fixture.ts new file mode 100644 index 000000000000..639434a8c2f7 --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-using-id-type-no-init/fixture.ts @@ -0,0 +1 @@ +declare using foo: any; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-using-id-type-no-init/snapshots/1-TSESTree-Error.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-using-id-type-no-init/snapshots/1-TSESTree-Error.shot new file mode 100644 index 000000000000..bfa9aafa731d --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-using-id-type-no-init/snapshots/1-TSESTree-Error.shot @@ -0,0 +1,8 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration VariableDeclaration _error_ declare-using-id-type-no-init TSESTree - Error 1`] = ` +"TSError +> 1 | declare using foo: any; + | ^^^^^^^ 'declare' modifier cannot appear on a 'using' declaration. + 2 |" +`; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-using-id-type-no-init/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-using-id-type-no-init/snapshots/2-Babel-Error.shot new file mode 100644 index 000000000000..fae41077c82a --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-using-id-type-no-init/snapshots/2-Babel-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration VariableDeclaration _error_ declare-using-id-type-no-init Babel - Error 1`] = `[SyntaxError: Missing semicolon. (1:7)]`; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-using-id-type-no-init/snapshots/3-Alignment-Error.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-using-id-type-no-init/snapshots/3-Alignment-Error.shot new file mode 100644 index 000000000000..74970af2390c --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-using-id-type-no-init/snapshots/3-Alignment-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration VariableDeclaration _error_ declare-using-id-type-no-init Error Alignment 1`] = `"Both errored"`; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-var-destructure-init/fixture.ts b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-var-destructure-init/fixture.ts new file mode 100644 index 000000000000..4b87ce1e585a --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-var-destructure-init/fixture.ts @@ -0,0 +1 @@ +declare var { foo } = 1; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-var-destructure-init/snapshots/1-TSESTree-Error.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-var-destructure-init/snapshots/1-TSESTree-Error.shot new file mode 100644 index 000000000000..b1821cca106f --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-var-destructure-init/snapshots/1-TSESTree-Error.shot @@ -0,0 +1,8 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration VariableDeclaration _error_ declare-var-destructure-init TSESTree - Error 1`] = ` +"TSError +> 1 | declare var { foo } = 1; + | ^^^^^^^^^^^ Initializers are not permitted in ambient contexts. + 2 |" +`; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-var-destructure-init/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-var-destructure-init/snapshots/2-Babel-Error.shot new file mode 100644 index 000000000000..71beedf3d204 --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-var-destructure-init/snapshots/2-Babel-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration VariableDeclaration _error_ declare-var-destructure-init Babel - Error 1`] = `[SyntaxError: Initializers are not allowed in ambient contexts. (1:22)]`; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-var-destructure-init/snapshots/3-Alignment-Error.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-var-destructure-init/snapshots/3-Alignment-Error.shot new file mode 100644 index 000000000000..7608cefccaa0 --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-var-destructure-init/snapshots/3-Alignment-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration VariableDeclaration _error_ declare-var-destructure-init Error Alignment 1`] = `"Both errored"`; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-var-destructure-type-init/fixture.ts b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-var-destructure-type-init/fixture.ts new file mode 100644 index 000000000000..5c80ea84baa1 --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-var-destructure-type-init/fixture.ts @@ -0,0 +1 @@ +declare var { foo }: any = 1; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-var-destructure-type-init/snapshots/1-TSESTree-Error.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-var-destructure-type-init/snapshots/1-TSESTree-Error.shot new file mode 100644 index 000000000000..cfdd6a2db7bd --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-var-destructure-type-init/snapshots/1-TSESTree-Error.shot @@ -0,0 +1,8 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration VariableDeclaration _error_ declare-var-destructure-type-init TSESTree - Error 1`] = ` +"TSError +> 1 | declare var { foo }: any = 1; + | ^^^^^^^^^^^^^^^^ Initializers are not permitted in ambient contexts. + 2 |" +`; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-var-destructure-type-init/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-var-destructure-type-init/snapshots/2-Babel-Error.shot new file mode 100644 index 000000000000..39908b6a61c1 --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-var-destructure-type-init/snapshots/2-Babel-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration VariableDeclaration _error_ declare-var-destructure-type-init Babel - Error 1`] = `[SyntaxError: Initializers are not allowed in ambient contexts. (1:27)]`; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-var-destructure-type-init/snapshots/3-Alignment-Error.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-var-destructure-type-init/snapshots/3-Alignment-Error.shot new file mode 100644 index 000000000000..6b9b33b952dd --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-var-destructure-type-init/snapshots/3-Alignment-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration VariableDeclaration _error_ declare-var-destructure-type-init Error Alignment 1`] = `"Both errored"`; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-var-id-definite-init/fixture.ts b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-var-id-definite-init/fixture.ts new file mode 100644 index 000000000000..5f2d9d7a8d93 --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-var-id-definite-init/fixture.ts @@ -0,0 +1 @@ +declare var foo! = 1; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-var-id-definite-init/snapshots/1-TSESTree-Error.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-var-id-definite-init/snapshots/1-TSESTree-Error.shot new file mode 100644 index 000000000000..9124aeff31d7 --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-var-id-definite-init/snapshots/1-TSESTree-Error.shot @@ -0,0 +1,8 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration VariableDeclaration _error_ declare-var-id-definite-init TSESTree - Error 1`] = ` +"TSError +> 1 | declare var foo! = 1; + | ^^^^^^^^ Declarations with initializers cannot also have definite assignment assertions. + 2 |" +`; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-var-id-definite-init/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-var-id-definite-init/snapshots/2-Babel-Error.shot new file mode 100644 index 000000000000..61ac46540de3 --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-var-id-definite-init/snapshots/2-Babel-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration VariableDeclaration _error_ declare-var-id-definite-init Babel - Error 1`] = `[SyntaxError: Initializers are not allowed in ambient contexts. (1:19)]`; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-var-id-definite-init/snapshots/3-Alignment-Error.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-var-id-definite-init/snapshots/3-Alignment-Error.shot new file mode 100644 index 000000000000..2c8e2a1729af --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-var-id-definite-init/snapshots/3-Alignment-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration VariableDeclaration _error_ declare-var-id-definite-init Error Alignment 1`] = `"Both errored"`; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-var-id-definite-no-init/fixture.ts b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-var-id-definite-no-init/fixture.ts new file mode 100644 index 000000000000..fb90b0d44acd --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-var-id-definite-no-init/fixture.ts @@ -0,0 +1 @@ +declare var foo!; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-var-id-definite-no-init/snapshots/1-TSESTree-Error.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-var-id-definite-no-init/snapshots/1-TSESTree-Error.shot new file mode 100644 index 000000000000..d365ee7e5426 --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-var-id-definite-no-init/snapshots/1-TSESTree-Error.shot @@ -0,0 +1,8 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration VariableDeclaration _error_ declare-var-id-definite-no-init TSESTree - Error 1`] = ` +"TSError +> 1 | declare var foo!; + | ^^^^ Declarations with definite assignment assertions must also have type annotations. + 2 |" +`; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-var-id-definite-no-init/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-var-id-definite-no-init/snapshots/2-Babel-Error.shot new file mode 100644 index 000000000000..91fa34f8fa08 --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-var-id-definite-no-init/snapshots/2-Babel-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration VariableDeclaration _error_ declare-var-id-definite-no-init Babel - Error 1`] = `"NO ERROR"`; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-var-id-definite-no-init/snapshots/3-Alignment-Error.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-var-id-definite-no-init/snapshots/3-Alignment-Error.shot new file mode 100644 index 000000000000..e69b9c371480 --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-var-id-definite-no-init/snapshots/3-Alignment-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration VariableDeclaration _error_ declare-var-id-definite-no-init Error Alignment 1`] = `"TSESTree errored but Babel didn't"`; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-var-id-definite-type-init/fixture.ts b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-var-id-definite-type-init/fixture.ts new file mode 100644 index 000000000000..a3bedcf66c78 --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-var-id-definite-type-init/fixture.ts @@ -0,0 +1 @@ +declare var foo!: any = 1; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-var-id-definite-type-init/snapshots/1-TSESTree-Error.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-var-id-definite-type-init/snapshots/1-TSESTree-Error.shot new file mode 100644 index 000000000000..800fa67ada6a --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-var-id-definite-type-init/snapshots/1-TSESTree-Error.shot @@ -0,0 +1,8 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration VariableDeclaration _error_ declare-var-id-definite-type-init TSESTree - Error 1`] = ` +"TSError +> 1 | declare var foo!: any = 1; + | ^^^^^^^^^^^^^ Declarations with initializers cannot also have definite assignment assertions. + 2 |" +`; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-var-id-definite-type-init/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-var-id-definite-type-init/snapshots/2-Babel-Error.shot new file mode 100644 index 000000000000..030a0afcb722 --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-var-id-definite-type-init/snapshots/2-Babel-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration VariableDeclaration _error_ declare-var-id-definite-type-init Babel - Error 1`] = `[SyntaxError: Initializers are not allowed in ambient contexts. (1:24)]`; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-var-id-definite-type-init/snapshots/3-Alignment-Error.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-var-id-definite-type-init/snapshots/3-Alignment-Error.shot new file mode 100644 index 000000000000..620e790a4ae5 --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-var-id-definite-type-init/snapshots/3-Alignment-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration VariableDeclaration _error_ declare-var-id-definite-type-init Error Alignment 1`] = `"Both errored"`; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-var-id-definite-type-no-init/fixture.ts b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-var-id-definite-type-no-init/fixture.ts new file mode 100644 index 000000000000..25ec60092361 --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-var-id-definite-type-no-init/fixture.ts @@ -0,0 +1 @@ +declare var foo!: any; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-var-id-definite-type-no-init/snapshots/1-TSESTree-Error.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-var-id-definite-type-no-init/snapshots/1-TSESTree-Error.shot new file mode 100644 index 000000000000..e7846be1106b --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-var-id-definite-type-no-init/snapshots/1-TSESTree-Error.shot @@ -0,0 +1,8 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration VariableDeclaration _error_ declare-var-id-definite-type-no-init TSESTree - Error 1`] = ` +"TSError +> 1 | declare var foo!: any; + | ^^^^^^^^^ A definite assignment assertion '!' is not permitted in this context. + 2 |" +`; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-var-id-definite-type-no-init/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-var-id-definite-type-no-init/snapshots/2-Babel-Error.shot new file mode 100644 index 000000000000..a51da3c57443 --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-var-id-definite-type-no-init/snapshots/2-Babel-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration VariableDeclaration _error_ declare-var-id-definite-type-no-init Babel - Error 1`] = `"NO ERROR"`; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-var-id-definite-type-no-init/snapshots/3-Alignment-Error.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-var-id-definite-type-no-init/snapshots/3-Alignment-Error.shot new file mode 100644 index 000000000000..e82f0e1bd02a --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-var-id-definite-type-no-init/snapshots/3-Alignment-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration VariableDeclaration _error_ declare-var-id-definite-type-no-init Error Alignment 1`] = `"TSESTree errored but Babel didn't"`; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-var-id-init/fixture.ts b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-var-id-init/fixture.ts new file mode 100644 index 000000000000..258ee3f2335c --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-var-id-init/fixture.ts @@ -0,0 +1 @@ +declare var foo = 1; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-var-id-init/snapshots/1-TSESTree-Error.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-var-id-init/snapshots/1-TSESTree-Error.shot new file mode 100644 index 000000000000..48b78c090bc6 --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-var-id-init/snapshots/1-TSESTree-Error.shot @@ -0,0 +1,8 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration VariableDeclaration _error_ declare-var-id-init TSESTree - Error 1`] = ` +"TSError +> 1 | declare var foo = 1; + | ^^^^^^^ Initializers are not permitted in ambient contexts. + 2 |" +`; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-var-id-init/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-var-id-init/snapshots/2-Babel-Error.shot new file mode 100644 index 000000000000..9492ebadf4f2 --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-var-id-init/snapshots/2-Babel-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration VariableDeclaration _error_ declare-var-id-init Babel - Error 1`] = `[SyntaxError: Initializers are not allowed in ambient contexts. (1:18)]`; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-var-id-init/snapshots/3-Alignment-Error.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-var-id-init/snapshots/3-Alignment-Error.shot new file mode 100644 index 000000000000..f57a49bc0c1e --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-var-id-init/snapshots/3-Alignment-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration VariableDeclaration _error_ declare-var-id-init Error Alignment 1`] = `"Both errored"`; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-var-id-type-init/fixture.ts b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-var-id-type-init/fixture.ts new file mode 100644 index 000000000000..000601b07303 --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-var-id-type-init/fixture.ts @@ -0,0 +1 @@ +declare var foo: any = 1; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-var-id-type-init/snapshots/1-TSESTree-Error.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-var-id-type-init/snapshots/1-TSESTree-Error.shot new file mode 100644 index 000000000000..a92004642d50 --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-var-id-type-init/snapshots/1-TSESTree-Error.shot @@ -0,0 +1,8 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration VariableDeclaration _error_ declare-var-id-type-init TSESTree - Error 1`] = ` +"TSError +> 1 | declare var foo: any = 1; + | ^^^^^^^^^^^^ Initializers are not permitted in ambient contexts. + 2 |" +`; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-var-id-type-init/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-var-id-type-init/snapshots/2-Babel-Error.shot new file mode 100644 index 000000000000..988284efc747 --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-var-id-type-init/snapshots/2-Babel-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration VariableDeclaration _error_ declare-var-id-type-init Babel - Error 1`] = `[SyntaxError: Initializers are not allowed in ambient contexts. (1:23)]`; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-var-id-type-init/snapshots/3-Alignment-Error.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-var-id-type-init/snapshots/3-Alignment-Error.shot new file mode 100644 index 000000000000..fa323d6822e3 --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-var-id-type-init/snapshots/3-Alignment-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration VariableDeclaration _error_ declare-var-id-type-init Error Alignment 1`] = `"Both errored"`; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-with-using/fixture.ts b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-with-using/fixture.ts deleted file mode 100644 index e36a9e085f2a..000000000000 --- a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/declare-with-using/fixture.ts +++ /dev/null @@ -1 +0,0 @@ -declare using a = 1; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/let-destructure-no-init/fixture.ts b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/let-destructure-no-init/fixture.ts new file mode 100644 index 000000000000..d9b96b4fa2dc --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/let-destructure-no-init/fixture.ts @@ -0,0 +1 @@ +let { foo }; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/let-destructure-no-init/snapshots/1-TSESTree-Error.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/let-destructure-no-init/snapshots/1-TSESTree-Error.shot new file mode 100644 index 000000000000..169e787f5ca6 --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/let-destructure-no-init/snapshots/1-TSESTree-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration VariableDeclaration _error_ let-destructure-no-init TSESTree - Error 1`] = `"NO ERROR"`; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/let-destructure-no-init/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/let-destructure-no-init/snapshots/2-Babel-Error.shot new file mode 100644 index 000000000000..322140560ab2 --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/let-destructure-no-init/snapshots/2-Babel-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration VariableDeclaration _error_ let-destructure-no-init Babel - Error 1`] = `[SyntaxError: Missing initializer in destructuring declaration. (1:11)]`; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/let-destructure-no-init/snapshots/3-Alignment-Error.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/let-destructure-no-init/snapshots/3-Alignment-Error.shot new file mode 100644 index 000000000000..0462639dd13b --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/let-destructure-no-init/snapshots/3-Alignment-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration VariableDeclaration _error_ let-destructure-no-init Error Alignment 1`] = `"Babel errored but TSESTree didn't"`; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/let-destructure-type-no-init/fixture.ts b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/let-destructure-type-no-init/fixture.ts new file mode 100644 index 000000000000..e275d595440a --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/let-destructure-type-no-init/fixture.ts @@ -0,0 +1 @@ +let { foo }: any; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/let-destructure-type-no-init/snapshots/1-TSESTree-Error.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/let-destructure-type-no-init/snapshots/1-TSESTree-Error.shot new file mode 100644 index 000000000000..541a090803eb --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/let-destructure-type-no-init/snapshots/1-TSESTree-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration VariableDeclaration _error_ let-destructure-type-no-init TSESTree - Error 1`] = `"NO ERROR"`; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/let-destructure-type-no-init/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/let-destructure-type-no-init/snapshots/2-Babel-Error.shot new file mode 100644 index 000000000000..08ac3ff9a9a8 --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/let-destructure-type-no-init/snapshots/2-Babel-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration VariableDeclaration _error_ let-destructure-type-no-init Babel - Error 1`] = `[SyntaxError: Missing initializer in destructuring declaration. (1:16)]`; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/let-destructure-type-no-init/snapshots/3-Alignment-Error.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/let-destructure-type-no-init/snapshots/3-Alignment-Error.shot new file mode 100644 index 000000000000..83583de6d277 --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/let-destructure-type-no-init/snapshots/3-Alignment-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration VariableDeclaration _error_ let-destructure-type-no-init Error Alignment 1`] = `"Babel errored but TSESTree didn't"`; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/let-id-definite-init/fixture.ts b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/let-id-definite-init/fixture.ts new file mode 100644 index 000000000000..e3bb013f7995 --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/let-id-definite-init/fixture.ts @@ -0,0 +1 @@ +let foo! = 1; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/let-id-definite-init/snapshots/1-TSESTree-Error.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/let-id-definite-init/snapshots/1-TSESTree-Error.shot new file mode 100644 index 000000000000..7f0a20be7320 --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/let-id-definite-init/snapshots/1-TSESTree-Error.shot @@ -0,0 +1,8 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration VariableDeclaration _error_ let-id-definite-init TSESTree - Error 1`] = ` +"TSError +> 1 | let foo! = 1; + | ^^^^^^^^ Declarations with initializers cannot also have definite assignment assertions. + 2 |" +`; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/let-id-definite-init/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/let-id-definite-init/snapshots/2-Babel-Error.shot new file mode 100644 index 000000000000..24d2d9b41784 --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/let-id-definite-init/snapshots/2-Babel-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration VariableDeclaration _error_ let-id-definite-init Babel - Error 1`] = `"NO ERROR"`; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/let-id-definite-init/snapshots/3-Alignment-Error.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/let-id-definite-init/snapshots/3-Alignment-Error.shot new file mode 100644 index 000000000000..772eda2c9f66 --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/let-id-definite-init/snapshots/3-Alignment-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration VariableDeclaration _error_ let-id-definite-init Error Alignment 1`] = `"TSESTree errored but Babel didn't"`; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/let-id-definite-no-init/fixture.ts b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/let-id-definite-no-init/fixture.ts new file mode 100644 index 000000000000..3c86746df29f --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/let-id-definite-no-init/fixture.ts @@ -0,0 +1 @@ +let foo!; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/let-id-definite-no-init/snapshots/1-TSESTree-Error.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/let-id-definite-no-init/snapshots/1-TSESTree-Error.shot new file mode 100644 index 000000000000..9fc87ad6a277 --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/let-id-definite-no-init/snapshots/1-TSESTree-Error.shot @@ -0,0 +1,8 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration VariableDeclaration _error_ let-id-definite-no-init TSESTree - Error 1`] = ` +"TSError +> 1 | let foo!; + | ^^^^ Declarations with definite assignment assertions must also have type annotations. + 2 |" +`; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/let-id-definite-no-init/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/let-id-definite-no-init/snapshots/2-Babel-Error.shot new file mode 100644 index 000000000000..ea859f637709 --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/let-id-definite-no-init/snapshots/2-Babel-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration VariableDeclaration _error_ let-id-definite-no-init Babel - Error 1`] = `"NO ERROR"`; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/let-id-definite-no-init/snapshots/3-Alignment-Error.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/let-id-definite-no-init/snapshots/3-Alignment-Error.shot new file mode 100644 index 000000000000..0dff57831fa9 --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/let-id-definite-no-init/snapshots/3-Alignment-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration VariableDeclaration _error_ let-id-definite-no-init Error Alignment 1`] = `"TSESTree errored but Babel didn't"`; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/let-id-definite-type-init/fixture.ts b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/let-id-definite-type-init/fixture.ts new file mode 100644 index 000000000000..96b83cbc7c32 --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/let-id-definite-type-init/fixture.ts @@ -0,0 +1 @@ +let foo!: any = 1; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/let-id-definite-type-init/snapshots/1-TSESTree-Error.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/let-id-definite-type-init/snapshots/1-TSESTree-Error.shot new file mode 100644 index 000000000000..f03f9c79039f --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/let-id-definite-type-init/snapshots/1-TSESTree-Error.shot @@ -0,0 +1,8 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration VariableDeclaration _error_ let-id-definite-type-init TSESTree - Error 1`] = ` +"TSError +> 1 | let foo!: any = 1; + | ^^^^^^^^^^^^^ Declarations with initializers cannot also have definite assignment assertions. + 2 |" +`; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/let-id-definite-type-init/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/let-id-definite-type-init/snapshots/2-Babel-Error.shot new file mode 100644 index 000000000000..d68a11cec616 --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/let-id-definite-type-init/snapshots/2-Babel-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration VariableDeclaration _error_ let-id-definite-type-init Babel - Error 1`] = `"NO ERROR"`; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/let-id-definite-type-init/snapshots/3-Alignment-Error.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/let-id-definite-type-init/snapshots/3-Alignment-Error.shot new file mode 100644 index 000000000000..24974b84b491 --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/let-id-definite-type-init/snapshots/3-Alignment-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration VariableDeclaration _error_ let-id-definite-type-init Error Alignment 1`] = `"TSESTree errored but Babel didn't"`; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/missing-id-without-value/fixture.ts b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/missing-id-without-value/fixture.ts deleted file mode 100644 index c53e6c279527..000000000000 --- a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/missing-id-without-value/fixture.ts +++ /dev/null @@ -1 +0,0 @@ -const; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/missing-id-without-value/snapshots/1-Babel-Error.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/missing-id-without-value/snapshots/1-Babel-Error.shot deleted file mode 100644 index 7a42d0e079b6..000000000000 --- a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/missing-id-without-value/snapshots/1-Babel-Error.shot +++ /dev/null @@ -1,3 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`AST Fixtures declaration VariableDeclaration _error_ missing-id-without-value Babel - Error 1`] = `[SyntaxError: Unexpected token (1:5)]`; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/missing-id-without-value/snapshots/1-TSESTree-Error.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/missing-id-without-value/snapshots/1-TSESTree-Error.shot deleted file mode 100644 index dedcabc0bbf9..000000000000 --- a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/missing-id-without-value/snapshots/1-TSESTree-Error.shot +++ /dev/null @@ -1,8 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`AST Fixtures declaration VariableDeclaration _error_ missing-id-without-value TSESTree - Error 1`] = ` -"TSError -> 1 | const; - | ^^^^^^ A variable declaration list must have at least one variable declarator. - 2 |" -`; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/missing-id-without-value/snapshots/2-Alignment-Error.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/missing-id-without-value/snapshots/2-Alignment-Error.shot deleted file mode 100644 index cd2401b6862d..000000000000 --- a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/missing-id-without-value/snapshots/2-Alignment-Error.shot +++ /dev/null @@ -1,3 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`AST Fixtures declaration VariableDeclaration _error_ missing-id-without-value Error Alignment 1`] = `"Babel errored but TSESTree didn't"`; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/missing-id-without-value/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/missing-id-without-value/snapshots/2-Babel-Error.shot deleted file mode 100644 index 7a42d0e079b6..000000000000 --- a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/missing-id-without-value/snapshots/2-Babel-Error.shot +++ /dev/null @@ -1,3 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`AST Fixtures declaration VariableDeclaration _error_ missing-id-without-value Babel - Error 1`] = `[SyntaxError: Unexpected token (1:5)]`; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/missing-id-without-value/snapshots/3-Alignment-Error.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/missing-id-without-value/snapshots/3-Alignment-Error.shot deleted file mode 100644 index 89f5785e4c72..000000000000 --- a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/missing-id-without-value/snapshots/3-Alignment-Error.shot +++ /dev/null @@ -1,3 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`AST Fixtures declaration VariableDeclaration _error_ missing-id-without-value Error Alignment 1`] = `"Both errored"`; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/missing-value-in-using/fixture.ts b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/missing-value-in-using/fixture.ts deleted file mode 100644 index 2d16eec5ceca..000000000000 --- a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/missing-value-in-using/fixture.ts +++ /dev/null @@ -1 +0,0 @@ -using a; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/missing-value-in-using/snapshots/1-TSESTree-Error.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/missing-value-in-using/snapshots/1-TSESTree-Error.shot deleted file mode 100644 index 92cdc2e07735..000000000000 --- a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/missing-value-in-using/snapshots/1-TSESTree-Error.shot +++ /dev/null @@ -1,8 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`AST Fixtures declaration VariableDeclaration _error_ missing-value-in-using TSESTree - Error 1`] = ` -"TSError -> 1 | using a; - | ^ 'using' declarations must be initialized. - 2 |" -`; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/missing-value-in-using/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/missing-value-in-using/snapshots/2-Babel-Error.shot deleted file mode 100644 index d261e20d3f43..000000000000 --- a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/missing-value-in-using/snapshots/2-Babel-Error.shot +++ /dev/null @@ -1,3 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`AST Fixtures declaration VariableDeclaration _error_ missing-value-in-using Babel - Error 1`] = `[SyntaxError: Missing initializer in using declaration. (1:7)]`; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/missing-value-in-using/snapshots/3-Alignment-Error.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/missing-value-in-using/snapshots/3-Alignment-Error.shot deleted file mode 100644 index 62b811d2845c..000000000000 --- a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/missing-value-in-using/snapshots/3-Alignment-Error.shot +++ /dev/null @@ -1,3 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`AST Fixtures declaration VariableDeclaration _error_ missing-value-in-using Error Alignment 1`] = `"Both errored"`; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/object-binding-patterns-in-using/fixture.ts b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/object-binding-patterns-in-using/fixture.ts deleted file mode 100644 index ecdeec9248e8..000000000000 --- a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/object-binding-patterns-in-using/fixture.ts +++ /dev/null @@ -1 +0,0 @@ -using {a} = {a: 1}; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/object-binding-patterns-in-using/snapshots/1-TSESTree-Error.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/object-binding-patterns-in-using/snapshots/1-TSESTree-Error.shot deleted file mode 100644 index dc13d7605c23..000000000000 --- a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/object-binding-patterns-in-using/snapshots/1-TSESTree-Error.shot +++ /dev/null @@ -1,8 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`AST Fixtures declaration VariableDeclaration _error_ object-binding-patterns-in-using TSESTree - Error 1`] = ` -"TSError -> 1 | using {a} = {a: 1}; - | ^^^ 'using' declarations may not have binding patterns. - 2 |" -`; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/object-binding-patterns-in-using/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/object-binding-patterns-in-using/snapshots/2-Babel-Error.shot deleted file mode 100644 index 150938c24f96..000000000000 --- a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/object-binding-patterns-in-using/snapshots/2-Babel-Error.shot +++ /dev/null @@ -1,3 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`AST Fixtures declaration VariableDeclaration _error_ object-binding-patterns-in-using Babel - Error 1`] = `[SyntaxError: Missing semicolon. (1:5)]`; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/object-binding-patterns-in-using/snapshots/3-Alignment-Error.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/object-binding-patterns-in-using/snapshots/3-Alignment-Error.shot deleted file mode 100644 index f8d176652f8f..000000000000 --- a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/object-binding-patterns-in-using/snapshots/3-Alignment-Error.shot +++ /dev/null @@ -1,3 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`AST Fixtures declaration VariableDeclaration _error_ object-binding-patterns-in-using Error Alignment 1`] = `"Both errored"`; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/using-destructure-init/fixture.ts b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/using-destructure-init/fixture.ts new file mode 100644 index 000000000000..1041b7fe4c86 --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/using-destructure-init/fixture.ts @@ -0,0 +1 @@ +using { foo } = 1; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/using-destructure-init/snapshots/1-TSESTree-Error.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/using-destructure-init/snapshots/1-TSESTree-Error.shot new file mode 100644 index 000000000000..4dd5cadf88e5 --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/using-destructure-init/snapshots/1-TSESTree-Error.shot @@ -0,0 +1,8 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration VariableDeclaration _error_ using-destructure-init TSESTree - Error 1`] = ` +"TSError +> 1 | using { foo } = 1; + | ^^^^^^^ 'using' declarations may not have binding patterns. + 2 |" +`; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/using-destructure-init/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/using-destructure-init/snapshots/2-Babel-Error.shot new file mode 100644 index 000000000000..cb166d91cb46 --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/using-destructure-init/snapshots/2-Babel-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration VariableDeclaration _error_ using-destructure-init Babel - Error 1`] = `[SyntaxError: Missing semicolon. (1:5)]`; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/using-destructure-init/snapshots/3-Alignment-Error.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/using-destructure-init/snapshots/3-Alignment-Error.shot new file mode 100644 index 000000000000..f49f0af2b2b3 --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/using-destructure-init/snapshots/3-Alignment-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration VariableDeclaration _error_ using-destructure-init Error Alignment 1`] = `"Both errored"`; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/using-destructure-no-init/fixture.ts b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/using-destructure-no-init/fixture.ts new file mode 100644 index 000000000000..20e69190901f --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/using-destructure-no-init/fixture.ts @@ -0,0 +1 @@ +using { foo }; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/using-destructure-no-init/snapshots/1-TSESTree-Error.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/using-destructure-no-init/snapshots/1-TSESTree-Error.shot new file mode 100644 index 000000000000..6c99f9defe91 --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/using-destructure-no-init/snapshots/1-TSESTree-Error.shot @@ -0,0 +1,8 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration VariableDeclaration _error_ using-destructure-no-init TSESTree - Error 1`] = ` +"TSError +> 1 | using { foo }; + | ^^^^^^^ 'using' declarations must be initialized. + 2 |" +`; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/using-destructure-no-init/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/using-destructure-no-init/snapshots/2-Babel-Error.shot new file mode 100644 index 000000000000..fb344fb25e23 --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/using-destructure-no-init/snapshots/2-Babel-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration VariableDeclaration _error_ using-destructure-no-init Babel - Error 1`] = `[SyntaxError: Missing semicolon. (1:5)]`; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/using-destructure-no-init/snapshots/3-Alignment-Error.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/using-destructure-no-init/snapshots/3-Alignment-Error.shot new file mode 100644 index 000000000000..dbf4aa8c93c8 --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/using-destructure-no-init/snapshots/3-Alignment-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration VariableDeclaration _error_ using-destructure-no-init Error Alignment 1`] = `"Both errored"`; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/using-destructure-type-init/fixture.ts b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/using-destructure-type-init/fixture.ts new file mode 100644 index 000000000000..87f55b7faa5b --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/using-destructure-type-init/fixture.ts @@ -0,0 +1 @@ +using { foo }: any = 1; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/using-destructure-type-init/snapshots/1-TSESTree-Error.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/using-destructure-type-init/snapshots/1-TSESTree-Error.shot new file mode 100644 index 000000000000..c1c327b673ec --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/using-destructure-type-init/snapshots/1-TSESTree-Error.shot @@ -0,0 +1,8 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration VariableDeclaration _error_ using-destructure-type-init TSESTree - Error 1`] = ` +"TSError +> 1 | using { foo }: any = 1; + | ^^^^^^^ 'using' declarations may not have binding patterns. + 2 |" +`; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/using-destructure-type-init/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/using-destructure-type-init/snapshots/2-Babel-Error.shot new file mode 100644 index 000000000000..4599c4a40f6d --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/using-destructure-type-init/snapshots/2-Babel-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration VariableDeclaration _error_ using-destructure-type-init Babel - Error 1`] = `[SyntaxError: Missing semicolon. (1:5)]`; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/using-destructure-type-init/snapshots/3-Alignment-Error.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/using-destructure-type-init/snapshots/3-Alignment-Error.shot new file mode 100644 index 000000000000..56b4cfd764e3 --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/using-destructure-type-init/snapshots/3-Alignment-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration VariableDeclaration _error_ using-destructure-type-init Error Alignment 1`] = `"Both errored"`; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/using-destructure-type-no-init/fixture.ts b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/using-destructure-type-no-init/fixture.ts new file mode 100644 index 000000000000..47c5898baefb --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/using-destructure-type-no-init/fixture.ts @@ -0,0 +1 @@ +using { foo }: any; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/using-destructure-type-no-init/snapshots/1-TSESTree-Error.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/using-destructure-type-no-init/snapshots/1-TSESTree-Error.shot new file mode 100644 index 000000000000..bf844f9d2004 --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/using-destructure-type-no-init/snapshots/1-TSESTree-Error.shot @@ -0,0 +1,8 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration VariableDeclaration _error_ using-destructure-type-no-init TSESTree - Error 1`] = ` +"TSError +> 1 | using { foo }: any; + | ^^^^^^^^^^^^ 'using' declarations must be initialized. + 2 |" +`; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/using-destructure-type-no-init/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/using-destructure-type-no-init/snapshots/2-Babel-Error.shot new file mode 100644 index 000000000000..6170b977a145 --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/using-destructure-type-no-init/snapshots/2-Babel-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration VariableDeclaration _error_ using-destructure-type-no-init Babel - Error 1`] = `[SyntaxError: Missing semicolon. (1:5)]`; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/using-destructure-type-no-init/snapshots/3-Alignment-Error.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/using-destructure-type-no-init/snapshots/3-Alignment-Error.shot new file mode 100644 index 000000000000..a82070cebf0d --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/using-destructure-type-no-init/snapshots/3-Alignment-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration VariableDeclaration _error_ using-destructure-type-no-init Error Alignment 1`] = `"Both errored"`; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/using-id-definite-init/fixture.ts b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/using-id-definite-init/fixture.ts new file mode 100644 index 000000000000..8088b1d609f8 --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/using-id-definite-init/fixture.ts @@ -0,0 +1 @@ +using foo! = 1; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/using-id-definite-init/snapshots/1-TSESTree-Error.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/using-id-definite-init/snapshots/1-TSESTree-Error.shot new file mode 100644 index 000000000000..c2cf41b5b1d9 --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/using-id-definite-init/snapshots/1-TSESTree-Error.shot @@ -0,0 +1,8 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration VariableDeclaration _error_ using-id-definite-init TSESTree - Error 1`] = ` +"TSError +> 1 | using foo! = 1; + | ^^^^^^^^ Declarations with initializers cannot also have definite assignment assertions. + 2 |" +`; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/using-id-definite-init/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/using-id-definite-init/snapshots/2-Babel-Error.shot new file mode 100644 index 000000000000..56f217331066 --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/using-id-definite-init/snapshots/2-Babel-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration VariableDeclaration _error_ using-id-definite-init Babel - Error 1`] = `"NO ERROR"`; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/using-id-definite-init/snapshots/3-Alignment-Error.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/using-id-definite-init/snapshots/3-Alignment-Error.shot new file mode 100644 index 000000000000..07c9cf394b2c --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/using-id-definite-init/snapshots/3-Alignment-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration VariableDeclaration _error_ using-id-definite-init Error Alignment 1`] = `"TSESTree errored but Babel didn't"`; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/using-id-definite-no-init/fixture.ts b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/using-id-definite-no-init/fixture.ts new file mode 100644 index 000000000000..40b3efcd3ef0 --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/using-id-definite-no-init/fixture.ts @@ -0,0 +1 @@ +using foo!; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/using-id-definite-no-init/snapshots/1-TSESTree-Error.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/using-id-definite-no-init/snapshots/1-TSESTree-Error.shot new file mode 100644 index 000000000000..8e6e5124056e --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/using-id-definite-no-init/snapshots/1-TSESTree-Error.shot @@ -0,0 +1,8 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration VariableDeclaration _error_ using-id-definite-no-init TSESTree - Error 1`] = ` +"TSError +> 1 | using foo!; + | ^^^^ Declarations with definite assignment assertions must also have type annotations. + 2 |" +`; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/using-id-definite-no-init/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/using-id-definite-no-init/snapshots/2-Babel-Error.shot new file mode 100644 index 000000000000..2c9b0eae48e0 --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/using-id-definite-no-init/snapshots/2-Babel-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration VariableDeclaration _error_ using-id-definite-no-init Babel - Error 1`] = `[SyntaxError: Missing initializer in using declaration. (1:10)]`; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/using-id-definite-no-init/snapshots/3-Alignment-Error.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/using-id-definite-no-init/snapshots/3-Alignment-Error.shot new file mode 100644 index 000000000000..00ee879765b8 --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/using-id-definite-no-init/snapshots/3-Alignment-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration VariableDeclaration _error_ using-id-definite-no-init Error Alignment 1`] = `"Both errored"`; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/using-id-definite-type-init/fixture.ts b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/using-id-definite-type-init/fixture.ts new file mode 100644 index 000000000000..bd062a5c57a9 --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/using-id-definite-type-init/fixture.ts @@ -0,0 +1 @@ +using foo!: any = 1; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/using-id-definite-type-init/snapshots/1-TSESTree-Error.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/using-id-definite-type-init/snapshots/1-TSESTree-Error.shot new file mode 100644 index 000000000000..099de03a3b6e --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/using-id-definite-type-init/snapshots/1-TSESTree-Error.shot @@ -0,0 +1,8 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration VariableDeclaration _error_ using-id-definite-type-init TSESTree - Error 1`] = ` +"TSError +> 1 | using foo!: any = 1; + | ^^^^^^^^^^^^^ Declarations with initializers cannot also have definite assignment assertions. + 2 |" +`; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/using-id-definite-type-init/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/using-id-definite-type-init/snapshots/2-Babel-Error.shot new file mode 100644 index 000000000000..197e118313cd --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/using-id-definite-type-init/snapshots/2-Babel-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration VariableDeclaration _error_ using-id-definite-type-init Babel - Error 1`] = `"NO ERROR"`; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/using-id-definite-type-init/snapshots/3-Alignment-Error.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/using-id-definite-type-init/snapshots/3-Alignment-Error.shot new file mode 100644 index 000000000000..1db52a8114c1 --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/using-id-definite-type-init/snapshots/3-Alignment-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration VariableDeclaration _error_ using-id-definite-type-init Error Alignment 1`] = `"TSESTree errored but Babel didn't"`; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/using-id-definite-type-no-init/fixture.ts b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/using-id-definite-type-no-init/fixture.ts new file mode 100644 index 000000000000..7c67dd0dd9e8 --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/using-id-definite-type-no-init/fixture.ts @@ -0,0 +1 @@ +using foo!: any; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/using-id-definite-type-no-init/snapshots/1-TSESTree-Error.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/using-id-definite-type-no-init/snapshots/1-TSESTree-Error.shot new file mode 100644 index 000000000000..357c66c0815f --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/using-id-definite-type-no-init/snapshots/1-TSESTree-Error.shot @@ -0,0 +1,8 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration VariableDeclaration _error_ using-id-definite-type-no-init TSESTree - Error 1`] = ` +"TSError +> 1 | using foo!: any; + | ^^^^^^^^^ 'using' declarations must be initialized. + 2 |" +`; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/using-id-definite-type-no-init/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/using-id-definite-type-no-init/snapshots/2-Babel-Error.shot new file mode 100644 index 000000000000..8ccf98c1bd75 --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/using-id-definite-type-no-init/snapshots/2-Babel-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration VariableDeclaration _error_ using-id-definite-type-no-init Babel - Error 1`] = `[SyntaxError: Missing initializer in using declaration. (1:15)]`; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/using-id-definite-type-no-init/snapshots/3-Alignment-Error.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/using-id-definite-type-no-init/snapshots/3-Alignment-Error.shot new file mode 100644 index 000000000000..a387f1a7afff --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/using-id-definite-type-no-init/snapshots/3-Alignment-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration VariableDeclaration _error_ using-id-definite-type-no-init Error Alignment 1`] = `"Both errored"`; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/using-id-no-init/fixture.ts b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/using-id-no-init/fixture.ts new file mode 100644 index 000000000000..eceff80aa2be --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/using-id-no-init/fixture.ts @@ -0,0 +1 @@ +using foo; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/using-id-no-init/snapshots/1-TSESTree-Error.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/using-id-no-init/snapshots/1-TSESTree-Error.shot new file mode 100644 index 000000000000..3cc1abd20725 --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/using-id-no-init/snapshots/1-TSESTree-Error.shot @@ -0,0 +1,8 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration VariableDeclaration _error_ using-id-no-init TSESTree - Error 1`] = ` +"TSError +> 1 | using foo; + | ^^^ 'using' declarations must be initialized. + 2 |" +`; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/using-id-no-init/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/using-id-no-init/snapshots/2-Babel-Error.shot new file mode 100644 index 000000000000..1fa2533e0f2f --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/using-id-no-init/snapshots/2-Babel-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration VariableDeclaration _error_ using-id-no-init Babel - Error 1`] = `[SyntaxError: Missing initializer in using declaration. (1:9)]`; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/using-id-no-init/snapshots/3-Alignment-Error.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/using-id-no-init/snapshots/3-Alignment-Error.shot new file mode 100644 index 000000000000..cb3c4ed9fd12 --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/using-id-no-init/snapshots/3-Alignment-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration VariableDeclaration _error_ using-id-no-init Error Alignment 1`] = `"Both errored"`; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/using-id-type-no-init/fixture.ts b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/using-id-type-no-init/fixture.ts new file mode 100644 index 000000000000..647e9d836428 --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/using-id-type-no-init/fixture.ts @@ -0,0 +1 @@ +using foo: any; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/using-id-type-no-init/snapshots/1-TSESTree-Error.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/using-id-type-no-init/snapshots/1-TSESTree-Error.shot new file mode 100644 index 000000000000..6090efcf6ec3 --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/using-id-type-no-init/snapshots/1-TSESTree-Error.shot @@ -0,0 +1,8 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration VariableDeclaration _error_ using-id-type-no-init TSESTree - Error 1`] = ` +"TSError +> 1 | using foo: any; + | ^^^^^^^^ 'using' declarations must be initialized. + 2 |" +`; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/using-id-type-no-init/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/using-id-type-no-init/snapshots/2-Babel-Error.shot new file mode 100644 index 000000000000..43dcea26a2e2 --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/using-id-type-no-init/snapshots/2-Babel-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration VariableDeclaration _error_ using-id-type-no-init Babel - Error 1`] = `[SyntaxError: Missing initializer in using declaration. (1:14)]`; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/using-id-type-no-init/snapshots/3-Alignment-Error.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/using-id-type-no-init/snapshots/3-Alignment-Error.shot new file mode 100644 index 000000000000..9c46dc8f1d5e --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/using-id-type-no-init/snapshots/3-Alignment-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration VariableDeclaration _error_ using-id-type-no-init Error Alignment 1`] = `"Both errored"`; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/var-destructure-no-init/fixture.ts b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/var-destructure-no-init/fixture.ts new file mode 100644 index 000000000000..b8066b24dbbf --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/var-destructure-no-init/fixture.ts @@ -0,0 +1 @@ +var { foo }; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/var-destructure-no-init/snapshots/1-TSESTree-Error.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/var-destructure-no-init/snapshots/1-TSESTree-Error.shot new file mode 100644 index 000000000000..af758f63cfe0 --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/var-destructure-no-init/snapshots/1-TSESTree-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration VariableDeclaration _error_ var-destructure-no-init TSESTree - Error 1`] = `"NO ERROR"`; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/var-destructure-no-init/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/var-destructure-no-init/snapshots/2-Babel-Error.shot new file mode 100644 index 000000000000..3f4bed8bbb97 --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/var-destructure-no-init/snapshots/2-Babel-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration VariableDeclaration _error_ var-destructure-no-init Babel - Error 1`] = `[SyntaxError: Missing initializer in destructuring declaration. (1:11)]`; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/var-destructure-no-init/snapshots/3-Alignment-Error.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/var-destructure-no-init/snapshots/3-Alignment-Error.shot new file mode 100644 index 000000000000..bf3bf5b01689 --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/var-destructure-no-init/snapshots/3-Alignment-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration VariableDeclaration _error_ var-destructure-no-init Error Alignment 1`] = `"Babel errored but TSESTree didn't"`; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/var-destructure-type-no-init/fixture.ts b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/var-destructure-type-no-init/fixture.ts new file mode 100644 index 000000000000..c57774116664 --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/var-destructure-type-no-init/fixture.ts @@ -0,0 +1 @@ +var { foo }: any; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/var-destructure-type-no-init/snapshots/1-TSESTree-Error.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/var-destructure-type-no-init/snapshots/1-TSESTree-Error.shot new file mode 100644 index 000000000000..4164dc69c01e --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/var-destructure-type-no-init/snapshots/1-TSESTree-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration VariableDeclaration _error_ var-destructure-type-no-init TSESTree - Error 1`] = `"NO ERROR"`; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/var-destructure-type-no-init/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/var-destructure-type-no-init/snapshots/2-Babel-Error.shot new file mode 100644 index 000000000000..9baeefe63ad5 --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/var-destructure-type-no-init/snapshots/2-Babel-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration VariableDeclaration _error_ var-destructure-type-no-init Babel - Error 1`] = `[SyntaxError: Missing initializer in destructuring declaration. (1:16)]`; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/var-destructure-type-no-init/snapshots/3-Alignment-Error.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/var-destructure-type-no-init/snapshots/3-Alignment-Error.shot new file mode 100644 index 000000000000..a194e33cb8c7 --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/var-destructure-type-no-init/snapshots/3-Alignment-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration VariableDeclaration _error_ var-destructure-type-no-init Error Alignment 1`] = `"Babel errored but TSESTree didn't"`; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/var-id-definite-init/fixture.ts b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/var-id-definite-init/fixture.ts new file mode 100644 index 000000000000..265f0dde5187 --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/var-id-definite-init/fixture.ts @@ -0,0 +1 @@ +var foo! = 1; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/var-id-definite-init/snapshots/1-TSESTree-Error.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/var-id-definite-init/snapshots/1-TSESTree-Error.shot new file mode 100644 index 000000000000..7b711067a127 --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/var-id-definite-init/snapshots/1-TSESTree-Error.shot @@ -0,0 +1,8 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration VariableDeclaration _error_ var-id-definite-init TSESTree - Error 1`] = ` +"TSError +> 1 | var foo! = 1; + | ^^^^^^^^ Declarations with initializers cannot also have definite assignment assertions. + 2 |" +`; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/var-id-definite-init/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/var-id-definite-init/snapshots/2-Babel-Error.shot new file mode 100644 index 000000000000..aacca613c853 --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/var-id-definite-init/snapshots/2-Babel-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration VariableDeclaration _error_ var-id-definite-init Babel - Error 1`] = `"NO ERROR"`; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/var-id-definite-init/snapshots/3-Alignment-Error.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/var-id-definite-init/snapshots/3-Alignment-Error.shot new file mode 100644 index 000000000000..acefe589f336 --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/var-id-definite-init/snapshots/3-Alignment-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration VariableDeclaration _error_ var-id-definite-init Error Alignment 1`] = `"TSESTree errored but Babel didn't"`; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/var-id-definite-no-init/fixture.ts b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/var-id-definite-no-init/fixture.ts new file mode 100644 index 000000000000..bed948fe2b92 --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/var-id-definite-no-init/fixture.ts @@ -0,0 +1 @@ +var foo!; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/var-id-definite-no-init/snapshots/1-TSESTree-Error.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/var-id-definite-no-init/snapshots/1-TSESTree-Error.shot new file mode 100644 index 000000000000..5835f69ead4e --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/var-id-definite-no-init/snapshots/1-TSESTree-Error.shot @@ -0,0 +1,8 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration VariableDeclaration _error_ var-id-definite-no-init TSESTree - Error 1`] = ` +"TSError +> 1 | var foo!; + | ^^^^ Declarations with definite assignment assertions must also have type annotations. + 2 |" +`; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/var-id-definite-no-init/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/var-id-definite-no-init/snapshots/2-Babel-Error.shot new file mode 100644 index 000000000000..dff819cad942 --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/var-id-definite-no-init/snapshots/2-Babel-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration VariableDeclaration _error_ var-id-definite-no-init Babel - Error 1`] = `"NO ERROR"`; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/var-id-definite-no-init/snapshots/3-Alignment-Error.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/var-id-definite-no-init/snapshots/3-Alignment-Error.shot new file mode 100644 index 000000000000..53f0ec42c2a4 --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/var-id-definite-no-init/snapshots/3-Alignment-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration VariableDeclaration _error_ var-id-definite-no-init Error Alignment 1`] = `"TSESTree errored but Babel didn't"`; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/var-id-definite-type-init/fixture.ts b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/var-id-definite-type-init/fixture.ts new file mode 100644 index 000000000000..ccbd306f169f --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/var-id-definite-type-init/fixture.ts @@ -0,0 +1 @@ +var foo!: any = 1; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/var-id-definite-type-init/snapshots/1-TSESTree-Error.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/var-id-definite-type-init/snapshots/1-TSESTree-Error.shot new file mode 100644 index 000000000000..1e6e6062e0a4 --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/var-id-definite-type-init/snapshots/1-TSESTree-Error.shot @@ -0,0 +1,8 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration VariableDeclaration _error_ var-id-definite-type-init TSESTree - Error 1`] = ` +"TSError +> 1 | var foo!: any = 1; + | ^^^^^^^^^^^^^ Declarations with initializers cannot also have definite assignment assertions. + 2 |" +`; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/var-id-definite-type-init/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/var-id-definite-type-init/snapshots/2-Babel-Error.shot new file mode 100644 index 000000000000..458355a3ebeb --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/var-id-definite-type-init/snapshots/2-Babel-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration VariableDeclaration _error_ var-id-definite-type-init Babel - Error 1`] = `"NO ERROR"`; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/var-id-definite-type-init/snapshots/3-Alignment-Error.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/var-id-definite-type-init/snapshots/3-Alignment-Error.shot new file mode 100644 index 000000000000..ab29af081117 --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/var-id-definite-type-init/snapshots/3-Alignment-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration VariableDeclaration _error_ var-id-definite-type-init Error Alignment 1`] = `"TSESTree errored but Babel didn't"`; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/const-destructure-init/fixture.ts b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/const-destructure-init/fixture.ts new file mode 100644 index 000000000000..4ba4e3e66c42 --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/const-destructure-init/fixture.ts @@ -0,0 +1 @@ +const { foo } = 1; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/const-destructure-init/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/const-destructure-init/snapshots/1-TSESTree-AST.shot new file mode 100644 index 000000000000..c1169d0d8a55 --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/const-destructure-init/snapshots/1-TSESTree-AST.shot @@ -0,0 +1,101 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration VariableDeclaration const-destructure-init TSESTree - AST 1`] = ` +Program { + type: "Program", + body: [ + VariableDeclaration { + type: "VariableDeclaration", + declarations: [ + VariableDeclarator { + type: "VariableDeclarator", + definite: false, + id: ObjectPattern { + type: "ObjectPattern", + decorators: [], + optional: false, + properties: [ + Property { + type: "Property", + computed: false, + key: Identifier { + type: "Identifier", + decorators: [], + name: "foo", + optional: false, + + range: [8, 11], + loc: { + start: { column: 8, line: 1 }, + end: { column: 11, line: 1 }, + }, + }, + kind: "init", + method: false, + optional: false, + shorthand: true, + value: Identifier { + type: "Identifier", + decorators: [], + name: "foo", + optional: false, + + range: [8, 11], + loc: { + start: { column: 8, line: 1 }, + end: { column: 11, line: 1 }, + }, + }, + + range: [8, 11], + loc: { + start: { column: 8, line: 1 }, + end: { column: 11, line: 1 }, + }, + }, + ], + + range: [6, 13], + loc: { + start: { column: 6, line: 1 }, + end: { column: 13, line: 1 }, + }, + }, + init: Literal { + type: "Literal", + raw: "1", + value: 1, + + range: [16, 17], + loc: { + start: { column: 16, line: 1 }, + end: { column: 17, line: 1 }, + }, + }, + + range: [6, 17], + loc: { + start: { column: 6, line: 1 }, + end: { column: 17, line: 1 }, + }, + }, + ], + declare: false, + kind: "const", + + range: [0, 18], + loc: { + start: { column: 0, line: 1 }, + end: { column: 18, line: 1 }, + }, + }, + ], + sourceType: "script", + + range: [0, 19], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 2 }, + }, +} +`; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/const-destructure-init/snapshots/2-TSESTree-Tokens.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/const-destructure-init/snapshots/2-TSESTree-Tokens.shot new file mode 100644 index 000000000000..4fdc40932323 --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/const-destructure-init/snapshots/2-TSESTree-Tokens.shot @@ -0,0 +1,76 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration VariableDeclaration const-destructure-init TSESTree - Tokens 1`] = ` +[ + Keyword { + type: "Keyword", + value: "const", + + range: [0, 5], + loc: { + start: { column: 0, line: 1 }, + end: { column: 5, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "{", + + range: [6, 7], + loc: { + start: { column: 6, line: 1 }, + end: { column: 7, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "foo", + + range: [8, 11], + loc: { + start: { column: 8, line: 1 }, + end: { column: 11, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "}", + + range: [12, 13], + loc: { + start: { column: 12, line: 1 }, + end: { column: 13, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "=", + + range: [14, 15], + loc: { + start: { column: 14, line: 1 }, + end: { column: 15, line: 1 }, + }, + }, + Numeric { + type: "Numeric", + value: "1", + + range: [16, 17], + loc: { + start: { column: 16, line: 1 }, + end: { column: 17, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ";", + + range: [17, 18], + loc: { + start: { column: 17, line: 1 }, + end: { column: 18, line: 1 }, + }, + }, +] +`; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/const-destructure-init/snapshots/3-Babel-AST.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/const-destructure-init/snapshots/3-Babel-AST.shot new file mode 100644 index 000000000000..30ef6114a7fb --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/const-destructure-init/snapshots/3-Babel-AST.shot @@ -0,0 +1,92 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration VariableDeclaration const-destructure-init Babel - AST 1`] = ` +Program { + type: "Program", + body: [ + VariableDeclaration { + type: "VariableDeclaration", + declarations: [ + VariableDeclarator { + type: "VariableDeclarator", + id: ObjectPattern { + type: "ObjectPattern", + properties: [ + Property { + type: "Property", + computed: false, + key: Identifier { + type: "Identifier", + name: "foo", + + range: [8, 11], + loc: { + start: { column: 8, line: 1 }, + end: { column: 11, line: 1 }, + }, + }, + kind: "init", + method: false, + shorthand: true, + value: Identifier { + type: "Identifier", + name: "foo", + + range: [8, 11], + loc: { + start: { column: 8, line: 1 }, + end: { column: 11, line: 1 }, + }, + }, + + range: [8, 11], + loc: { + start: { column: 8, line: 1 }, + end: { column: 11, line: 1 }, + }, + }, + ], + + range: [6, 13], + loc: { + start: { column: 6, line: 1 }, + end: { column: 13, line: 1 }, + }, + }, + init: Literal { + type: "Literal", + raw: "1", + value: 1, + + range: [16, 17], + loc: { + start: { column: 16, line: 1 }, + end: { column: 17, line: 1 }, + }, + }, + + range: [6, 17], + loc: { + start: { column: 6, line: 1 }, + end: { column: 17, line: 1 }, + }, + }, + ], + kind: "const", + + range: [0, 18], + loc: { + start: { column: 0, line: 1 }, + end: { column: 18, line: 1 }, + }, + }, + ], + sourceType: "script", + + range: [0, 19], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 2 }, + }, +} +`; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/const-destructure-init/snapshots/4-Babel-Tokens.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/const-destructure-init/snapshots/4-Babel-Tokens.shot new file mode 100644 index 000000000000..cfb20544784d --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/const-destructure-init/snapshots/4-Babel-Tokens.shot @@ -0,0 +1,76 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration VariableDeclaration const-destructure-init Babel - Tokens 1`] = ` +[ + Keyword { + type: "Keyword", + value: "const", + + range: [0, 5], + loc: { + start: { column: 0, line: 1 }, + end: { column: 5, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "{", + + range: [6, 7], + loc: { + start: { column: 6, line: 1 }, + end: { column: 7, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "foo", + + range: [8, 11], + loc: { + start: { column: 8, line: 1 }, + end: { column: 11, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "}", + + range: [12, 13], + loc: { + start: { column: 12, line: 1 }, + end: { column: 13, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "=", + + range: [14, 15], + loc: { + start: { column: 14, line: 1 }, + end: { column: 15, line: 1 }, + }, + }, + Numeric { + type: "Numeric", + value: "1", + + range: [16, 17], + loc: { + start: { column: 16, line: 1 }, + end: { column: 17, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ";", + + range: [17, 18], + loc: { + start: { column: 17, line: 1 }, + end: { column: 18, line: 1 }, + }, + }, +] +`; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/const-destructure-init/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/const-destructure-init/snapshots/5-AST-Alignment-AST.shot new file mode 100644 index 000000000000..5ae9814d30cc --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/const-destructure-init/snapshots/5-AST-Alignment-AST.shot @@ -0,0 +1,105 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration VariableDeclaration const-destructure-init AST Alignment - AST 1`] = ` +"Snapshot Diff: +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + VariableDeclaration { + type: 'VariableDeclaration', + declarations: Array [ + VariableDeclarator { + type: 'VariableDeclarator', +- definite: false, + id: ObjectPattern { + type: 'ObjectPattern', +- decorators: Array [], +- optional: false, + properties: Array [ + Property { + type: 'Property', + computed: false, + key: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'foo', +- optional: false, + + range: [8, 11], + loc: { + start: { column: 8, line: 1 }, + end: { column: 11, line: 1 }, + }, + }, + kind: 'init', + method: false, +- optional: false, + shorthand: true, + value: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'foo', +- optional: false, + + range: [8, 11], + loc: { + start: { column: 8, line: 1 }, + end: { column: 11, line: 1 }, + }, + }, + + range: [8, 11], + loc: { + start: { column: 8, line: 1 }, + end: { column: 11, line: 1 }, + }, + }, + ], + + range: [6, 13], + loc: { + start: { column: 6, line: 1 }, + end: { column: 13, line: 1 }, + }, + }, + init: Literal { + type: 'Literal', + raw: '1', + value: 1, + + range: [16, 17], + loc: { + start: { column: 16, line: 1 }, + end: { column: 17, line: 1 }, + }, + }, + + range: [6, 17], + loc: { + start: { column: 6, line: 1 }, + end: { column: 17, line: 1 }, + }, + }, + ], +- declare: false, + kind: 'const', + + range: [0, 18], + loc: { + start: { column: 0, line: 1 }, + end: { column: 18, line: 1 }, + }, + }, + ], + sourceType: 'script', + + range: [0, 19], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 2 }, + }, + }" +`; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/const-destructure-init/snapshots/6-AST-Alignment-Tokens.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/const-destructure-init/snapshots/6-AST-Alignment-Tokens.shot new file mode 100644 index 000000000000..1bf6cf0c20c8 --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/const-destructure-init/snapshots/6-AST-Alignment-Tokens.shot @@ -0,0 +1,6 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration VariableDeclaration const-destructure-init AST Alignment - Token 1`] = ` +"Snapshot Diff: +Compared values have no visual difference." +`; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/const-destructure-type-init/fixture.ts b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/const-destructure-type-init/fixture.ts new file mode 100644 index 000000000000..e13fa6ceae52 --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/const-destructure-type-init/fixture.ts @@ -0,0 +1 @@ +const { foo }: any = 1; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/const-destructure-type-init/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/const-destructure-type-init/snapshots/1-TSESTree-AST.shot new file mode 100644 index 000000000000..24bb0b9f75e0 --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/const-destructure-type-init/snapshots/1-TSESTree-AST.shot @@ -0,0 +1,119 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration VariableDeclaration const-destructure-type-init TSESTree - AST 1`] = ` +Program { + type: "Program", + body: [ + VariableDeclaration { + type: "VariableDeclaration", + declarations: [ + VariableDeclarator { + type: "VariableDeclarator", + definite: false, + id: ObjectPattern { + type: "ObjectPattern", + decorators: [], + optional: false, + properties: [ + Property { + type: "Property", + computed: false, + key: Identifier { + type: "Identifier", + decorators: [], + name: "foo", + optional: false, + + range: [8, 11], + loc: { + start: { column: 8, line: 1 }, + end: { column: 11, line: 1 }, + }, + }, + kind: "init", + method: false, + optional: false, + shorthand: true, + value: Identifier { + type: "Identifier", + decorators: [], + name: "foo", + optional: false, + + range: [8, 11], + loc: { + start: { column: 8, line: 1 }, + end: { column: 11, line: 1 }, + }, + }, + + range: [8, 11], + loc: { + start: { column: 8, line: 1 }, + end: { column: 11, line: 1 }, + }, + }, + ], + typeAnnotation: TSTypeAnnotation { + type: "TSTypeAnnotation", + typeAnnotation: TSAnyKeyword { + type: "TSAnyKeyword", + + range: [15, 18], + loc: { + start: { column: 15, line: 1 }, + end: { column: 18, line: 1 }, + }, + }, + + range: [13, 18], + loc: { + start: { column: 13, line: 1 }, + end: { column: 18, line: 1 }, + }, + }, + + range: [6, 18], + loc: { + start: { column: 6, line: 1 }, + end: { column: 18, line: 1 }, + }, + }, + init: Literal { + type: "Literal", + raw: "1", + value: 1, + + range: [21, 22], + loc: { + start: { column: 21, line: 1 }, + end: { column: 22, line: 1 }, + }, + }, + + range: [6, 22], + loc: { + start: { column: 6, line: 1 }, + end: { column: 22, line: 1 }, + }, + }, + ], + declare: false, + kind: "const", + + range: [0, 23], + loc: { + start: { column: 0, line: 1 }, + end: { column: 23, line: 1 }, + }, + }, + ], + sourceType: "script", + + range: [0, 24], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 2 }, + }, +} +`; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/const-destructure-type-init/snapshots/2-TSESTree-Tokens.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/const-destructure-type-init/snapshots/2-TSESTree-Tokens.shot new file mode 100644 index 000000000000..9f866e9ac962 --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/const-destructure-type-init/snapshots/2-TSESTree-Tokens.shot @@ -0,0 +1,96 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration VariableDeclaration const-destructure-type-init TSESTree - Tokens 1`] = ` +[ + Keyword { + type: "Keyword", + value: "const", + + range: [0, 5], + loc: { + start: { column: 0, line: 1 }, + end: { column: 5, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "{", + + range: [6, 7], + loc: { + start: { column: 6, line: 1 }, + end: { column: 7, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "foo", + + range: [8, 11], + loc: { + start: { column: 8, line: 1 }, + end: { column: 11, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "}", + + range: [12, 13], + loc: { + start: { column: 12, line: 1 }, + end: { column: 13, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ":", + + range: [13, 14], + loc: { + start: { column: 13, line: 1 }, + end: { column: 14, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "any", + + range: [15, 18], + loc: { + start: { column: 15, line: 1 }, + end: { column: 18, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "=", + + range: [19, 20], + loc: { + start: { column: 19, line: 1 }, + end: { column: 20, line: 1 }, + }, + }, + Numeric { + type: "Numeric", + value: "1", + + range: [21, 22], + loc: { + start: { column: 21, line: 1 }, + end: { column: 22, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ";", + + range: [22, 23], + loc: { + start: { column: 22, line: 1 }, + end: { column: 23, line: 1 }, + }, + }, +] +`; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/const-destructure-type-init/snapshots/3-Babel-AST.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/const-destructure-type-init/snapshots/3-Babel-AST.shot new file mode 100644 index 000000000000..9f1deb740007 --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/const-destructure-type-init/snapshots/3-Babel-AST.shot @@ -0,0 +1,110 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration VariableDeclaration const-destructure-type-init Babel - AST 1`] = ` +Program { + type: "Program", + body: [ + VariableDeclaration { + type: "VariableDeclaration", + declarations: [ + VariableDeclarator { + type: "VariableDeclarator", + id: ObjectPattern { + type: "ObjectPattern", + properties: [ + Property { + type: "Property", + computed: false, + key: Identifier { + type: "Identifier", + name: "foo", + + range: [8, 11], + loc: { + start: { column: 8, line: 1 }, + end: { column: 11, line: 1 }, + }, + }, + kind: "init", + method: false, + shorthand: true, + value: Identifier { + type: "Identifier", + name: "foo", + + range: [8, 11], + loc: { + start: { column: 8, line: 1 }, + end: { column: 11, line: 1 }, + }, + }, + + range: [8, 11], + loc: { + start: { column: 8, line: 1 }, + end: { column: 11, line: 1 }, + }, + }, + ], + typeAnnotation: TSTypeAnnotation { + type: "TSTypeAnnotation", + typeAnnotation: TSAnyKeyword { + type: "TSAnyKeyword", + + range: [15, 18], + loc: { + start: { column: 15, line: 1 }, + end: { column: 18, line: 1 }, + }, + }, + + range: [13, 18], + loc: { + start: { column: 13, line: 1 }, + end: { column: 18, line: 1 }, + }, + }, + + range: [6, 18], + loc: { + start: { column: 6, line: 1 }, + end: { column: 18, line: 1 }, + }, + }, + init: Literal { + type: "Literal", + raw: "1", + value: 1, + + range: [21, 22], + loc: { + start: { column: 21, line: 1 }, + end: { column: 22, line: 1 }, + }, + }, + + range: [6, 22], + loc: { + start: { column: 6, line: 1 }, + end: { column: 22, line: 1 }, + }, + }, + ], + kind: "const", + + range: [0, 23], + loc: { + start: { column: 0, line: 1 }, + end: { column: 23, line: 1 }, + }, + }, + ], + sourceType: "script", + + range: [0, 24], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 2 }, + }, +} +`; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/const-destructure-type-init/snapshots/4-Babel-Tokens.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/const-destructure-type-init/snapshots/4-Babel-Tokens.shot new file mode 100644 index 000000000000..f3993cd5fcc3 --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/const-destructure-type-init/snapshots/4-Babel-Tokens.shot @@ -0,0 +1,96 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration VariableDeclaration const-destructure-type-init Babel - Tokens 1`] = ` +[ + Keyword { + type: "Keyword", + value: "const", + + range: [0, 5], + loc: { + start: { column: 0, line: 1 }, + end: { column: 5, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "{", + + range: [6, 7], + loc: { + start: { column: 6, line: 1 }, + end: { column: 7, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "foo", + + range: [8, 11], + loc: { + start: { column: 8, line: 1 }, + end: { column: 11, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "}", + + range: [12, 13], + loc: { + start: { column: 12, line: 1 }, + end: { column: 13, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ":", + + range: [13, 14], + loc: { + start: { column: 13, line: 1 }, + end: { column: 14, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "any", + + range: [15, 18], + loc: { + start: { column: 15, line: 1 }, + end: { column: 18, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "=", + + range: [19, 20], + loc: { + start: { column: 19, line: 1 }, + end: { column: 20, line: 1 }, + }, + }, + Numeric { + type: "Numeric", + value: "1", + + range: [21, 22], + loc: { + start: { column: 21, line: 1 }, + end: { column: 22, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ";", + + range: [22, 23], + loc: { + start: { column: 22, line: 1 }, + end: { column: 23, line: 1 }, + }, + }, +] +`; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/const-destructure-type-init/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/const-destructure-type-init/snapshots/5-AST-Alignment-AST.shot new file mode 100644 index 000000000000..3a2fc3598126 --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/const-destructure-type-init/snapshots/5-AST-Alignment-AST.shot @@ -0,0 +1,123 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration VariableDeclaration const-destructure-type-init AST Alignment - AST 1`] = ` +"Snapshot Diff: +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + VariableDeclaration { + type: 'VariableDeclaration', + declarations: Array [ + VariableDeclarator { + type: 'VariableDeclarator', +- definite: false, + id: ObjectPattern { + type: 'ObjectPattern', +- decorators: Array [], +- optional: false, + properties: Array [ + Property { + type: 'Property', + computed: false, + key: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'foo', +- optional: false, + + range: [8, 11], + loc: { + start: { column: 8, line: 1 }, + end: { column: 11, line: 1 }, + }, + }, + kind: 'init', + method: false, +- optional: false, + shorthand: true, + value: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'foo', +- optional: false, + + range: [8, 11], + loc: { + start: { column: 8, line: 1 }, + end: { column: 11, line: 1 }, + }, + }, + + range: [8, 11], + loc: { + start: { column: 8, line: 1 }, + end: { column: 11, line: 1 }, + }, + }, + ], + typeAnnotation: TSTypeAnnotation { + type: 'TSTypeAnnotation', + typeAnnotation: TSAnyKeyword { + type: 'TSAnyKeyword', + + range: [15, 18], + loc: { + start: { column: 15, line: 1 }, + end: { column: 18, line: 1 }, + }, + }, + + range: [13, 18], + loc: { + start: { column: 13, line: 1 }, + end: { column: 18, line: 1 }, + }, + }, + + range: [6, 18], + loc: { + start: { column: 6, line: 1 }, + end: { column: 18, line: 1 }, + }, + }, + init: Literal { + type: 'Literal', + raw: '1', + value: 1, + + range: [21, 22], + loc: { + start: { column: 21, line: 1 }, + end: { column: 22, line: 1 }, + }, + }, + + range: [6, 22], + loc: { + start: { column: 6, line: 1 }, + end: { column: 22, line: 1 }, + }, + }, + ], +- declare: false, + kind: 'const', + + range: [0, 23], + loc: { + start: { column: 0, line: 1 }, + end: { column: 23, line: 1 }, + }, + }, + ], + sourceType: 'script', + + range: [0, 24], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 2 }, + }, + }" +`; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/const-destructure-type-init/snapshots/6-AST-Alignment-Tokens.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/const-destructure-type-init/snapshots/6-AST-Alignment-Tokens.shot new file mode 100644 index 000000000000..ec07434a0b19 --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/const-destructure-type-init/snapshots/6-AST-Alignment-Tokens.shot @@ -0,0 +1,6 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration VariableDeclaration const-destructure-type-init AST Alignment - Token 1`] = ` +"Snapshot Diff: +Compared values have no visual difference." +`; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/const-id-init/fixture.ts b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/const-id-init/fixture.ts new file mode 100644 index 000000000000..de022838ed1e --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/const-id-init/fixture.ts @@ -0,0 +1 @@ +const foo = 1; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/const-without-value/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/const-id-init/snapshots/1-TSESTree-AST.shot similarity index 67% rename from packages/ast-spec/src/declaration/VariableDeclaration/fixtures/const-without-value/snapshots/1-TSESTree-AST.shot rename to packages/ast-spec/src/declaration/VariableDeclaration/fixtures/const-id-init/snapshots/1-TSESTree-AST.shot index 0c7705ede31f..faeeb6769d15 100644 --- a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/const-without-value/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/const-id-init/snapshots/1-TSESTree-AST.shot @@ -1,6 +1,6 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`AST Fixtures declaration VariableDeclaration const-without-value TSESTree - AST 1`] = ` +exports[`AST Fixtures declaration VariableDeclaration const-id-init TSESTree - AST 1`] = ` Program { type: "Program", body: [ @@ -13,13 +13,13 @@ Program { id: Identifier { type: "Identifier", decorators: [], - name: "x", + name: "foo", optional: false, - range: [6, 7], + range: [6, 9], loc: { start: { column: 6, line: 1 }, - end: { column: 7, line: 1 }, + end: { column: 9, line: 1 }, }, }, init: Literal { @@ -27,33 +27,33 @@ Program { raw: "1", value: 1, - range: [10, 11], + range: [12, 13], loc: { - start: { column: 10, line: 1 }, - end: { column: 11, line: 1 }, + start: { column: 12, line: 1 }, + end: { column: 13, line: 1 }, }, }, - range: [6, 11], + range: [6, 13], loc: { start: { column: 6, line: 1 }, - end: { column: 11, line: 1 }, + end: { column: 13, line: 1 }, }, }, ], declare: false, kind: "const", - range: [0, 12], + range: [0, 14], loc: { start: { column: 0, line: 1 }, - end: { column: 12, line: 1 }, + end: { column: 14, line: 1 }, }, }, ], sourceType: "script", - range: [0, 13], + range: [0, 15], loc: { start: { column: 0, line: 1 }, end: { column: 0, line: 2 }, diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/const-without-value/snapshots/2-TSESTree-Tokens.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/const-id-init/snapshots/2-TSESTree-Tokens.shot similarity index 67% rename from packages/ast-spec/src/declaration/VariableDeclaration/fixtures/const-without-value/snapshots/2-TSESTree-Tokens.shot rename to packages/ast-spec/src/declaration/VariableDeclaration/fixtures/const-id-init/snapshots/2-TSESTree-Tokens.shot index a467b38b9566..7c9a290a1f1c 100644 --- a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/const-without-value/snapshots/2-TSESTree-Tokens.shot +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/const-id-init/snapshots/2-TSESTree-Tokens.shot @@ -1,6 +1,6 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`AST Fixtures declaration VariableDeclaration const-without-value TSESTree - Tokens 1`] = ` +exports[`AST Fixtures declaration VariableDeclaration const-id-init TSESTree - Tokens 1`] = ` [ Keyword { type: "Keyword", @@ -14,42 +14,42 @@ exports[`AST Fixtures declaration VariableDeclaration const-without-value TSESTr }, Identifier { type: "Identifier", - value: "x", + value: "foo", - range: [6, 7], + range: [6, 9], loc: { start: { column: 6, line: 1 }, - end: { column: 7, line: 1 }, + end: { column: 9, line: 1 }, }, }, Punctuator { type: "Punctuator", value: "=", - range: [8, 9], + range: [10, 11], loc: { - start: { column: 8, line: 1 }, - end: { column: 9, line: 1 }, + start: { column: 10, line: 1 }, + end: { column: 11, line: 1 }, }, }, Numeric { type: "Numeric", value: "1", - range: [10, 11], + range: [12, 13], loc: { - start: { column: 10, line: 1 }, - end: { column: 11, line: 1 }, + start: { column: 12, line: 1 }, + end: { column: 13, line: 1 }, }, }, Punctuator { type: "Punctuator", value: ";", - range: [11, 12], + range: [13, 14], loc: { - start: { column: 11, line: 1 }, - end: { column: 12, line: 1 }, + start: { column: 13, line: 1 }, + end: { column: 14, line: 1 }, }, }, ] diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/const-without-value/snapshots/3-Babel-AST.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/const-id-init/snapshots/3-Babel-AST.shot similarity index 64% rename from packages/ast-spec/src/declaration/VariableDeclaration/fixtures/const-without-value/snapshots/3-Babel-AST.shot rename to packages/ast-spec/src/declaration/VariableDeclaration/fixtures/const-id-init/snapshots/3-Babel-AST.shot index 40629d3a2c04..abdb15b2ad6f 100644 --- a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/const-without-value/snapshots/3-Babel-AST.shot +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/const-id-init/snapshots/3-Babel-AST.shot @@ -1,6 +1,6 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`AST Fixtures declaration VariableDeclaration const-without-value Babel - AST 1`] = ` +exports[`AST Fixtures declaration VariableDeclaration const-id-init Babel - AST 1`] = ` Program { type: "Program", body: [ @@ -11,12 +11,12 @@ Program { type: "VariableDeclarator", id: Identifier { type: "Identifier", - name: "x", + name: "foo", - range: [6, 7], + range: [6, 9], loc: { start: { column: 6, line: 1 }, - end: { column: 7, line: 1 }, + end: { column: 9, line: 1 }, }, }, init: Literal { @@ -24,32 +24,32 @@ Program { raw: "1", value: 1, - range: [10, 11], + range: [12, 13], loc: { - start: { column: 10, line: 1 }, - end: { column: 11, line: 1 }, + start: { column: 12, line: 1 }, + end: { column: 13, line: 1 }, }, }, - range: [6, 11], + range: [6, 13], loc: { start: { column: 6, line: 1 }, - end: { column: 11, line: 1 }, + end: { column: 13, line: 1 }, }, }, ], kind: "const", - range: [0, 12], + range: [0, 14], loc: { start: { column: 0, line: 1 }, - end: { column: 12, line: 1 }, + end: { column: 14, line: 1 }, }, }, ], sourceType: "script", - range: [0, 13], + range: [0, 15], loc: { start: { column: 0, line: 1 }, end: { column: 0, line: 2 }, diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/const-id-init/snapshots/4-Babel-Tokens.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/const-id-init/snapshots/4-Babel-Tokens.shot new file mode 100644 index 000000000000..9fceea714b02 --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/const-id-init/snapshots/4-Babel-Tokens.shot @@ -0,0 +1,56 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration VariableDeclaration const-id-init Babel - Tokens 1`] = ` +[ + Keyword { + type: "Keyword", + value: "const", + + range: [0, 5], + loc: { + start: { column: 0, line: 1 }, + end: { column: 5, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "foo", + + range: [6, 9], + loc: { + start: { column: 6, line: 1 }, + end: { column: 9, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "=", + + range: [10, 11], + loc: { + start: { column: 10, line: 1 }, + end: { column: 11, line: 1 }, + }, + }, + Numeric { + type: "Numeric", + value: "1", + + range: [12, 13], + loc: { + start: { column: 12, line: 1 }, + end: { column: 13, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ";", + + range: [13, 14], + loc: { + start: { column: 13, line: 1 }, + end: { column: 14, line: 1 }, + }, + }, +] +`; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/const-without-value/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/const-id-init/snapshots/5-AST-Alignment-AST.shot similarity index 69% rename from packages/ast-spec/src/declaration/VariableDeclaration/fixtures/const-without-value/snapshots/5-AST-Alignment-AST.shot rename to packages/ast-spec/src/declaration/VariableDeclaration/fixtures/const-id-init/snapshots/5-AST-Alignment-AST.shot index 077480be9fd8..114152a547d4 100644 --- a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/const-without-value/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/const-id-init/snapshots/5-AST-Alignment-AST.shot @@ -1,6 +1,6 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`AST Fixtures declaration VariableDeclaration const-without-value AST Alignment - AST 1`] = ` +exports[`AST Fixtures declaration VariableDeclaration const-id-init AST Alignment - AST 1`] = ` "Snapshot Diff: - TSESTree + Babel @@ -17,13 +17,13 @@ exports[`AST Fixtures declaration VariableDeclaration const-without-value AST Al id: Identifier { type: 'Identifier', - decorators: Array [], - name: 'x', + name: 'foo', - optional: false, - range: [6, 7], + range: [6, 9], loc: { start: { column: 6, line: 1 }, - end: { column: 7, line: 1 }, + end: { column: 9, line: 1 }, }, }, init: Literal { @@ -31,33 +31,33 @@ exports[`AST Fixtures declaration VariableDeclaration const-without-value AST Al raw: '1', value: 1, - range: [10, 11], + range: [12, 13], loc: { - start: { column: 10, line: 1 }, - end: { column: 11, line: 1 }, + start: { column: 12, line: 1 }, + end: { column: 13, line: 1 }, }, }, - range: [6, 11], + range: [6, 13], loc: { start: { column: 6, line: 1 }, - end: { column: 11, line: 1 }, + end: { column: 13, line: 1 }, }, }, ], - declare: false, kind: 'const', - range: [0, 12], + range: [0, 14], loc: { start: { column: 0, line: 1 }, - end: { column: 12, line: 1 }, + end: { column: 14, line: 1 }, }, }, ], sourceType: 'script', - range: [0, 13], + range: [0, 15], loc: { start: { column: 0, line: 1 }, end: { column: 0, line: 2 }, diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/var-with-value/snapshots/6-AST-Alignment-Tokens.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/const-id-init/snapshots/6-AST-Alignment-Tokens.shot similarity index 51% rename from packages/ast-spec/src/declaration/VariableDeclaration/fixtures/var-with-value/snapshots/6-AST-Alignment-Tokens.shot rename to packages/ast-spec/src/declaration/VariableDeclaration/fixtures/const-id-init/snapshots/6-AST-Alignment-Tokens.shot index 1eb3bcd0b986..0162b8701216 100644 --- a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/var-with-value/snapshots/6-AST-Alignment-Tokens.shot +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/const-id-init/snapshots/6-AST-Alignment-Tokens.shot @@ -1,6 +1,6 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`AST Fixtures declaration VariableDeclaration var-with-value AST Alignment - Token 1`] = ` +exports[`AST Fixtures declaration VariableDeclaration const-id-init AST Alignment - Token 1`] = ` "Snapshot Diff: Compared values have no visual difference." `; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/const-id-type-init/fixture.ts b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/const-id-type-init/fixture.ts new file mode 100644 index 000000000000..ae512527402b --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/const-id-type-init/fixture.ts @@ -0,0 +1 @@ +const foo: any = 1; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/const-id-type-init/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/const-id-type-init/snapshots/1-TSESTree-AST.shot new file mode 100644 index 000000000000..fb04a7ce2e33 --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/const-id-type-init/snapshots/1-TSESTree-AST.shot @@ -0,0 +1,80 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration VariableDeclaration const-id-type-init TSESTree - AST 1`] = ` +Program { + type: "Program", + body: [ + VariableDeclaration { + type: "VariableDeclaration", + declarations: [ + VariableDeclarator { + type: "VariableDeclarator", + definite: false, + id: Identifier { + type: "Identifier", + decorators: [], + name: "foo", + optional: false, + typeAnnotation: TSTypeAnnotation { + type: "TSTypeAnnotation", + typeAnnotation: TSAnyKeyword { + type: "TSAnyKeyword", + + range: [11, 14], + loc: { + start: { column: 11, line: 1 }, + end: { column: 14, line: 1 }, + }, + }, + + range: [9, 14], + loc: { + start: { column: 9, line: 1 }, + end: { column: 14, line: 1 }, + }, + }, + + range: [6, 14], + loc: { + start: { column: 6, line: 1 }, + end: { column: 14, line: 1 }, + }, + }, + init: Literal { + type: "Literal", + raw: "1", + value: 1, + + range: [17, 18], + loc: { + start: { column: 17, line: 1 }, + end: { column: 18, line: 1 }, + }, + }, + + range: [6, 18], + loc: { + start: { column: 6, line: 1 }, + end: { column: 18, line: 1 }, + }, + }, + ], + declare: false, + kind: "const", + + range: [0, 19], + loc: { + start: { column: 0, line: 1 }, + end: { column: 19, line: 1 }, + }, + }, + ], + sourceType: "script", + + range: [0, 20], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 2 }, + }, +} +`; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/const-id-type-init/snapshots/2-TSESTree-Tokens.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/const-id-type-init/snapshots/2-TSESTree-Tokens.shot new file mode 100644 index 000000000000..ea0637bf5855 --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/const-id-type-init/snapshots/2-TSESTree-Tokens.shot @@ -0,0 +1,76 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration VariableDeclaration const-id-type-init TSESTree - Tokens 1`] = ` +[ + Keyword { + type: "Keyword", + value: "const", + + range: [0, 5], + loc: { + start: { column: 0, line: 1 }, + end: { column: 5, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "foo", + + range: [6, 9], + loc: { + start: { column: 6, line: 1 }, + end: { column: 9, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ":", + + range: [9, 10], + loc: { + start: { column: 9, line: 1 }, + end: { column: 10, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "any", + + range: [11, 14], + loc: { + start: { column: 11, line: 1 }, + end: { column: 14, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "=", + + range: [15, 16], + loc: { + start: { column: 15, line: 1 }, + end: { column: 16, line: 1 }, + }, + }, + Numeric { + type: "Numeric", + value: "1", + + range: [17, 18], + loc: { + start: { column: 17, line: 1 }, + end: { column: 18, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ";", + + range: [18, 19], + loc: { + start: { column: 18, line: 1 }, + end: { column: 19, line: 1 }, + }, + }, +] +`; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/const-id-type-init/snapshots/3-Babel-AST.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/const-id-type-init/snapshots/3-Babel-AST.shot new file mode 100644 index 000000000000..59f8f33bf515 --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/const-id-type-init/snapshots/3-Babel-AST.shot @@ -0,0 +1,76 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration VariableDeclaration const-id-type-init Babel - AST 1`] = ` +Program { + type: "Program", + body: [ + VariableDeclaration { + type: "VariableDeclaration", + declarations: [ + VariableDeclarator { + type: "VariableDeclarator", + id: Identifier { + type: "Identifier", + name: "foo", + typeAnnotation: TSTypeAnnotation { + type: "TSTypeAnnotation", + typeAnnotation: TSAnyKeyword { + type: "TSAnyKeyword", + + range: [11, 14], + loc: { + start: { column: 11, line: 1 }, + end: { column: 14, line: 1 }, + }, + }, + + range: [9, 14], + loc: { + start: { column: 9, line: 1 }, + end: { column: 14, line: 1 }, + }, + }, + + range: [6, 14], + loc: { + start: { column: 6, line: 1 }, + end: { column: 14, line: 1 }, + }, + }, + init: Literal { + type: "Literal", + raw: "1", + value: 1, + + range: [17, 18], + loc: { + start: { column: 17, line: 1 }, + end: { column: 18, line: 1 }, + }, + }, + + range: [6, 18], + loc: { + start: { column: 6, line: 1 }, + end: { column: 18, line: 1 }, + }, + }, + ], + kind: "const", + + range: [0, 19], + loc: { + start: { column: 0, line: 1 }, + end: { column: 19, line: 1 }, + }, + }, + ], + sourceType: "script", + + range: [0, 20], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 2 }, + }, +} +`; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/const-id-type-init/snapshots/4-Babel-Tokens.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/const-id-type-init/snapshots/4-Babel-Tokens.shot new file mode 100644 index 000000000000..86332a7d8570 --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/const-id-type-init/snapshots/4-Babel-Tokens.shot @@ -0,0 +1,76 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration VariableDeclaration const-id-type-init Babel - Tokens 1`] = ` +[ + Keyword { + type: "Keyword", + value: "const", + + range: [0, 5], + loc: { + start: { column: 0, line: 1 }, + end: { column: 5, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "foo", + + range: [6, 9], + loc: { + start: { column: 6, line: 1 }, + end: { column: 9, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ":", + + range: [9, 10], + loc: { + start: { column: 9, line: 1 }, + end: { column: 10, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "any", + + range: [11, 14], + loc: { + start: { column: 11, line: 1 }, + end: { column: 14, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "=", + + range: [15, 16], + loc: { + start: { column: 15, line: 1 }, + end: { column: 16, line: 1 }, + }, + }, + Numeric { + type: "Numeric", + value: "1", + + range: [17, 18], + loc: { + start: { column: 17, line: 1 }, + end: { column: 18, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ";", + + range: [18, 19], + loc: { + start: { column: 18, line: 1 }, + end: { column: 19, line: 1 }, + }, + }, +] +`; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/const-id-type-init/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/const-id-type-init/snapshots/5-AST-Alignment-AST.shot new file mode 100644 index 000000000000..dbc72bd3a10b --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/const-id-type-init/snapshots/5-AST-Alignment-AST.shot @@ -0,0 +1,84 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration VariableDeclaration const-id-type-init AST Alignment - AST 1`] = ` +"Snapshot Diff: +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + VariableDeclaration { + type: 'VariableDeclaration', + declarations: Array [ + VariableDeclarator { + type: 'VariableDeclarator', +- definite: false, + id: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'foo', +- optional: false, + typeAnnotation: TSTypeAnnotation { + type: 'TSTypeAnnotation', + typeAnnotation: TSAnyKeyword { + type: 'TSAnyKeyword', + + range: [11, 14], + loc: { + start: { column: 11, line: 1 }, + end: { column: 14, line: 1 }, + }, + }, + + range: [9, 14], + loc: { + start: { column: 9, line: 1 }, + end: { column: 14, line: 1 }, + }, + }, + + range: [6, 14], + loc: { + start: { column: 6, line: 1 }, + end: { column: 14, line: 1 }, + }, + }, + init: Literal { + type: 'Literal', + raw: '1', + value: 1, + + range: [17, 18], + loc: { + start: { column: 17, line: 1 }, + end: { column: 18, line: 1 }, + }, + }, + + range: [6, 18], + loc: { + start: { column: 6, line: 1 }, + end: { column: 18, line: 1 }, + }, + }, + ], +- declare: false, + kind: 'const', + + range: [0, 19], + loc: { + start: { column: 0, line: 1 }, + end: { column: 19, line: 1 }, + }, + }, + ], + sourceType: 'script', + + range: [0, 20], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 2 }, + }, + }" +`; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/const-id-type-init/snapshots/6-AST-Alignment-Tokens.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/const-id-type-init/snapshots/6-AST-Alignment-Tokens.shot new file mode 100644 index 000000000000..71bda5258496 --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/const-id-type-init/snapshots/6-AST-Alignment-Tokens.shot @@ -0,0 +1,6 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration VariableDeclaration const-id-type-init AST Alignment - Token 1`] = ` +"Snapshot Diff: +Compared values have no visual difference." +`; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/const-with-value/fixture.ts b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/const-with-value/fixture.ts deleted file mode 100644 index 943c458c79e2..000000000000 --- a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/const-with-value/fixture.ts +++ /dev/null @@ -1 +0,0 @@ -const x = 1; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/const-without-value/fixture.ts b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/const-without-value/fixture.ts deleted file mode 100644 index 943c458c79e2..000000000000 --- a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/const-without-value/fixture.ts +++ /dev/null @@ -1 +0,0 @@ -const x = 1; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare-const-destructure-init/fixture.ts b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare-const-destructure-init/fixture.ts new file mode 100644 index 000000000000..759f4024da46 --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare-const-destructure-init/fixture.ts @@ -0,0 +1 @@ +declare const { foo } = 1; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare-const-destructure-init/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare-const-destructure-init/snapshots/1-TSESTree-AST.shot new file mode 100644 index 000000000000..5c2d0c59d760 --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare-const-destructure-init/snapshots/1-TSESTree-AST.shot @@ -0,0 +1,101 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration VariableDeclaration declare-const-destructure-init TSESTree - AST 1`] = ` +Program { + type: "Program", + body: [ + VariableDeclaration { + type: "VariableDeclaration", + declarations: [ + VariableDeclarator { + type: "VariableDeclarator", + definite: false, + id: ObjectPattern { + type: "ObjectPattern", + decorators: [], + optional: false, + properties: [ + Property { + type: "Property", + computed: false, + key: Identifier { + type: "Identifier", + decorators: [], + name: "foo", + optional: false, + + range: [16, 19], + loc: { + start: { column: 16, line: 1 }, + end: { column: 19, line: 1 }, + }, + }, + kind: "init", + method: false, + optional: false, + shorthand: true, + value: Identifier { + type: "Identifier", + decorators: [], + name: "foo", + optional: false, + + range: [16, 19], + loc: { + start: { column: 16, line: 1 }, + end: { column: 19, line: 1 }, + }, + }, + + range: [16, 19], + loc: { + start: { column: 16, line: 1 }, + end: { column: 19, line: 1 }, + }, + }, + ], + + range: [14, 21], + loc: { + start: { column: 14, line: 1 }, + end: { column: 21, line: 1 }, + }, + }, + init: Literal { + type: "Literal", + raw: "1", + value: 1, + + range: [24, 25], + loc: { + start: { column: 24, line: 1 }, + end: { column: 25, line: 1 }, + }, + }, + + range: [14, 25], + loc: { + start: { column: 14, line: 1 }, + end: { column: 25, line: 1 }, + }, + }, + ], + declare: true, + kind: "const", + + range: [0, 26], + loc: { + start: { column: 0, line: 1 }, + end: { column: 26, line: 1 }, + }, + }, + ], + sourceType: "script", + + range: [0, 27], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 2 }, + }, +} +`; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare-const-destructure-init/snapshots/2-TSESTree-Tokens.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare-const-destructure-init/snapshots/2-TSESTree-Tokens.shot new file mode 100644 index 000000000000..d1dd059bfd1a --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare-const-destructure-init/snapshots/2-TSESTree-Tokens.shot @@ -0,0 +1,86 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration VariableDeclaration declare-const-destructure-init TSESTree - Tokens 1`] = ` +[ + Identifier { + type: "Identifier", + value: "declare", + + range: [0, 7], + loc: { + start: { column: 0, line: 1 }, + end: { column: 7, line: 1 }, + }, + }, + Keyword { + type: "Keyword", + value: "const", + + range: [8, 13], + loc: { + start: { column: 8, line: 1 }, + end: { column: 13, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "{", + + range: [14, 15], + loc: { + start: { column: 14, line: 1 }, + end: { column: 15, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "foo", + + range: [16, 19], + loc: { + start: { column: 16, line: 1 }, + end: { column: 19, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "}", + + range: [20, 21], + loc: { + start: { column: 20, line: 1 }, + end: { column: 21, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "=", + + range: [22, 23], + loc: { + start: { column: 22, line: 1 }, + end: { column: 23, line: 1 }, + }, + }, + Numeric { + type: "Numeric", + value: "1", + + range: [24, 25], + loc: { + start: { column: 24, line: 1 }, + end: { column: 25, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ";", + + range: [25, 26], + loc: { + start: { column: 25, line: 1 }, + end: { column: 26, line: 1 }, + }, + }, +] +`; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare-const-destructure-init/snapshots/3-Babel-AST.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare-const-destructure-init/snapshots/3-Babel-AST.shot new file mode 100644 index 000000000000..9aad845b5619 --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare-const-destructure-init/snapshots/3-Babel-AST.shot @@ -0,0 +1,93 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration VariableDeclaration declare-const-destructure-init Babel - AST 1`] = ` +Program { + type: "Program", + body: [ + VariableDeclaration { + type: "VariableDeclaration", + declarations: [ + VariableDeclarator { + type: "VariableDeclarator", + id: ObjectPattern { + type: "ObjectPattern", + properties: [ + Property { + type: "Property", + computed: false, + key: Identifier { + type: "Identifier", + name: "foo", + + range: [16, 19], + loc: { + start: { column: 16, line: 1 }, + end: { column: 19, line: 1 }, + }, + }, + kind: "init", + method: false, + shorthand: true, + value: Identifier { + type: "Identifier", + name: "foo", + + range: [16, 19], + loc: { + start: { column: 16, line: 1 }, + end: { column: 19, line: 1 }, + }, + }, + + range: [16, 19], + loc: { + start: { column: 16, line: 1 }, + end: { column: 19, line: 1 }, + }, + }, + ], + + range: [14, 21], + loc: { + start: { column: 14, line: 1 }, + end: { column: 21, line: 1 }, + }, + }, + init: Literal { + type: "Literal", + raw: "1", + value: 1, + + range: [24, 25], + loc: { + start: { column: 24, line: 1 }, + end: { column: 25, line: 1 }, + }, + }, + + range: [14, 25], + loc: { + start: { column: 14, line: 1 }, + end: { column: 25, line: 1 }, + }, + }, + ], + declare: true, + kind: "const", + + range: [0, 26], + loc: { + start: { column: 0, line: 1 }, + end: { column: 26, line: 1 }, + }, + }, + ], + sourceType: "script", + + range: [0, 27], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 2 }, + }, +} +`; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare-const-destructure-init/snapshots/4-Babel-Tokens.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare-const-destructure-init/snapshots/4-Babel-Tokens.shot new file mode 100644 index 000000000000..5e0071bd6308 --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare-const-destructure-init/snapshots/4-Babel-Tokens.shot @@ -0,0 +1,86 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration VariableDeclaration declare-const-destructure-init Babel - Tokens 1`] = ` +[ + Identifier { + type: "Identifier", + value: "declare", + + range: [0, 7], + loc: { + start: { column: 0, line: 1 }, + end: { column: 7, line: 1 }, + }, + }, + Keyword { + type: "Keyword", + value: "const", + + range: [8, 13], + loc: { + start: { column: 8, line: 1 }, + end: { column: 13, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "{", + + range: [14, 15], + loc: { + start: { column: 14, line: 1 }, + end: { column: 15, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "foo", + + range: [16, 19], + loc: { + start: { column: 16, line: 1 }, + end: { column: 19, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "}", + + range: [20, 21], + loc: { + start: { column: 20, line: 1 }, + end: { column: 21, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "=", + + range: [22, 23], + loc: { + start: { column: 22, line: 1 }, + end: { column: 23, line: 1 }, + }, + }, + Numeric { + type: "Numeric", + value: "1", + + range: [24, 25], + loc: { + start: { column: 24, line: 1 }, + end: { column: 25, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ";", + + range: [25, 26], + loc: { + start: { column: 25, line: 1 }, + end: { column: 26, line: 1 }, + }, + }, +] +`; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare-const-destructure-init/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare-const-destructure-init/snapshots/5-AST-Alignment-AST.shot new file mode 100644 index 000000000000..29a5cc061434 --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare-const-destructure-init/snapshots/5-AST-Alignment-AST.shot @@ -0,0 +1,105 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration VariableDeclaration declare-const-destructure-init AST Alignment - AST 1`] = ` +"Snapshot Diff: +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + VariableDeclaration { + type: 'VariableDeclaration', + declarations: Array [ + VariableDeclarator { + type: 'VariableDeclarator', +- definite: false, + id: ObjectPattern { + type: 'ObjectPattern', +- decorators: Array [], +- optional: false, + properties: Array [ + Property { + type: 'Property', + computed: false, + key: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'foo', +- optional: false, + + range: [16, 19], + loc: { + start: { column: 16, line: 1 }, + end: { column: 19, line: 1 }, + }, + }, + kind: 'init', + method: false, +- optional: false, + shorthand: true, + value: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'foo', +- optional: false, + + range: [16, 19], + loc: { + start: { column: 16, line: 1 }, + end: { column: 19, line: 1 }, + }, + }, + + range: [16, 19], + loc: { + start: { column: 16, line: 1 }, + end: { column: 19, line: 1 }, + }, + }, + ], + + range: [14, 21], + loc: { + start: { column: 14, line: 1 }, + end: { column: 21, line: 1 }, + }, + }, + init: Literal { + type: 'Literal', + raw: '1', + value: 1, + + range: [24, 25], + loc: { + start: { column: 24, line: 1 }, + end: { column: 25, line: 1 }, + }, + }, + + range: [14, 25], + loc: { + start: { column: 14, line: 1 }, + end: { column: 25, line: 1 }, + }, + }, + ], + declare: true, + kind: 'const', + + range: [0, 26], + loc: { + start: { column: 0, line: 1 }, + end: { column: 26, line: 1 }, + }, + }, + ], + sourceType: 'script', + + range: [0, 27], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 2 }, + }, + }" +`; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare-const-destructure-init/snapshots/6-AST-Alignment-Tokens.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare-const-destructure-init/snapshots/6-AST-Alignment-Tokens.shot new file mode 100644 index 000000000000..fdbff53ad01f --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare-const-destructure-init/snapshots/6-AST-Alignment-Tokens.shot @@ -0,0 +1,6 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration VariableDeclaration declare-const-destructure-init AST Alignment - Token 1`] = ` +"Snapshot Diff: +Compared values have no visual difference." +`; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare-const-destructure-no-init/fixture.ts b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare-const-destructure-no-init/fixture.ts new file mode 100644 index 000000000000..1a4d5dca718a --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare-const-destructure-no-init/fixture.ts @@ -0,0 +1 @@ +declare const { foo }; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare-const-destructure-no-init/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare-const-destructure-no-init/snapshots/1-TSESTree-AST.shot new file mode 100644 index 000000000000..1abda7838faa --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare-const-destructure-no-init/snapshots/1-TSESTree-AST.shot @@ -0,0 +1,91 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration VariableDeclaration declare-const-destructure-no-init TSESTree - AST 1`] = ` +Program { + type: "Program", + body: [ + VariableDeclaration { + type: "VariableDeclaration", + declarations: [ + VariableDeclarator { + type: "VariableDeclarator", + definite: false, + id: ObjectPattern { + type: "ObjectPattern", + decorators: [], + optional: false, + properties: [ + Property { + type: "Property", + computed: false, + key: Identifier { + type: "Identifier", + decorators: [], + name: "foo", + optional: false, + + range: [16, 19], + loc: { + start: { column: 16, line: 1 }, + end: { column: 19, line: 1 }, + }, + }, + kind: "init", + method: false, + optional: false, + shorthand: true, + value: Identifier { + type: "Identifier", + decorators: [], + name: "foo", + optional: false, + + range: [16, 19], + loc: { + start: { column: 16, line: 1 }, + end: { column: 19, line: 1 }, + }, + }, + + range: [16, 19], + loc: { + start: { column: 16, line: 1 }, + end: { column: 19, line: 1 }, + }, + }, + ], + + range: [14, 21], + loc: { + start: { column: 14, line: 1 }, + end: { column: 21, line: 1 }, + }, + }, + init: null, + + range: [14, 21], + loc: { + start: { column: 14, line: 1 }, + end: { column: 21, line: 1 }, + }, + }, + ], + declare: true, + kind: "const", + + range: [0, 22], + loc: { + start: { column: 0, line: 1 }, + end: { column: 22, line: 1 }, + }, + }, + ], + sourceType: "script", + + range: [0, 23], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 2 }, + }, +} +`; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare-const-destructure-no-init/snapshots/2-TSESTree-Tokens.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare-const-destructure-no-init/snapshots/2-TSESTree-Tokens.shot new file mode 100644 index 000000000000..918e123e0246 --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare-const-destructure-no-init/snapshots/2-TSESTree-Tokens.shot @@ -0,0 +1,66 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration VariableDeclaration declare-const-destructure-no-init TSESTree - Tokens 1`] = ` +[ + Identifier { + type: "Identifier", + value: "declare", + + range: [0, 7], + loc: { + start: { column: 0, line: 1 }, + end: { column: 7, line: 1 }, + }, + }, + Keyword { + type: "Keyword", + value: "const", + + range: [8, 13], + loc: { + start: { column: 8, line: 1 }, + end: { column: 13, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "{", + + range: [14, 15], + loc: { + start: { column: 14, line: 1 }, + end: { column: 15, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "foo", + + range: [16, 19], + loc: { + start: { column: 16, line: 1 }, + end: { column: 19, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "}", + + range: [20, 21], + loc: { + start: { column: 20, line: 1 }, + end: { column: 21, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ";", + + range: [21, 22], + loc: { + start: { column: 21, line: 1 }, + end: { column: 22, line: 1 }, + }, + }, +] +`; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare-const-destructure-no-init/snapshots/3-Babel-AST.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare-const-destructure-no-init/snapshots/3-Babel-AST.shot new file mode 100644 index 000000000000..371a00be8753 --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare-const-destructure-no-init/snapshots/3-Babel-AST.shot @@ -0,0 +1,83 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration VariableDeclaration declare-const-destructure-no-init Babel - AST 1`] = ` +Program { + type: "Program", + body: [ + VariableDeclaration { + type: "VariableDeclaration", + declarations: [ + VariableDeclarator { + type: "VariableDeclarator", + id: ObjectPattern { + type: "ObjectPattern", + properties: [ + Property { + type: "Property", + computed: false, + key: Identifier { + type: "Identifier", + name: "foo", + + range: [16, 19], + loc: { + start: { column: 16, line: 1 }, + end: { column: 19, line: 1 }, + }, + }, + kind: "init", + method: false, + shorthand: true, + value: Identifier { + type: "Identifier", + name: "foo", + + range: [16, 19], + loc: { + start: { column: 16, line: 1 }, + end: { column: 19, line: 1 }, + }, + }, + + range: [16, 19], + loc: { + start: { column: 16, line: 1 }, + end: { column: 19, line: 1 }, + }, + }, + ], + + range: [14, 21], + loc: { + start: { column: 14, line: 1 }, + end: { column: 21, line: 1 }, + }, + }, + init: null, + + range: [14, 21], + loc: { + start: { column: 14, line: 1 }, + end: { column: 21, line: 1 }, + }, + }, + ], + declare: true, + kind: "const", + + range: [0, 22], + loc: { + start: { column: 0, line: 1 }, + end: { column: 22, line: 1 }, + }, + }, + ], + sourceType: "script", + + range: [0, 23], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 2 }, + }, +} +`; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare-const-destructure-no-init/snapshots/4-Babel-Tokens.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare-const-destructure-no-init/snapshots/4-Babel-Tokens.shot new file mode 100644 index 000000000000..81bca00b2182 --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare-const-destructure-no-init/snapshots/4-Babel-Tokens.shot @@ -0,0 +1,66 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration VariableDeclaration declare-const-destructure-no-init Babel - Tokens 1`] = ` +[ + Identifier { + type: "Identifier", + value: "declare", + + range: [0, 7], + loc: { + start: { column: 0, line: 1 }, + end: { column: 7, line: 1 }, + }, + }, + Keyword { + type: "Keyword", + value: "const", + + range: [8, 13], + loc: { + start: { column: 8, line: 1 }, + end: { column: 13, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "{", + + range: [14, 15], + loc: { + start: { column: 14, line: 1 }, + end: { column: 15, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "foo", + + range: [16, 19], + loc: { + start: { column: 16, line: 1 }, + end: { column: 19, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "}", + + range: [20, 21], + loc: { + start: { column: 20, line: 1 }, + end: { column: 21, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ";", + + range: [21, 22], + loc: { + start: { column: 21, line: 1 }, + end: { column: 22, line: 1 }, + }, + }, +] +`; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare-const-destructure-no-init/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare-const-destructure-no-init/snapshots/5-AST-Alignment-AST.shot new file mode 100644 index 000000000000..dc63253a86c8 --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare-const-destructure-no-init/snapshots/5-AST-Alignment-AST.shot @@ -0,0 +1,95 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration VariableDeclaration declare-const-destructure-no-init AST Alignment - AST 1`] = ` +"Snapshot Diff: +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + VariableDeclaration { + type: 'VariableDeclaration', + declarations: Array [ + VariableDeclarator { + type: 'VariableDeclarator', +- definite: false, + id: ObjectPattern { + type: 'ObjectPattern', +- decorators: Array [], +- optional: false, + properties: Array [ + Property { + type: 'Property', + computed: false, + key: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'foo', +- optional: false, + + range: [16, 19], + loc: { + start: { column: 16, line: 1 }, + end: { column: 19, line: 1 }, + }, + }, + kind: 'init', + method: false, +- optional: false, + shorthand: true, + value: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'foo', +- optional: false, + + range: [16, 19], + loc: { + start: { column: 16, line: 1 }, + end: { column: 19, line: 1 }, + }, + }, + + range: [16, 19], + loc: { + start: { column: 16, line: 1 }, + end: { column: 19, line: 1 }, + }, + }, + ], + + range: [14, 21], + loc: { + start: { column: 14, line: 1 }, + end: { column: 21, line: 1 }, + }, + }, + init: null, + + range: [14, 21], + loc: { + start: { column: 14, line: 1 }, + end: { column: 21, line: 1 }, + }, + }, + ], + declare: true, + kind: 'const', + + range: [0, 22], + loc: { + start: { column: 0, line: 1 }, + end: { column: 22, line: 1 }, + }, + }, + ], + sourceType: 'script', + + range: [0, 23], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 2 }, + }, + }" +`; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare-const-destructure-no-init/snapshots/6-AST-Alignment-Tokens.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare-const-destructure-no-init/snapshots/6-AST-Alignment-Tokens.shot new file mode 100644 index 000000000000..9a0deb0953f2 --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare-const-destructure-no-init/snapshots/6-AST-Alignment-Tokens.shot @@ -0,0 +1,6 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration VariableDeclaration declare-const-destructure-no-init AST Alignment - Token 1`] = ` +"Snapshot Diff: +Compared values have no visual difference." +`; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare-const-destructure-type-no-init/fixture.ts b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare-const-destructure-type-no-init/fixture.ts new file mode 100644 index 000000000000..f2cd5df3b0ea --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare-const-destructure-type-no-init/fixture.ts @@ -0,0 +1 @@ +declare const { foo }: any; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare-const-destructure-type-no-init/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare-const-destructure-type-no-init/snapshots/1-TSESTree-AST.shot new file mode 100644 index 000000000000..d0a06bb90e66 --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare-const-destructure-type-no-init/snapshots/1-TSESTree-AST.shot @@ -0,0 +1,109 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration VariableDeclaration declare-const-destructure-type-no-init TSESTree - AST 1`] = ` +Program { + type: "Program", + body: [ + VariableDeclaration { + type: "VariableDeclaration", + declarations: [ + VariableDeclarator { + type: "VariableDeclarator", + definite: false, + id: ObjectPattern { + type: "ObjectPattern", + decorators: [], + optional: false, + properties: [ + Property { + type: "Property", + computed: false, + key: Identifier { + type: "Identifier", + decorators: [], + name: "foo", + optional: false, + + range: [16, 19], + loc: { + start: { column: 16, line: 1 }, + end: { column: 19, line: 1 }, + }, + }, + kind: "init", + method: false, + optional: false, + shorthand: true, + value: Identifier { + type: "Identifier", + decorators: [], + name: "foo", + optional: false, + + range: [16, 19], + loc: { + start: { column: 16, line: 1 }, + end: { column: 19, line: 1 }, + }, + }, + + range: [16, 19], + loc: { + start: { column: 16, line: 1 }, + end: { column: 19, line: 1 }, + }, + }, + ], + typeAnnotation: TSTypeAnnotation { + type: "TSTypeAnnotation", + typeAnnotation: TSAnyKeyword { + type: "TSAnyKeyword", + + range: [23, 26], + loc: { + start: { column: 23, line: 1 }, + end: { column: 26, line: 1 }, + }, + }, + + range: [21, 26], + loc: { + start: { column: 21, line: 1 }, + end: { column: 26, line: 1 }, + }, + }, + + range: [14, 26], + loc: { + start: { column: 14, line: 1 }, + end: { column: 26, line: 1 }, + }, + }, + init: null, + + range: [14, 26], + loc: { + start: { column: 14, line: 1 }, + end: { column: 26, line: 1 }, + }, + }, + ], + declare: true, + kind: "const", + + range: [0, 27], + loc: { + start: { column: 0, line: 1 }, + end: { column: 27, line: 1 }, + }, + }, + ], + sourceType: "script", + + range: [0, 28], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 2 }, + }, +} +`; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare-const-destructure-type-no-init/snapshots/2-TSESTree-Tokens.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare-const-destructure-type-no-init/snapshots/2-TSESTree-Tokens.shot new file mode 100644 index 000000000000..fe3222744aeb --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare-const-destructure-type-no-init/snapshots/2-TSESTree-Tokens.shot @@ -0,0 +1,86 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration VariableDeclaration declare-const-destructure-type-no-init TSESTree - Tokens 1`] = ` +[ + Identifier { + type: "Identifier", + value: "declare", + + range: [0, 7], + loc: { + start: { column: 0, line: 1 }, + end: { column: 7, line: 1 }, + }, + }, + Keyword { + type: "Keyword", + value: "const", + + range: [8, 13], + loc: { + start: { column: 8, line: 1 }, + end: { column: 13, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "{", + + range: [14, 15], + loc: { + start: { column: 14, line: 1 }, + end: { column: 15, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "foo", + + range: [16, 19], + loc: { + start: { column: 16, line: 1 }, + end: { column: 19, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "}", + + range: [20, 21], + loc: { + start: { column: 20, line: 1 }, + end: { column: 21, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ":", + + range: [21, 22], + loc: { + start: { column: 21, line: 1 }, + end: { column: 22, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "any", + + range: [23, 26], + loc: { + start: { column: 23, line: 1 }, + end: { column: 26, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ";", + + range: [26, 27], + loc: { + start: { column: 26, line: 1 }, + end: { column: 27, line: 1 }, + }, + }, +] +`; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare-const-destructure-type-no-init/snapshots/3-Babel-AST.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare-const-destructure-type-no-init/snapshots/3-Babel-AST.shot new file mode 100644 index 000000000000..3cb77cf17569 --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare-const-destructure-type-no-init/snapshots/3-Babel-AST.shot @@ -0,0 +1,101 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration VariableDeclaration declare-const-destructure-type-no-init Babel - AST 1`] = ` +Program { + type: "Program", + body: [ + VariableDeclaration { + type: "VariableDeclaration", + declarations: [ + VariableDeclarator { + type: "VariableDeclarator", + id: ObjectPattern { + type: "ObjectPattern", + properties: [ + Property { + type: "Property", + computed: false, + key: Identifier { + type: "Identifier", + name: "foo", + + range: [16, 19], + loc: { + start: { column: 16, line: 1 }, + end: { column: 19, line: 1 }, + }, + }, + kind: "init", + method: false, + shorthand: true, + value: Identifier { + type: "Identifier", + name: "foo", + + range: [16, 19], + loc: { + start: { column: 16, line: 1 }, + end: { column: 19, line: 1 }, + }, + }, + + range: [16, 19], + loc: { + start: { column: 16, line: 1 }, + end: { column: 19, line: 1 }, + }, + }, + ], + typeAnnotation: TSTypeAnnotation { + type: "TSTypeAnnotation", + typeAnnotation: TSAnyKeyword { + type: "TSAnyKeyword", + + range: [23, 26], + loc: { + start: { column: 23, line: 1 }, + end: { column: 26, line: 1 }, + }, + }, + + range: [21, 26], + loc: { + start: { column: 21, line: 1 }, + end: { column: 26, line: 1 }, + }, + }, + + range: [14, 26], + loc: { + start: { column: 14, line: 1 }, + end: { column: 26, line: 1 }, + }, + }, + init: null, + + range: [14, 26], + loc: { + start: { column: 14, line: 1 }, + end: { column: 26, line: 1 }, + }, + }, + ], + declare: true, + kind: "const", + + range: [0, 27], + loc: { + start: { column: 0, line: 1 }, + end: { column: 27, line: 1 }, + }, + }, + ], + sourceType: "script", + + range: [0, 28], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 2 }, + }, +} +`; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare-const-destructure-type-no-init/snapshots/4-Babel-Tokens.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare-const-destructure-type-no-init/snapshots/4-Babel-Tokens.shot new file mode 100644 index 000000000000..17f3e2e3ccd2 --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare-const-destructure-type-no-init/snapshots/4-Babel-Tokens.shot @@ -0,0 +1,86 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration VariableDeclaration declare-const-destructure-type-no-init Babel - Tokens 1`] = ` +[ + Identifier { + type: "Identifier", + value: "declare", + + range: [0, 7], + loc: { + start: { column: 0, line: 1 }, + end: { column: 7, line: 1 }, + }, + }, + Keyword { + type: "Keyword", + value: "const", + + range: [8, 13], + loc: { + start: { column: 8, line: 1 }, + end: { column: 13, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "{", + + range: [14, 15], + loc: { + start: { column: 14, line: 1 }, + end: { column: 15, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "foo", + + range: [16, 19], + loc: { + start: { column: 16, line: 1 }, + end: { column: 19, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "}", + + range: [20, 21], + loc: { + start: { column: 20, line: 1 }, + end: { column: 21, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ":", + + range: [21, 22], + loc: { + start: { column: 21, line: 1 }, + end: { column: 22, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "any", + + range: [23, 26], + loc: { + start: { column: 23, line: 1 }, + end: { column: 26, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ";", + + range: [26, 27], + loc: { + start: { column: 26, line: 1 }, + end: { column: 27, line: 1 }, + }, + }, +] +`; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare-const-destructure-type-no-init/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare-const-destructure-type-no-init/snapshots/5-AST-Alignment-AST.shot new file mode 100644 index 000000000000..8bd50b531521 --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare-const-destructure-type-no-init/snapshots/5-AST-Alignment-AST.shot @@ -0,0 +1,113 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration VariableDeclaration declare-const-destructure-type-no-init AST Alignment - AST 1`] = ` +"Snapshot Diff: +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + VariableDeclaration { + type: 'VariableDeclaration', + declarations: Array [ + VariableDeclarator { + type: 'VariableDeclarator', +- definite: false, + id: ObjectPattern { + type: 'ObjectPattern', +- decorators: Array [], +- optional: false, + properties: Array [ + Property { + type: 'Property', + computed: false, + key: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'foo', +- optional: false, + + range: [16, 19], + loc: { + start: { column: 16, line: 1 }, + end: { column: 19, line: 1 }, + }, + }, + kind: 'init', + method: false, +- optional: false, + shorthand: true, + value: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'foo', +- optional: false, + + range: [16, 19], + loc: { + start: { column: 16, line: 1 }, + end: { column: 19, line: 1 }, + }, + }, + + range: [16, 19], + loc: { + start: { column: 16, line: 1 }, + end: { column: 19, line: 1 }, + }, + }, + ], + typeAnnotation: TSTypeAnnotation { + type: 'TSTypeAnnotation', + typeAnnotation: TSAnyKeyword { + type: 'TSAnyKeyword', + + range: [23, 26], + loc: { + start: { column: 23, line: 1 }, + end: { column: 26, line: 1 }, + }, + }, + + range: [21, 26], + loc: { + start: { column: 21, line: 1 }, + end: { column: 26, line: 1 }, + }, + }, + + range: [14, 26], + loc: { + start: { column: 14, line: 1 }, + end: { column: 26, line: 1 }, + }, + }, + init: null, + + range: [14, 26], + loc: { + start: { column: 14, line: 1 }, + end: { column: 26, line: 1 }, + }, + }, + ], + declare: true, + kind: 'const', + + range: [0, 27], + loc: { + start: { column: 0, line: 1 }, + end: { column: 27, line: 1 }, + }, + }, + ], + sourceType: 'script', + + range: [0, 28], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 2 }, + }, + }" +`; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare-const-destructure-type-no-init/snapshots/6-AST-Alignment-Tokens.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare-const-destructure-type-no-init/snapshots/6-AST-Alignment-Tokens.shot new file mode 100644 index 000000000000..9960a9512a1b --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare-const-destructure-type-no-init/snapshots/6-AST-Alignment-Tokens.shot @@ -0,0 +1,6 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration VariableDeclaration declare-const-destructure-type-no-init AST Alignment - Token 1`] = ` +"Snapshot Diff: +Compared values have no visual difference." +`; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare-const-id-init/fixture.ts b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare-const-id-init/fixture.ts new file mode 100644 index 000000000000..17852ec06c50 --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare-const-id-init/fixture.ts @@ -0,0 +1 @@ +declare const foo = 1; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/let-with-value/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare-const-id-init/snapshots/1-TSESTree-AST.shot similarity index 57% rename from packages/ast-spec/src/declaration/VariableDeclaration/fixtures/let-with-value/snapshots/1-TSESTree-AST.shot rename to packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare-const-id-init/snapshots/1-TSESTree-AST.shot index 9795f20c91c2..b54dc548b9ba 100644 --- a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/let-with-value/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare-const-id-init/snapshots/1-TSESTree-AST.shot @@ -1,6 +1,6 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`AST Fixtures declaration VariableDeclaration let-with-value TSESTree - AST 1`] = ` +exports[`AST Fixtures declaration VariableDeclaration declare-const-id-init TSESTree - AST 1`] = ` Program { type: "Program", body: [ @@ -13,13 +13,13 @@ Program { id: Identifier { type: "Identifier", decorators: [], - name: "x", + name: "foo", optional: false, - range: [4, 5], + range: [14, 17], loc: { - start: { column: 4, line: 1 }, - end: { column: 5, line: 1 }, + start: { column: 14, line: 1 }, + end: { column: 17, line: 1 }, }, }, init: Literal { @@ -27,33 +27,33 @@ Program { raw: "1", value: 1, - range: [8, 9], + range: [20, 21], loc: { - start: { column: 8, line: 1 }, - end: { column: 9, line: 1 }, + start: { column: 20, line: 1 }, + end: { column: 21, line: 1 }, }, }, - range: [4, 9], + range: [14, 21], loc: { - start: { column: 4, line: 1 }, - end: { column: 9, line: 1 }, + start: { column: 14, line: 1 }, + end: { column: 21, line: 1 }, }, }, ], - declare: false, - kind: "let", + declare: true, + kind: "const", - range: [0, 10], + range: [0, 22], loc: { start: { column: 0, line: 1 }, - end: { column: 10, line: 1 }, + end: { column: 22, line: 1 }, }, }, ], sourceType: "script", - range: [0, 11], + range: [0, 23], loc: { start: { column: 0, line: 1 }, end: { column: 0, line: 2 }, diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare-const-id-init/snapshots/2-TSESTree-Tokens.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare-const-id-init/snapshots/2-TSESTree-Tokens.shot new file mode 100644 index 000000000000..c2606baa3c5c --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare-const-id-init/snapshots/2-TSESTree-Tokens.shot @@ -0,0 +1,66 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration VariableDeclaration declare-const-id-init TSESTree - Tokens 1`] = ` +[ + Identifier { + type: "Identifier", + value: "declare", + + range: [0, 7], + loc: { + start: { column: 0, line: 1 }, + end: { column: 7, line: 1 }, + }, + }, + Keyword { + type: "Keyword", + value: "const", + + range: [8, 13], + loc: { + start: { column: 8, line: 1 }, + end: { column: 13, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "foo", + + range: [14, 17], + loc: { + start: { column: 14, line: 1 }, + end: { column: 17, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "=", + + range: [18, 19], + loc: { + start: { column: 18, line: 1 }, + end: { column: 19, line: 1 }, + }, + }, + Numeric { + type: "Numeric", + value: "1", + + range: [20, 21], + loc: { + start: { column: 20, line: 1 }, + end: { column: 21, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ";", + + range: [21, 22], + loc: { + start: { column: 21, line: 1 }, + end: { column: 22, line: 1 }, + }, + }, +] +`; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/let-with-value/snapshots/3-Babel-AST.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare-const-id-init/snapshots/3-Babel-AST.shot similarity index 55% rename from packages/ast-spec/src/declaration/VariableDeclaration/fixtures/let-with-value/snapshots/3-Babel-AST.shot rename to packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare-const-id-init/snapshots/3-Babel-AST.shot index 56183a6d8be1..41af28b397aa 100644 --- a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/let-with-value/snapshots/3-Babel-AST.shot +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare-const-id-init/snapshots/3-Babel-AST.shot @@ -1,6 +1,6 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`AST Fixtures declaration VariableDeclaration let-with-value Babel - AST 1`] = ` +exports[`AST Fixtures declaration VariableDeclaration declare-const-id-init Babel - AST 1`] = ` Program { type: "Program", body: [ @@ -11,12 +11,12 @@ Program { type: "VariableDeclarator", id: Identifier { type: "Identifier", - name: "x", + name: "foo", - range: [4, 5], + range: [14, 17], loc: { - start: { column: 4, line: 1 }, - end: { column: 5, line: 1 }, + start: { column: 14, line: 1 }, + end: { column: 17, line: 1 }, }, }, init: Literal { @@ -24,32 +24,33 @@ Program { raw: "1", value: 1, - range: [8, 9], + range: [20, 21], loc: { - start: { column: 8, line: 1 }, - end: { column: 9, line: 1 }, + start: { column: 20, line: 1 }, + end: { column: 21, line: 1 }, }, }, - range: [4, 9], + range: [14, 21], loc: { - start: { column: 4, line: 1 }, - end: { column: 9, line: 1 }, + start: { column: 14, line: 1 }, + end: { column: 21, line: 1 }, }, }, ], - kind: "let", + declare: true, + kind: "const", - range: [0, 10], + range: [0, 22], loc: { start: { column: 0, line: 1 }, - end: { column: 10, line: 1 }, + end: { column: 22, line: 1 }, }, }, ], sourceType: "script", - range: [0, 11], + range: [0, 23], loc: { start: { column: 0, line: 1 }, end: { column: 0, line: 2 }, diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare-const-id-init/snapshots/4-Babel-Tokens.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare-const-id-init/snapshots/4-Babel-Tokens.shot new file mode 100644 index 000000000000..c2323e387106 --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare-const-id-init/snapshots/4-Babel-Tokens.shot @@ -0,0 +1,66 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration VariableDeclaration declare-const-id-init Babel - Tokens 1`] = ` +[ + Identifier { + type: "Identifier", + value: "declare", + + range: [0, 7], + loc: { + start: { column: 0, line: 1 }, + end: { column: 7, line: 1 }, + }, + }, + Keyword { + type: "Keyword", + value: "const", + + range: [8, 13], + loc: { + start: { column: 8, line: 1 }, + end: { column: 13, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "foo", + + range: [14, 17], + loc: { + start: { column: 14, line: 1 }, + end: { column: 17, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "=", + + range: [18, 19], + loc: { + start: { column: 18, line: 1 }, + end: { column: 19, line: 1 }, + }, + }, + Numeric { + type: "Numeric", + value: "1", + + range: [20, 21], + loc: { + start: { column: 20, line: 1 }, + end: { column: 21, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ";", + + range: [21, 22], + loc: { + start: { column: 21, line: 1 }, + end: { column: 22, line: 1 }, + }, + }, +] +`; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/let-with-value/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare-const-id-init/snapshots/5-AST-Alignment-AST.shot similarity index 59% rename from packages/ast-spec/src/declaration/VariableDeclaration/fixtures/let-with-value/snapshots/5-AST-Alignment-AST.shot rename to packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare-const-id-init/snapshots/5-AST-Alignment-AST.shot index b275669e12ac..7c85a25d69b7 100644 --- a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/let-with-value/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare-const-id-init/snapshots/5-AST-Alignment-AST.shot @@ -1,6 +1,6 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`AST Fixtures declaration VariableDeclaration let-with-value AST Alignment - AST 1`] = ` +exports[`AST Fixtures declaration VariableDeclaration declare-const-id-init AST Alignment - AST 1`] = ` "Snapshot Diff: - TSESTree + Babel @@ -17,13 +17,13 @@ exports[`AST Fixtures declaration VariableDeclaration let-with-value AST Alignme id: Identifier { type: 'Identifier', - decorators: Array [], - name: 'x', + name: 'foo', - optional: false, - range: [4, 5], + range: [14, 17], loc: { - start: { column: 4, line: 1 }, - end: { column: 5, line: 1 }, + start: { column: 14, line: 1 }, + end: { column: 17, line: 1 }, }, }, init: Literal { @@ -31,33 +31,33 @@ exports[`AST Fixtures declaration VariableDeclaration let-with-value AST Alignme raw: '1', value: 1, - range: [8, 9], + range: [20, 21], loc: { - start: { column: 8, line: 1 }, - end: { column: 9, line: 1 }, + start: { column: 20, line: 1 }, + end: { column: 21, line: 1 }, }, }, - range: [4, 9], + range: [14, 21], loc: { - start: { column: 4, line: 1 }, - end: { column: 9, line: 1 }, + start: { column: 14, line: 1 }, + end: { column: 21, line: 1 }, }, }, ], -- declare: false, - kind: 'let', + declare: true, + kind: 'const', - range: [0, 10], + range: [0, 22], loc: { start: { column: 0, line: 1 }, - end: { column: 10, line: 1 }, + end: { column: 22, line: 1 }, }, }, ], sourceType: 'script', - range: [0, 11], + range: [0, 23], loc: { start: { column: 0, line: 1 }, end: { column: 0, line: 2 }, diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare-const-id-init/snapshots/6-AST-Alignment-Tokens.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare-const-id-init/snapshots/6-AST-Alignment-Tokens.shot new file mode 100644 index 000000000000..1f7fcc7ddd1a --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare-const-id-init/snapshots/6-AST-Alignment-Tokens.shot @@ -0,0 +1,6 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration VariableDeclaration declare-const-id-init AST Alignment - Token 1`] = ` +"Snapshot Diff: +Compared values have no visual difference." +`; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare-const-id-no-init/fixture.ts b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare-const-id-no-init/fixture.ts new file mode 100644 index 000000000000..45246cb916d6 --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare-const-id-no-init/fixture.ts @@ -0,0 +1 @@ +declare const foo; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare-const-id-no-init/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare-const-id-no-init/snapshots/1-TSESTree-AST.shot new file mode 100644 index 000000000000..fd47a1cf4a75 --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare-const-id-no-init/snapshots/1-TSESTree-AST.shot @@ -0,0 +1,52 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration VariableDeclaration declare-const-id-no-init TSESTree - AST 1`] = ` +Program { + type: "Program", + body: [ + VariableDeclaration { + type: "VariableDeclaration", + declarations: [ + VariableDeclarator { + type: "VariableDeclarator", + definite: false, + id: Identifier { + type: "Identifier", + decorators: [], + name: "foo", + optional: false, + + range: [14, 17], + loc: { + start: { column: 14, line: 1 }, + end: { column: 17, line: 1 }, + }, + }, + init: null, + + range: [14, 17], + loc: { + start: { column: 14, line: 1 }, + end: { column: 17, line: 1 }, + }, + }, + ], + declare: true, + kind: "const", + + range: [0, 18], + loc: { + start: { column: 0, line: 1 }, + end: { column: 18, line: 1 }, + }, + }, + ], + sourceType: "script", + + range: [0, 19], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 2 }, + }, +} +`; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare-const-id-no-init/snapshots/2-TSESTree-Tokens.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare-const-id-no-init/snapshots/2-TSESTree-Tokens.shot new file mode 100644 index 000000000000..c4e5c177e6c9 --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare-const-id-no-init/snapshots/2-TSESTree-Tokens.shot @@ -0,0 +1,46 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration VariableDeclaration declare-const-id-no-init TSESTree - Tokens 1`] = ` +[ + Identifier { + type: "Identifier", + value: "declare", + + range: [0, 7], + loc: { + start: { column: 0, line: 1 }, + end: { column: 7, line: 1 }, + }, + }, + Keyword { + type: "Keyword", + value: "const", + + range: [8, 13], + loc: { + start: { column: 8, line: 1 }, + end: { column: 13, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "foo", + + range: [14, 17], + loc: { + start: { column: 14, line: 1 }, + end: { column: 17, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ";", + + range: [17, 18], + loc: { + start: { column: 17, line: 1 }, + end: { column: 18, line: 1 }, + }, + }, +] +`; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare-const-id-no-init/snapshots/3-Babel-AST.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare-const-id-no-init/snapshots/3-Babel-AST.shot new file mode 100644 index 000000000000..777c30cd13e8 --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare-const-id-no-init/snapshots/3-Babel-AST.shot @@ -0,0 +1,49 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration VariableDeclaration declare-const-id-no-init Babel - AST 1`] = ` +Program { + type: "Program", + body: [ + VariableDeclaration { + type: "VariableDeclaration", + declarations: [ + VariableDeclarator { + type: "VariableDeclarator", + id: Identifier { + type: "Identifier", + name: "foo", + + range: [14, 17], + loc: { + start: { column: 14, line: 1 }, + end: { column: 17, line: 1 }, + }, + }, + init: null, + + range: [14, 17], + loc: { + start: { column: 14, line: 1 }, + end: { column: 17, line: 1 }, + }, + }, + ], + declare: true, + kind: "const", + + range: [0, 18], + loc: { + start: { column: 0, line: 1 }, + end: { column: 18, line: 1 }, + }, + }, + ], + sourceType: "script", + + range: [0, 19], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 2 }, + }, +} +`; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare-const-id-no-init/snapshots/4-Babel-Tokens.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare-const-id-no-init/snapshots/4-Babel-Tokens.shot new file mode 100644 index 000000000000..514e1161b4f0 --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare-const-id-no-init/snapshots/4-Babel-Tokens.shot @@ -0,0 +1,46 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration VariableDeclaration declare-const-id-no-init Babel - Tokens 1`] = ` +[ + Identifier { + type: "Identifier", + value: "declare", + + range: [0, 7], + loc: { + start: { column: 0, line: 1 }, + end: { column: 7, line: 1 }, + }, + }, + Keyword { + type: "Keyword", + value: "const", + + range: [8, 13], + loc: { + start: { column: 8, line: 1 }, + end: { column: 13, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "foo", + + range: [14, 17], + loc: { + start: { column: 14, line: 1 }, + end: { column: 17, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ";", + + range: [17, 18], + loc: { + start: { column: 17, line: 1 }, + end: { column: 18, line: 1 }, + }, + }, +] +`; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare-const-id-no-init/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare-const-id-no-init/snapshots/5-AST-Alignment-AST.shot new file mode 100644 index 000000000000..a065e88425d8 --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare-const-id-no-init/snapshots/5-AST-Alignment-AST.shot @@ -0,0 +1,56 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration VariableDeclaration declare-const-id-no-init AST Alignment - AST 1`] = ` +"Snapshot Diff: +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + VariableDeclaration { + type: 'VariableDeclaration', + declarations: Array [ + VariableDeclarator { + type: 'VariableDeclarator', +- definite: false, + id: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'foo', +- optional: false, + + range: [14, 17], + loc: { + start: { column: 14, line: 1 }, + end: { column: 17, line: 1 }, + }, + }, + init: null, + + range: [14, 17], + loc: { + start: { column: 14, line: 1 }, + end: { column: 17, line: 1 }, + }, + }, + ], + declare: true, + kind: 'const', + + range: [0, 18], + loc: { + start: { column: 0, line: 1 }, + end: { column: 18, line: 1 }, + }, + }, + ], + sourceType: 'script', + + range: [0, 19], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 2 }, + }, + }" +`; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare-const-id-no-init/snapshots/6-AST-Alignment-Tokens.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare-const-id-no-init/snapshots/6-AST-Alignment-Tokens.shot new file mode 100644 index 000000000000..8945e47cd2f3 --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare-const-id-no-init/snapshots/6-AST-Alignment-Tokens.shot @@ -0,0 +1,6 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration VariableDeclaration declare-const-id-no-init AST Alignment - Token 1`] = ` +"Snapshot Diff: +Compared values have no visual difference." +`; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare-const-id-type-no-init/fixture.ts b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare-const-id-type-no-init/fixture.ts new file mode 100644 index 000000000000..3e969234f589 --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare-const-id-type-no-init/fixture.ts @@ -0,0 +1 @@ +declare const foo: any; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare-const-id-type-no-init/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare-const-id-type-no-init/snapshots/1-TSESTree-AST.shot new file mode 100644 index 000000000000..e6d42b41e047 --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare-const-id-type-no-init/snapshots/1-TSESTree-AST.shot @@ -0,0 +1,70 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration VariableDeclaration declare-const-id-type-no-init TSESTree - AST 1`] = ` +Program { + type: "Program", + body: [ + VariableDeclaration { + type: "VariableDeclaration", + declarations: [ + VariableDeclarator { + type: "VariableDeclarator", + definite: false, + id: Identifier { + type: "Identifier", + decorators: [], + name: "foo", + optional: false, + typeAnnotation: TSTypeAnnotation { + type: "TSTypeAnnotation", + typeAnnotation: TSAnyKeyword { + type: "TSAnyKeyword", + + range: [19, 22], + loc: { + start: { column: 19, line: 1 }, + end: { column: 22, line: 1 }, + }, + }, + + range: [17, 22], + loc: { + start: { column: 17, line: 1 }, + end: { column: 22, line: 1 }, + }, + }, + + range: [14, 22], + loc: { + start: { column: 14, line: 1 }, + end: { column: 22, line: 1 }, + }, + }, + init: null, + + range: [14, 22], + loc: { + start: { column: 14, line: 1 }, + end: { column: 22, line: 1 }, + }, + }, + ], + declare: true, + kind: "const", + + range: [0, 23], + loc: { + start: { column: 0, line: 1 }, + end: { column: 23, line: 1 }, + }, + }, + ], + sourceType: "script", + + range: [0, 24], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 2 }, + }, +} +`; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare-const-id-type-no-init/snapshots/2-TSESTree-Tokens.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare-const-id-type-no-init/snapshots/2-TSESTree-Tokens.shot new file mode 100644 index 000000000000..d2d9ad0a63b2 --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare-const-id-type-no-init/snapshots/2-TSESTree-Tokens.shot @@ -0,0 +1,66 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration VariableDeclaration declare-const-id-type-no-init TSESTree - Tokens 1`] = ` +[ + Identifier { + type: "Identifier", + value: "declare", + + range: [0, 7], + loc: { + start: { column: 0, line: 1 }, + end: { column: 7, line: 1 }, + }, + }, + Keyword { + type: "Keyword", + value: "const", + + range: [8, 13], + loc: { + start: { column: 8, line: 1 }, + end: { column: 13, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "foo", + + range: [14, 17], + loc: { + start: { column: 14, line: 1 }, + end: { column: 17, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ":", + + range: [17, 18], + loc: { + start: { column: 17, line: 1 }, + end: { column: 18, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "any", + + range: [19, 22], + loc: { + start: { column: 19, line: 1 }, + end: { column: 22, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ";", + + range: [22, 23], + loc: { + start: { column: 22, line: 1 }, + end: { column: 23, line: 1 }, + }, + }, +] +`; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare-const-id-type-no-init/snapshots/3-Babel-AST.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare-const-id-type-no-init/snapshots/3-Babel-AST.shot new file mode 100644 index 000000000000..0ab751af70b3 --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare-const-id-type-no-init/snapshots/3-Babel-AST.shot @@ -0,0 +1,67 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration VariableDeclaration declare-const-id-type-no-init Babel - AST 1`] = ` +Program { + type: "Program", + body: [ + VariableDeclaration { + type: "VariableDeclaration", + declarations: [ + VariableDeclarator { + type: "VariableDeclarator", + id: Identifier { + type: "Identifier", + name: "foo", + typeAnnotation: TSTypeAnnotation { + type: "TSTypeAnnotation", + typeAnnotation: TSAnyKeyword { + type: "TSAnyKeyword", + + range: [19, 22], + loc: { + start: { column: 19, line: 1 }, + end: { column: 22, line: 1 }, + }, + }, + + range: [17, 22], + loc: { + start: { column: 17, line: 1 }, + end: { column: 22, line: 1 }, + }, + }, + + range: [14, 22], + loc: { + start: { column: 14, line: 1 }, + end: { column: 22, line: 1 }, + }, + }, + init: null, + + range: [14, 22], + loc: { + start: { column: 14, line: 1 }, + end: { column: 22, line: 1 }, + }, + }, + ], + declare: true, + kind: "const", + + range: [0, 23], + loc: { + start: { column: 0, line: 1 }, + end: { column: 23, line: 1 }, + }, + }, + ], + sourceType: "script", + + range: [0, 24], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 2 }, + }, +} +`; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare-const-id-type-no-init/snapshots/4-Babel-Tokens.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare-const-id-type-no-init/snapshots/4-Babel-Tokens.shot new file mode 100644 index 000000000000..c482cb27b848 --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare-const-id-type-no-init/snapshots/4-Babel-Tokens.shot @@ -0,0 +1,66 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration VariableDeclaration declare-const-id-type-no-init Babel - Tokens 1`] = ` +[ + Identifier { + type: "Identifier", + value: "declare", + + range: [0, 7], + loc: { + start: { column: 0, line: 1 }, + end: { column: 7, line: 1 }, + }, + }, + Keyword { + type: "Keyword", + value: "const", + + range: [8, 13], + loc: { + start: { column: 8, line: 1 }, + end: { column: 13, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "foo", + + range: [14, 17], + loc: { + start: { column: 14, line: 1 }, + end: { column: 17, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ":", + + range: [17, 18], + loc: { + start: { column: 17, line: 1 }, + end: { column: 18, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "any", + + range: [19, 22], + loc: { + start: { column: 19, line: 1 }, + end: { column: 22, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ";", + + range: [22, 23], + loc: { + start: { column: 22, line: 1 }, + end: { column: 23, line: 1 }, + }, + }, +] +`; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare-const-id-type-no-init/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare-const-id-type-no-init/snapshots/5-AST-Alignment-AST.shot new file mode 100644 index 000000000000..cc2905bc1f5e --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare-const-id-type-no-init/snapshots/5-AST-Alignment-AST.shot @@ -0,0 +1,74 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration VariableDeclaration declare-const-id-type-no-init AST Alignment - AST 1`] = ` +"Snapshot Diff: +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + VariableDeclaration { + type: 'VariableDeclaration', + declarations: Array [ + VariableDeclarator { + type: 'VariableDeclarator', +- definite: false, + id: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'foo', +- optional: false, + typeAnnotation: TSTypeAnnotation { + type: 'TSTypeAnnotation', + typeAnnotation: TSAnyKeyword { + type: 'TSAnyKeyword', + + range: [19, 22], + loc: { + start: { column: 19, line: 1 }, + end: { column: 22, line: 1 }, + }, + }, + + range: [17, 22], + loc: { + start: { column: 17, line: 1 }, + end: { column: 22, line: 1 }, + }, + }, + + range: [14, 22], + loc: { + start: { column: 14, line: 1 }, + end: { column: 22, line: 1 }, + }, + }, + init: null, + + range: [14, 22], + loc: { + start: { column: 14, line: 1 }, + end: { column: 22, line: 1 }, + }, + }, + ], + declare: true, + kind: 'const', + + range: [0, 23], + loc: { + start: { column: 0, line: 1 }, + end: { column: 23, line: 1 }, + }, + }, + ], + sourceType: 'script', + + range: [0, 24], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 2 }, + }, + }" +`; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare-const-id-type-no-init/snapshots/6-AST-Alignment-Tokens.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare-const-id-type-no-init/snapshots/6-AST-Alignment-Tokens.shot new file mode 100644 index 000000000000..32be13884000 --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare-const-id-type-no-init/snapshots/6-AST-Alignment-Tokens.shot @@ -0,0 +1,6 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration VariableDeclaration declare-const-id-type-no-init AST Alignment - Token 1`] = ` +"Snapshot Diff: +Compared values have no visual difference." +`; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare-let-destructure-no-init/fixture.ts b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare-let-destructure-no-init/fixture.ts new file mode 100644 index 000000000000..c1a6934be66b --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare-let-destructure-no-init/fixture.ts @@ -0,0 +1 @@ +declare let { foo }; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare-let-destructure-no-init/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare-let-destructure-no-init/snapshots/1-TSESTree-AST.shot new file mode 100644 index 000000000000..9e13e6d5bf6d --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare-let-destructure-no-init/snapshots/1-TSESTree-AST.shot @@ -0,0 +1,91 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration VariableDeclaration declare-let-destructure-no-init TSESTree - AST 1`] = ` +Program { + type: "Program", + body: [ + VariableDeclaration { + type: "VariableDeclaration", + declarations: [ + VariableDeclarator { + type: "VariableDeclarator", + definite: false, + id: ObjectPattern { + type: "ObjectPattern", + decorators: [], + optional: false, + properties: [ + Property { + type: "Property", + computed: false, + key: Identifier { + type: "Identifier", + decorators: [], + name: "foo", + optional: false, + + range: [14, 17], + loc: { + start: { column: 14, line: 1 }, + end: { column: 17, line: 1 }, + }, + }, + kind: "init", + method: false, + optional: false, + shorthand: true, + value: Identifier { + type: "Identifier", + decorators: [], + name: "foo", + optional: false, + + range: [14, 17], + loc: { + start: { column: 14, line: 1 }, + end: { column: 17, line: 1 }, + }, + }, + + range: [14, 17], + loc: { + start: { column: 14, line: 1 }, + end: { column: 17, line: 1 }, + }, + }, + ], + + range: [12, 19], + loc: { + start: { column: 12, line: 1 }, + end: { column: 19, line: 1 }, + }, + }, + init: null, + + range: [12, 19], + loc: { + start: { column: 12, line: 1 }, + end: { column: 19, line: 1 }, + }, + }, + ], + declare: true, + kind: "let", + + range: [0, 20], + loc: { + start: { column: 0, line: 1 }, + end: { column: 20, line: 1 }, + }, + }, + ], + sourceType: "script", + + range: [0, 21], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 2 }, + }, +} +`; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare-let-destructure-no-init/snapshots/2-TSESTree-Tokens.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare-let-destructure-no-init/snapshots/2-TSESTree-Tokens.shot new file mode 100644 index 000000000000..68ee9b162d38 --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare-let-destructure-no-init/snapshots/2-TSESTree-Tokens.shot @@ -0,0 +1,66 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration VariableDeclaration declare-let-destructure-no-init TSESTree - Tokens 1`] = ` +[ + Identifier { + type: "Identifier", + value: "declare", + + range: [0, 7], + loc: { + start: { column: 0, line: 1 }, + end: { column: 7, line: 1 }, + }, + }, + Keyword { + type: "Keyword", + value: "let", + + range: [8, 11], + loc: { + start: { column: 8, line: 1 }, + end: { column: 11, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "{", + + range: [12, 13], + loc: { + start: { column: 12, line: 1 }, + end: { column: 13, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "foo", + + range: [14, 17], + loc: { + start: { column: 14, line: 1 }, + end: { column: 17, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "}", + + range: [18, 19], + loc: { + start: { column: 18, line: 1 }, + end: { column: 19, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ";", + + range: [19, 20], + loc: { + start: { column: 19, line: 1 }, + end: { column: 20, line: 1 }, + }, + }, +] +`; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare-let-destructure-no-init/snapshots/3-Babel-AST.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare-let-destructure-no-init/snapshots/3-Babel-AST.shot new file mode 100644 index 000000000000..d05756167a4b --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare-let-destructure-no-init/snapshots/3-Babel-AST.shot @@ -0,0 +1,83 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration VariableDeclaration declare-let-destructure-no-init Babel - AST 1`] = ` +Program { + type: "Program", + body: [ + VariableDeclaration { + type: "VariableDeclaration", + declarations: [ + VariableDeclarator { + type: "VariableDeclarator", + id: ObjectPattern { + type: "ObjectPattern", + properties: [ + Property { + type: "Property", + computed: false, + key: Identifier { + type: "Identifier", + name: "foo", + + range: [14, 17], + loc: { + start: { column: 14, line: 1 }, + end: { column: 17, line: 1 }, + }, + }, + kind: "init", + method: false, + shorthand: true, + value: Identifier { + type: "Identifier", + name: "foo", + + range: [14, 17], + loc: { + start: { column: 14, line: 1 }, + end: { column: 17, line: 1 }, + }, + }, + + range: [14, 17], + loc: { + start: { column: 14, line: 1 }, + end: { column: 17, line: 1 }, + }, + }, + ], + + range: [12, 19], + loc: { + start: { column: 12, line: 1 }, + end: { column: 19, line: 1 }, + }, + }, + init: null, + + range: [12, 19], + loc: { + start: { column: 12, line: 1 }, + end: { column: 19, line: 1 }, + }, + }, + ], + declare: true, + kind: "let", + + range: [0, 20], + loc: { + start: { column: 0, line: 1 }, + end: { column: 20, line: 1 }, + }, + }, + ], + sourceType: "script", + + range: [0, 21], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 2 }, + }, +} +`; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare-let-destructure-no-init/snapshots/4-Babel-Tokens.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare-let-destructure-no-init/snapshots/4-Babel-Tokens.shot new file mode 100644 index 000000000000..d0cdf900b853 --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare-let-destructure-no-init/snapshots/4-Babel-Tokens.shot @@ -0,0 +1,66 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration VariableDeclaration declare-let-destructure-no-init Babel - Tokens 1`] = ` +[ + Identifier { + type: "Identifier", + value: "declare", + + range: [0, 7], + loc: { + start: { column: 0, line: 1 }, + end: { column: 7, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "let", + + range: [8, 11], + loc: { + start: { column: 8, line: 1 }, + end: { column: 11, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "{", + + range: [12, 13], + loc: { + start: { column: 12, line: 1 }, + end: { column: 13, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "foo", + + range: [14, 17], + loc: { + start: { column: 14, line: 1 }, + end: { column: 17, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "}", + + range: [18, 19], + loc: { + start: { column: 18, line: 1 }, + end: { column: 19, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ";", + + range: [19, 20], + loc: { + start: { column: 19, line: 1 }, + end: { column: 20, line: 1 }, + }, + }, +] +`; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare-let-destructure-no-init/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare-let-destructure-no-init/snapshots/5-AST-Alignment-AST.shot new file mode 100644 index 000000000000..32b22a297d2c --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare-let-destructure-no-init/snapshots/5-AST-Alignment-AST.shot @@ -0,0 +1,95 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration VariableDeclaration declare-let-destructure-no-init AST Alignment - AST 1`] = ` +"Snapshot Diff: +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + VariableDeclaration { + type: 'VariableDeclaration', + declarations: Array [ + VariableDeclarator { + type: 'VariableDeclarator', +- definite: false, + id: ObjectPattern { + type: 'ObjectPattern', +- decorators: Array [], +- optional: false, + properties: Array [ + Property { + type: 'Property', + computed: false, + key: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'foo', +- optional: false, + + range: [14, 17], + loc: { + start: { column: 14, line: 1 }, + end: { column: 17, line: 1 }, + }, + }, + kind: 'init', + method: false, +- optional: false, + shorthand: true, + value: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'foo', +- optional: false, + + range: [14, 17], + loc: { + start: { column: 14, line: 1 }, + end: { column: 17, line: 1 }, + }, + }, + + range: [14, 17], + loc: { + start: { column: 14, line: 1 }, + end: { column: 17, line: 1 }, + }, + }, + ], + + range: [12, 19], + loc: { + start: { column: 12, line: 1 }, + end: { column: 19, line: 1 }, + }, + }, + init: null, + + range: [12, 19], + loc: { + start: { column: 12, line: 1 }, + end: { column: 19, line: 1 }, + }, + }, + ], + declare: true, + kind: 'let', + + range: [0, 20], + loc: { + start: { column: 0, line: 1 }, + end: { column: 20, line: 1 }, + }, + }, + ], + sourceType: 'script', + + range: [0, 21], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 2 }, + }, + }" +`; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare-let-destructure-no-init/snapshots/6-AST-Alignment-Tokens.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare-let-destructure-no-init/snapshots/6-AST-Alignment-Tokens.shot new file mode 100644 index 000000000000..a0e538021089 --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare-let-destructure-no-init/snapshots/6-AST-Alignment-Tokens.shot @@ -0,0 +1,72 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration VariableDeclaration declare-let-destructure-no-init AST Alignment - Token 1`] = ` +"Snapshot Diff: +- TSESTree ++ Babel + + Array [ + Identifier { + type: 'Identifier', + value: 'declare', + + range: [0, 7], + loc: { + start: { column: 0, line: 1 }, + end: { column: 7, line: 1 }, + }, + }, +- Keyword { +- type: 'Keyword', ++ Identifier { ++ type: 'Identifier', + value: 'let', + + range: [8, 11], + loc: { + start: { column: 8, line: 1 }, + end: { column: 11, line: 1 }, + }, + }, + Punctuator { + type: 'Punctuator', + value: '{', + + range: [12, 13], + loc: { + start: { column: 12, line: 1 }, + end: { column: 13, line: 1 }, + }, + }, + Identifier { + type: 'Identifier', + value: 'foo', + + range: [14, 17], + loc: { + start: { column: 14, line: 1 }, + end: { column: 17, line: 1 }, + }, + }, + Punctuator { + type: 'Punctuator', + value: '}', + + range: [18, 19], + loc: { + start: { column: 18, line: 1 }, + end: { column: 19, line: 1 }, + }, + }, + Punctuator { + type: 'Punctuator', + value: ';', + + range: [19, 20], + loc: { + start: { column: 19, line: 1 }, + end: { column: 20, line: 1 }, + }, + }, + ]" +`; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare-let-destructure-type-no-init/fixture.ts b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare-let-destructure-type-no-init/fixture.ts new file mode 100644 index 000000000000..1fa9a69e08b4 --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare-let-destructure-type-no-init/fixture.ts @@ -0,0 +1 @@ +declare let { foo }: any; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare-let-destructure-type-no-init/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare-let-destructure-type-no-init/snapshots/1-TSESTree-AST.shot new file mode 100644 index 000000000000..033e2432e429 --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare-let-destructure-type-no-init/snapshots/1-TSESTree-AST.shot @@ -0,0 +1,109 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration VariableDeclaration declare-let-destructure-type-no-init TSESTree - AST 1`] = ` +Program { + type: "Program", + body: [ + VariableDeclaration { + type: "VariableDeclaration", + declarations: [ + VariableDeclarator { + type: "VariableDeclarator", + definite: false, + id: ObjectPattern { + type: "ObjectPattern", + decorators: [], + optional: false, + properties: [ + Property { + type: "Property", + computed: false, + key: Identifier { + type: "Identifier", + decorators: [], + name: "foo", + optional: false, + + range: [14, 17], + loc: { + start: { column: 14, line: 1 }, + end: { column: 17, line: 1 }, + }, + }, + kind: "init", + method: false, + optional: false, + shorthand: true, + value: Identifier { + type: "Identifier", + decorators: [], + name: "foo", + optional: false, + + range: [14, 17], + loc: { + start: { column: 14, line: 1 }, + end: { column: 17, line: 1 }, + }, + }, + + range: [14, 17], + loc: { + start: { column: 14, line: 1 }, + end: { column: 17, line: 1 }, + }, + }, + ], + typeAnnotation: TSTypeAnnotation { + type: "TSTypeAnnotation", + typeAnnotation: TSAnyKeyword { + type: "TSAnyKeyword", + + range: [21, 24], + loc: { + start: { column: 21, line: 1 }, + end: { column: 24, line: 1 }, + }, + }, + + range: [19, 24], + loc: { + start: { column: 19, line: 1 }, + end: { column: 24, line: 1 }, + }, + }, + + range: [12, 24], + loc: { + start: { column: 12, line: 1 }, + end: { column: 24, line: 1 }, + }, + }, + init: null, + + range: [12, 24], + loc: { + start: { column: 12, line: 1 }, + end: { column: 24, line: 1 }, + }, + }, + ], + declare: true, + kind: "let", + + range: [0, 25], + loc: { + start: { column: 0, line: 1 }, + end: { column: 25, line: 1 }, + }, + }, + ], + sourceType: "script", + + range: [0, 26], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 2 }, + }, +} +`; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare-let-destructure-type-no-init/snapshots/2-TSESTree-Tokens.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare-let-destructure-type-no-init/snapshots/2-TSESTree-Tokens.shot new file mode 100644 index 000000000000..1ff4409fb2b8 --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare-let-destructure-type-no-init/snapshots/2-TSESTree-Tokens.shot @@ -0,0 +1,86 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration VariableDeclaration declare-let-destructure-type-no-init TSESTree - Tokens 1`] = ` +[ + Identifier { + type: "Identifier", + value: "declare", + + range: [0, 7], + loc: { + start: { column: 0, line: 1 }, + end: { column: 7, line: 1 }, + }, + }, + Keyword { + type: "Keyword", + value: "let", + + range: [8, 11], + loc: { + start: { column: 8, line: 1 }, + end: { column: 11, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "{", + + range: [12, 13], + loc: { + start: { column: 12, line: 1 }, + end: { column: 13, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "foo", + + range: [14, 17], + loc: { + start: { column: 14, line: 1 }, + end: { column: 17, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "}", + + range: [18, 19], + loc: { + start: { column: 18, line: 1 }, + end: { column: 19, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ":", + + range: [19, 20], + loc: { + start: { column: 19, line: 1 }, + end: { column: 20, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "any", + + range: [21, 24], + loc: { + start: { column: 21, line: 1 }, + end: { column: 24, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ";", + + range: [24, 25], + loc: { + start: { column: 24, line: 1 }, + end: { column: 25, line: 1 }, + }, + }, +] +`; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare-let-destructure-type-no-init/snapshots/3-Babel-AST.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare-let-destructure-type-no-init/snapshots/3-Babel-AST.shot new file mode 100644 index 000000000000..4798a5e3e2d3 --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare-let-destructure-type-no-init/snapshots/3-Babel-AST.shot @@ -0,0 +1,101 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration VariableDeclaration declare-let-destructure-type-no-init Babel - AST 1`] = ` +Program { + type: "Program", + body: [ + VariableDeclaration { + type: "VariableDeclaration", + declarations: [ + VariableDeclarator { + type: "VariableDeclarator", + id: ObjectPattern { + type: "ObjectPattern", + properties: [ + Property { + type: "Property", + computed: false, + key: Identifier { + type: "Identifier", + name: "foo", + + range: [14, 17], + loc: { + start: { column: 14, line: 1 }, + end: { column: 17, line: 1 }, + }, + }, + kind: "init", + method: false, + shorthand: true, + value: Identifier { + type: "Identifier", + name: "foo", + + range: [14, 17], + loc: { + start: { column: 14, line: 1 }, + end: { column: 17, line: 1 }, + }, + }, + + range: [14, 17], + loc: { + start: { column: 14, line: 1 }, + end: { column: 17, line: 1 }, + }, + }, + ], + typeAnnotation: TSTypeAnnotation { + type: "TSTypeAnnotation", + typeAnnotation: TSAnyKeyword { + type: "TSAnyKeyword", + + range: [21, 24], + loc: { + start: { column: 21, line: 1 }, + end: { column: 24, line: 1 }, + }, + }, + + range: [19, 24], + loc: { + start: { column: 19, line: 1 }, + end: { column: 24, line: 1 }, + }, + }, + + range: [12, 24], + loc: { + start: { column: 12, line: 1 }, + end: { column: 24, line: 1 }, + }, + }, + init: null, + + range: [12, 24], + loc: { + start: { column: 12, line: 1 }, + end: { column: 24, line: 1 }, + }, + }, + ], + declare: true, + kind: "let", + + range: [0, 25], + loc: { + start: { column: 0, line: 1 }, + end: { column: 25, line: 1 }, + }, + }, + ], + sourceType: "script", + + range: [0, 26], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 2 }, + }, +} +`; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare-let-destructure-type-no-init/snapshots/4-Babel-Tokens.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare-let-destructure-type-no-init/snapshots/4-Babel-Tokens.shot new file mode 100644 index 000000000000..073e670a8172 --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare-let-destructure-type-no-init/snapshots/4-Babel-Tokens.shot @@ -0,0 +1,86 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration VariableDeclaration declare-let-destructure-type-no-init Babel - Tokens 1`] = ` +[ + Identifier { + type: "Identifier", + value: "declare", + + range: [0, 7], + loc: { + start: { column: 0, line: 1 }, + end: { column: 7, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "let", + + range: [8, 11], + loc: { + start: { column: 8, line: 1 }, + end: { column: 11, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "{", + + range: [12, 13], + loc: { + start: { column: 12, line: 1 }, + end: { column: 13, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "foo", + + range: [14, 17], + loc: { + start: { column: 14, line: 1 }, + end: { column: 17, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "}", + + range: [18, 19], + loc: { + start: { column: 18, line: 1 }, + end: { column: 19, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ":", + + range: [19, 20], + loc: { + start: { column: 19, line: 1 }, + end: { column: 20, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "any", + + range: [21, 24], + loc: { + start: { column: 21, line: 1 }, + end: { column: 24, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ";", + + range: [24, 25], + loc: { + start: { column: 24, line: 1 }, + end: { column: 25, line: 1 }, + }, + }, +] +`; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare-let-destructure-type-no-init/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare-let-destructure-type-no-init/snapshots/5-AST-Alignment-AST.shot new file mode 100644 index 000000000000..7dd7c7f67283 --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare-let-destructure-type-no-init/snapshots/5-AST-Alignment-AST.shot @@ -0,0 +1,113 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration VariableDeclaration declare-let-destructure-type-no-init AST Alignment - AST 1`] = ` +"Snapshot Diff: +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + VariableDeclaration { + type: 'VariableDeclaration', + declarations: Array [ + VariableDeclarator { + type: 'VariableDeclarator', +- definite: false, + id: ObjectPattern { + type: 'ObjectPattern', +- decorators: Array [], +- optional: false, + properties: Array [ + Property { + type: 'Property', + computed: false, + key: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'foo', +- optional: false, + + range: [14, 17], + loc: { + start: { column: 14, line: 1 }, + end: { column: 17, line: 1 }, + }, + }, + kind: 'init', + method: false, +- optional: false, + shorthand: true, + value: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'foo', +- optional: false, + + range: [14, 17], + loc: { + start: { column: 14, line: 1 }, + end: { column: 17, line: 1 }, + }, + }, + + range: [14, 17], + loc: { + start: { column: 14, line: 1 }, + end: { column: 17, line: 1 }, + }, + }, + ], + typeAnnotation: TSTypeAnnotation { + type: 'TSTypeAnnotation', + typeAnnotation: TSAnyKeyword { + type: 'TSAnyKeyword', + + range: [21, 24], + loc: { + start: { column: 21, line: 1 }, + end: { column: 24, line: 1 }, + }, + }, + + range: [19, 24], + loc: { + start: { column: 19, line: 1 }, + end: { column: 24, line: 1 }, + }, + }, + + range: [12, 24], + loc: { + start: { column: 12, line: 1 }, + end: { column: 24, line: 1 }, + }, + }, + init: null, + + range: [12, 24], + loc: { + start: { column: 12, line: 1 }, + end: { column: 24, line: 1 }, + }, + }, + ], + declare: true, + kind: 'let', + + range: [0, 25], + loc: { + start: { column: 0, line: 1 }, + end: { column: 25, line: 1 }, + }, + }, + ], + sourceType: 'script', + + range: [0, 26], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 2 }, + }, + }" +`; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare-let-destructure-type-no-init/snapshots/6-AST-Alignment-Tokens.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare-let-destructure-type-no-init/snapshots/6-AST-Alignment-Tokens.shot new file mode 100644 index 000000000000..366f08dc0cc5 --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare-let-destructure-type-no-init/snapshots/6-AST-Alignment-Tokens.shot @@ -0,0 +1,92 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration VariableDeclaration declare-let-destructure-type-no-init AST Alignment - Token 1`] = ` +"Snapshot Diff: +- TSESTree ++ Babel + + Array [ + Identifier { + type: 'Identifier', + value: 'declare', + + range: [0, 7], + loc: { + start: { column: 0, line: 1 }, + end: { column: 7, line: 1 }, + }, + }, +- Keyword { +- type: 'Keyword', ++ Identifier { ++ type: 'Identifier', + value: 'let', + + range: [8, 11], + loc: { + start: { column: 8, line: 1 }, + end: { column: 11, line: 1 }, + }, + }, + Punctuator { + type: 'Punctuator', + value: '{', + + range: [12, 13], + loc: { + start: { column: 12, line: 1 }, + end: { column: 13, line: 1 }, + }, + }, + Identifier { + type: 'Identifier', + value: 'foo', + + range: [14, 17], + loc: { + start: { column: 14, line: 1 }, + end: { column: 17, line: 1 }, + }, + }, + Punctuator { + type: 'Punctuator', + value: '}', + + range: [18, 19], + loc: { + start: { column: 18, line: 1 }, + end: { column: 19, line: 1 }, + }, + }, + Punctuator { + type: 'Punctuator', + value: ':', + + range: [19, 20], + loc: { + start: { column: 19, line: 1 }, + end: { column: 20, line: 1 }, + }, + }, + Identifier { + type: 'Identifier', + value: 'any', + + range: [21, 24], + loc: { + start: { column: 21, line: 1 }, + end: { column: 24, line: 1 }, + }, + }, + Punctuator { + type: 'Punctuator', + value: ';', + + range: [24, 25], + loc: { + start: { column: 24, line: 1 }, + end: { column: 25, line: 1 }, + }, + }, + ]" +`; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare-let-id-no-init/fixture.ts b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare-let-id-no-init/fixture.ts new file mode 100644 index 000000000000..e67c0e31ebfe --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare-let-id-no-init/fixture.ts @@ -0,0 +1 @@ +declare let foo; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare-let-id-no-init/snapshots/1-TSESTree-AST.shot similarity index 70% rename from packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare/snapshots/1-TSESTree-AST.shot rename to packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare-let-id-no-init/snapshots/1-TSESTree-AST.shot index a60c9f86f53b..1d18d4d86907 100644 --- a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare-let-id-no-init/snapshots/1-TSESTree-AST.shot @@ -1,6 +1,6 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`AST Fixtures declaration VariableDeclaration declare TSESTree - AST 1`] = ` +exports[`AST Fixtures declaration VariableDeclaration declare-let-id-no-init TSESTree - AST 1`] = ` Program { type: "Program", body: [ @@ -13,37 +13,37 @@ Program { id: Identifier { type: "Identifier", decorators: [], - name: "x", + name: "foo", optional: false, - range: [12, 13], + range: [12, 15], loc: { start: { column: 12, line: 1 }, - end: { column: 13, line: 1 }, + end: { column: 15, line: 1 }, }, }, init: null, - range: [12, 13], + range: [12, 15], loc: { start: { column: 12, line: 1 }, - end: { column: 13, line: 1 }, + end: { column: 15, line: 1 }, }, }, ], declare: true, kind: "let", - range: [0, 14], + range: [0, 16], loc: { start: { column: 0, line: 1 }, - end: { column: 14, line: 1 }, + end: { column: 16, line: 1 }, }, }, ], sourceType: "script", - range: [0, 15], + range: [0, 17], loc: { start: { column: 0, line: 1 }, end: { column: 0, line: 2 }, diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare/snapshots/2-TSESTree-Tokens.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare-let-id-no-init/snapshots/2-TSESTree-Tokens.shot similarity index 67% rename from packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare/snapshots/2-TSESTree-Tokens.shot rename to packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare-let-id-no-init/snapshots/2-TSESTree-Tokens.shot index 730c761d4df8..b4cd26797553 100644 --- a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare/snapshots/2-TSESTree-Tokens.shot +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare-let-id-no-init/snapshots/2-TSESTree-Tokens.shot @@ -1,6 +1,6 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`AST Fixtures declaration VariableDeclaration declare TSESTree - Tokens 1`] = ` +exports[`AST Fixtures declaration VariableDeclaration declare-let-id-no-init TSESTree - Tokens 1`] = ` [ Identifier { type: "Identifier", @@ -24,22 +24,22 @@ exports[`AST Fixtures declaration VariableDeclaration declare TSESTree - Tokens }, Identifier { type: "Identifier", - value: "x", + value: "foo", - range: [12, 13], + range: [12, 15], loc: { start: { column: 12, line: 1 }, - end: { column: 13, line: 1 }, + end: { column: 15, line: 1 }, }, }, Punctuator { type: "Punctuator", value: ";", - range: [13, 14], + range: [15, 16], loc: { - start: { column: 13, line: 1 }, - end: { column: 14, line: 1 }, + start: { column: 15, line: 1 }, + end: { column: 16, line: 1 }, }, }, ] diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare/snapshots/3-Babel-AST.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare-let-id-no-init/snapshots/3-Babel-AST.shot similarity index 68% rename from packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare/snapshots/3-Babel-AST.shot rename to packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare-let-id-no-init/snapshots/3-Babel-AST.shot index 062fe8efa697..fbd26ca17a1b 100644 --- a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare/snapshots/3-Babel-AST.shot +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare-let-id-no-init/snapshots/3-Babel-AST.shot @@ -1,6 +1,6 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`AST Fixtures declaration VariableDeclaration declare Babel - AST 1`] = ` +exports[`AST Fixtures declaration VariableDeclaration declare-let-id-no-init Babel - AST 1`] = ` Program { type: "Program", body: [ @@ -11,36 +11,36 @@ Program { type: "VariableDeclarator", id: Identifier { type: "Identifier", - name: "x", + name: "foo", - range: [12, 13], + range: [12, 15], loc: { start: { column: 12, line: 1 }, - end: { column: 13, line: 1 }, + end: { column: 15, line: 1 }, }, }, init: null, - range: [12, 13], + range: [12, 15], loc: { start: { column: 12, line: 1 }, - end: { column: 13, line: 1 }, + end: { column: 15, line: 1 }, }, }, ], declare: true, kind: "let", - range: [0, 14], + range: [0, 16], loc: { start: { column: 0, line: 1 }, - end: { column: 14, line: 1 }, + end: { column: 16, line: 1 }, }, }, ], sourceType: "script", - range: [0, 15], + range: [0, 17], loc: { start: { column: 0, line: 1 }, end: { column: 0, line: 2 }, diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare/snapshots/4-Babel-Tokens.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare-let-id-no-init/snapshots/4-Babel-Tokens.shot similarity index 68% rename from packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare/snapshots/4-Babel-Tokens.shot rename to packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare-let-id-no-init/snapshots/4-Babel-Tokens.shot index 5696efd1c50d..b0f99a022bb6 100644 --- a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare/snapshots/4-Babel-Tokens.shot +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare-let-id-no-init/snapshots/4-Babel-Tokens.shot @@ -1,6 +1,6 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`AST Fixtures declaration VariableDeclaration declare Babel - Tokens 1`] = ` +exports[`AST Fixtures declaration VariableDeclaration declare-let-id-no-init Babel - Tokens 1`] = ` [ Identifier { type: "Identifier", @@ -24,22 +24,22 @@ exports[`AST Fixtures declaration VariableDeclaration declare Babel - Tokens 1`] }, Identifier { type: "Identifier", - value: "x", + value: "foo", - range: [12, 13], + range: [12, 15], loc: { start: { column: 12, line: 1 }, - end: { column: 13, line: 1 }, + end: { column: 15, line: 1 }, }, }, Punctuator { type: "Punctuator", value: ";", - range: [13, 14], + range: [15, 16], loc: { - start: { column: 13, line: 1 }, - end: { column: 14, line: 1 }, + start: { column: 15, line: 1 }, + end: { column: 16, line: 1 }, }, }, ] diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare-let-id-no-init/snapshots/5-AST-Alignment-AST.shot similarity index 71% rename from packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare/snapshots/5-AST-Alignment-AST.shot rename to packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare-let-id-no-init/snapshots/5-AST-Alignment-AST.shot index 87e680ef9a28..af12a428f069 100644 --- a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare-let-id-no-init/snapshots/5-AST-Alignment-AST.shot @@ -1,6 +1,6 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`AST Fixtures declaration VariableDeclaration declare AST Alignment - AST 1`] = ` +exports[`AST Fixtures declaration VariableDeclaration declare-let-id-no-init AST Alignment - AST 1`] = ` "Snapshot Diff: - TSESTree + Babel @@ -17,37 +17,37 @@ exports[`AST Fixtures declaration VariableDeclaration declare AST Alignment - AS id: Identifier { type: 'Identifier', - decorators: Array [], - name: 'x', + name: 'foo', - optional: false, - range: [12, 13], + range: [12, 15], loc: { start: { column: 12, line: 1 }, - end: { column: 13, line: 1 }, + end: { column: 15, line: 1 }, }, }, init: null, - range: [12, 13], + range: [12, 15], loc: { start: { column: 12, line: 1 }, - end: { column: 13, line: 1 }, + end: { column: 15, line: 1 }, }, }, ], declare: true, kind: 'let', - range: [0, 14], + range: [0, 16], loc: { start: { column: 0, line: 1 }, - end: { column: 14, line: 1 }, + end: { column: 16, line: 1 }, }, }, ], sourceType: 'script', - range: [0, 15], + range: [0, 17], loc: { start: { column: 0, line: 1 }, end: { column: 0, line: 2 }, diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare/snapshots/6-AST-Alignment-Tokens.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare-let-id-no-init/snapshots/6-AST-Alignment-Tokens.shot similarity index 71% rename from packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare/snapshots/6-AST-Alignment-Tokens.shot rename to packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare-let-id-no-init/snapshots/6-AST-Alignment-Tokens.shot index 6d4eee5276a1..86a813deab04 100644 --- a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare/snapshots/6-AST-Alignment-Tokens.shot +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare-let-id-no-init/snapshots/6-AST-Alignment-Tokens.shot @@ -1,6 +1,6 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`AST Fixtures declaration VariableDeclaration declare AST Alignment - Token 1`] = ` +exports[`AST Fixtures declaration VariableDeclaration declare-let-id-no-init AST Alignment - Token 1`] = ` "Snapshot Diff: - TSESTree + Babel @@ -30,22 +30,22 @@ exports[`AST Fixtures declaration VariableDeclaration declare AST Alignment - To }, Identifier { type: 'Identifier', - value: 'x', + value: 'foo', - range: [12, 13], + range: [12, 15], loc: { start: { column: 12, line: 1 }, - end: { column: 13, line: 1 }, + end: { column: 15, line: 1 }, }, }, Punctuator { type: 'Punctuator', value: ';', - range: [13, 14], + range: [15, 16], loc: { - start: { column: 13, line: 1 }, - end: { column: 14, line: 1 }, + start: { column: 15, line: 1 }, + end: { column: 16, line: 1 }, }, }, ]" diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare-let-id-type-no-init/fixture.ts b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare-let-id-type-no-init/fixture.ts new file mode 100644 index 000000000000..d45efcc1098a --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare-let-id-type-no-init/fixture.ts @@ -0,0 +1 @@ +declare let foo: any; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare-let-id-type-no-init/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare-let-id-type-no-init/snapshots/1-TSESTree-AST.shot new file mode 100644 index 000000000000..fa56900bbcf2 --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare-let-id-type-no-init/snapshots/1-TSESTree-AST.shot @@ -0,0 +1,70 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration VariableDeclaration declare-let-id-type-no-init TSESTree - AST 1`] = ` +Program { + type: "Program", + body: [ + VariableDeclaration { + type: "VariableDeclaration", + declarations: [ + VariableDeclarator { + type: "VariableDeclarator", + definite: false, + id: Identifier { + type: "Identifier", + decorators: [], + name: "foo", + optional: false, + typeAnnotation: TSTypeAnnotation { + type: "TSTypeAnnotation", + typeAnnotation: TSAnyKeyword { + type: "TSAnyKeyword", + + range: [17, 20], + loc: { + start: { column: 17, line: 1 }, + end: { column: 20, line: 1 }, + }, + }, + + range: [15, 20], + loc: { + start: { column: 15, line: 1 }, + end: { column: 20, line: 1 }, + }, + }, + + range: [12, 20], + loc: { + start: { column: 12, line: 1 }, + end: { column: 20, line: 1 }, + }, + }, + init: null, + + range: [12, 20], + loc: { + start: { column: 12, line: 1 }, + end: { column: 20, line: 1 }, + }, + }, + ], + declare: true, + kind: "let", + + range: [0, 21], + loc: { + start: { column: 0, line: 1 }, + end: { column: 21, line: 1 }, + }, + }, + ], + sourceType: "script", + + range: [0, 22], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 2 }, + }, +} +`; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare-let-id-type-no-init/snapshots/2-TSESTree-Tokens.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare-let-id-type-no-init/snapshots/2-TSESTree-Tokens.shot new file mode 100644 index 000000000000..bc19e4a7f17e --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare-let-id-type-no-init/snapshots/2-TSESTree-Tokens.shot @@ -0,0 +1,66 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration VariableDeclaration declare-let-id-type-no-init TSESTree - Tokens 1`] = ` +[ + Identifier { + type: "Identifier", + value: "declare", + + range: [0, 7], + loc: { + start: { column: 0, line: 1 }, + end: { column: 7, line: 1 }, + }, + }, + Keyword { + type: "Keyword", + value: "let", + + range: [8, 11], + loc: { + start: { column: 8, line: 1 }, + end: { column: 11, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "foo", + + range: [12, 15], + loc: { + start: { column: 12, line: 1 }, + end: { column: 15, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ":", + + range: [15, 16], + loc: { + start: { column: 15, line: 1 }, + end: { column: 16, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "any", + + range: [17, 20], + loc: { + start: { column: 17, line: 1 }, + end: { column: 20, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ";", + + range: [20, 21], + loc: { + start: { column: 20, line: 1 }, + end: { column: 21, line: 1 }, + }, + }, +] +`; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare-let-id-type-no-init/snapshots/3-Babel-AST.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare-let-id-type-no-init/snapshots/3-Babel-AST.shot new file mode 100644 index 000000000000..e9f8ea7c4f0a --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare-let-id-type-no-init/snapshots/3-Babel-AST.shot @@ -0,0 +1,67 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration VariableDeclaration declare-let-id-type-no-init Babel - AST 1`] = ` +Program { + type: "Program", + body: [ + VariableDeclaration { + type: "VariableDeclaration", + declarations: [ + VariableDeclarator { + type: "VariableDeclarator", + id: Identifier { + type: "Identifier", + name: "foo", + typeAnnotation: TSTypeAnnotation { + type: "TSTypeAnnotation", + typeAnnotation: TSAnyKeyword { + type: "TSAnyKeyword", + + range: [17, 20], + loc: { + start: { column: 17, line: 1 }, + end: { column: 20, line: 1 }, + }, + }, + + range: [15, 20], + loc: { + start: { column: 15, line: 1 }, + end: { column: 20, line: 1 }, + }, + }, + + range: [12, 20], + loc: { + start: { column: 12, line: 1 }, + end: { column: 20, line: 1 }, + }, + }, + init: null, + + range: [12, 20], + loc: { + start: { column: 12, line: 1 }, + end: { column: 20, line: 1 }, + }, + }, + ], + declare: true, + kind: "let", + + range: [0, 21], + loc: { + start: { column: 0, line: 1 }, + end: { column: 21, line: 1 }, + }, + }, + ], + sourceType: "script", + + range: [0, 22], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 2 }, + }, +} +`; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare-let-id-type-no-init/snapshots/4-Babel-Tokens.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare-let-id-type-no-init/snapshots/4-Babel-Tokens.shot new file mode 100644 index 000000000000..20b17025e121 --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare-let-id-type-no-init/snapshots/4-Babel-Tokens.shot @@ -0,0 +1,66 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration VariableDeclaration declare-let-id-type-no-init Babel - Tokens 1`] = ` +[ + Identifier { + type: "Identifier", + value: "declare", + + range: [0, 7], + loc: { + start: { column: 0, line: 1 }, + end: { column: 7, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "let", + + range: [8, 11], + loc: { + start: { column: 8, line: 1 }, + end: { column: 11, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "foo", + + range: [12, 15], + loc: { + start: { column: 12, line: 1 }, + end: { column: 15, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ":", + + range: [15, 16], + loc: { + start: { column: 15, line: 1 }, + end: { column: 16, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "any", + + range: [17, 20], + loc: { + start: { column: 17, line: 1 }, + end: { column: 20, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ";", + + range: [20, 21], + loc: { + start: { column: 20, line: 1 }, + end: { column: 21, line: 1 }, + }, + }, +] +`; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare-let-id-type-no-init/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare-let-id-type-no-init/snapshots/5-AST-Alignment-AST.shot new file mode 100644 index 000000000000..82f3a6a1dbec --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare-let-id-type-no-init/snapshots/5-AST-Alignment-AST.shot @@ -0,0 +1,74 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration VariableDeclaration declare-let-id-type-no-init AST Alignment - AST 1`] = ` +"Snapshot Diff: +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + VariableDeclaration { + type: 'VariableDeclaration', + declarations: Array [ + VariableDeclarator { + type: 'VariableDeclarator', +- definite: false, + id: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'foo', +- optional: false, + typeAnnotation: TSTypeAnnotation { + type: 'TSTypeAnnotation', + typeAnnotation: TSAnyKeyword { + type: 'TSAnyKeyword', + + range: [17, 20], + loc: { + start: { column: 17, line: 1 }, + end: { column: 20, line: 1 }, + }, + }, + + range: [15, 20], + loc: { + start: { column: 15, line: 1 }, + end: { column: 20, line: 1 }, + }, + }, + + range: [12, 20], + loc: { + start: { column: 12, line: 1 }, + end: { column: 20, line: 1 }, + }, + }, + init: null, + + range: [12, 20], + loc: { + start: { column: 12, line: 1 }, + end: { column: 20, line: 1 }, + }, + }, + ], + declare: true, + kind: 'let', + + range: [0, 21], + loc: { + start: { column: 0, line: 1 }, + end: { column: 21, line: 1 }, + }, + }, + ], + sourceType: 'script', + + range: [0, 22], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 2 }, + }, + }" +`; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare-let-id-type-no-init/snapshots/6-AST-Alignment-Tokens.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare-let-id-type-no-init/snapshots/6-AST-Alignment-Tokens.shot new file mode 100644 index 000000000000..555d63c0e800 --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare-let-id-type-no-init/snapshots/6-AST-Alignment-Tokens.shot @@ -0,0 +1,72 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration VariableDeclaration declare-let-id-type-no-init AST Alignment - Token 1`] = ` +"Snapshot Diff: +- TSESTree ++ Babel + + Array [ + Identifier { + type: 'Identifier', + value: 'declare', + + range: [0, 7], + loc: { + start: { column: 0, line: 1 }, + end: { column: 7, line: 1 }, + }, + }, +- Keyword { +- type: 'Keyword', ++ Identifier { ++ type: 'Identifier', + value: 'let', + + range: [8, 11], + loc: { + start: { column: 8, line: 1 }, + end: { column: 11, line: 1 }, + }, + }, + Identifier { + type: 'Identifier', + value: 'foo', + + range: [12, 15], + loc: { + start: { column: 12, line: 1 }, + end: { column: 15, line: 1 }, + }, + }, + Punctuator { + type: 'Punctuator', + value: ':', + + range: [15, 16], + loc: { + start: { column: 15, line: 1 }, + end: { column: 16, line: 1 }, + }, + }, + Identifier { + type: 'Identifier', + value: 'any', + + range: [17, 20], + loc: { + start: { column: 17, line: 1 }, + end: { column: 20, line: 1 }, + }, + }, + Punctuator { + type: 'Punctuator', + value: ';', + + range: [20, 21], + loc: { + start: { column: 20, line: 1 }, + end: { column: 21, line: 1 }, + }, + }, + ]" +`; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare-var-destructure-no-init/fixture.ts b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare-var-destructure-no-init/fixture.ts new file mode 100644 index 000000000000..624424232488 --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare-var-destructure-no-init/fixture.ts @@ -0,0 +1 @@ +declare var { foo }; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare-var-destructure-no-init/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare-var-destructure-no-init/snapshots/1-TSESTree-AST.shot new file mode 100644 index 000000000000..c0b3e46d5e82 --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare-var-destructure-no-init/snapshots/1-TSESTree-AST.shot @@ -0,0 +1,91 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration VariableDeclaration declare-var-destructure-no-init TSESTree - AST 1`] = ` +Program { + type: "Program", + body: [ + VariableDeclaration { + type: "VariableDeclaration", + declarations: [ + VariableDeclarator { + type: "VariableDeclarator", + definite: false, + id: ObjectPattern { + type: "ObjectPattern", + decorators: [], + optional: false, + properties: [ + Property { + type: "Property", + computed: false, + key: Identifier { + type: "Identifier", + decorators: [], + name: "foo", + optional: false, + + range: [14, 17], + loc: { + start: { column: 14, line: 1 }, + end: { column: 17, line: 1 }, + }, + }, + kind: "init", + method: false, + optional: false, + shorthand: true, + value: Identifier { + type: "Identifier", + decorators: [], + name: "foo", + optional: false, + + range: [14, 17], + loc: { + start: { column: 14, line: 1 }, + end: { column: 17, line: 1 }, + }, + }, + + range: [14, 17], + loc: { + start: { column: 14, line: 1 }, + end: { column: 17, line: 1 }, + }, + }, + ], + + range: [12, 19], + loc: { + start: { column: 12, line: 1 }, + end: { column: 19, line: 1 }, + }, + }, + init: null, + + range: [12, 19], + loc: { + start: { column: 12, line: 1 }, + end: { column: 19, line: 1 }, + }, + }, + ], + declare: true, + kind: "var", + + range: [0, 20], + loc: { + start: { column: 0, line: 1 }, + end: { column: 20, line: 1 }, + }, + }, + ], + sourceType: "script", + + range: [0, 21], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 2 }, + }, +} +`; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare-var-destructure-no-init/snapshots/2-TSESTree-Tokens.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare-var-destructure-no-init/snapshots/2-TSESTree-Tokens.shot new file mode 100644 index 000000000000..a3cd0f1d1c2e --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare-var-destructure-no-init/snapshots/2-TSESTree-Tokens.shot @@ -0,0 +1,66 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration VariableDeclaration declare-var-destructure-no-init TSESTree - Tokens 1`] = ` +[ + Identifier { + type: "Identifier", + value: "declare", + + range: [0, 7], + loc: { + start: { column: 0, line: 1 }, + end: { column: 7, line: 1 }, + }, + }, + Keyword { + type: "Keyword", + value: "var", + + range: [8, 11], + loc: { + start: { column: 8, line: 1 }, + end: { column: 11, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "{", + + range: [12, 13], + loc: { + start: { column: 12, line: 1 }, + end: { column: 13, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "foo", + + range: [14, 17], + loc: { + start: { column: 14, line: 1 }, + end: { column: 17, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "}", + + range: [18, 19], + loc: { + start: { column: 18, line: 1 }, + end: { column: 19, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ";", + + range: [19, 20], + loc: { + start: { column: 19, line: 1 }, + end: { column: 20, line: 1 }, + }, + }, +] +`; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare-var-destructure-no-init/snapshots/3-Babel-AST.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare-var-destructure-no-init/snapshots/3-Babel-AST.shot new file mode 100644 index 000000000000..45bfbfa8c9e9 --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare-var-destructure-no-init/snapshots/3-Babel-AST.shot @@ -0,0 +1,83 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration VariableDeclaration declare-var-destructure-no-init Babel - AST 1`] = ` +Program { + type: "Program", + body: [ + VariableDeclaration { + type: "VariableDeclaration", + declarations: [ + VariableDeclarator { + type: "VariableDeclarator", + id: ObjectPattern { + type: "ObjectPattern", + properties: [ + Property { + type: "Property", + computed: false, + key: Identifier { + type: "Identifier", + name: "foo", + + range: [14, 17], + loc: { + start: { column: 14, line: 1 }, + end: { column: 17, line: 1 }, + }, + }, + kind: "init", + method: false, + shorthand: true, + value: Identifier { + type: "Identifier", + name: "foo", + + range: [14, 17], + loc: { + start: { column: 14, line: 1 }, + end: { column: 17, line: 1 }, + }, + }, + + range: [14, 17], + loc: { + start: { column: 14, line: 1 }, + end: { column: 17, line: 1 }, + }, + }, + ], + + range: [12, 19], + loc: { + start: { column: 12, line: 1 }, + end: { column: 19, line: 1 }, + }, + }, + init: null, + + range: [12, 19], + loc: { + start: { column: 12, line: 1 }, + end: { column: 19, line: 1 }, + }, + }, + ], + declare: true, + kind: "var", + + range: [0, 20], + loc: { + start: { column: 0, line: 1 }, + end: { column: 20, line: 1 }, + }, + }, + ], + sourceType: "script", + + range: [0, 21], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 2 }, + }, +} +`; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare-var-destructure-no-init/snapshots/4-Babel-Tokens.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare-var-destructure-no-init/snapshots/4-Babel-Tokens.shot new file mode 100644 index 000000000000..31a31612c996 --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare-var-destructure-no-init/snapshots/4-Babel-Tokens.shot @@ -0,0 +1,66 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration VariableDeclaration declare-var-destructure-no-init Babel - Tokens 1`] = ` +[ + Identifier { + type: "Identifier", + value: "declare", + + range: [0, 7], + loc: { + start: { column: 0, line: 1 }, + end: { column: 7, line: 1 }, + }, + }, + Keyword { + type: "Keyword", + value: "var", + + range: [8, 11], + loc: { + start: { column: 8, line: 1 }, + end: { column: 11, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "{", + + range: [12, 13], + loc: { + start: { column: 12, line: 1 }, + end: { column: 13, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "foo", + + range: [14, 17], + loc: { + start: { column: 14, line: 1 }, + end: { column: 17, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "}", + + range: [18, 19], + loc: { + start: { column: 18, line: 1 }, + end: { column: 19, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ";", + + range: [19, 20], + loc: { + start: { column: 19, line: 1 }, + end: { column: 20, line: 1 }, + }, + }, +] +`; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare-var-destructure-no-init/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare-var-destructure-no-init/snapshots/5-AST-Alignment-AST.shot new file mode 100644 index 000000000000..e2c7066a5953 --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare-var-destructure-no-init/snapshots/5-AST-Alignment-AST.shot @@ -0,0 +1,95 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration VariableDeclaration declare-var-destructure-no-init AST Alignment - AST 1`] = ` +"Snapshot Diff: +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + VariableDeclaration { + type: 'VariableDeclaration', + declarations: Array [ + VariableDeclarator { + type: 'VariableDeclarator', +- definite: false, + id: ObjectPattern { + type: 'ObjectPattern', +- decorators: Array [], +- optional: false, + properties: Array [ + Property { + type: 'Property', + computed: false, + key: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'foo', +- optional: false, + + range: [14, 17], + loc: { + start: { column: 14, line: 1 }, + end: { column: 17, line: 1 }, + }, + }, + kind: 'init', + method: false, +- optional: false, + shorthand: true, + value: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'foo', +- optional: false, + + range: [14, 17], + loc: { + start: { column: 14, line: 1 }, + end: { column: 17, line: 1 }, + }, + }, + + range: [14, 17], + loc: { + start: { column: 14, line: 1 }, + end: { column: 17, line: 1 }, + }, + }, + ], + + range: [12, 19], + loc: { + start: { column: 12, line: 1 }, + end: { column: 19, line: 1 }, + }, + }, + init: null, + + range: [12, 19], + loc: { + start: { column: 12, line: 1 }, + end: { column: 19, line: 1 }, + }, + }, + ], + declare: true, + kind: 'var', + + range: [0, 20], + loc: { + start: { column: 0, line: 1 }, + end: { column: 20, line: 1 }, + }, + }, + ], + sourceType: 'script', + + range: [0, 21], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 2 }, + }, + }" +`; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare-var-destructure-no-init/snapshots/6-AST-Alignment-Tokens.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare-var-destructure-no-init/snapshots/6-AST-Alignment-Tokens.shot new file mode 100644 index 000000000000..b00432d83356 --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare-var-destructure-no-init/snapshots/6-AST-Alignment-Tokens.shot @@ -0,0 +1,6 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration VariableDeclaration declare-var-destructure-no-init AST Alignment - Token 1`] = ` +"Snapshot Diff: +Compared values have no visual difference." +`; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare-var-destructure-type-no-init/fixture.ts b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare-var-destructure-type-no-init/fixture.ts new file mode 100644 index 000000000000..70df9f8f5cce --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare-var-destructure-type-no-init/fixture.ts @@ -0,0 +1 @@ +declare var { foo }: any; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare-var-destructure-type-no-init/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare-var-destructure-type-no-init/snapshots/1-TSESTree-AST.shot new file mode 100644 index 000000000000..e2ab98b32afd --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare-var-destructure-type-no-init/snapshots/1-TSESTree-AST.shot @@ -0,0 +1,109 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration VariableDeclaration declare-var-destructure-type-no-init TSESTree - AST 1`] = ` +Program { + type: "Program", + body: [ + VariableDeclaration { + type: "VariableDeclaration", + declarations: [ + VariableDeclarator { + type: "VariableDeclarator", + definite: false, + id: ObjectPattern { + type: "ObjectPattern", + decorators: [], + optional: false, + properties: [ + Property { + type: "Property", + computed: false, + key: Identifier { + type: "Identifier", + decorators: [], + name: "foo", + optional: false, + + range: [14, 17], + loc: { + start: { column: 14, line: 1 }, + end: { column: 17, line: 1 }, + }, + }, + kind: "init", + method: false, + optional: false, + shorthand: true, + value: Identifier { + type: "Identifier", + decorators: [], + name: "foo", + optional: false, + + range: [14, 17], + loc: { + start: { column: 14, line: 1 }, + end: { column: 17, line: 1 }, + }, + }, + + range: [14, 17], + loc: { + start: { column: 14, line: 1 }, + end: { column: 17, line: 1 }, + }, + }, + ], + typeAnnotation: TSTypeAnnotation { + type: "TSTypeAnnotation", + typeAnnotation: TSAnyKeyword { + type: "TSAnyKeyword", + + range: [21, 24], + loc: { + start: { column: 21, line: 1 }, + end: { column: 24, line: 1 }, + }, + }, + + range: [19, 24], + loc: { + start: { column: 19, line: 1 }, + end: { column: 24, line: 1 }, + }, + }, + + range: [12, 24], + loc: { + start: { column: 12, line: 1 }, + end: { column: 24, line: 1 }, + }, + }, + init: null, + + range: [12, 24], + loc: { + start: { column: 12, line: 1 }, + end: { column: 24, line: 1 }, + }, + }, + ], + declare: true, + kind: "var", + + range: [0, 25], + loc: { + start: { column: 0, line: 1 }, + end: { column: 25, line: 1 }, + }, + }, + ], + sourceType: "script", + + range: [0, 26], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 2 }, + }, +} +`; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare-var-destructure-type-no-init/snapshots/2-TSESTree-Tokens.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare-var-destructure-type-no-init/snapshots/2-TSESTree-Tokens.shot new file mode 100644 index 000000000000..9f24707a90b6 --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare-var-destructure-type-no-init/snapshots/2-TSESTree-Tokens.shot @@ -0,0 +1,86 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration VariableDeclaration declare-var-destructure-type-no-init TSESTree - Tokens 1`] = ` +[ + Identifier { + type: "Identifier", + value: "declare", + + range: [0, 7], + loc: { + start: { column: 0, line: 1 }, + end: { column: 7, line: 1 }, + }, + }, + Keyword { + type: "Keyword", + value: "var", + + range: [8, 11], + loc: { + start: { column: 8, line: 1 }, + end: { column: 11, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "{", + + range: [12, 13], + loc: { + start: { column: 12, line: 1 }, + end: { column: 13, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "foo", + + range: [14, 17], + loc: { + start: { column: 14, line: 1 }, + end: { column: 17, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "}", + + range: [18, 19], + loc: { + start: { column: 18, line: 1 }, + end: { column: 19, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ":", + + range: [19, 20], + loc: { + start: { column: 19, line: 1 }, + end: { column: 20, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "any", + + range: [21, 24], + loc: { + start: { column: 21, line: 1 }, + end: { column: 24, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ";", + + range: [24, 25], + loc: { + start: { column: 24, line: 1 }, + end: { column: 25, line: 1 }, + }, + }, +] +`; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare-var-destructure-type-no-init/snapshots/3-Babel-AST.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare-var-destructure-type-no-init/snapshots/3-Babel-AST.shot new file mode 100644 index 000000000000..7e7b68a0c004 --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare-var-destructure-type-no-init/snapshots/3-Babel-AST.shot @@ -0,0 +1,101 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration VariableDeclaration declare-var-destructure-type-no-init Babel - AST 1`] = ` +Program { + type: "Program", + body: [ + VariableDeclaration { + type: "VariableDeclaration", + declarations: [ + VariableDeclarator { + type: "VariableDeclarator", + id: ObjectPattern { + type: "ObjectPattern", + properties: [ + Property { + type: "Property", + computed: false, + key: Identifier { + type: "Identifier", + name: "foo", + + range: [14, 17], + loc: { + start: { column: 14, line: 1 }, + end: { column: 17, line: 1 }, + }, + }, + kind: "init", + method: false, + shorthand: true, + value: Identifier { + type: "Identifier", + name: "foo", + + range: [14, 17], + loc: { + start: { column: 14, line: 1 }, + end: { column: 17, line: 1 }, + }, + }, + + range: [14, 17], + loc: { + start: { column: 14, line: 1 }, + end: { column: 17, line: 1 }, + }, + }, + ], + typeAnnotation: TSTypeAnnotation { + type: "TSTypeAnnotation", + typeAnnotation: TSAnyKeyword { + type: "TSAnyKeyword", + + range: [21, 24], + loc: { + start: { column: 21, line: 1 }, + end: { column: 24, line: 1 }, + }, + }, + + range: [19, 24], + loc: { + start: { column: 19, line: 1 }, + end: { column: 24, line: 1 }, + }, + }, + + range: [12, 24], + loc: { + start: { column: 12, line: 1 }, + end: { column: 24, line: 1 }, + }, + }, + init: null, + + range: [12, 24], + loc: { + start: { column: 12, line: 1 }, + end: { column: 24, line: 1 }, + }, + }, + ], + declare: true, + kind: "var", + + range: [0, 25], + loc: { + start: { column: 0, line: 1 }, + end: { column: 25, line: 1 }, + }, + }, + ], + sourceType: "script", + + range: [0, 26], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 2 }, + }, +} +`; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare-var-destructure-type-no-init/snapshots/4-Babel-Tokens.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare-var-destructure-type-no-init/snapshots/4-Babel-Tokens.shot new file mode 100644 index 000000000000..ee46c0c3d865 --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare-var-destructure-type-no-init/snapshots/4-Babel-Tokens.shot @@ -0,0 +1,86 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration VariableDeclaration declare-var-destructure-type-no-init Babel - Tokens 1`] = ` +[ + Identifier { + type: "Identifier", + value: "declare", + + range: [0, 7], + loc: { + start: { column: 0, line: 1 }, + end: { column: 7, line: 1 }, + }, + }, + Keyword { + type: "Keyword", + value: "var", + + range: [8, 11], + loc: { + start: { column: 8, line: 1 }, + end: { column: 11, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "{", + + range: [12, 13], + loc: { + start: { column: 12, line: 1 }, + end: { column: 13, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "foo", + + range: [14, 17], + loc: { + start: { column: 14, line: 1 }, + end: { column: 17, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "}", + + range: [18, 19], + loc: { + start: { column: 18, line: 1 }, + end: { column: 19, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ":", + + range: [19, 20], + loc: { + start: { column: 19, line: 1 }, + end: { column: 20, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "any", + + range: [21, 24], + loc: { + start: { column: 21, line: 1 }, + end: { column: 24, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ";", + + range: [24, 25], + loc: { + start: { column: 24, line: 1 }, + end: { column: 25, line: 1 }, + }, + }, +] +`; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare-var-destructure-type-no-init/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare-var-destructure-type-no-init/snapshots/5-AST-Alignment-AST.shot new file mode 100644 index 000000000000..88fa4e62f229 --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare-var-destructure-type-no-init/snapshots/5-AST-Alignment-AST.shot @@ -0,0 +1,113 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration VariableDeclaration declare-var-destructure-type-no-init AST Alignment - AST 1`] = ` +"Snapshot Diff: +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + VariableDeclaration { + type: 'VariableDeclaration', + declarations: Array [ + VariableDeclarator { + type: 'VariableDeclarator', +- definite: false, + id: ObjectPattern { + type: 'ObjectPattern', +- decorators: Array [], +- optional: false, + properties: Array [ + Property { + type: 'Property', + computed: false, + key: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'foo', +- optional: false, + + range: [14, 17], + loc: { + start: { column: 14, line: 1 }, + end: { column: 17, line: 1 }, + }, + }, + kind: 'init', + method: false, +- optional: false, + shorthand: true, + value: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'foo', +- optional: false, + + range: [14, 17], + loc: { + start: { column: 14, line: 1 }, + end: { column: 17, line: 1 }, + }, + }, + + range: [14, 17], + loc: { + start: { column: 14, line: 1 }, + end: { column: 17, line: 1 }, + }, + }, + ], + typeAnnotation: TSTypeAnnotation { + type: 'TSTypeAnnotation', + typeAnnotation: TSAnyKeyword { + type: 'TSAnyKeyword', + + range: [21, 24], + loc: { + start: { column: 21, line: 1 }, + end: { column: 24, line: 1 }, + }, + }, + + range: [19, 24], + loc: { + start: { column: 19, line: 1 }, + end: { column: 24, line: 1 }, + }, + }, + + range: [12, 24], + loc: { + start: { column: 12, line: 1 }, + end: { column: 24, line: 1 }, + }, + }, + init: null, + + range: [12, 24], + loc: { + start: { column: 12, line: 1 }, + end: { column: 24, line: 1 }, + }, + }, + ], + declare: true, + kind: 'var', + + range: [0, 25], + loc: { + start: { column: 0, line: 1 }, + end: { column: 25, line: 1 }, + }, + }, + ], + sourceType: 'script', + + range: [0, 26], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 2 }, + }, + }" +`; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare-var-destructure-type-no-init/snapshots/6-AST-Alignment-Tokens.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare-var-destructure-type-no-init/snapshots/6-AST-Alignment-Tokens.shot new file mode 100644 index 000000000000..1511793f17f5 --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare-var-destructure-type-no-init/snapshots/6-AST-Alignment-Tokens.shot @@ -0,0 +1,6 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration VariableDeclaration declare-var-destructure-type-no-init AST Alignment - Token 1`] = ` +"Snapshot Diff: +Compared values have no visual difference." +`; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare-var-id-no-init/fixture.ts b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare-var-id-no-init/fixture.ts new file mode 100644 index 000000000000..290bd349a9ac --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare-var-id-no-init/fixture.ts @@ -0,0 +1 @@ +declare var foo; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare-var-id-no-init/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare-var-id-no-init/snapshots/1-TSESTree-AST.shot new file mode 100644 index 000000000000..a87a117bcf9e --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare-var-id-no-init/snapshots/1-TSESTree-AST.shot @@ -0,0 +1,52 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration VariableDeclaration declare-var-id-no-init TSESTree - AST 1`] = ` +Program { + type: "Program", + body: [ + VariableDeclaration { + type: "VariableDeclaration", + declarations: [ + VariableDeclarator { + type: "VariableDeclarator", + definite: false, + id: Identifier { + type: "Identifier", + decorators: [], + name: "foo", + optional: false, + + range: [12, 15], + loc: { + start: { column: 12, line: 1 }, + end: { column: 15, line: 1 }, + }, + }, + init: null, + + range: [12, 15], + loc: { + start: { column: 12, line: 1 }, + end: { column: 15, line: 1 }, + }, + }, + ], + declare: true, + kind: "var", + + range: [0, 16], + loc: { + start: { column: 0, line: 1 }, + end: { column: 16, line: 1 }, + }, + }, + ], + sourceType: "script", + + range: [0, 17], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 2 }, + }, +} +`; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare-var-id-no-init/snapshots/2-TSESTree-Tokens.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare-var-id-no-init/snapshots/2-TSESTree-Tokens.shot new file mode 100644 index 000000000000..39b42b8869ad --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare-var-id-no-init/snapshots/2-TSESTree-Tokens.shot @@ -0,0 +1,46 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration VariableDeclaration declare-var-id-no-init TSESTree - Tokens 1`] = ` +[ + Identifier { + type: "Identifier", + value: "declare", + + range: [0, 7], + loc: { + start: { column: 0, line: 1 }, + end: { column: 7, line: 1 }, + }, + }, + Keyword { + type: "Keyword", + value: "var", + + range: [8, 11], + loc: { + start: { column: 8, line: 1 }, + end: { column: 11, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "foo", + + range: [12, 15], + loc: { + start: { column: 12, line: 1 }, + end: { column: 15, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ";", + + range: [15, 16], + loc: { + start: { column: 15, line: 1 }, + end: { column: 16, line: 1 }, + }, + }, +] +`; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare-var-id-no-init/snapshots/3-Babel-AST.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare-var-id-no-init/snapshots/3-Babel-AST.shot new file mode 100644 index 000000000000..3b5e18c4be3f --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare-var-id-no-init/snapshots/3-Babel-AST.shot @@ -0,0 +1,49 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration VariableDeclaration declare-var-id-no-init Babel - AST 1`] = ` +Program { + type: "Program", + body: [ + VariableDeclaration { + type: "VariableDeclaration", + declarations: [ + VariableDeclarator { + type: "VariableDeclarator", + id: Identifier { + type: "Identifier", + name: "foo", + + range: [12, 15], + loc: { + start: { column: 12, line: 1 }, + end: { column: 15, line: 1 }, + }, + }, + init: null, + + range: [12, 15], + loc: { + start: { column: 12, line: 1 }, + end: { column: 15, line: 1 }, + }, + }, + ], + declare: true, + kind: "var", + + range: [0, 16], + loc: { + start: { column: 0, line: 1 }, + end: { column: 16, line: 1 }, + }, + }, + ], + sourceType: "script", + + range: [0, 17], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 2 }, + }, +} +`; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare-var-id-no-init/snapshots/4-Babel-Tokens.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare-var-id-no-init/snapshots/4-Babel-Tokens.shot new file mode 100644 index 000000000000..8686e0764b2d --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare-var-id-no-init/snapshots/4-Babel-Tokens.shot @@ -0,0 +1,46 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration VariableDeclaration declare-var-id-no-init Babel - Tokens 1`] = ` +[ + Identifier { + type: "Identifier", + value: "declare", + + range: [0, 7], + loc: { + start: { column: 0, line: 1 }, + end: { column: 7, line: 1 }, + }, + }, + Keyword { + type: "Keyword", + value: "var", + + range: [8, 11], + loc: { + start: { column: 8, line: 1 }, + end: { column: 11, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "foo", + + range: [12, 15], + loc: { + start: { column: 12, line: 1 }, + end: { column: 15, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ";", + + range: [15, 16], + loc: { + start: { column: 15, line: 1 }, + end: { column: 16, line: 1 }, + }, + }, +] +`; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/var-with-value/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare-var-id-no-init/snapshots/5-AST-Alignment-AST.shot similarity index 51% rename from packages/ast-spec/src/declaration/VariableDeclaration/fixtures/var-with-value/snapshots/5-AST-Alignment-AST.shot rename to packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare-var-id-no-init/snapshots/5-AST-Alignment-AST.shot index f9ec50b22b43..0c2e0f352505 100644 --- a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/var-with-value/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare-var-id-no-init/snapshots/5-AST-Alignment-AST.shot @@ -1,6 +1,6 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`AST Fixtures declaration VariableDeclaration var-with-value AST Alignment - AST 1`] = ` +exports[`AST Fixtures declaration VariableDeclaration declare-var-id-no-init AST Alignment - AST 1`] = ` "Snapshot Diff: - TSESTree + Babel @@ -17,47 +17,37 @@ exports[`AST Fixtures declaration VariableDeclaration var-with-value AST Alignme id: Identifier { type: 'Identifier', - decorators: Array [], - name: 'x', + name: 'foo', - optional: false, - range: [4, 5], + range: [12, 15], loc: { - start: { column: 4, line: 1 }, - end: { column: 5, line: 1 }, + start: { column: 12, line: 1 }, + end: { column: 15, line: 1 }, }, }, - init: Literal { - type: 'Literal', - raw: '1', - value: 1, + init: null, - range: [8, 9], - loc: { - start: { column: 8, line: 1 }, - end: { column: 9, line: 1 }, - }, - }, - - range: [4, 9], + range: [12, 15], loc: { - start: { column: 4, line: 1 }, - end: { column: 9, line: 1 }, + start: { column: 12, line: 1 }, + end: { column: 15, line: 1 }, }, }, ], -- declare: false, + declare: true, kind: 'var', - range: [0, 10], + range: [0, 16], loc: { start: { column: 0, line: 1 }, - end: { column: 10, line: 1 }, + end: { column: 16, line: 1 }, }, }, ], sourceType: 'script', - range: [0, 11], + range: [0, 17], loc: { start: { column: 0, line: 1 }, end: { column: 0, line: 2 }, diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare-var-id-no-init/snapshots/6-AST-Alignment-Tokens.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare-var-id-no-init/snapshots/6-AST-Alignment-Tokens.shot new file mode 100644 index 000000000000..96ed09c6c4e7 --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare-var-id-no-init/snapshots/6-AST-Alignment-Tokens.shot @@ -0,0 +1,6 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration VariableDeclaration declare-var-id-no-init AST Alignment - Token 1`] = ` +"Snapshot Diff: +Compared values have no visual difference." +`; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare-var-id-type-no-init/fixture.ts b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare-var-id-type-no-init/fixture.ts new file mode 100644 index 000000000000..cdb68e32b1fe --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare-var-id-type-no-init/fixture.ts @@ -0,0 +1 @@ +declare var foo: any; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare-var-id-type-no-init/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare-var-id-type-no-init/snapshots/1-TSESTree-AST.shot new file mode 100644 index 000000000000..2f59d820fc90 --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare-var-id-type-no-init/snapshots/1-TSESTree-AST.shot @@ -0,0 +1,70 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration VariableDeclaration declare-var-id-type-no-init TSESTree - AST 1`] = ` +Program { + type: "Program", + body: [ + VariableDeclaration { + type: "VariableDeclaration", + declarations: [ + VariableDeclarator { + type: "VariableDeclarator", + definite: false, + id: Identifier { + type: "Identifier", + decorators: [], + name: "foo", + optional: false, + typeAnnotation: TSTypeAnnotation { + type: "TSTypeAnnotation", + typeAnnotation: TSAnyKeyword { + type: "TSAnyKeyword", + + range: [17, 20], + loc: { + start: { column: 17, line: 1 }, + end: { column: 20, line: 1 }, + }, + }, + + range: [15, 20], + loc: { + start: { column: 15, line: 1 }, + end: { column: 20, line: 1 }, + }, + }, + + range: [12, 20], + loc: { + start: { column: 12, line: 1 }, + end: { column: 20, line: 1 }, + }, + }, + init: null, + + range: [12, 20], + loc: { + start: { column: 12, line: 1 }, + end: { column: 20, line: 1 }, + }, + }, + ], + declare: true, + kind: "var", + + range: [0, 21], + loc: { + start: { column: 0, line: 1 }, + end: { column: 21, line: 1 }, + }, + }, + ], + sourceType: "script", + + range: [0, 22], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 2 }, + }, +} +`; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare-var-id-type-no-init/snapshots/2-TSESTree-Tokens.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare-var-id-type-no-init/snapshots/2-TSESTree-Tokens.shot new file mode 100644 index 000000000000..1361a4683428 --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare-var-id-type-no-init/snapshots/2-TSESTree-Tokens.shot @@ -0,0 +1,66 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration VariableDeclaration declare-var-id-type-no-init TSESTree - Tokens 1`] = ` +[ + Identifier { + type: "Identifier", + value: "declare", + + range: [0, 7], + loc: { + start: { column: 0, line: 1 }, + end: { column: 7, line: 1 }, + }, + }, + Keyword { + type: "Keyword", + value: "var", + + range: [8, 11], + loc: { + start: { column: 8, line: 1 }, + end: { column: 11, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "foo", + + range: [12, 15], + loc: { + start: { column: 12, line: 1 }, + end: { column: 15, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ":", + + range: [15, 16], + loc: { + start: { column: 15, line: 1 }, + end: { column: 16, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "any", + + range: [17, 20], + loc: { + start: { column: 17, line: 1 }, + end: { column: 20, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ";", + + range: [20, 21], + loc: { + start: { column: 20, line: 1 }, + end: { column: 21, line: 1 }, + }, + }, +] +`; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare-var-id-type-no-init/snapshots/3-Babel-AST.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare-var-id-type-no-init/snapshots/3-Babel-AST.shot new file mode 100644 index 000000000000..9832cd12db52 --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare-var-id-type-no-init/snapshots/3-Babel-AST.shot @@ -0,0 +1,67 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration VariableDeclaration declare-var-id-type-no-init Babel - AST 1`] = ` +Program { + type: "Program", + body: [ + VariableDeclaration { + type: "VariableDeclaration", + declarations: [ + VariableDeclarator { + type: "VariableDeclarator", + id: Identifier { + type: "Identifier", + name: "foo", + typeAnnotation: TSTypeAnnotation { + type: "TSTypeAnnotation", + typeAnnotation: TSAnyKeyword { + type: "TSAnyKeyword", + + range: [17, 20], + loc: { + start: { column: 17, line: 1 }, + end: { column: 20, line: 1 }, + }, + }, + + range: [15, 20], + loc: { + start: { column: 15, line: 1 }, + end: { column: 20, line: 1 }, + }, + }, + + range: [12, 20], + loc: { + start: { column: 12, line: 1 }, + end: { column: 20, line: 1 }, + }, + }, + init: null, + + range: [12, 20], + loc: { + start: { column: 12, line: 1 }, + end: { column: 20, line: 1 }, + }, + }, + ], + declare: true, + kind: "var", + + range: [0, 21], + loc: { + start: { column: 0, line: 1 }, + end: { column: 21, line: 1 }, + }, + }, + ], + sourceType: "script", + + range: [0, 22], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 2 }, + }, +} +`; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare-var-id-type-no-init/snapshots/4-Babel-Tokens.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare-var-id-type-no-init/snapshots/4-Babel-Tokens.shot new file mode 100644 index 000000000000..4ebe598c7f79 --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare-var-id-type-no-init/snapshots/4-Babel-Tokens.shot @@ -0,0 +1,66 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration VariableDeclaration declare-var-id-type-no-init Babel - Tokens 1`] = ` +[ + Identifier { + type: "Identifier", + value: "declare", + + range: [0, 7], + loc: { + start: { column: 0, line: 1 }, + end: { column: 7, line: 1 }, + }, + }, + Keyword { + type: "Keyword", + value: "var", + + range: [8, 11], + loc: { + start: { column: 8, line: 1 }, + end: { column: 11, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "foo", + + range: [12, 15], + loc: { + start: { column: 12, line: 1 }, + end: { column: 15, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ":", + + range: [15, 16], + loc: { + start: { column: 15, line: 1 }, + end: { column: 16, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "any", + + range: [17, 20], + loc: { + start: { column: 17, line: 1 }, + end: { column: 20, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ";", + + range: [20, 21], + loc: { + start: { column: 20, line: 1 }, + end: { column: 21, line: 1 }, + }, + }, +] +`; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare-var-id-type-no-init/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare-var-id-type-no-init/snapshots/5-AST-Alignment-AST.shot new file mode 100644 index 000000000000..f586887f4408 --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare-var-id-type-no-init/snapshots/5-AST-Alignment-AST.shot @@ -0,0 +1,74 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration VariableDeclaration declare-var-id-type-no-init AST Alignment - AST 1`] = ` +"Snapshot Diff: +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + VariableDeclaration { + type: 'VariableDeclaration', + declarations: Array [ + VariableDeclarator { + type: 'VariableDeclarator', +- definite: false, + id: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'foo', +- optional: false, + typeAnnotation: TSTypeAnnotation { + type: 'TSTypeAnnotation', + typeAnnotation: TSAnyKeyword { + type: 'TSAnyKeyword', + + range: [17, 20], + loc: { + start: { column: 17, line: 1 }, + end: { column: 20, line: 1 }, + }, + }, + + range: [15, 20], + loc: { + start: { column: 15, line: 1 }, + end: { column: 20, line: 1 }, + }, + }, + + range: [12, 20], + loc: { + start: { column: 12, line: 1 }, + end: { column: 20, line: 1 }, + }, + }, + init: null, + + range: [12, 20], + loc: { + start: { column: 12, line: 1 }, + end: { column: 20, line: 1 }, + }, + }, + ], + declare: true, + kind: 'var', + + range: [0, 21], + loc: { + start: { column: 0, line: 1 }, + end: { column: 21, line: 1 }, + }, + }, + ], + sourceType: 'script', + + range: [0, 22], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 2 }, + }, + }" +`; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare-var-id-type-no-init/snapshots/6-AST-Alignment-Tokens.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare-var-id-type-no-init/snapshots/6-AST-Alignment-Tokens.shot new file mode 100644 index 000000000000..c23f93e21a8b --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare-var-id-type-no-init/snapshots/6-AST-Alignment-Tokens.shot @@ -0,0 +1,6 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration VariableDeclaration declare-var-id-type-no-init AST Alignment - Token 1`] = ` +"Snapshot Diff: +Compared values have no visual difference." +`; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare/fixture.ts b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare/fixture.ts deleted file mode 100644 index 3dc63502e9ca..000000000000 --- a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare/fixture.ts +++ /dev/null @@ -1 +0,0 @@ -declare let x; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/generate-fixtures.mjs b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/generate-fixtures.mjs new file mode 100644 index 000000000000..f5ee611deb0a --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/generate-fixtures.mjs @@ -0,0 +1,43 @@ +import fs from 'node:fs'; + +// Even when technically we only need to test one combination of each case, +// we still test all cases just to be sure +const knownErrors = [ + /^(const|using).*no-init/, + /declare-using/, + /declare-(let|var).*(? re.test(fixtureName)); + fs.mkdirSync(`./${isError ? '_error_/' : ''}${fixtureName}`, { + recursive: true, + }); + fs.rmSync(`./${isError ? '' : '_error_/'}${fixtureName}`, { + recursive: true, + force: true, + }); + fs.writeFileSync( + `./${isError ? '_error_/' : ''}${fixtureName}/fixture.ts`, + `${declare ? 'declare ' : ''}${keyword} ${id === 'id' ? 'foo' : '{ foo }'}${definite ? '!' : ''}${type ? ': any' : ''}${init ? ' = 1' : ''};\n`, + ); + } + } + } + } + } +} diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/let-destructure-init/fixture.ts b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/let-destructure-init/fixture.ts new file mode 100644 index 000000000000..4da206e415b6 --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/let-destructure-init/fixture.ts @@ -0,0 +1 @@ +let { foo } = 1; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/let-destructure-init/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/let-destructure-init/snapshots/1-TSESTree-AST.shot new file mode 100644 index 000000000000..5b2cb45cca35 --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/let-destructure-init/snapshots/1-TSESTree-AST.shot @@ -0,0 +1,101 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration VariableDeclaration let-destructure-init TSESTree - AST 1`] = ` +Program { + type: "Program", + body: [ + VariableDeclaration { + type: "VariableDeclaration", + declarations: [ + VariableDeclarator { + type: "VariableDeclarator", + definite: false, + id: ObjectPattern { + type: "ObjectPattern", + decorators: [], + optional: false, + properties: [ + Property { + type: "Property", + computed: false, + key: Identifier { + type: "Identifier", + decorators: [], + name: "foo", + optional: false, + + range: [6, 9], + loc: { + start: { column: 6, line: 1 }, + end: { column: 9, line: 1 }, + }, + }, + kind: "init", + method: false, + optional: false, + shorthand: true, + value: Identifier { + type: "Identifier", + decorators: [], + name: "foo", + optional: false, + + range: [6, 9], + loc: { + start: { column: 6, line: 1 }, + end: { column: 9, line: 1 }, + }, + }, + + range: [6, 9], + loc: { + start: { column: 6, line: 1 }, + end: { column: 9, line: 1 }, + }, + }, + ], + + range: [4, 11], + loc: { + start: { column: 4, line: 1 }, + end: { column: 11, line: 1 }, + }, + }, + init: Literal { + type: "Literal", + raw: "1", + value: 1, + + range: [14, 15], + loc: { + start: { column: 14, line: 1 }, + end: { column: 15, line: 1 }, + }, + }, + + range: [4, 15], + loc: { + start: { column: 4, line: 1 }, + end: { column: 15, line: 1 }, + }, + }, + ], + declare: false, + kind: "let", + + range: [0, 16], + loc: { + start: { column: 0, line: 1 }, + end: { column: 16, line: 1 }, + }, + }, + ], + sourceType: "script", + + range: [0, 17], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 2 }, + }, +} +`; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/let-destructure-init/snapshots/2-TSESTree-Tokens.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/let-destructure-init/snapshots/2-TSESTree-Tokens.shot new file mode 100644 index 000000000000..0afd3ae06f64 --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/let-destructure-init/snapshots/2-TSESTree-Tokens.shot @@ -0,0 +1,76 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration VariableDeclaration let-destructure-init TSESTree - Tokens 1`] = ` +[ + Keyword { + type: "Keyword", + value: "let", + + range: [0, 3], + loc: { + start: { column: 0, line: 1 }, + end: { column: 3, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "{", + + range: [4, 5], + loc: { + start: { column: 4, line: 1 }, + end: { column: 5, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "foo", + + range: [6, 9], + loc: { + start: { column: 6, line: 1 }, + end: { column: 9, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "}", + + range: [10, 11], + loc: { + start: { column: 10, line: 1 }, + end: { column: 11, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "=", + + range: [12, 13], + loc: { + start: { column: 12, line: 1 }, + end: { column: 13, line: 1 }, + }, + }, + Numeric { + type: "Numeric", + value: "1", + + range: [14, 15], + loc: { + start: { column: 14, line: 1 }, + end: { column: 15, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ";", + + range: [15, 16], + loc: { + start: { column: 15, line: 1 }, + end: { column: 16, line: 1 }, + }, + }, +] +`; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/let-destructure-init/snapshots/3-Babel-AST.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/let-destructure-init/snapshots/3-Babel-AST.shot new file mode 100644 index 000000000000..95d067df9d4c --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/let-destructure-init/snapshots/3-Babel-AST.shot @@ -0,0 +1,92 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration VariableDeclaration let-destructure-init Babel - AST 1`] = ` +Program { + type: "Program", + body: [ + VariableDeclaration { + type: "VariableDeclaration", + declarations: [ + VariableDeclarator { + type: "VariableDeclarator", + id: ObjectPattern { + type: "ObjectPattern", + properties: [ + Property { + type: "Property", + computed: false, + key: Identifier { + type: "Identifier", + name: "foo", + + range: [6, 9], + loc: { + start: { column: 6, line: 1 }, + end: { column: 9, line: 1 }, + }, + }, + kind: "init", + method: false, + shorthand: true, + value: Identifier { + type: "Identifier", + name: "foo", + + range: [6, 9], + loc: { + start: { column: 6, line: 1 }, + end: { column: 9, line: 1 }, + }, + }, + + range: [6, 9], + loc: { + start: { column: 6, line: 1 }, + end: { column: 9, line: 1 }, + }, + }, + ], + + range: [4, 11], + loc: { + start: { column: 4, line: 1 }, + end: { column: 11, line: 1 }, + }, + }, + init: Literal { + type: "Literal", + raw: "1", + value: 1, + + range: [14, 15], + loc: { + start: { column: 14, line: 1 }, + end: { column: 15, line: 1 }, + }, + }, + + range: [4, 15], + loc: { + start: { column: 4, line: 1 }, + end: { column: 15, line: 1 }, + }, + }, + ], + kind: "let", + + range: [0, 16], + loc: { + start: { column: 0, line: 1 }, + end: { column: 16, line: 1 }, + }, + }, + ], + sourceType: "script", + + range: [0, 17], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 2 }, + }, +} +`; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/let-destructure-init/snapshots/4-Babel-Tokens.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/let-destructure-init/snapshots/4-Babel-Tokens.shot new file mode 100644 index 000000000000..96b767d4a4c1 --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/let-destructure-init/snapshots/4-Babel-Tokens.shot @@ -0,0 +1,76 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration VariableDeclaration let-destructure-init Babel - Tokens 1`] = ` +[ + Identifier { + type: "Identifier", + value: "let", + + range: [0, 3], + loc: { + start: { column: 0, line: 1 }, + end: { column: 3, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "{", + + range: [4, 5], + loc: { + start: { column: 4, line: 1 }, + end: { column: 5, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "foo", + + range: [6, 9], + loc: { + start: { column: 6, line: 1 }, + end: { column: 9, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "}", + + range: [10, 11], + loc: { + start: { column: 10, line: 1 }, + end: { column: 11, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "=", + + range: [12, 13], + loc: { + start: { column: 12, line: 1 }, + end: { column: 13, line: 1 }, + }, + }, + Numeric { + type: "Numeric", + value: "1", + + range: [14, 15], + loc: { + start: { column: 14, line: 1 }, + end: { column: 15, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ";", + + range: [15, 16], + loc: { + start: { column: 15, line: 1 }, + end: { column: 16, line: 1 }, + }, + }, +] +`; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/let-destructure-init/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/let-destructure-init/snapshots/5-AST-Alignment-AST.shot new file mode 100644 index 000000000000..dd96b54a3388 --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/let-destructure-init/snapshots/5-AST-Alignment-AST.shot @@ -0,0 +1,105 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration VariableDeclaration let-destructure-init AST Alignment - AST 1`] = ` +"Snapshot Diff: +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + VariableDeclaration { + type: 'VariableDeclaration', + declarations: Array [ + VariableDeclarator { + type: 'VariableDeclarator', +- definite: false, + id: ObjectPattern { + type: 'ObjectPattern', +- decorators: Array [], +- optional: false, + properties: Array [ + Property { + type: 'Property', + computed: false, + key: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'foo', +- optional: false, + + range: [6, 9], + loc: { + start: { column: 6, line: 1 }, + end: { column: 9, line: 1 }, + }, + }, + kind: 'init', + method: false, +- optional: false, + shorthand: true, + value: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'foo', +- optional: false, + + range: [6, 9], + loc: { + start: { column: 6, line: 1 }, + end: { column: 9, line: 1 }, + }, + }, + + range: [6, 9], + loc: { + start: { column: 6, line: 1 }, + end: { column: 9, line: 1 }, + }, + }, + ], + + range: [4, 11], + loc: { + start: { column: 4, line: 1 }, + end: { column: 11, line: 1 }, + }, + }, + init: Literal { + type: 'Literal', + raw: '1', + value: 1, + + range: [14, 15], + loc: { + start: { column: 14, line: 1 }, + end: { column: 15, line: 1 }, + }, + }, + + range: [4, 15], + loc: { + start: { column: 4, line: 1 }, + end: { column: 15, line: 1 }, + }, + }, + ], +- declare: false, + kind: 'let', + + range: [0, 16], + loc: { + start: { column: 0, line: 1 }, + end: { column: 16, line: 1 }, + }, + }, + ], + sourceType: 'script', + + range: [0, 17], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 2 }, + }, + }" +`; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/let-destructure-init/snapshots/6-AST-Alignment-Tokens.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/let-destructure-init/snapshots/6-AST-Alignment-Tokens.shot new file mode 100644 index 000000000000..cc6b95aa310e --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/let-destructure-init/snapshots/6-AST-Alignment-Tokens.shot @@ -0,0 +1,82 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration VariableDeclaration let-destructure-init AST Alignment - Token 1`] = ` +"Snapshot Diff: +- TSESTree ++ Babel + + Array [ +- Keyword { +- type: 'Keyword', ++ Identifier { ++ type: 'Identifier', + value: 'let', + + range: [0, 3], + loc: { + start: { column: 0, line: 1 }, + end: { column: 3, line: 1 }, + }, + }, + Punctuator { + type: 'Punctuator', + value: '{', + + range: [4, 5], + loc: { + start: { column: 4, line: 1 }, + end: { column: 5, line: 1 }, + }, + }, + Identifier { + type: 'Identifier', + value: 'foo', + + range: [6, 9], + loc: { + start: { column: 6, line: 1 }, + end: { column: 9, line: 1 }, + }, + }, + Punctuator { + type: 'Punctuator', + value: '}', + + range: [10, 11], + loc: { + start: { column: 10, line: 1 }, + end: { column: 11, line: 1 }, + }, + }, + Punctuator { + type: 'Punctuator', + value: '=', + + range: [12, 13], + loc: { + start: { column: 12, line: 1 }, + end: { column: 13, line: 1 }, + }, + }, + Numeric { + type: 'Numeric', + value: '1', + + range: [14, 15], + loc: { + start: { column: 14, line: 1 }, + end: { column: 15, line: 1 }, + }, + }, + Punctuator { + type: 'Punctuator', + value: ';', + + range: [15, 16], + loc: { + start: { column: 15, line: 1 }, + end: { column: 16, line: 1 }, + }, + }, + ]" +`; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/let-destructure-type-init/fixture.ts b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/let-destructure-type-init/fixture.ts new file mode 100644 index 000000000000..b984591f9689 --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/let-destructure-type-init/fixture.ts @@ -0,0 +1 @@ +let { foo }: any = 1; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/let-destructure-type-init/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/let-destructure-type-init/snapshots/1-TSESTree-AST.shot new file mode 100644 index 000000000000..d71850309be6 --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/let-destructure-type-init/snapshots/1-TSESTree-AST.shot @@ -0,0 +1,119 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration VariableDeclaration let-destructure-type-init TSESTree - AST 1`] = ` +Program { + type: "Program", + body: [ + VariableDeclaration { + type: "VariableDeclaration", + declarations: [ + VariableDeclarator { + type: "VariableDeclarator", + definite: false, + id: ObjectPattern { + type: "ObjectPattern", + decorators: [], + optional: false, + properties: [ + Property { + type: "Property", + computed: false, + key: Identifier { + type: "Identifier", + decorators: [], + name: "foo", + optional: false, + + range: [6, 9], + loc: { + start: { column: 6, line: 1 }, + end: { column: 9, line: 1 }, + }, + }, + kind: "init", + method: false, + optional: false, + shorthand: true, + value: Identifier { + type: "Identifier", + decorators: [], + name: "foo", + optional: false, + + range: [6, 9], + loc: { + start: { column: 6, line: 1 }, + end: { column: 9, line: 1 }, + }, + }, + + range: [6, 9], + loc: { + start: { column: 6, line: 1 }, + end: { column: 9, line: 1 }, + }, + }, + ], + typeAnnotation: TSTypeAnnotation { + type: "TSTypeAnnotation", + typeAnnotation: TSAnyKeyword { + type: "TSAnyKeyword", + + range: [13, 16], + loc: { + start: { column: 13, line: 1 }, + end: { column: 16, line: 1 }, + }, + }, + + range: [11, 16], + loc: { + start: { column: 11, line: 1 }, + end: { column: 16, line: 1 }, + }, + }, + + range: [4, 16], + loc: { + start: { column: 4, line: 1 }, + end: { column: 16, line: 1 }, + }, + }, + init: Literal { + type: "Literal", + raw: "1", + value: 1, + + range: [19, 20], + loc: { + start: { column: 19, line: 1 }, + end: { column: 20, line: 1 }, + }, + }, + + range: [4, 20], + loc: { + start: { column: 4, line: 1 }, + end: { column: 20, line: 1 }, + }, + }, + ], + declare: false, + kind: "let", + + range: [0, 21], + loc: { + start: { column: 0, line: 1 }, + end: { column: 21, line: 1 }, + }, + }, + ], + sourceType: "script", + + range: [0, 22], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 2 }, + }, +} +`; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/let-destructure-type-init/snapshots/2-TSESTree-Tokens.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/let-destructure-type-init/snapshots/2-TSESTree-Tokens.shot new file mode 100644 index 000000000000..b9d067c9f155 --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/let-destructure-type-init/snapshots/2-TSESTree-Tokens.shot @@ -0,0 +1,96 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration VariableDeclaration let-destructure-type-init TSESTree - Tokens 1`] = ` +[ + Keyword { + type: "Keyword", + value: "let", + + range: [0, 3], + loc: { + start: { column: 0, line: 1 }, + end: { column: 3, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "{", + + range: [4, 5], + loc: { + start: { column: 4, line: 1 }, + end: { column: 5, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "foo", + + range: [6, 9], + loc: { + start: { column: 6, line: 1 }, + end: { column: 9, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "}", + + range: [10, 11], + loc: { + start: { column: 10, line: 1 }, + end: { column: 11, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ":", + + range: [11, 12], + loc: { + start: { column: 11, line: 1 }, + end: { column: 12, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "any", + + range: [13, 16], + loc: { + start: { column: 13, line: 1 }, + end: { column: 16, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "=", + + range: [17, 18], + loc: { + start: { column: 17, line: 1 }, + end: { column: 18, line: 1 }, + }, + }, + Numeric { + type: "Numeric", + value: "1", + + range: [19, 20], + loc: { + start: { column: 19, line: 1 }, + end: { column: 20, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ";", + + range: [20, 21], + loc: { + start: { column: 20, line: 1 }, + end: { column: 21, line: 1 }, + }, + }, +] +`; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/let-destructure-type-init/snapshots/3-Babel-AST.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/let-destructure-type-init/snapshots/3-Babel-AST.shot new file mode 100644 index 000000000000..7d2e928e5a4c --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/let-destructure-type-init/snapshots/3-Babel-AST.shot @@ -0,0 +1,110 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration VariableDeclaration let-destructure-type-init Babel - AST 1`] = ` +Program { + type: "Program", + body: [ + VariableDeclaration { + type: "VariableDeclaration", + declarations: [ + VariableDeclarator { + type: "VariableDeclarator", + id: ObjectPattern { + type: "ObjectPattern", + properties: [ + Property { + type: "Property", + computed: false, + key: Identifier { + type: "Identifier", + name: "foo", + + range: [6, 9], + loc: { + start: { column: 6, line: 1 }, + end: { column: 9, line: 1 }, + }, + }, + kind: "init", + method: false, + shorthand: true, + value: Identifier { + type: "Identifier", + name: "foo", + + range: [6, 9], + loc: { + start: { column: 6, line: 1 }, + end: { column: 9, line: 1 }, + }, + }, + + range: [6, 9], + loc: { + start: { column: 6, line: 1 }, + end: { column: 9, line: 1 }, + }, + }, + ], + typeAnnotation: TSTypeAnnotation { + type: "TSTypeAnnotation", + typeAnnotation: TSAnyKeyword { + type: "TSAnyKeyword", + + range: [13, 16], + loc: { + start: { column: 13, line: 1 }, + end: { column: 16, line: 1 }, + }, + }, + + range: [11, 16], + loc: { + start: { column: 11, line: 1 }, + end: { column: 16, line: 1 }, + }, + }, + + range: [4, 16], + loc: { + start: { column: 4, line: 1 }, + end: { column: 16, line: 1 }, + }, + }, + init: Literal { + type: "Literal", + raw: "1", + value: 1, + + range: [19, 20], + loc: { + start: { column: 19, line: 1 }, + end: { column: 20, line: 1 }, + }, + }, + + range: [4, 20], + loc: { + start: { column: 4, line: 1 }, + end: { column: 20, line: 1 }, + }, + }, + ], + kind: "let", + + range: [0, 21], + loc: { + start: { column: 0, line: 1 }, + end: { column: 21, line: 1 }, + }, + }, + ], + sourceType: "script", + + range: [0, 22], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 2 }, + }, +} +`; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/let-destructure-type-init/snapshots/4-Babel-Tokens.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/let-destructure-type-init/snapshots/4-Babel-Tokens.shot new file mode 100644 index 000000000000..2aae36105edd --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/let-destructure-type-init/snapshots/4-Babel-Tokens.shot @@ -0,0 +1,96 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration VariableDeclaration let-destructure-type-init Babel - Tokens 1`] = ` +[ + Identifier { + type: "Identifier", + value: "let", + + range: [0, 3], + loc: { + start: { column: 0, line: 1 }, + end: { column: 3, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "{", + + range: [4, 5], + loc: { + start: { column: 4, line: 1 }, + end: { column: 5, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "foo", + + range: [6, 9], + loc: { + start: { column: 6, line: 1 }, + end: { column: 9, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "}", + + range: [10, 11], + loc: { + start: { column: 10, line: 1 }, + end: { column: 11, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ":", + + range: [11, 12], + loc: { + start: { column: 11, line: 1 }, + end: { column: 12, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "any", + + range: [13, 16], + loc: { + start: { column: 13, line: 1 }, + end: { column: 16, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "=", + + range: [17, 18], + loc: { + start: { column: 17, line: 1 }, + end: { column: 18, line: 1 }, + }, + }, + Numeric { + type: "Numeric", + value: "1", + + range: [19, 20], + loc: { + start: { column: 19, line: 1 }, + end: { column: 20, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ";", + + range: [20, 21], + loc: { + start: { column: 20, line: 1 }, + end: { column: 21, line: 1 }, + }, + }, +] +`; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/let-destructure-type-init/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/let-destructure-type-init/snapshots/5-AST-Alignment-AST.shot new file mode 100644 index 000000000000..fbd38b7b8716 --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/let-destructure-type-init/snapshots/5-AST-Alignment-AST.shot @@ -0,0 +1,123 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration VariableDeclaration let-destructure-type-init AST Alignment - AST 1`] = ` +"Snapshot Diff: +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + VariableDeclaration { + type: 'VariableDeclaration', + declarations: Array [ + VariableDeclarator { + type: 'VariableDeclarator', +- definite: false, + id: ObjectPattern { + type: 'ObjectPattern', +- decorators: Array [], +- optional: false, + properties: Array [ + Property { + type: 'Property', + computed: false, + key: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'foo', +- optional: false, + + range: [6, 9], + loc: { + start: { column: 6, line: 1 }, + end: { column: 9, line: 1 }, + }, + }, + kind: 'init', + method: false, +- optional: false, + shorthand: true, + value: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'foo', +- optional: false, + + range: [6, 9], + loc: { + start: { column: 6, line: 1 }, + end: { column: 9, line: 1 }, + }, + }, + + range: [6, 9], + loc: { + start: { column: 6, line: 1 }, + end: { column: 9, line: 1 }, + }, + }, + ], + typeAnnotation: TSTypeAnnotation { + type: 'TSTypeAnnotation', + typeAnnotation: TSAnyKeyword { + type: 'TSAnyKeyword', + + range: [13, 16], + loc: { + start: { column: 13, line: 1 }, + end: { column: 16, line: 1 }, + }, + }, + + range: [11, 16], + loc: { + start: { column: 11, line: 1 }, + end: { column: 16, line: 1 }, + }, + }, + + range: [4, 16], + loc: { + start: { column: 4, line: 1 }, + end: { column: 16, line: 1 }, + }, + }, + init: Literal { + type: 'Literal', + raw: '1', + value: 1, + + range: [19, 20], + loc: { + start: { column: 19, line: 1 }, + end: { column: 20, line: 1 }, + }, + }, + + range: [4, 20], + loc: { + start: { column: 4, line: 1 }, + end: { column: 20, line: 1 }, + }, + }, + ], +- declare: false, + kind: 'let', + + range: [0, 21], + loc: { + start: { column: 0, line: 1 }, + end: { column: 21, line: 1 }, + }, + }, + ], + sourceType: 'script', + + range: [0, 22], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 2 }, + }, + }" +`; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/let-destructure-type-init/snapshots/6-AST-Alignment-Tokens.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/let-destructure-type-init/snapshots/6-AST-Alignment-Tokens.shot new file mode 100644 index 000000000000..2b45aa97a2c3 --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/let-destructure-type-init/snapshots/6-AST-Alignment-Tokens.shot @@ -0,0 +1,102 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration VariableDeclaration let-destructure-type-init AST Alignment - Token 1`] = ` +"Snapshot Diff: +- TSESTree ++ Babel + + Array [ +- Keyword { +- type: 'Keyword', ++ Identifier { ++ type: 'Identifier', + value: 'let', + + range: [0, 3], + loc: { + start: { column: 0, line: 1 }, + end: { column: 3, line: 1 }, + }, + }, + Punctuator { + type: 'Punctuator', + value: '{', + + range: [4, 5], + loc: { + start: { column: 4, line: 1 }, + end: { column: 5, line: 1 }, + }, + }, + Identifier { + type: 'Identifier', + value: 'foo', + + range: [6, 9], + loc: { + start: { column: 6, line: 1 }, + end: { column: 9, line: 1 }, + }, + }, + Punctuator { + type: 'Punctuator', + value: '}', + + range: [10, 11], + loc: { + start: { column: 10, line: 1 }, + end: { column: 11, line: 1 }, + }, + }, + Punctuator { + type: 'Punctuator', + value: ':', + + range: [11, 12], + loc: { + start: { column: 11, line: 1 }, + end: { column: 12, line: 1 }, + }, + }, + Identifier { + type: 'Identifier', + value: 'any', + + range: [13, 16], + loc: { + start: { column: 13, line: 1 }, + end: { column: 16, line: 1 }, + }, + }, + Punctuator { + type: 'Punctuator', + value: '=', + + range: [17, 18], + loc: { + start: { column: 17, line: 1 }, + end: { column: 18, line: 1 }, + }, + }, + Numeric { + type: 'Numeric', + value: '1', + + range: [19, 20], + loc: { + start: { column: 19, line: 1 }, + end: { column: 20, line: 1 }, + }, + }, + Punctuator { + type: 'Punctuator', + value: ';', + + range: [20, 21], + loc: { + start: { column: 20, line: 1 }, + end: { column: 21, line: 1 }, + }, + }, + ]" +`; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/let-id-definite-type-no-init/fixture.ts b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/let-id-definite-type-no-init/fixture.ts new file mode 100644 index 000000000000..1bc99af2fb0a --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/let-id-definite-type-no-init/fixture.ts @@ -0,0 +1 @@ +let foo!: any; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/let-id-definite-type-no-init/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/let-id-definite-type-no-init/snapshots/1-TSESTree-AST.shot new file mode 100644 index 000000000000..f7df125f18c5 --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/let-id-definite-type-no-init/snapshots/1-TSESTree-AST.shot @@ -0,0 +1,70 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration VariableDeclaration let-id-definite-type-no-init TSESTree - AST 1`] = ` +Program { + type: "Program", + body: [ + VariableDeclaration { + type: "VariableDeclaration", + declarations: [ + VariableDeclarator { + type: "VariableDeclarator", + definite: true, + id: Identifier { + type: "Identifier", + decorators: [], + name: "foo", + optional: false, + typeAnnotation: TSTypeAnnotation { + type: "TSTypeAnnotation", + typeAnnotation: TSAnyKeyword { + type: "TSAnyKeyword", + + range: [10, 13], + loc: { + start: { column: 10, line: 1 }, + end: { column: 13, line: 1 }, + }, + }, + + range: [8, 13], + loc: { + start: { column: 8, line: 1 }, + end: { column: 13, line: 1 }, + }, + }, + + range: [4, 13], + loc: { + start: { column: 4, line: 1 }, + end: { column: 13, line: 1 }, + }, + }, + init: null, + + range: [4, 13], + loc: { + start: { column: 4, line: 1 }, + end: { column: 13, line: 1 }, + }, + }, + ], + declare: false, + kind: "let", + + range: [0, 14], + loc: { + start: { column: 0, line: 1 }, + end: { column: 14, line: 1 }, + }, + }, + ], + sourceType: "script", + + range: [0, 15], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 2 }, + }, +} +`; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/let-id-definite-type-no-init/snapshots/2-TSESTree-Tokens.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/let-id-definite-type-no-init/snapshots/2-TSESTree-Tokens.shot new file mode 100644 index 000000000000..f4fe3903231f --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/let-id-definite-type-no-init/snapshots/2-TSESTree-Tokens.shot @@ -0,0 +1,66 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration VariableDeclaration let-id-definite-type-no-init TSESTree - Tokens 1`] = ` +[ + Keyword { + type: "Keyword", + value: "let", + + range: [0, 3], + loc: { + start: { column: 0, line: 1 }, + end: { column: 3, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "foo", + + range: [4, 7], + loc: { + start: { column: 4, line: 1 }, + end: { column: 7, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "!", + + range: [7, 8], + loc: { + start: { column: 7, line: 1 }, + end: { column: 8, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ":", + + range: [8, 9], + loc: { + start: { column: 8, line: 1 }, + end: { column: 9, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "any", + + range: [10, 13], + loc: { + start: { column: 10, line: 1 }, + end: { column: 13, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ";", + + range: [13, 14], + loc: { + start: { column: 13, line: 1 }, + end: { column: 14, line: 1 }, + }, + }, +] +`; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/let-id-definite-type-no-init/snapshots/3-Babel-AST.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/let-id-definite-type-no-init/snapshots/3-Babel-AST.shot new file mode 100644 index 000000000000..0af29cc8c409 --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/let-id-definite-type-no-init/snapshots/3-Babel-AST.shot @@ -0,0 +1,67 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration VariableDeclaration let-id-definite-type-no-init Babel - AST 1`] = ` +Program { + type: "Program", + body: [ + VariableDeclaration { + type: "VariableDeclaration", + declarations: [ + VariableDeclarator { + type: "VariableDeclarator", + definite: true, + id: Identifier { + type: "Identifier", + name: "foo", + typeAnnotation: TSTypeAnnotation { + type: "TSTypeAnnotation", + typeAnnotation: TSAnyKeyword { + type: "TSAnyKeyword", + + range: [10, 13], + loc: { + start: { column: 10, line: 1 }, + end: { column: 13, line: 1 }, + }, + }, + + range: [8, 13], + loc: { + start: { column: 8, line: 1 }, + end: { column: 13, line: 1 }, + }, + }, + + range: [4, 13], + loc: { + start: { column: 4, line: 1 }, + end: { column: 13, line: 1 }, + }, + }, + init: null, + + range: [4, 13], + loc: { + start: { column: 4, line: 1 }, + end: { column: 13, line: 1 }, + }, + }, + ], + kind: "let", + + range: [0, 14], + loc: { + start: { column: 0, line: 1 }, + end: { column: 14, line: 1 }, + }, + }, + ], + sourceType: "script", + + range: [0, 15], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 2 }, + }, +} +`; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/let-id-definite-type-no-init/snapshots/4-Babel-Tokens.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/let-id-definite-type-no-init/snapshots/4-Babel-Tokens.shot new file mode 100644 index 000000000000..71370fd77c5f --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/let-id-definite-type-no-init/snapshots/4-Babel-Tokens.shot @@ -0,0 +1,66 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration VariableDeclaration let-id-definite-type-no-init Babel - Tokens 1`] = ` +[ + Identifier { + type: "Identifier", + value: "let", + + range: [0, 3], + loc: { + start: { column: 0, line: 1 }, + end: { column: 3, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "foo", + + range: [4, 7], + loc: { + start: { column: 4, line: 1 }, + end: { column: 7, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "!", + + range: [7, 8], + loc: { + start: { column: 7, line: 1 }, + end: { column: 8, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ":", + + range: [8, 9], + loc: { + start: { column: 8, line: 1 }, + end: { column: 9, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "any", + + range: [10, 13], + loc: { + start: { column: 10, line: 1 }, + end: { column: 13, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ";", + + range: [13, 14], + loc: { + start: { column: 13, line: 1 }, + end: { column: 14, line: 1 }, + }, + }, +] +`; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/let-id-definite-type-no-init/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/let-id-definite-type-no-init/snapshots/5-AST-Alignment-AST.shot new file mode 100644 index 000000000000..63c0a24c789b --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/let-id-definite-type-no-init/snapshots/5-AST-Alignment-AST.shot @@ -0,0 +1,74 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration VariableDeclaration let-id-definite-type-no-init AST Alignment - AST 1`] = ` +"Snapshot Diff: +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + VariableDeclaration { + type: 'VariableDeclaration', + declarations: Array [ + VariableDeclarator { + type: 'VariableDeclarator', + definite: true, + id: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'foo', +- optional: false, + typeAnnotation: TSTypeAnnotation { + type: 'TSTypeAnnotation', + typeAnnotation: TSAnyKeyword { + type: 'TSAnyKeyword', + + range: [10, 13], + loc: { + start: { column: 10, line: 1 }, + end: { column: 13, line: 1 }, + }, + }, + + range: [8, 13], + loc: { + start: { column: 8, line: 1 }, + end: { column: 13, line: 1 }, + }, + }, + + range: [4, 13], + loc: { + start: { column: 4, line: 1 }, + end: { column: 13, line: 1 }, + }, + }, + init: null, + + range: [4, 13], + loc: { + start: { column: 4, line: 1 }, + end: { column: 13, line: 1 }, + }, + }, + ], +- declare: false, + kind: 'let', + + range: [0, 14], + loc: { + start: { column: 0, line: 1 }, + end: { column: 14, line: 1 }, + }, + }, + ], + sourceType: 'script', + + range: [0, 15], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 2 }, + }, + }" +`; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/let-id-definite-type-no-init/snapshots/6-AST-Alignment-Tokens.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/let-id-definite-type-no-init/snapshots/6-AST-Alignment-Tokens.shot new file mode 100644 index 000000000000..bde769de6f4e --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/let-id-definite-type-no-init/snapshots/6-AST-Alignment-Tokens.shot @@ -0,0 +1,72 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration VariableDeclaration let-id-definite-type-no-init AST Alignment - Token 1`] = ` +"Snapshot Diff: +- TSESTree ++ Babel + + Array [ +- Keyword { +- type: 'Keyword', ++ Identifier { ++ type: 'Identifier', + value: 'let', + + range: [0, 3], + loc: { + start: { column: 0, line: 1 }, + end: { column: 3, line: 1 }, + }, + }, + Identifier { + type: 'Identifier', + value: 'foo', + + range: [4, 7], + loc: { + start: { column: 4, line: 1 }, + end: { column: 7, line: 1 }, + }, + }, + Punctuator { + type: 'Punctuator', + value: '!', + + range: [7, 8], + loc: { + start: { column: 7, line: 1 }, + end: { column: 8, line: 1 }, + }, + }, + Punctuator { + type: 'Punctuator', + value: ':', + + range: [8, 9], + loc: { + start: { column: 8, line: 1 }, + end: { column: 9, line: 1 }, + }, + }, + Identifier { + type: 'Identifier', + value: 'any', + + range: [10, 13], + loc: { + start: { column: 10, line: 1 }, + end: { column: 13, line: 1 }, + }, + }, + Punctuator { + type: 'Punctuator', + value: ';', + + range: [13, 14], + loc: { + start: { column: 13, line: 1 }, + end: { column: 14, line: 1 }, + }, + }, + ]" +`; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/let-id-init/fixture.ts b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/let-id-init/fixture.ts new file mode 100644 index 000000000000..24bc51ed5e4f --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/let-id-init/fixture.ts @@ -0,0 +1 @@ +let foo = 1; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/const-with-value/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/let-id-init/snapshots/1-TSESTree-AST.shot similarity index 79% rename from packages/ast-spec/src/declaration/VariableDeclaration/fixtures/const-with-value/snapshots/1-TSESTree-AST.shot rename to packages/ast-spec/src/declaration/VariableDeclaration/fixtures/let-id-init/snapshots/1-TSESTree-AST.shot index 0bf57620c6e2..8754c41f2b1e 100644 --- a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/const-with-value/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/let-id-init/snapshots/1-TSESTree-AST.shot @@ -1,6 +1,6 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`AST Fixtures declaration VariableDeclaration const-with-value TSESTree - AST 1`] = ` +exports[`AST Fixtures declaration VariableDeclaration let-id-init TSESTree - AST 1`] = ` Program { type: "Program", body: [ @@ -13,12 +13,12 @@ Program { id: Identifier { type: "Identifier", decorators: [], - name: "x", + name: "foo", optional: false, - range: [6, 7], + range: [4, 7], loc: { - start: { column: 6, line: 1 }, + start: { column: 4, line: 1 }, end: { column: 7, line: 1 }, }, }, @@ -34,15 +34,15 @@ Program { }, }, - range: [6, 11], + range: [4, 11], loc: { - start: { column: 6, line: 1 }, + start: { column: 4, line: 1 }, end: { column: 11, line: 1 }, }, }, ], declare: false, - kind: "const", + kind: "let", range: [0, 12], loc: { diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/const-with-value/snapshots/2-TSESTree-Tokens.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/let-id-init/snapshots/2-TSESTree-Tokens.shot similarity index 75% rename from packages/ast-spec/src/declaration/VariableDeclaration/fixtures/const-with-value/snapshots/2-TSESTree-Tokens.shot rename to packages/ast-spec/src/declaration/VariableDeclaration/fixtures/let-id-init/snapshots/2-TSESTree-Tokens.shot index 9f1fbb65220c..afa325fee2c1 100644 --- a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/const-with-value/snapshots/2-TSESTree-Tokens.shot +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/let-id-init/snapshots/2-TSESTree-Tokens.shot @@ -1,24 +1,24 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`AST Fixtures declaration VariableDeclaration const-with-value TSESTree - Tokens 1`] = ` +exports[`AST Fixtures declaration VariableDeclaration let-id-init TSESTree - Tokens 1`] = ` [ Keyword { type: "Keyword", - value: "const", + value: "let", - range: [0, 5], + range: [0, 3], loc: { start: { column: 0, line: 1 }, - end: { column: 5, line: 1 }, + end: { column: 3, line: 1 }, }, }, Identifier { type: "Identifier", - value: "x", + value: "foo", - range: [6, 7], + range: [4, 7], loc: { - start: { column: 6, line: 1 }, + start: { column: 4, line: 1 }, end: { column: 7, line: 1 }, }, }, diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/using-with-value/snapshots/3-Babel-AST.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/let-id-init/snapshots/3-Babel-AST.shot similarity index 78% rename from packages/ast-spec/src/declaration/VariableDeclaration/fixtures/using-with-value/snapshots/3-Babel-AST.shot rename to packages/ast-spec/src/declaration/VariableDeclaration/fixtures/let-id-init/snapshots/3-Babel-AST.shot index b220aa39c335..46289d2a6e83 100644 --- a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/using-with-value/snapshots/3-Babel-AST.shot +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/let-id-init/snapshots/3-Babel-AST.shot @@ -1,6 +1,6 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`AST Fixtures declaration VariableDeclaration using-with-value Babel - AST 1`] = ` +exports[`AST Fixtures declaration VariableDeclaration let-id-init Babel - AST 1`] = ` Program { type: "Program", body: [ @@ -11,11 +11,11 @@ Program { type: "VariableDeclarator", id: Identifier { type: "Identifier", - name: "a", + name: "foo", - range: [6, 7], + range: [4, 7], loc: { - start: { column: 6, line: 1 }, + start: { column: 4, line: 1 }, end: { column: 7, line: 1 }, }, }, @@ -31,14 +31,14 @@ Program { }, }, - range: [6, 11], + range: [4, 11], loc: { - start: { column: 6, line: 1 }, + start: { column: 4, line: 1 }, end: { column: 11, line: 1 }, }, }, ], - kind: "using", + kind: "let", range: [0, 12], loc: { diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/using-with-value/snapshots/4-Babel-Tokens.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/let-id-init/snapshots/4-Babel-Tokens.shot similarity index 76% rename from packages/ast-spec/src/declaration/VariableDeclaration/fixtures/using-with-value/snapshots/4-Babel-Tokens.shot rename to packages/ast-spec/src/declaration/VariableDeclaration/fixtures/let-id-init/snapshots/4-Babel-Tokens.shot index 683b21358f2f..d2e5bd946387 100644 --- a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/using-with-value/snapshots/4-Babel-Tokens.shot +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/let-id-init/snapshots/4-Babel-Tokens.shot @@ -1,24 +1,24 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`AST Fixtures declaration VariableDeclaration using-with-value Babel - Tokens 1`] = ` +exports[`AST Fixtures declaration VariableDeclaration let-id-init Babel - Tokens 1`] = ` [ Identifier { type: "Identifier", - value: "using", + value: "let", - range: [0, 5], + range: [0, 3], loc: { start: { column: 0, line: 1 }, - end: { column: 5, line: 1 }, + end: { column: 3, line: 1 }, }, }, Identifier { type: "Identifier", - value: "a", + value: "foo", - range: [6, 7], + range: [4, 7], loc: { - start: { column: 6, line: 1 }, + start: { column: 4, line: 1 }, end: { column: 7, line: 1 }, }, }, diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/const-with-value/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/let-id-init/snapshots/5-AST-Alignment-AST.shot similarity index 80% rename from packages/ast-spec/src/declaration/VariableDeclaration/fixtures/const-with-value/snapshots/5-AST-Alignment-AST.shot rename to packages/ast-spec/src/declaration/VariableDeclaration/fixtures/let-id-init/snapshots/5-AST-Alignment-AST.shot index d997027ffaba..2ca7f5d4a746 100644 --- a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/const-with-value/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/let-id-init/snapshots/5-AST-Alignment-AST.shot @@ -1,6 +1,6 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`AST Fixtures declaration VariableDeclaration const-with-value AST Alignment - AST 1`] = ` +exports[`AST Fixtures declaration VariableDeclaration let-id-init AST Alignment - AST 1`] = ` "Snapshot Diff: - TSESTree + Babel @@ -17,12 +17,12 @@ exports[`AST Fixtures declaration VariableDeclaration const-with-value AST Align id: Identifier { type: 'Identifier', - decorators: Array [], - name: 'x', + name: 'foo', - optional: false, - range: [6, 7], + range: [4, 7], loc: { - start: { column: 6, line: 1 }, + start: { column: 4, line: 1 }, end: { column: 7, line: 1 }, }, }, @@ -38,15 +38,15 @@ exports[`AST Fixtures declaration VariableDeclaration const-with-value AST Align }, }, - range: [6, 11], + range: [4, 11], loc: { - start: { column: 6, line: 1 }, + start: { column: 4, line: 1 }, end: { column: 11, line: 1 }, }, }, ], - declare: false, - kind: 'const', + kind: 'let', range: [0, 12], loc: { diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/let-with-value/snapshots/6-AST-Alignment-Tokens.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/let-id-init/snapshots/6-AST-Alignment-Tokens.shot similarity index 71% rename from packages/ast-spec/src/declaration/VariableDeclaration/fixtures/let-with-value/snapshots/6-AST-Alignment-Tokens.shot rename to packages/ast-spec/src/declaration/VariableDeclaration/fixtures/let-id-init/snapshots/6-AST-Alignment-Tokens.shot index e8e2c1727b2f..8cb7da15942e 100644 --- a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/let-with-value/snapshots/6-AST-Alignment-Tokens.shot +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/let-id-init/snapshots/6-AST-Alignment-Tokens.shot @@ -1,6 +1,6 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`AST Fixtures declaration VariableDeclaration let-with-value AST Alignment - Token 1`] = ` +exports[`AST Fixtures declaration VariableDeclaration let-id-init AST Alignment - Token 1`] = ` "Snapshot Diff: - TSESTree + Babel @@ -20,42 +20,42 @@ exports[`AST Fixtures declaration VariableDeclaration let-with-value AST Alignme }, Identifier { type: 'Identifier', - value: 'x', + value: 'foo', - range: [4, 5], + range: [4, 7], loc: { start: { column: 4, line: 1 }, - end: { column: 5, line: 1 }, + end: { column: 7, line: 1 }, }, }, Punctuator { type: 'Punctuator', value: '=', - range: [6, 7], + range: [8, 9], loc: { - start: { column: 6, line: 1 }, - end: { column: 7, line: 1 }, + start: { column: 8, line: 1 }, + end: { column: 9, line: 1 }, }, }, Numeric { type: 'Numeric', value: '1', - range: [8, 9], + range: [10, 11], loc: { - start: { column: 8, line: 1 }, - end: { column: 9, line: 1 }, + start: { column: 10, line: 1 }, + end: { column: 11, line: 1 }, }, }, Punctuator { type: 'Punctuator', value: ';', - range: [9, 10], + range: [11, 12], loc: { - start: { column: 9, line: 1 }, - end: { column: 10, line: 1 }, + start: { column: 11, line: 1 }, + end: { column: 12, line: 1 }, }, }, ]" diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/let-id-no-init/fixture.ts b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/let-id-no-init/fixture.ts new file mode 100644 index 000000000000..5a845d262fb1 --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/let-id-no-init/fixture.ts @@ -0,0 +1 @@ +let foo; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/let-without-value/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/let-id-no-init/snapshots/1-TSESTree-AST.shot similarity index 71% rename from packages/ast-spec/src/declaration/VariableDeclaration/fixtures/let-without-value/snapshots/1-TSESTree-AST.shot rename to packages/ast-spec/src/declaration/VariableDeclaration/fixtures/let-id-no-init/snapshots/1-TSESTree-AST.shot index 0374c31feb55..d99bf0b530a9 100644 --- a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/let-without-value/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/let-id-no-init/snapshots/1-TSESTree-AST.shot @@ -1,6 +1,6 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`AST Fixtures declaration VariableDeclaration let-without-value TSESTree - AST 1`] = ` +exports[`AST Fixtures declaration VariableDeclaration let-id-no-init TSESTree - AST 1`] = ` Program { type: "Program", body: [ @@ -13,37 +13,37 @@ Program { id: Identifier { type: "Identifier", decorators: [], - name: "x", + name: "foo", optional: false, - range: [4, 5], + range: [4, 7], loc: { start: { column: 4, line: 1 }, - end: { column: 5, line: 1 }, + end: { column: 7, line: 1 }, }, }, init: null, - range: [4, 5], + range: [4, 7], loc: { start: { column: 4, line: 1 }, - end: { column: 5, line: 1 }, + end: { column: 7, line: 1 }, }, }, ], declare: false, kind: "let", - range: [0, 6], + range: [0, 8], loc: { start: { column: 0, line: 1 }, - end: { column: 6, line: 1 }, + end: { column: 8, line: 1 }, }, }, ], sourceType: "script", - range: [0, 7], + range: [0, 9], loc: { start: { column: 0, line: 1 }, end: { column: 0, line: 2 }, diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/let-without-value/snapshots/2-TSESTree-Tokens.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/let-id-no-init/snapshots/2-TSESTree-Tokens.shot similarity index 60% rename from packages/ast-spec/src/declaration/VariableDeclaration/fixtures/let-without-value/snapshots/2-TSESTree-Tokens.shot rename to packages/ast-spec/src/declaration/VariableDeclaration/fixtures/let-id-no-init/snapshots/2-TSESTree-Tokens.shot index cf324f79787c..093f0ce89ab3 100644 --- a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/let-without-value/snapshots/2-TSESTree-Tokens.shot +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/let-id-no-init/snapshots/2-TSESTree-Tokens.shot @@ -1,6 +1,6 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`AST Fixtures declaration VariableDeclaration let-without-value TSESTree - Tokens 1`] = ` +exports[`AST Fixtures declaration VariableDeclaration let-id-no-init TSESTree - Tokens 1`] = ` [ Keyword { type: "Keyword", @@ -14,22 +14,22 @@ exports[`AST Fixtures declaration VariableDeclaration let-without-value TSESTree }, Identifier { type: "Identifier", - value: "x", + value: "foo", - range: [4, 5], + range: [4, 7], loc: { start: { column: 4, line: 1 }, - end: { column: 5, line: 1 }, + end: { column: 7, line: 1 }, }, }, Punctuator { type: "Punctuator", value: ";", - range: [5, 6], + range: [7, 8], loc: { - start: { column: 5, line: 1 }, - end: { column: 6, line: 1 }, + start: { column: 7, line: 1 }, + end: { column: 8, line: 1 }, }, }, ] diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/let-without-value/snapshots/3-Babel-AST.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/let-id-no-init/snapshots/3-Babel-AST.shot similarity index 68% rename from packages/ast-spec/src/declaration/VariableDeclaration/fixtures/let-without-value/snapshots/3-Babel-AST.shot rename to packages/ast-spec/src/declaration/VariableDeclaration/fixtures/let-id-no-init/snapshots/3-Babel-AST.shot index 535544301b0a..643d5118ebc0 100644 --- a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/let-without-value/snapshots/3-Babel-AST.shot +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/let-id-no-init/snapshots/3-Babel-AST.shot @@ -1,6 +1,6 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`AST Fixtures declaration VariableDeclaration let-without-value Babel - AST 1`] = ` +exports[`AST Fixtures declaration VariableDeclaration let-id-no-init Babel - AST 1`] = ` Program { type: "Program", body: [ @@ -11,35 +11,35 @@ Program { type: "VariableDeclarator", id: Identifier { type: "Identifier", - name: "x", + name: "foo", - range: [4, 5], + range: [4, 7], loc: { start: { column: 4, line: 1 }, - end: { column: 5, line: 1 }, + end: { column: 7, line: 1 }, }, }, init: null, - range: [4, 5], + range: [4, 7], loc: { start: { column: 4, line: 1 }, - end: { column: 5, line: 1 }, + end: { column: 7, line: 1 }, }, }, ], kind: "let", - range: [0, 6], + range: [0, 8], loc: { start: { column: 0, line: 1 }, - end: { column: 6, line: 1 }, + end: { column: 8, line: 1 }, }, }, ], sourceType: "script", - range: [0, 7], + range: [0, 9], loc: { start: { column: 0, line: 1 }, end: { column: 0, line: 2 }, diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/let-without-value/snapshots/4-Babel-Tokens.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/let-id-no-init/snapshots/4-Babel-Tokens.shot similarity index 61% rename from packages/ast-spec/src/declaration/VariableDeclaration/fixtures/let-without-value/snapshots/4-Babel-Tokens.shot rename to packages/ast-spec/src/declaration/VariableDeclaration/fixtures/let-id-no-init/snapshots/4-Babel-Tokens.shot index cb83d68d6c99..707529b5a1e8 100644 --- a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/let-without-value/snapshots/4-Babel-Tokens.shot +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/let-id-no-init/snapshots/4-Babel-Tokens.shot @@ -1,6 +1,6 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`AST Fixtures declaration VariableDeclaration let-without-value Babel - Tokens 1`] = ` +exports[`AST Fixtures declaration VariableDeclaration let-id-no-init Babel - Tokens 1`] = ` [ Identifier { type: "Identifier", @@ -14,22 +14,22 @@ exports[`AST Fixtures declaration VariableDeclaration let-without-value Babel - }, Identifier { type: "Identifier", - value: "x", + value: "foo", - range: [4, 5], + range: [4, 7], loc: { start: { column: 4, line: 1 }, - end: { column: 5, line: 1 }, + end: { column: 7, line: 1 }, }, }, Punctuator { type: "Punctuator", value: ";", - range: [5, 6], + range: [7, 8], loc: { - start: { column: 5, line: 1 }, - end: { column: 6, line: 1 }, + start: { column: 7, line: 1 }, + end: { column: 8, line: 1 }, }, }, ] diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/let-without-value/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/let-id-no-init/snapshots/5-AST-Alignment-AST.shot similarity index 72% rename from packages/ast-spec/src/declaration/VariableDeclaration/fixtures/let-without-value/snapshots/5-AST-Alignment-AST.shot rename to packages/ast-spec/src/declaration/VariableDeclaration/fixtures/let-id-no-init/snapshots/5-AST-Alignment-AST.shot index 7df64b552f6f..6bbb3ba1a0ef 100644 --- a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/let-without-value/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/let-id-no-init/snapshots/5-AST-Alignment-AST.shot @@ -1,6 +1,6 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`AST Fixtures declaration VariableDeclaration let-without-value AST Alignment - AST 1`] = ` +exports[`AST Fixtures declaration VariableDeclaration let-id-no-init AST Alignment - AST 1`] = ` "Snapshot Diff: - TSESTree + Babel @@ -17,37 +17,37 @@ exports[`AST Fixtures declaration VariableDeclaration let-without-value AST Alig id: Identifier { type: 'Identifier', - decorators: Array [], - name: 'x', + name: 'foo', - optional: false, - range: [4, 5], + range: [4, 7], loc: { start: { column: 4, line: 1 }, - end: { column: 5, line: 1 }, + end: { column: 7, line: 1 }, }, }, init: null, - range: [4, 5], + range: [4, 7], loc: { start: { column: 4, line: 1 }, - end: { column: 5, line: 1 }, + end: { column: 7, line: 1 }, }, }, ], - declare: false, kind: 'let', - range: [0, 6], + range: [0, 8], loc: { start: { column: 0, line: 1 }, - end: { column: 6, line: 1 }, + end: { column: 8, line: 1 }, }, }, ], sourceType: 'script', - range: [0, 7], + range: [0, 9], loc: { start: { column: 0, line: 1 }, end: { column: 0, line: 2 }, diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/let-without-value/snapshots/6-AST-Alignment-Tokens.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/let-id-no-init/snapshots/6-AST-Alignment-Tokens.shot similarity index 65% rename from packages/ast-spec/src/declaration/VariableDeclaration/fixtures/let-without-value/snapshots/6-AST-Alignment-Tokens.shot rename to packages/ast-spec/src/declaration/VariableDeclaration/fixtures/let-id-no-init/snapshots/6-AST-Alignment-Tokens.shot index 949c66669c79..59d191b969a0 100644 --- a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/let-without-value/snapshots/6-AST-Alignment-Tokens.shot +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/let-id-no-init/snapshots/6-AST-Alignment-Tokens.shot @@ -1,6 +1,6 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`AST Fixtures declaration VariableDeclaration let-without-value AST Alignment - Token 1`] = ` +exports[`AST Fixtures declaration VariableDeclaration let-id-no-init AST Alignment - Token 1`] = ` "Snapshot Diff: - TSESTree + Babel @@ -20,22 +20,22 @@ exports[`AST Fixtures declaration VariableDeclaration let-without-value AST Alig }, Identifier { type: 'Identifier', - value: 'x', + value: 'foo', - range: [4, 5], + range: [4, 7], loc: { start: { column: 4, line: 1 }, - end: { column: 5, line: 1 }, + end: { column: 7, line: 1 }, }, }, Punctuator { type: 'Punctuator', value: ';', - range: [5, 6], + range: [7, 8], loc: { - start: { column: 5, line: 1 }, - end: { column: 6, line: 1 }, + start: { column: 7, line: 1 }, + end: { column: 8, line: 1 }, }, }, ]" diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/let-id-type-init/fixture.ts b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/let-id-type-init/fixture.ts new file mode 100644 index 000000000000..1b160e80cc56 --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/let-id-type-init/fixture.ts @@ -0,0 +1 @@ +let foo: any = 1; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/let-id-type-init/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/let-id-type-init/snapshots/1-TSESTree-AST.shot new file mode 100644 index 000000000000..c4184afce9a2 --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/let-id-type-init/snapshots/1-TSESTree-AST.shot @@ -0,0 +1,80 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration VariableDeclaration let-id-type-init TSESTree - AST 1`] = ` +Program { + type: "Program", + body: [ + VariableDeclaration { + type: "VariableDeclaration", + declarations: [ + VariableDeclarator { + type: "VariableDeclarator", + definite: false, + id: Identifier { + type: "Identifier", + decorators: [], + name: "foo", + optional: false, + typeAnnotation: TSTypeAnnotation { + type: "TSTypeAnnotation", + typeAnnotation: TSAnyKeyword { + type: "TSAnyKeyword", + + range: [9, 12], + loc: { + start: { column: 9, line: 1 }, + end: { column: 12, line: 1 }, + }, + }, + + range: [7, 12], + loc: { + start: { column: 7, line: 1 }, + end: { column: 12, line: 1 }, + }, + }, + + range: [4, 12], + loc: { + start: { column: 4, line: 1 }, + end: { column: 12, line: 1 }, + }, + }, + init: Literal { + type: "Literal", + raw: "1", + value: 1, + + range: [15, 16], + loc: { + start: { column: 15, line: 1 }, + end: { column: 16, line: 1 }, + }, + }, + + range: [4, 16], + loc: { + start: { column: 4, line: 1 }, + end: { column: 16, line: 1 }, + }, + }, + ], + declare: false, + kind: "let", + + range: [0, 17], + loc: { + start: { column: 0, line: 1 }, + end: { column: 17, line: 1 }, + }, + }, + ], + sourceType: "script", + + range: [0, 18], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 2 }, + }, +} +`; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/let-id-type-init/snapshots/2-TSESTree-Tokens.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/let-id-type-init/snapshots/2-TSESTree-Tokens.shot new file mode 100644 index 000000000000..bb2ad7afd05f --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/let-id-type-init/snapshots/2-TSESTree-Tokens.shot @@ -0,0 +1,76 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration VariableDeclaration let-id-type-init TSESTree - Tokens 1`] = ` +[ + Keyword { + type: "Keyword", + value: "let", + + range: [0, 3], + loc: { + start: { column: 0, line: 1 }, + end: { column: 3, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "foo", + + range: [4, 7], + loc: { + start: { column: 4, line: 1 }, + end: { column: 7, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ":", + + range: [7, 8], + loc: { + start: { column: 7, line: 1 }, + end: { column: 8, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "any", + + range: [9, 12], + loc: { + start: { column: 9, line: 1 }, + end: { column: 12, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "=", + + range: [13, 14], + loc: { + start: { column: 13, line: 1 }, + end: { column: 14, line: 1 }, + }, + }, + Numeric { + type: "Numeric", + value: "1", + + range: [15, 16], + loc: { + start: { column: 15, line: 1 }, + end: { column: 16, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ";", + + range: [16, 17], + loc: { + start: { column: 16, line: 1 }, + end: { column: 17, line: 1 }, + }, + }, +] +`; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/let-id-type-init/snapshots/3-Babel-AST.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/let-id-type-init/snapshots/3-Babel-AST.shot new file mode 100644 index 000000000000..ddd0f76ef9e5 --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/let-id-type-init/snapshots/3-Babel-AST.shot @@ -0,0 +1,76 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration VariableDeclaration let-id-type-init Babel - AST 1`] = ` +Program { + type: "Program", + body: [ + VariableDeclaration { + type: "VariableDeclaration", + declarations: [ + VariableDeclarator { + type: "VariableDeclarator", + id: Identifier { + type: "Identifier", + name: "foo", + typeAnnotation: TSTypeAnnotation { + type: "TSTypeAnnotation", + typeAnnotation: TSAnyKeyword { + type: "TSAnyKeyword", + + range: [9, 12], + loc: { + start: { column: 9, line: 1 }, + end: { column: 12, line: 1 }, + }, + }, + + range: [7, 12], + loc: { + start: { column: 7, line: 1 }, + end: { column: 12, line: 1 }, + }, + }, + + range: [4, 12], + loc: { + start: { column: 4, line: 1 }, + end: { column: 12, line: 1 }, + }, + }, + init: Literal { + type: "Literal", + raw: "1", + value: 1, + + range: [15, 16], + loc: { + start: { column: 15, line: 1 }, + end: { column: 16, line: 1 }, + }, + }, + + range: [4, 16], + loc: { + start: { column: 4, line: 1 }, + end: { column: 16, line: 1 }, + }, + }, + ], + kind: "let", + + range: [0, 17], + loc: { + start: { column: 0, line: 1 }, + end: { column: 17, line: 1 }, + }, + }, + ], + sourceType: "script", + + range: [0, 18], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 2 }, + }, +} +`; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/let-id-type-init/snapshots/4-Babel-Tokens.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/let-id-type-init/snapshots/4-Babel-Tokens.shot new file mode 100644 index 000000000000..7c62f46f1c0f --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/let-id-type-init/snapshots/4-Babel-Tokens.shot @@ -0,0 +1,76 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration VariableDeclaration let-id-type-init Babel - Tokens 1`] = ` +[ + Identifier { + type: "Identifier", + value: "let", + + range: [0, 3], + loc: { + start: { column: 0, line: 1 }, + end: { column: 3, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "foo", + + range: [4, 7], + loc: { + start: { column: 4, line: 1 }, + end: { column: 7, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ":", + + range: [7, 8], + loc: { + start: { column: 7, line: 1 }, + end: { column: 8, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "any", + + range: [9, 12], + loc: { + start: { column: 9, line: 1 }, + end: { column: 12, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "=", + + range: [13, 14], + loc: { + start: { column: 13, line: 1 }, + end: { column: 14, line: 1 }, + }, + }, + Numeric { + type: "Numeric", + value: "1", + + range: [15, 16], + loc: { + start: { column: 15, line: 1 }, + end: { column: 16, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ";", + + range: [16, 17], + loc: { + start: { column: 16, line: 1 }, + end: { column: 17, line: 1 }, + }, + }, +] +`; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/let-id-type-init/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/let-id-type-init/snapshots/5-AST-Alignment-AST.shot new file mode 100644 index 000000000000..315e22b76051 --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/let-id-type-init/snapshots/5-AST-Alignment-AST.shot @@ -0,0 +1,84 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration VariableDeclaration let-id-type-init AST Alignment - AST 1`] = ` +"Snapshot Diff: +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + VariableDeclaration { + type: 'VariableDeclaration', + declarations: Array [ + VariableDeclarator { + type: 'VariableDeclarator', +- definite: false, + id: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'foo', +- optional: false, + typeAnnotation: TSTypeAnnotation { + type: 'TSTypeAnnotation', + typeAnnotation: TSAnyKeyword { + type: 'TSAnyKeyword', + + range: [9, 12], + loc: { + start: { column: 9, line: 1 }, + end: { column: 12, line: 1 }, + }, + }, + + range: [7, 12], + loc: { + start: { column: 7, line: 1 }, + end: { column: 12, line: 1 }, + }, + }, + + range: [4, 12], + loc: { + start: { column: 4, line: 1 }, + end: { column: 12, line: 1 }, + }, + }, + init: Literal { + type: 'Literal', + raw: '1', + value: 1, + + range: [15, 16], + loc: { + start: { column: 15, line: 1 }, + end: { column: 16, line: 1 }, + }, + }, + + range: [4, 16], + loc: { + start: { column: 4, line: 1 }, + end: { column: 16, line: 1 }, + }, + }, + ], +- declare: false, + kind: 'let', + + range: [0, 17], + loc: { + start: { column: 0, line: 1 }, + end: { column: 17, line: 1 }, + }, + }, + ], + sourceType: 'script', + + range: [0, 18], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 2 }, + }, + }" +`; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/let-id-type-init/snapshots/6-AST-Alignment-Tokens.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/let-id-type-init/snapshots/6-AST-Alignment-Tokens.shot new file mode 100644 index 000000000000..c13dd7bde752 --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/let-id-type-init/snapshots/6-AST-Alignment-Tokens.shot @@ -0,0 +1,82 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration VariableDeclaration let-id-type-init AST Alignment - Token 1`] = ` +"Snapshot Diff: +- TSESTree ++ Babel + + Array [ +- Keyword { +- type: 'Keyword', ++ Identifier { ++ type: 'Identifier', + value: 'let', + + range: [0, 3], + loc: { + start: { column: 0, line: 1 }, + end: { column: 3, line: 1 }, + }, + }, + Identifier { + type: 'Identifier', + value: 'foo', + + range: [4, 7], + loc: { + start: { column: 4, line: 1 }, + end: { column: 7, line: 1 }, + }, + }, + Punctuator { + type: 'Punctuator', + value: ':', + + range: [7, 8], + loc: { + start: { column: 7, line: 1 }, + end: { column: 8, line: 1 }, + }, + }, + Identifier { + type: 'Identifier', + value: 'any', + + range: [9, 12], + loc: { + start: { column: 9, line: 1 }, + end: { column: 12, line: 1 }, + }, + }, + Punctuator { + type: 'Punctuator', + value: '=', + + range: [13, 14], + loc: { + start: { column: 13, line: 1 }, + end: { column: 14, line: 1 }, + }, + }, + Numeric { + type: 'Numeric', + value: '1', + + range: [15, 16], + loc: { + start: { column: 15, line: 1 }, + end: { column: 16, line: 1 }, + }, + }, + Punctuator { + type: 'Punctuator', + value: ';', + + range: [16, 17], + loc: { + start: { column: 16, line: 1 }, + end: { column: 17, line: 1 }, + }, + }, + ]" +`; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/let-id-type-no-init/fixture.ts b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/let-id-type-no-init/fixture.ts new file mode 100644 index 000000000000..0ed40e897459 --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/let-id-type-no-init/fixture.ts @@ -0,0 +1 @@ +let foo: any; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/let-id-type-no-init/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/let-id-type-no-init/snapshots/1-TSESTree-AST.shot new file mode 100644 index 000000000000..1136df97ee2b --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/let-id-type-no-init/snapshots/1-TSESTree-AST.shot @@ -0,0 +1,70 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration VariableDeclaration let-id-type-no-init TSESTree - AST 1`] = ` +Program { + type: "Program", + body: [ + VariableDeclaration { + type: "VariableDeclaration", + declarations: [ + VariableDeclarator { + type: "VariableDeclarator", + definite: false, + id: Identifier { + type: "Identifier", + decorators: [], + name: "foo", + optional: false, + typeAnnotation: TSTypeAnnotation { + type: "TSTypeAnnotation", + typeAnnotation: TSAnyKeyword { + type: "TSAnyKeyword", + + range: [9, 12], + loc: { + start: { column: 9, line: 1 }, + end: { column: 12, line: 1 }, + }, + }, + + range: [7, 12], + loc: { + start: { column: 7, line: 1 }, + end: { column: 12, line: 1 }, + }, + }, + + range: [4, 12], + loc: { + start: { column: 4, line: 1 }, + end: { column: 12, line: 1 }, + }, + }, + init: null, + + range: [4, 12], + loc: { + start: { column: 4, line: 1 }, + end: { column: 12, line: 1 }, + }, + }, + ], + declare: false, + kind: "let", + + range: [0, 13], + loc: { + start: { column: 0, line: 1 }, + end: { column: 13, line: 1 }, + }, + }, + ], + sourceType: "script", + + range: [0, 14], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 2 }, + }, +} +`; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/let-with-value/snapshots/4-Babel-Tokens.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/let-id-type-no-init/snapshots/2-TSESTree-Tokens.shot similarity index 55% rename from packages/ast-spec/src/declaration/VariableDeclaration/fixtures/let-with-value/snapshots/4-Babel-Tokens.shot rename to packages/ast-spec/src/declaration/VariableDeclaration/fixtures/let-id-type-no-init/snapshots/2-TSESTree-Tokens.shot index f05ba1b92d0b..2dd60bc4b555 100644 --- a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/let-with-value/snapshots/4-Babel-Tokens.shot +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/let-id-type-no-init/snapshots/2-TSESTree-Tokens.shot @@ -1,9 +1,9 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`AST Fixtures declaration VariableDeclaration let-with-value Babel - Tokens 1`] = ` +exports[`AST Fixtures declaration VariableDeclaration let-id-type-no-init TSESTree - Tokens 1`] = ` [ - Identifier { - type: "Identifier", + Keyword { + type: "Keyword", value: "let", range: [0, 3], @@ -14,42 +14,42 @@ exports[`AST Fixtures declaration VariableDeclaration let-with-value Babel - Tok }, Identifier { type: "Identifier", - value: "x", + value: "foo", - range: [4, 5], + range: [4, 7], loc: { start: { column: 4, line: 1 }, - end: { column: 5, line: 1 }, + end: { column: 7, line: 1 }, }, }, Punctuator { type: "Punctuator", - value: "=", + value: ":", - range: [6, 7], + range: [7, 8], loc: { - start: { column: 6, line: 1 }, - end: { column: 7, line: 1 }, + start: { column: 7, line: 1 }, + end: { column: 8, line: 1 }, }, }, - Numeric { - type: "Numeric", - value: "1", + Identifier { + type: "Identifier", + value: "any", - range: [8, 9], + range: [9, 12], loc: { - start: { column: 8, line: 1 }, - end: { column: 9, line: 1 }, + start: { column: 9, line: 1 }, + end: { column: 12, line: 1 }, }, }, Punctuator { type: "Punctuator", value: ";", - range: [9, 10], + range: [12, 13], loc: { - start: { column: 9, line: 1 }, - end: { column: 10, line: 1 }, + start: { column: 12, line: 1 }, + end: { column: 13, line: 1 }, }, }, ] diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/let-id-type-no-init/snapshots/3-Babel-AST.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/let-id-type-no-init/snapshots/3-Babel-AST.shot new file mode 100644 index 000000000000..838a8843635a --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/let-id-type-no-init/snapshots/3-Babel-AST.shot @@ -0,0 +1,66 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration VariableDeclaration let-id-type-no-init Babel - AST 1`] = ` +Program { + type: "Program", + body: [ + VariableDeclaration { + type: "VariableDeclaration", + declarations: [ + VariableDeclarator { + type: "VariableDeclarator", + id: Identifier { + type: "Identifier", + name: "foo", + typeAnnotation: TSTypeAnnotation { + type: "TSTypeAnnotation", + typeAnnotation: TSAnyKeyword { + type: "TSAnyKeyword", + + range: [9, 12], + loc: { + start: { column: 9, line: 1 }, + end: { column: 12, line: 1 }, + }, + }, + + range: [7, 12], + loc: { + start: { column: 7, line: 1 }, + end: { column: 12, line: 1 }, + }, + }, + + range: [4, 12], + loc: { + start: { column: 4, line: 1 }, + end: { column: 12, line: 1 }, + }, + }, + init: null, + + range: [4, 12], + loc: { + start: { column: 4, line: 1 }, + end: { column: 12, line: 1 }, + }, + }, + ], + kind: "let", + + range: [0, 13], + loc: { + start: { column: 0, line: 1 }, + end: { column: 13, line: 1 }, + }, + }, + ], + sourceType: "script", + + range: [0, 14], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 2 }, + }, +} +`; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/let-with-value/snapshots/2-TSESTree-Tokens.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/let-id-type-no-init/snapshots/4-Babel-Tokens.shot similarity index 51% rename from packages/ast-spec/src/declaration/VariableDeclaration/fixtures/let-with-value/snapshots/2-TSESTree-Tokens.shot rename to packages/ast-spec/src/declaration/VariableDeclaration/fixtures/let-id-type-no-init/snapshots/4-Babel-Tokens.shot index 5d79b8753e14..7315e7c66641 100644 --- a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/let-with-value/snapshots/2-TSESTree-Tokens.shot +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/let-id-type-no-init/snapshots/4-Babel-Tokens.shot @@ -1,9 +1,9 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`AST Fixtures declaration VariableDeclaration let-with-value TSESTree - Tokens 1`] = ` +exports[`AST Fixtures declaration VariableDeclaration let-id-type-no-init Babel - Tokens 1`] = ` [ - Keyword { - type: "Keyword", + Identifier { + type: "Identifier", value: "let", range: [0, 3], @@ -14,42 +14,42 @@ exports[`AST Fixtures declaration VariableDeclaration let-with-value TSESTree - }, Identifier { type: "Identifier", - value: "x", + value: "foo", - range: [4, 5], + range: [4, 7], loc: { start: { column: 4, line: 1 }, - end: { column: 5, line: 1 }, + end: { column: 7, line: 1 }, }, }, Punctuator { type: "Punctuator", - value: "=", + value: ":", - range: [6, 7], + range: [7, 8], loc: { - start: { column: 6, line: 1 }, - end: { column: 7, line: 1 }, + start: { column: 7, line: 1 }, + end: { column: 8, line: 1 }, }, }, - Numeric { - type: "Numeric", - value: "1", + Identifier { + type: "Identifier", + value: "any", - range: [8, 9], + range: [9, 12], loc: { - start: { column: 8, line: 1 }, - end: { column: 9, line: 1 }, + start: { column: 9, line: 1 }, + end: { column: 12, line: 1 }, }, }, Punctuator { type: "Punctuator", value: ";", - range: [9, 10], + range: [12, 13], loc: { - start: { column: 9, line: 1 }, - end: { column: 10, line: 1 }, + start: { column: 12, line: 1 }, + end: { column: 13, line: 1 }, }, }, ] diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/let-id-type-no-init/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/let-id-type-no-init/snapshots/5-AST-Alignment-AST.shot new file mode 100644 index 000000000000..5b1ab2adad52 --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/let-id-type-no-init/snapshots/5-AST-Alignment-AST.shot @@ -0,0 +1,74 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration VariableDeclaration let-id-type-no-init AST Alignment - AST 1`] = ` +"Snapshot Diff: +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + VariableDeclaration { + type: 'VariableDeclaration', + declarations: Array [ + VariableDeclarator { + type: 'VariableDeclarator', +- definite: false, + id: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'foo', +- optional: false, + typeAnnotation: TSTypeAnnotation { + type: 'TSTypeAnnotation', + typeAnnotation: TSAnyKeyword { + type: 'TSAnyKeyword', + + range: [9, 12], + loc: { + start: { column: 9, line: 1 }, + end: { column: 12, line: 1 }, + }, + }, + + range: [7, 12], + loc: { + start: { column: 7, line: 1 }, + end: { column: 12, line: 1 }, + }, + }, + + range: [4, 12], + loc: { + start: { column: 4, line: 1 }, + end: { column: 12, line: 1 }, + }, + }, + init: null, + + range: [4, 12], + loc: { + start: { column: 4, line: 1 }, + end: { column: 12, line: 1 }, + }, + }, + ], +- declare: false, + kind: 'let', + + range: [0, 13], + loc: { + start: { column: 0, line: 1 }, + end: { column: 13, line: 1 }, + }, + }, + ], + sourceType: 'script', + + range: [0, 14], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 2 }, + }, + }" +`; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/let-id-type-no-init/snapshots/6-AST-Alignment-Tokens.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/let-id-type-no-init/snapshots/6-AST-Alignment-Tokens.shot new file mode 100644 index 000000000000..bcb14d69bf6b --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/let-id-type-no-init/snapshots/6-AST-Alignment-Tokens.shot @@ -0,0 +1,62 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration VariableDeclaration let-id-type-no-init AST Alignment - Token 1`] = ` +"Snapshot Diff: +- TSESTree ++ Babel + + Array [ +- Keyword { +- type: 'Keyword', ++ Identifier { ++ type: 'Identifier', + value: 'let', + + range: [0, 3], + loc: { + start: { column: 0, line: 1 }, + end: { column: 3, line: 1 }, + }, + }, + Identifier { + type: 'Identifier', + value: 'foo', + + range: [4, 7], + loc: { + start: { column: 4, line: 1 }, + end: { column: 7, line: 1 }, + }, + }, + Punctuator { + type: 'Punctuator', + value: ':', + + range: [7, 8], + loc: { + start: { column: 7, line: 1 }, + end: { column: 8, line: 1 }, + }, + }, + Identifier { + type: 'Identifier', + value: 'any', + + range: [9, 12], + loc: { + start: { column: 9, line: 1 }, + end: { column: 12, line: 1 }, + }, + }, + Punctuator { + type: 'Punctuator', + value: ';', + + range: [12, 13], + loc: { + start: { column: 12, line: 1 }, + end: { column: 13, line: 1 }, + }, + }, + ]" +`; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/let-with-value/fixture.ts b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/let-with-value/fixture.ts deleted file mode 100644 index db9133994486..000000000000 --- a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/let-with-value/fixture.ts +++ /dev/null @@ -1 +0,0 @@ -let x = 1; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/let-without-value/fixture.ts b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/let-without-value/fixture.ts deleted file mode 100644 index 2756c24c4577..000000000000 --- a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/let-without-value/fixture.ts +++ /dev/null @@ -1 +0,0 @@ -let x; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/using-id-init/fixture.ts b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/using-id-init/fixture.ts new file mode 100644 index 000000000000..813ad2fd34c2 --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/using-id-init/fixture.ts @@ -0,0 +1 @@ +using foo = 1; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/using-id-init/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/using-id-init/snapshots/1-TSESTree-AST.shot new file mode 100644 index 000000000000..7884d5e0441f --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/using-id-init/snapshots/1-TSESTree-AST.shot @@ -0,0 +1,62 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration VariableDeclaration using-id-init TSESTree - AST 1`] = ` +Program { + type: "Program", + body: [ + VariableDeclaration { + type: "VariableDeclaration", + declarations: [ + VariableDeclarator { + type: "VariableDeclarator", + definite: false, + id: Identifier { + type: "Identifier", + decorators: [], + name: "foo", + optional: false, + + range: [6, 9], + loc: { + start: { column: 6, line: 1 }, + end: { column: 9, line: 1 }, + }, + }, + init: Literal { + type: "Literal", + raw: "1", + value: 1, + + range: [12, 13], + loc: { + start: { column: 12, line: 1 }, + end: { column: 13, line: 1 }, + }, + }, + + range: [6, 13], + loc: { + start: { column: 6, line: 1 }, + end: { column: 13, line: 1 }, + }, + }, + ], + declare: false, + kind: "using", + + range: [0, 14], + loc: { + start: { column: 0, line: 1 }, + end: { column: 14, line: 1 }, + }, + }, + ], + sourceType: "script", + + range: [0, 15], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 2 }, + }, +} +`; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/using-id-init/snapshots/2-TSESTree-Tokens.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/using-id-init/snapshots/2-TSESTree-Tokens.shot new file mode 100644 index 000000000000..f7481905dc4d --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/using-id-init/snapshots/2-TSESTree-Tokens.shot @@ -0,0 +1,56 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration VariableDeclaration using-id-init TSESTree - Tokens 1`] = ` +[ + Identifier { + type: "Identifier", + value: "using", + + range: [0, 5], + loc: { + start: { column: 0, line: 1 }, + end: { column: 5, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "foo", + + range: [6, 9], + loc: { + start: { column: 6, line: 1 }, + end: { column: 9, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "=", + + range: [10, 11], + loc: { + start: { column: 10, line: 1 }, + end: { column: 11, line: 1 }, + }, + }, + Numeric { + type: "Numeric", + value: "1", + + range: [12, 13], + loc: { + start: { column: 12, line: 1 }, + end: { column: 13, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ";", + + range: [13, 14], + loc: { + start: { column: 13, line: 1 }, + end: { column: 14, line: 1 }, + }, + }, +] +`; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/using-id-init/snapshots/3-Babel-AST.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/using-id-init/snapshots/3-Babel-AST.shot new file mode 100644 index 000000000000..4a2b25ba3174 --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/using-id-init/snapshots/3-Babel-AST.shot @@ -0,0 +1,58 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration VariableDeclaration using-id-init Babel - AST 1`] = ` +Program { + type: "Program", + body: [ + VariableDeclaration { + type: "VariableDeclaration", + declarations: [ + VariableDeclarator { + type: "VariableDeclarator", + id: Identifier { + type: "Identifier", + name: "foo", + + range: [6, 9], + loc: { + start: { column: 6, line: 1 }, + end: { column: 9, line: 1 }, + }, + }, + init: Literal { + type: "Literal", + raw: "1", + value: 1, + + range: [12, 13], + loc: { + start: { column: 12, line: 1 }, + end: { column: 13, line: 1 }, + }, + }, + + range: [6, 13], + loc: { + start: { column: 6, line: 1 }, + end: { column: 13, line: 1 }, + }, + }, + ], + kind: "using", + + range: [0, 14], + loc: { + start: { column: 0, line: 1 }, + end: { column: 14, line: 1 }, + }, + }, + ], + sourceType: "script", + + range: [0, 15], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 2 }, + }, +} +`; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/using-with-value/snapshots/2-TSESTree-Tokens.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/using-id-init/snapshots/4-Babel-Tokens.shot similarity index 68% rename from packages/ast-spec/src/declaration/VariableDeclaration/fixtures/using-with-value/snapshots/2-TSESTree-Tokens.shot rename to packages/ast-spec/src/declaration/VariableDeclaration/fixtures/using-id-init/snapshots/4-Babel-Tokens.shot index dcdb5109c1c7..8f7238414c71 100644 --- a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/using-with-value/snapshots/2-TSESTree-Tokens.shot +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/using-id-init/snapshots/4-Babel-Tokens.shot @@ -1,6 +1,6 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`AST Fixtures declaration VariableDeclaration using-with-value TSESTree - Tokens 1`] = ` +exports[`AST Fixtures declaration VariableDeclaration using-id-init Babel - Tokens 1`] = ` [ Identifier { type: "Identifier", @@ -14,42 +14,42 @@ exports[`AST Fixtures declaration VariableDeclaration using-with-value TSESTree }, Identifier { type: "Identifier", - value: "a", + value: "foo", - range: [6, 7], + range: [6, 9], loc: { start: { column: 6, line: 1 }, - end: { column: 7, line: 1 }, + end: { column: 9, line: 1 }, }, }, Punctuator { type: "Punctuator", value: "=", - range: [8, 9], + range: [10, 11], loc: { - start: { column: 8, line: 1 }, - end: { column: 9, line: 1 }, + start: { column: 10, line: 1 }, + end: { column: 11, line: 1 }, }, }, Numeric { type: "Numeric", value: "1", - range: [10, 11], + range: [12, 13], loc: { - start: { column: 10, line: 1 }, - end: { column: 11, line: 1 }, + start: { column: 12, line: 1 }, + end: { column: 13, line: 1 }, }, }, Punctuator { type: "Punctuator", value: ";", - range: [11, 12], + range: [13, 14], loc: { - start: { column: 11, line: 1 }, - end: { column: 12, line: 1 }, + start: { column: 13, line: 1 }, + end: { column: 14, line: 1 }, }, }, ] diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/using-id-init/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/using-id-init/snapshots/5-AST-Alignment-AST.shot new file mode 100644 index 000000000000..051dd8a958d6 --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/using-id-init/snapshots/5-AST-Alignment-AST.shot @@ -0,0 +1,66 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration VariableDeclaration using-id-init AST Alignment - AST 1`] = ` +"Snapshot Diff: +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + VariableDeclaration { + type: 'VariableDeclaration', + declarations: Array [ + VariableDeclarator { + type: 'VariableDeclarator', +- definite: false, + id: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'foo', +- optional: false, + + range: [6, 9], + loc: { + start: { column: 6, line: 1 }, + end: { column: 9, line: 1 }, + }, + }, + init: Literal { + type: 'Literal', + raw: '1', + value: 1, + + range: [12, 13], + loc: { + start: { column: 12, line: 1 }, + end: { column: 13, line: 1 }, + }, + }, + + range: [6, 13], + loc: { + start: { column: 6, line: 1 }, + end: { column: 13, line: 1 }, + }, + }, + ], +- declare: false, + kind: 'using', + + range: [0, 14], + loc: { + start: { column: 0, line: 1 }, + end: { column: 14, line: 1 }, + }, + }, + ], + sourceType: 'script', + + range: [0, 15], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 2 }, + }, + }" +`; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/const-with-value/snapshots/6-AST-Alignment-Tokens.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/using-id-init/snapshots/6-AST-Alignment-Tokens.shot similarity index 51% rename from packages/ast-spec/src/declaration/VariableDeclaration/fixtures/const-with-value/snapshots/6-AST-Alignment-Tokens.shot rename to packages/ast-spec/src/declaration/VariableDeclaration/fixtures/using-id-init/snapshots/6-AST-Alignment-Tokens.shot index abc02d7344bf..165eb83a5143 100644 --- a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/const-with-value/snapshots/6-AST-Alignment-Tokens.shot +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/using-id-init/snapshots/6-AST-Alignment-Tokens.shot @@ -1,6 +1,6 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`AST Fixtures declaration VariableDeclaration const-with-value AST Alignment - Token 1`] = ` +exports[`AST Fixtures declaration VariableDeclaration using-id-init AST Alignment - Token 1`] = ` "Snapshot Diff: Compared values have no visual difference." `; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/using-id-type-init/fixture.ts b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/using-id-type-init/fixture.ts new file mode 100644 index 000000000000..f63cb30a8544 --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/using-id-type-init/fixture.ts @@ -0,0 +1 @@ +using foo: any = 1; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/using-id-type-init/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/using-id-type-init/snapshots/1-TSESTree-AST.shot new file mode 100644 index 000000000000..49af763ccd9e --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/using-id-type-init/snapshots/1-TSESTree-AST.shot @@ -0,0 +1,80 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration VariableDeclaration using-id-type-init TSESTree - AST 1`] = ` +Program { + type: "Program", + body: [ + VariableDeclaration { + type: "VariableDeclaration", + declarations: [ + VariableDeclarator { + type: "VariableDeclarator", + definite: false, + id: Identifier { + type: "Identifier", + decorators: [], + name: "foo", + optional: false, + typeAnnotation: TSTypeAnnotation { + type: "TSTypeAnnotation", + typeAnnotation: TSAnyKeyword { + type: "TSAnyKeyword", + + range: [11, 14], + loc: { + start: { column: 11, line: 1 }, + end: { column: 14, line: 1 }, + }, + }, + + range: [9, 14], + loc: { + start: { column: 9, line: 1 }, + end: { column: 14, line: 1 }, + }, + }, + + range: [6, 14], + loc: { + start: { column: 6, line: 1 }, + end: { column: 14, line: 1 }, + }, + }, + init: Literal { + type: "Literal", + raw: "1", + value: 1, + + range: [17, 18], + loc: { + start: { column: 17, line: 1 }, + end: { column: 18, line: 1 }, + }, + }, + + range: [6, 18], + loc: { + start: { column: 6, line: 1 }, + end: { column: 18, line: 1 }, + }, + }, + ], + declare: false, + kind: "using", + + range: [0, 19], + loc: { + start: { column: 0, line: 1 }, + end: { column: 19, line: 1 }, + }, + }, + ], + sourceType: "script", + + range: [0, 20], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 2 }, + }, +} +`; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/using-id-type-init/snapshots/2-TSESTree-Tokens.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/using-id-type-init/snapshots/2-TSESTree-Tokens.shot new file mode 100644 index 000000000000..a68f4e2f7a32 --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/using-id-type-init/snapshots/2-TSESTree-Tokens.shot @@ -0,0 +1,76 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration VariableDeclaration using-id-type-init TSESTree - Tokens 1`] = ` +[ + Identifier { + type: "Identifier", + value: "using", + + range: [0, 5], + loc: { + start: { column: 0, line: 1 }, + end: { column: 5, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "foo", + + range: [6, 9], + loc: { + start: { column: 6, line: 1 }, + end: { column: 9, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ":", + + range: [9, 10], + loc: { + start: { column: 9, line: 1 }, + end: { column: 10, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "any", + + range: [11, 14], + loc: { + start: { column: 11, line: 1 }, + end: { column: 14, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "=", + + range: [15, 16], + loc: { + start: { column: 15, line: 1 }, + end: { column: 16, line: 1 }, + }, + }, + Numeric { + type: "Numeric", + value: "1", + + range: [17, 18], + loc: { + start: { column: 17, line: 1 }, + end: { column: 18, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ";", + + range: [18, 19], + loc: { + start: { column: 18, line: 1 }, + end: { column: 19, line: 1 }, + }, + }, +] +`; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/using-id-type-init/snapshots/3-Babel-AST.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/using-id-type-init/snapshots/3-Babel-AST.shot new file mode 100644 index 000000000000..3480930719b6 --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/using-id-type-init/snapshots/3-Babel-AST.shot @@ -0,0 +1,76 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration VariableDeclaration using-id-type-init Babel - AST 1`] = ` +Program { + type: "Program", + body: [ + VariableDeclaration { + type: "VariableDeclaration", + declarations: [ + VariableDeclarator { + type: "VariableDeclarator", + id: Identifier { + type: "Identifier", + name: "foo", + typeAnnotation: TSTypeAnnotation { + type: "TSTypeAnnotation", + typeAnnotation: TSAnyKeyword { + type: "TSAnyKeyword", + + range: [11, 14], + loc: { + start: { column: 11, line: 1 }, + end: { column: 14, line: 1 }, + }, + }, + + range: [9, 14], + loc: { + start: { column: 9, line: 1 }, + end: { column: 14, line: 1 }, + }, + }, + + range: [6, 14], + loc: { + start: { column: 6, line: 1 }, + end: { column: 14, line: 1 }, + }, + }, + init: Literal { + type: "Literal", + raw: "1", + value: 1, + + range: [17, 18], + loc: { + start: { column: 17, line: 1 }, + end: { column: 18, line: 1 }, + }, + }, + + range: [6, 18], + loc: { + start: { column: 6, line: 1 }, + end: { column: 18, line: 1 }, + }, + }, + ], + kind: "using", + + range: [0, 19], + loc: { + start: { column: 0, line: 1 }, + end: { column: 19, line: 1 }, + }, + }, + ], + sourceType: "script", + + range: [0, 20], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 2 }, + }, +} +`; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/using-id-type-init/snapshots/4-Babel-Tokens.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/using-id-type-init/snapshots/4-Babel-Tokens.shot new file mode 100644 index 000000000000..b8617dd971a7 --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/using-id-type-init/snapshots/4-Babel-Tokens.shot @@ -0,0 +1,76 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration VariableDeclaration using-id-type-init Babel - Tokens 1`] = ` +[ + Identifier { + type: "Identifier", + value: "using", + + range: [0, 5], + loc: { + start: { column: 0, line: 1 }, + end: { column: 5, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "foo", + + range: [6, 9], + loc: { + start: { column: 6, line: 1 }, + end: { column: 9, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ":", + + range: [9, 10], + loc: { + start: { column: 9, line: 1 }, + end: { column: 10, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "any", + + range: [11, 14], + loc: { + start: { column: 11, line: 1 }, + end: { column: 14, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "=", + + range: [15, 16], + loc: { + start: { column: 15, line: 1 }, + end: { column: 16, line: 1 }, + }, + }, + Numeric { + type: "Numeric", + value: "1", + + range: [17, 18], + loc: { + start: { column: 17, line: 1 }, + end: { column: 18, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ";", + + range: [18, 19], + loc: { + start: { column: 18, line: 1 }, + end: { column: 19, line: 1 }, + }, + }, +] +`; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/using-id-type-init/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/using-id-type-init/snapshots/5-AST-Alignment-AST.shot new file mode 100644 index 000000000000..74ea9bb8ae6d --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/using-id-type-init/snapshots/5-AST-Alignment-AST.shot @@ -0,0 +1,84 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration VariableDeclaration using-id-type-init AST Alignment - AST 1`] = ` +"Snapshot Diff: +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + VariableDeclaration { + type: 'VariableDeclaration', + declarations: Array [ + VariableDeclarator { + type: 'VariableDeclarator', +- definite: false, + id: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'foo', +- optional: false, + typeAnnotation: TSTypeAnnotation { + type: 'TSTypeAnnotation', + typeAnnotation: TSAnyKeyword { + type: 'TSAnyKeyword', + + range: [11, 14], + loc: { + start: { column: 11, line: 1 }, + end: { column: 14, line: 1 }, + }, + }, + + range: [9, 14], + loc: { + start: { column: 9, line: 1 }, + end: { column: 14, line: 1 }, + }, + }, + + range: [6, 14], + loc: { + start: { column: 6, line: 1 }, + end: { column: 14, line: 1 }, + }, + }, + init: Literal { + type: 'Literal', + raw: '1', + value: 1, + + range: [17, 18], + loc: { + start: { column: 17, line: 1 }, + end: { column: 18, line: 1 }, + }, + }, + + range: [6, 18], + loc: { + start: { column: 6, line: 1 }, + end: { column: 18, line: 1 }, + }, + }, + ], +- declare: false, + kind: 'using', + + range: [0, 19], + loc: { + start: { column: 0, line: 1 }, + end: { column: 19, line: 1 }, + }, + }, + ], + sourceType: 'script', + + range: [0, 20], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 2 }, + }, + }" +`; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/using-id-type-init/snapshots/6-AST-Alignment-Tokens.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/using-id-type-init/snapshots/6-AST-Alignment-Tokens.shot new file mode 100644 index 000000000000..e660ba34cb44 --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/using-id-type-init/snapshots/6-AST-Alignment-Tokens.shot @@ -0,0 +1,6 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration VariableDeclaration using-id-type-init AST Alignment - Token 1`] = ` +"Snapshot Diff: +Compared values have no visual difference." +`; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/using-with-value/fixture.ts b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/using-with-value/fixture.ts deleted file mode 100644 index 0b59975f6289..000000000000 --- a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/using-with-value/fixture.ts +++ /dev/null @@ -1 +0,0 @@ -using a = 1; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/var-destructure-init/fixture.ts b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/var-destructure-init/fixture.ts new file mode 100644 index 000000000000..66eb0dbf1d64 --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/var-destructure-init/fixture.ts @@ -0,0 +1 @@ +var { foo } = 1; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/var-destructure-init/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/var-destructure-init/snapshots/1-TSESTree-AST.shot new file mode 100644 index 000000000000..fc1d38439655 --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/var-destructure-init/snapshots/1-TSESTree-AST.shot @@ -0,0 +1,101 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration VariableDeclaration var-destructure-init TSESTree - AST 1`] = ` +Program { + type: "Program", + body: [ + VariableDeclaration { + type: "VariableDeclaration", + declarations: [ + VariableDeclarator { + type: "VariableDeclarator", + definite: false, + id: ObjectPattern { + type: "ObjectPattern", + decorators: [], + optional: false, + properties: [ + Property { + type: "Property", + computed: false, + key: Identifier { + type: "Identifier", + decorators: [], + name: "foo", + optional: false, + + range: [6, 9], + loc: { + start: { column: 6, line: 1 }, + end: { column: 9, line: 1 }, + }, + }, + kind: "init", + method: false, + optional: false, + shorthand: true, + value: Identifier { + type: "Identifier", + decorators: [], + name: "foo", + optional: false, + + range: [6, 9], + loc: { + start: { column: 6, line: 1 }, + end: { column: 9, line: 1 }, + }, + }, + + range: [6, 9], + loc: { + start: { column: 6, line: 1 }, + end: { column: 9, line: 1 }, + }, + }, + ], + + range: [4, 11], + loc: { + start: { column: 4, line: 1 }, + end: { column: 11, line: 1 }, + }, + }, + init: Literal { + type: "Literal", + raw: "1", + value: 1, + + range: [14, 15], + loc: { + start: { column: 14, line: 1 }, + end: { column: 15, line: 1 }, + }, + }, + + range: [4, 15], + loc: { + start: { column: 4, line: 1 }, + end: { column: 15, line: 1 }, + }, + }, + ], + declare: false, + kind: "var", + + range: [0, 16], + loc: { + start: { column: 0, line: 1 }, + end: { column: 16, line: 1 }, + }, + }, + ], + sourceType: "script", + + range: [0, 17], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 2 }, + }, +} +`; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/var-destructure-init/snapshots/2-TSESTree-Tokens.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/var-destructure-init/snapshots/2-TSESTree-Tokens.shot new file mode 100644 index 000000000000..07e780fc8a35 --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/var-destructure-init/snapshots/2-TSESTree-Tokens.shot @@ -0,0 +1,76 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration VariableDeclaration var-destructure-init TSESTree - Tokens 1`] = ` +[ + Keyword { + type: "Keyword", + value: "var", + + range: [0, 3], + loc: { + start: { column: 0, line: 1 }, + end: { column: 3, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "{", + + range: [4, 5], + loc: { + start: { column: 4, line: 1 }, + end: { column: 5, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "foo", + + range: [6, 9], + loc: { + start: { column: 6, line: 1 }, + end: { column: 9, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "}", + + range: [10, 11], + loc: { + start: { column: 10, line: 1 }, + end: { column: 11, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "=", + + range: [12, 13], + loc: { + start: { column: 12, line: 1 }, + end: { column: 13, line: 1 }, + }, + }, + Numeric { + type: "Numeric", + value: "1", + + range: [14, 15], + loc: { + start: { column: 14, line: 1 }, + end: { column: 15, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ";", + + range: [15, 16], + loc: { + start: { column: 15, line: 1 }, + end: { column: 16, line: 1 }, + }, + }, +] +`; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/var-destructure-init/snapshots/3-Babel-AST.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/var-destructure-init/snapshots/3-Babel-AST.shot new file mode 100644 index 000000000000..c05ad30ccbd6 --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/var-destructure-init/snapshots/3-Babel-AST.shot @@ -0,0 +1,92 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration VariableDeclaration var-destructure-init Babel - AST 1`] = ` +Program { + type: "Program", + body: [ + VariableDeclaration { + type: "VariableDeclaration", + declarations: [ + VariableDeclarator { + type: "VariableDeclarator", + id: ObjectPattern { + type: "ObjectPattern", + properties: [ + Property { + type: "Property", + computed: false, + key: Identifier { + type: "Identifier", + name: "foo", + + range: [6, 9], + loc: { + start: { column: 6, line: 1 }, + end: { column: 9, line: 1 }, + }, + }, + kind: "init", + method: false, + shorthand: true, + value: Identifier { + type: "Identifier", + name: "foo", + + range: [6, 9], + loc: { + start: { column: 6, line: 1 }, + end: { column: 9, line: 1 }, + }, + }, + + range: [6, 9], + loc: { + start: { column: 6, line: 1 }, + end: { column: 9, line: 1 }, + }, + }, + ], + + range: [4, 11], + loc: { + start: { column: 4, line: 1 }, + end: { column: 11, line: 1 }, + }, + }, + init: Literal { + type: "Literal", + raw: "1", + value: 1, + + range: [14, 15], + loc: { + start: { column: 14, line: 1 }, + end: { column: 15, line: 1 }, + }, + }, + + range: [4, 15], + loc: { + start: { column: 4, line: 1 }, + end: { column: 15, line: 1 }, + }, + }, + ], + kind: "var", + + range: [0, 16], + loc: { + start: { column: 0, line: 1 }, + end: { column: 16, line: 1 }, + }, + }, + ], + sourceType: "script", + + range: [0, 17], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 2 }, + }, +} +`; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/var-destructure-init/snapshots/4-Babel-Tokens.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/var-destructure-init/snapshots/4-Babel-Tokens.shot new file mode 100644 index 000000000000..9b72ae7d12aa --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/var-destructure-init/snapshots/4-Babel-Tokens.shot @@ -0,0 +1,76 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration VariableDeclaration var-destructure-init Babel - Tokens 1`] = ` +[ + Keyword { + type: "Keyword", + value: "var", + + range: [0, 3], + loc: { + start: { column: 0, line: 1 }, + end: { column: 3, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "{", + + range: [4, 5], + loc: { + start: { column: 4, line: 1 }, + end: { column: 5, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "foo", + + range: [6, 9], + loc: { + start: { column: 6, line: 1 }, + end: { column: 9, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "}", + + range: [10, 11], + loc: { + start: { column: 10, line: 1 }, + end: { column: 11, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "=", + + range: [12, 13], + loc: { + start: { column: 12, line: 1 }, + end: { column: 13, line: 1 }, + }, + }, + Numeric { + type: "Numeric", + value: "1", + + range: [14, 15], + loc: { + start: { column: 14, line: 1 }, + end: { column: 15, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ";", + + range: [15, 16], + loc: { + start: { column: 15, line: 1 }, + end: { column: 16, line: 1 }, + }, + }, +] +`; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/var-destructure-init/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/var-destructure-init/snapshots/5-AST-Alignment-AST.shot new file mode 100644 index 000000000000..6393bc6e2447 --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/var-destructure-init/snapshots/5-AST-Alignment-AST.shot @@ -0,0 +1,105 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration VariableDeclaration var-destructure-init AST Alignment - AST 1`] = ` +"Snapshot Diff: +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + VariableDeclaration { + type: 'VariableDeclaration', + declarations: Array [ + VariableDeclarator { + type: 'VariableDeclarator', +- definite: false, + id: ObjectPattern { + type: 'ObjectPattern', +- decorators: Array [], +- optional: false, + properties: Array [ + Property { + type: 'Property', + computed: false, + key: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'foo', +- optional: false, + + range: [6, 9], + loc: { + start: { column: 6, line: 1 }, + end: { column: 9, line: 1 }, + }, + }, + kind: 'init', + method: false, +- optional: false, + shorthand: true, + value: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'foo', +- optional: false, + + range: [6, 9], + loc: { + start: { column: 6, line: 1 }, + end: { column: 9, line: 1 }, + }, + }, + + range: [6, 9], + loc: { + start: { column: 6, line: 1 }, + end: { column: 9, line: 1 }, + }, + }, + ], + + range: [4, 11], + loc: { + start: { column: 4, line: 1 }, + end: { column: 11, line: 1 }, + }, + }, + init: Literal { + type: 'Literal', + raw: '1', + value: 1, + + range: [14, 15], + loc: { + start: { column: 14, line: 1 }, + end: { column: 15, line: 1 }, + }, + }, + + range: [4, 15], + loc: { + start: { column: 4, line: 1 }, + end: { column: 15, line: 1 }, + }, + }, + ], +- declare: false, + kind: 'var', + + range: [0, 16], + loc: { + start: { column: 0, line: 1 }, + end: { column: 16, line: 1 }, + }, + }, + ], + sourceType: 'script', + + range: [0, 17], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 2 }, + }, + }" +`; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/var-destructure-init/snapshots/6-AST-Alignment-Tokens.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/var-destructure-init/snapshots/6-AST-Alignment-Tokens.shot new file mode 100644 index 000000000000..2d87c3b3f58c --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/var-destructure-init/snapshots/6-AST-Alignment-Tokens.shot @@ -0,0 +1,6 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration VariableDeclaration var-destructure-init AST Alignment - Token 1`] = ` +"Snapshot Diff: +Compared values have no visual difference." +`; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/var-destructure-type-init/fixture.ts b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/var-destructure-type-init/fixture.ts new file mode 100644 index 000000000000..1dfb3f3b2c86 --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/var-destructure-type-init/fixture.ts @@ -0,0 +1 @@ +var { foo }: any = 1; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/var-destructure-type-init/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/var-destructure-type-init/snapshots/1-TSESTree-AST.shot new file mode 100644 index 000000000000..43e5bb1f00de --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/var-destructure-type-init/snapshots/1-TSESTree-AST.shot @@ -0,0 +1,119 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration VariableDeclaration var-destructure-type-init TSESTree - AST 1`] = ` +Program { + type: "Program", + body: [ + VariableDeclaration { + type: "VariableDeclaration", + declarations: [ + VariableDeclarator { + type: "VariableDeclarator", + definite: false, + id: ObjectPattern { + type: "ObjectPattern", + decorators: [], + optional: false, + properties: [ + Property { + type: "Property", + computed: false, + key: Identifier { + type: "Identifier", + decorators: [], + name: "foo", + optional: false, + + range: [6, 9], + loc: { + start: { column: 6, line: 1 }, + end: { column: 9, line: 1 }, + }, + }, + kind: "init", + method: false, + optional: false, + shorthand: true, + value: Identifier { + type: "Identifier", + decorators: [], + name: "foo", + optional: false, + + range: [6, 9], + loc: { + start: { column: 6, line: 1 }, + end: { column: 9, line: 1 }, + }, + }, + + range: [6, 9], + loc: { + start: { column: 6, line: 1 }, + end: { column: 9, line: 1 }, + }, + }, + ], + typeAnnotation: TSTypeAnnotation { + type: "TSTypeAnnotation", + typeAnnotation: TSAnyKeyword { + type: "TSAnyKeyword", + + range: [13, 16], + loc: { + start: { column: 13, line: 1 }, + end: { column: 16, line: 1 }, + }, + }, + + range: [11, 16], + loc: { + start: { column: 11, line: 1 }, + end: { column: 16, line: 1 }, + }, + }, + + range: [4, 16], + loc: { + start: { column: 4, line: 1 }, + end: { column: 16, line: 1 }, + }, + }, + init: Literal { + type: "Literal", + raw: "1", + value: 1, + + range: [19, 20], + loc: { + start: { column: 19, line: 1 }, + end: { column: 20, line: 1 }, + }, + }, + + range: [4, 20], + loc: { + start: { column: 4, line: 1 }, + end: { column: 20, line: 1 }, + }, + }, + ], + declare: false, + kind: "var", + + range: [0, 21], + loc: { + start: { column: 0, line: 1 }, + end: { column: 21, line: 1 }, + }, + }, + ], + sourceType: "script", + + range: [0, 22], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 2 }, + }, +} +`; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/var-destructure-type-init/snapshots/2-TSESTree-Tokens.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/var-destructure-type-init/snapshots/2-TSESTree-Tokens.shot new file mode 100644 index 000000000000..98c7e1526106 --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/var-destructure-type-init/snapshots/2-TSESTree-Tokens.shot @@ -0,0 +1,96 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration VariableDeclaration var-destructure-type-init TSESTree - Tokens 1`] = ` +[ + Keyword { + type: "Keyword", + value: "var", + + range: [0, 3], + loc: { + start: { column: 0, line: 1 }, + end: { column: 3, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "{", + + range: [4, 5], + loc: { + start: { column: 4, line: 1 }, + end: { column: 5, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "foo", + + range: [6, 9], + loc: { + start: { column: 6, line: 1 }, + end: { column: 9, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "}", + + range: [10, 11], + loc: { + start: { column: 10, line: 1 }, + end: { column: 11, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ":", + + range: [11, 12], + loc: { + start: { column: 11, line: 1 }, + end: { column: 12, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "any", + + range: [13, 16], + loc: { + start: { column: 13, line: 1 }, + end: { column: 16, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "=", + + range: [17, 18], + loc: { + start: { column: 17, line: 1 }, + end: { column: 18, line: 1 }, + }, + }, + Numeric { + type: "Numeric", + value: "1", + + range: [19, 20], + loc: { + start: { column: 19, line: 1 }, + end: { column: 20, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ";", + + range: [20, 21], + loc: { + start: { column: 20, line: 1 }, + end: { column: 21, line: 1 }, + }, + }, +] +`; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/var-destructure-type-init/snapshots/3-Babel-AST.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/var-destructure-type-init/snapshots/3-Babel-AST.shot new file mode 100644 index 000000000000..b2c4235c24cb --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/var-destructure-type-init/snapshots/3-Babel-AST.shot @@ -0,0 +1,110 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration VariableDeclaration var-destructure-type-init Babel - AST 1`] = ` +Program { + type: "Program", + body: [ + VariableDeclaration { + type: "VariableDeclaration", + declarations: [ + VariableDeclarator { + type: "VariableDeclarator", + id: ObjectPattern { + type: "ObjectPattern", + properties: [ + Property { + type: "Property", + computed: false, + key: Identifier { + type: "Identifier", + name: "foo", + + range: [6, 9], + loc: { + start: { column: 6, line: 1 }, + end: { column: 9, line: 1 }, + }, + }, + kind: "init", + method: false, + shorthand: true, + value: Identifier { + type: "Identifier", + name: "foo", + + range: [6, 9], + loc: { + start: { column: 6, line: 1 }, + end: { column: 9, line: 1 }, + }, + }, + + range: [6, 9], + loc: { + start: { column: 6, line: 1 }, + end: { column: 9, line: 1 }, + }, + }, + ], + typeAnnotation: TSTypeAnnotation { + type: "TSTypeAnnotation", + typeAnnotation: TSAnyKeyword { + type: "TSAnyKeyword", + + range: [13, 16], + loc: { + start: { column: 13, line: 1 }, + end: { column: 16, line: 1 }, + }, + }, + + range: [11, 16], + loc: { + start: { column: 11, line: 1 }, + end: { column: 16, line: 1 }, + }, + }, + + range: [4, 16], + loc: { + start: { column: 4, line: 1 }, + end: { column: 16, line: 1 }, + }, + }, + init: Literal { + type: "Literal", + raw: "1", + value: 1, + + range: [19, 20], + loc: { + start: { column: 19, line: 1 }, + end: { column: 20, line: 1 }, + }, + }, + + range: [4, 20], + loc: { + start: { column: 4, line: 1 }, + end: { column: 20, line: 1 }, + }, + }, + ], + kind: "var", + + range: [0, 21], + loc: { + start: { column: 0, line: 1 }, + end: { column: 21, line: 1 }, + }, + }, + ], + sourceType: "script", + + range: [0, 22], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 2 }, + }, +} +`; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/var-destructure-type-init/snapshots/4-Babel-Tokens.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/var-destructure-type-init/snapshots/4-Babel-Tokens.shot new file mode 100644 index 000000000000..02466964362f --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/var-destructure-type-init/snapshots/4-Babel-Tokens.shot @@ -0,0 +1,96 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration VariableDeclaration var-destructure-type-init Babel - Tokens 1`] = ` +[ + Keyword { + type: "Keyword", + value: "var", + + range: [0, 3], + loc: { + start: { column: 0, line: 1 }, + end: { column: 3, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "{", + + range: [4, 5], + loc: { + start: { column: 4, line: 1 }, + end: { column: 5, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "foo", + + range: [6, 9], + loc: { + start: { column: 6, line: 1 }, + end: { column: 9, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "}", + + range: [10, 11], + loc: { + start: { column: 10, line: 1 }, + end: { column: 11, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ":", + + range: [11, 12], + loc: { + start: { column: 11, line: 1 }, + end: { column: 12, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "any", + + range: [13, 16], + loc: { + start: { column: 13, line: 1 }, + end: { column: 16, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "=", + + range: [17, 18], + loc: { + start: { column: 17, line: 1 }, + end: { column: 18, line: 1 }, + }, + }, + Numeric { + type: "Numeric", + value: "1", + + range: [19, 20], + loc: { + start: { column: 19, line: 1 }, + end: { column: 20, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ";", + + range: [20, 21], + loc: { + start: { column: 20, line: 1 }, + end: { column: 21, line: 1 }, + }, + }, +] +`; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/var-destructure-type-init/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/var-destructure-type-init/snapshots/5-AST-Alignment-AST.shot new file mode 100644 index 000000000000..80f45833a2bb --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/var-destructure-type-init/snapshots/5-AST-Alignment-AST.shot @@ -0,0 +1,123 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration VariableDeclaration var-destructure-type-init AST Alignment - AST 1`] = ` +"Snapshot Diff: +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + VariableDeclaration { + type: 'VariableDeclaration', + declarations: Array [ + VariableDeclarator { + type: 'VariableDeclarator', +- definite: false, + id: ObjectPattern { + type: 'ObjectPattern', +- decorators: Array [], +- optional: false, + properties: Array [ + Property { + type: 'Property', + computed: false, + key: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'foo', +- optional: false, + + range: [6, 9], + loc: { + start: { column: 6, line: 1 }, + end: { column: 9, line: 1 }, + }, + }, + kind: 'init', + method: false, +- optional: false, + shorthand: true, + value: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'foo', +- optional: false, + + range: [6, 9], + loc: { + start: { column: 6, line: 1 }, + end: { column: 9, line: 1 }, + }, + }, + + range: [6, 9], + loc: { + start: { column: 6, line: 1 }, + end: { column: 9, line: 1 }, + }, + }, + ], + typeAnnotation: TSTypeAnnotation { + type: 'TSTypeAnnotation', + typeAnnotation: TSAnyKeyword { + type: 'TSAnyKeyword', + + range: [13, 16], + loc: { + start: { column: 13, line: 1 }, + end: { column: 16, line: 1 }, + }, + }, + + range: [11, 16], + loc: { + start: { column: 11, line: 1 }, + end: { column: 16, line: 1 }, + }, + }, + + range: [4, 16], + loc: { + start: { column: 4, line: 1 }, + end: { column: 16, line: 1 }, + }, + }, + init: Literal { + type: 'Literal', + raw: '1', + value: 1, + + range: [19, 20], + loc: { + start: { column: 19, line: 1 }, + end: { column: 20, line: 1 }, + }, + }, + + range: [4, 20], + loc: { + start: { column: 4, line: 1 }, + end: { column: 20, line: 1 }, + }, + }, + ], +- declare: false, + kind: 'var', + + range: [0, 21], + loc: { + start: { column: 0, line: 1 }, + end: { column: 21, line: 1 }, + }, + }, + ], + sourceType: 'script', + + range: [0, 22], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 2 }, + }, + }" +`; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/var-destructure-type-init/snapshots/6-AST-Alignment-Tokens.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/var-destructure-type-init/snapshots/6-AST-Alignment-Tokens.shot new file mode 100644 index 000000000000..21eefedbffbb --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/var-destructure-type-init/snapshots/6-AST-Alignment-Tokens.shot @@ -0,0 +1,6 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration VariableDeclaration var-destructure-type-init AST Alignment - Token 1`] = ` +"Snapshot Diff: +Compared values have no visual difference." +`; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/var-id-definite-type-no-init/fixture.ts b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/var-id-definite-type-no-init/fixture.ts new file mode 100644 index 000000000000..5e70f8e8240d --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/var-id-definite-type-no-init/fixture.ts @@ -0,0 +1 @@ +var foo!: any; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/var-id-definite-type-no-init/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/var-id-definite-type-no-init/snapshots/1-TSESTree-AST.shot new file mode 100644 index 000000000000..9690b61af6e4 --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/var-id-definite-type-no-init/snapshots/1-TSESTree-AST.shot @@ -0,0 +1,70 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration VariableDeclaration var-id-definite-type-no-init TSESTree - AST 1`] = ` +Program { + type: "Program", + body: [ + VariableDeclaration { + type: "VariableDeclaration", + declarations: [ + VariableDeclarator { + type: "VariableDeclarator", + definite: true, + id: Identifier { + type: "Identifier", + decorators: [], + name: "foo", + optional: false, + typeAnnotation: TSTypeAnnotation { + type: "TSTypeAnnotation", + typeAnnotation: TSAnyKeyword { + type: "TSAnyKeyword", + + range: [10, 13], + loc: { + start: { column: 10, line: 1 }, + end: { column: 13, line: 1 }, + }, + }, + + range: [8, 13], + loc: { + start: { column: 8, line: 1 }, + end: { column: 13, line: 1 }, + }, + }, + + range: [4, 13], + loc: { + start: { column: 4, line: 1 }, + end: { column: 13, line: 1 }, + }, + }, + init: null, + + range: [4, 13], + loc: { + start: { column: 4, line: 1 }, + end: { column: 13, line: 1 }, + }, + }, + ], + declare: false, + kind: "var", + + range: [0, 14], + loc: { + start: { column: 0, line: 1 }, + end: { column: 14, line: 1 }, + }, + }, + ], + sourceType: "script", + + range: [0, 15], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 2 }, + }, +} +`; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/var-id-definite-type-no-init/snapshots/2-TSESTree-Tokens.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/var-id-definite-type-no-init/snapshots/2-TSESTree-Tokens.shot new file mode 100644 index 000000000000..80c64a946f21 --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/var-id-definite-type-no-init/snapshots/2-TSESTree-Tokens.shot @@ -0,0 +1,66 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration VariableDeclaration var-id-definite-type-no-init TSESTree - Tokens 1`] = ` +[ + Keyword { + type: "Keyword", + value: "var", + + range: [0, 3], + loc: { + start: { column: 0, line: 1 }, + end: { column: 3, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "foo", + + range: [4, 7], + loc: { + start: { column: 4, line: 1 }, + end: { column: 7, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "!", + + range: [7, 8], + loc: { + start: { column: 7, line: 1 }, + end: { column: 8, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ":", + + range: [8, 9], + loc: { + start: { column: 8, line: 1 }, + end: { column: 9, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "any", + + range: [10, 13], + loc: { + start: { column: 10, line: 1 }, + end: { column: 13, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ";", + + range: [13, 14], + loc: { + start: { column: 13, line: 1 }, + end: { column: 14, line: 1 }, + }, + }, +] +`; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/var-id-definite-type-no-init/snapshots/3-Babel-AST.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/var-id-definite-type-no-init/snapshots/3-Babel-AST.shot new file mode 100644 index 000000000000..37a92d18283e --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/var-id-definite-type-no-init/snapshots/3-Babel-AST.shot @@ -0,0 +1,67 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration VariableDeclaration var-id-definite-type-no-init Babel - AST 1`] = ` +Program { + type: "Program", + body: [ + VariableDeclaration { + type: "VariableDeclaration", + declarations: [ + VariableDeclarator { + type: "VariableDeclarator", + definite: true, + id: Identifier { + type: "Identifier", + name: "foo", + typeAnnotation: TSTypeAnnotation { + type: "TSTypeAnnotation", + typeAnnotation: TSAnyKeyword { + type: "TSAnyKeyword", + + range: [10, 13], + loc: { + start: { column: 10, line: 1 }, + end: { column: 13, line: 1 }, + }, + }, + + range: [8, 13], + loc: { + start: { column: 8, line: 1 }, + end: { column: 13, line: 1 }, + }, + }, + + range: [4, 13], + loc: { + start: { column: 4, line: 1 }, + end: { column: 13, line: 1 }, + }, + }, + init: null, + + range: [4, 13], + loc: { + start: { column: 4, line: 1 }, + end: { column: 13, line: 1 }, + }, + }, + ], + kind: "var", + + range: [0, 14], + loc: { + start: { column: 0, line: 1 }, + end: { column: 14, line: 1 }, + }, + }, + ], + sourceType: "script", + + range: [0, 15], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 2 }, + }, +} +`; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/var-id-definite-type-no-init/snapshots/4-Babel-Tokens.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/var-id-definite-type-no-init/snapshots/4-Babel-Tokens.shot new file mode 100644 index 000000000000..af2cffcb706a --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/var-id-definite-type-no-init/snapshots/4-Babel-Tokens.shot @@ -0,0 +1,66 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration VariableDeclaration var-id-definite-type-no-init Babel - Tokens 1`] = ` +[ + Keyword { + type: "Keyword", + value: "var", + + range: [0, 3], + loc: { + start: { column: 0, line: 1 }, + end: { column: 3, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "foo", + + range: [4, 7], + loc: { + start: { column: 4, line: 1 }, + end: { column: 7, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "!", + + range: [7, 8], + loc: { + start: { column: 7, line: 1 }, + end: { column: 8, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ":", + + range: [8, 9], + loc: { + start: { column: 8, line: 1 }, + end: { column: 9, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "any", + + range: [10, 13], + loc: { + start: { column: 10, line: 1 }, + end: { column: 13, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ";", + + range: [13, 14], + loc: { + start: { column: 13, line: 1 }, + end: { column: 14, line: 1 }, + }, + }, +] +`; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/var-id-definite-type-no-init/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/var-id-definite-type-no-init/snapshots/5-AST-Alignment-AST.shot new file mode 100644 index 000000000000..b12306e582c7 --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/var-id-definite-type-no-init/snapshots/5-AST-Alignment-AST.shot @@ -0,0 +1,74 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration VariableDeclaration var-id-definite-type-no-init AST Alignment - AST 1`] = ` +"Snapshot Diff: +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + VariableDeclaration { + type: 'VariableDeclaration', + declarations: Array [ + VariableDeclarator { + type: 'VariableDeclarator', + definite: true, + id: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'foo', +- optional: false, + typeAnnotation: TSTypeAnnotation { + type: 'TSTypeAnnotation', + typeAnnotation: TSAnyKeyword { + type: 'TSAnyKeyword', + + range: [10, 13], + loc: { + start: { column: 10, line: 1 }, + end: { column: 13, line: 1 }, + }, + }, + + range: [8, 13], + loc: { + start: { column: 8, line: 1 }, + end: { column: 13, line: 1 }, + }, + }, + + range: [4, 13], + loc: { + start: { column: 4, line: 1 }, + end: { column: 13, line: 1 }, + }, + }, + init: null, + + range: [4, 13], + loc: { + start: { column: 4, line: 1 }, + end: { column: 13, line: 1 }, + }, + }, + ], +- declare: false, + kind: 'var', + + range: [0, 14], + loc: { + start: { column: 0, line: 1 }, + end: { column: 14, line: 1 }, + }, + }, + ], + sourceType: 'script', + + range: [0, 15], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 2 }, + }, + }" +`; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/var-id-definite-type-no-init/snapshots/6-AST-Alignment-Tokens.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/var-id-definite-type-no-init/snapshots/6-AST-Alignment-Tokens.shot new file mode 100644 index 000000000000..fb73e629a453 --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/var-id-definite-type-no-init/snapshots/6-AST-Alignment-Tokens.shot @@ -0,0 +1,6 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration VariableDeclaration var-id-definite-type-no-init AST Alignment - Token 1`] = ` +"Snapshot Diff: +Compared values have no visual difference." +`; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/var-id-init/fixture.ts b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/var-id-init/fixture.ts new file mode 100644 index 000000000000..9375fc4abd22 --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/var-id-init/fixture.ts @@ -0,0 +1 @@ +var foo = 1; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/using-with-value/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/var-id-init/snapshots/1-TSESTree-AST.shot similarity index 79% rename from packages/ast-spec/src/declaration/VariableDeclaration/fixtures/using-with-value/snapshots/1-TSESTree-AST.shot rename to packages/ast-spec/src/declaration/VariableDeclaration/fixtures/var-id-init/snapshots/1-TSESTree-AST.shot index cc85e096e920..264e84fed627 100644 --- a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/using-with-value/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/var-id-init/snapshots/1-TSESTree-AST.shot @@ -1,6 +1,6 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`AST Fixtures declaration VariableDeclaration using-with-value TSESTree - AST 1`] = ` +exports[`AST Fixtures declaration VariableDeclaration var-id-init TSESTree - AST 1`] = ` Program { type: "Program", body: [ @@ -13,12 +13,12 @@ Program { id: Identifier { type: "Identifier", decorators: [], - name: "a", + name: "foo", optional: false, - range: [6, 7], + range: [4, 7], loc: { - start: { column: 6, line: 1 }, + start: { column: 4, line: 1 }, end: { column: 7, line: 1 }, }, }, @@ -34,15 +34,15 @@ Program { }, }, - range: [6, 11], + range: [4, 11], loc: { - start: { column: 6, line: 1 }, + start: { column: 4, line: 1 }, end: { column: 11, line: 1 }, }, }, ], declare: false, - kind: "using", + kind: "var", range: [0, 12], loc: { diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/const-without-value/snapshots/4-Babel-Tokens.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/var-id-init/snapshots/2-TSESTree-Tokens.shot similarity index 75% rename from packages/ast-spec/src/declaration/VariableDeclaration/fixtures/const-without-value/snapshots/4-Babel-Tokens.shot rename to packages/ast-spec/src/declaration/VariableDeclaration/fixtures/var-id-init/snapshots/2-TSESTree-Tokens.shot index c296fedf1cba..d2a98c33338b 100644 --- a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/const-without-value/snapshots/4-Babel-Tokens.shot +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/var-id-init/snapshots/2-TSESTree-Tokens.shot @@ -1,24 +1,24 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`AST Fixtures declaration VariableDeclaration const-without-value Babel - Tokens 1`] = ` +exports[`AST Fixtures declaration VariableDeclaration var-id-init TSESTree - Tokens 1`] = ` [ Keyword { type: "Keyword", - value: "const", + value: "var", - range: [0, 5], + range: [0, 3], loc: { start: { column: 0, line: 1 }, - end: { column: 5, line: 1 }, + end: { column: 3, line: 1 }, }, }, Identifier { type: "Identifier", - value: "x", + value: "foo", - range: [6, 7], + range: [4, 7], loc: { - start: { column: 6, line: 1 }, + start: { column: 4, line: 1 }, end: { column: 7, line: 1 }, }, }, diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/const-with-value/snapshots/3-Babel-AST.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/var-id-init/snapshots/3-Babel-AST.shot similarity index 78% rename from packages/ast-spec/src/declaration/VariableDeclaration/fixtures/const-with-value/snapshots/3-Babel-AST.shot rename to packages/ast-spec/src/declaration/VariableDeclaration/fixtures/var-id-init/snapshots/3-Babel-AST.shot index b7cf1ef3ea98..28ae8f547c16 100644 --- a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/const-with-value/snapshots/3-Babel-AST.shot +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/var-id-init/snapshots/3-Babel-AST.shot @@ -1,6 +1,6 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`AST Fixtures declaration VariableDeclaration const-with-value Babel - AST 1`] = ` +exports[`AST Fixtures declaration VariableDeclaration var-id-init Babel - AST 1`] = ` Program { type: "Program", body: [ @@ -11,11 +11,11 @@ Program { type: "VariableDeclarator", id: Identifier { type: "Identifier", - name: "x", + name: "foo", - range: [6, 7], + range: [4, 7], loc: { - start: { column: 6, line: 1 }, + start: { column: 4, line: 1 }, end: { column: 7, line: 1 }, }, }, @@ -31,14 +31,14 @@ Program { }, }, - range: [6, 11], + range: [4, 11], loc: { - start: { column: 6, line: 1 }, + start: { column: 4, line: 1 }, end: { column: 11, line: 1 }, }, }, ], - kind: "const", + kind: "var", range: [0, 12], loc: { diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/const-with-value/snapshots/4-Babel-Tokens.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/var-id-init/snapshots/4-Babel-Tokens.shot similarity index 75% rename from packages/ast-spec/src/declaration/VariableDeclaration/fixtures/const-with-value/snapshots/4-Babel-Tokens.shot rename to packages/ast-spec/src/declaration/VariableDeclaration/fixtures/var-id-init/snapshots/4-Babel-Tokens.shot index ead3433d736f..259953d9c581 100644 --- a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/const-with-value/snapshots/4-Babel-Tokens.shot +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/var-id-init/snapshots/4-Babel-Tokens.shot @@ -1,24 +1,24 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`AST Fixtures declaration VariableDeclaration const-with-value Babel - Tokens 1`] = ` +exports[`AST Fixtures declaration VariableDeclaration var-id-init Babel - Tokens 1`] = ` [ Keyword { type: "Keyword", - value: "const", + value: "var", - range: [0, 5], + range: [0, 3], loc: { start: { column: 0, line: 1 }, - end: { column: 5, line: 1 }, + end: { column: 3, line: 1 }, }, }, Identifier { type: "Identifier", - value: "x", + value: "foo", - range: [6, 7], + range: [4, 7], loc: { - start: { column: 6, line: 1 }, + start: { column: 4, line: 1 }, end: { column: 7, line: 1 }, }, }, diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/using-with-value/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/var-id-init/snapshots/5-AST-Alignment-AST.shot similarity index 80% rename from packages/ast-spec/src/declaration/VariableDeclaration/fixtures/using-with-value/snapshots/5-AST-Alignment-AST.shot rename to packages/ast-spec/src/declaration/VariableDeclaration/fixtures/var-id-init/snapshots/5-AST-Alignment-AST.shot index ff3bebb4f1d0..3aa3dc90da8b 100644 --- a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/using-with-value/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/var-id-init/snapshots/5-AST-Alignment-AST.shot @@ -1,6 +1,6 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`AST Fixtures declaration VariableDeclaration using-with-value AST Alignment - AST 1`] = ` +exports[`AST Fixtures declaration VariableDeclaration var-id-init AST Alignment - AST 1`] = ` "Snapshot Diff: - TSESTree + Babel @@ -17,12 +17,12 @@ exports[`AST Fixtures declaration VariableDeclaration using-with-value AST Align id: Identifier { type: 'Identifier', - decorators: Array [], - name: 'a', + name: 'foo', - optional: false, - range: [6, 7], + range: [4, 7], loc: { - start: { column: 6, line: 1 }, + start: { column: 4, line: 1 }, end: { column: 7, line: 1 }, }, }, @@ -38,15 +38,15 @@ exports[`AST Fixtures declaration VariableDeclaration using-with-value AST Align }, }, - range: [6, 11], + range: [4, 11], loc: { - start: { column: 6, line: 1 }, + start: { column: 4, line: 1 }, end: { column: 11, line: 1 }, }, }, ], - declare: false, - kind: 'using', + kind: 'var', range: [0, 12], loc: { diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/using-with-value/snapshots/6-AST-Alignment-Tokens.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/var-id-init/snapshots/6-AST-Alignment-Tokens.shot similarity index 51% rename from packages/ast-spec/src/declaration/VariableDeclaration/fixtures/using-with-value/snapshots/6-AST-Alignment-Tokens.shot rename to packages/ast-spec/src/declaration/VariableDeclaration/fixtures/var-id-init/snapshots/6-AST-Alignment-Tokens.shot index b895e4005836..8761002e4af4 100644 --- a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/using-with-value/snapshots/6-AST-Alignment-Tokens.shot +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/var-id-init/snapshots/6-AST-Alignment-Tokens.shot @@ -1,6 +1,6 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`AST Fixtures declaration VariableDeclaration using-with-value AST Alignment - Token 1`] = ` +exports[`AST Fixtures declaration VariableDeclaration var-id-init AST Alignment - Token 1`] = ` "Snapshot Diff: Compared values have no visual difference." `; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/var-id-no-init/fixture.ts b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/var-id-no-init/fixture.ts new file mode 100644 index 000000000000..55484086d1cb --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/var-id-no-init/fixture.ts @@ -0,0 +1 @@ +var foo; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/var-without-value/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/var-id-no-init/snapshots/1-TSESTree-AST.shot similarity index 71% rename from packages/ast-spec/src/declaration/VariableDeclaration/fixtures/var-without-value/snapshots/1-TSESTree-AST.shot rename to packages/ast-spec/src/declaration/VariableDeclaration/fixtures/var-id-no-init/snapshots/1-TSESTree-AST.shot index 9c8cd46cb971..95ad8f4367d8 100644 --- a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/var-without-value/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/var-id-no-init/snapshots/1-TSESTree-AST.shot @@ -1,6 +1,6 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`AST Fixtures declaration VariableDeclaration var-without-value TSESTree - AST 1`] = ` +exports[`AST Fixtures declaration VariableDeclaration var-id-no-init TSESTree - AST 1`] = ` Program { type: "Program", body: [ @@ -13,37 +13,37 @@ Program { id: Identifier { type: "Identifier", decorators: [], - name: "x", + name: "foo", optional: false, - range: [4, 5], + range: [4, 7], loc: { start: { column: 4, line: 1 }, - end: { column: 5, line: 1 }, + end: { column: 7, line: 1 }, }, }, init: null, - range: [4, 5], + range: [4, 7], loc: { start: { column: 4, line: 1 }, - end: { column: 5, line: 1 }, + end: { column: 7, line: 1 }, }, }, ], declare: false, kind: "var", - range: [0, 6], + range: [0, 8], loc: { start: { column: 0, line: 1 }, - end: { column: 6, line: 1 }, + end: { column: 8, line: 1 }, }, }, ], sourceType: "script", - range: [0, 7], + range: [0, 9], loc: { start: { column: 0, line: 1 }, end: { column: 0, line: 2 }, diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/var-without-value/snapshots/2-TSESTree-Tokens.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/var-id-no-init/snapshots/2-TSESTree-Tokens.shot similarity index 60% rename from packages/ast-spec/src/declaration/VariableDeclaration/fixtures/var-without-value/snapshots/2-TSESTree-Tokens.shot rename to packages/ast-spec/src/declaration/VariableDeclaration/fixtures/var-id-no-init/snapshots/2-TSESTree-Tokens.shot index 5dfa456c4019..f2882331492f 100644 --- a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/var-without-value/snapshots/2-TSESTree-Tokens.shot +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/var-id-no-init/snapshots/2-TSESTree-Tokens.shot @@ -1,6 +1,6 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`AST Fixtures declaration VariableDeclaration var-without-value TSESTree - Tokens 1`] = ` +exports[`AST Fixtures declaration VariableDeclaration var-id-no-init TSESTree - Tokens 1`] = ` [ Keyword { type: "Keyword", @@ -14,22 +14,22 @@ exports[`AST Fixtures declaration VariableDeclaration var-without-value TSESTree }, Identifier { type: "Identifier", - value: "x", + value: "foo", - range: [4, 5], + range: [4, 7], loc: { start: { column: 4, line: 1 }, - end: { column: 5, line: 1 }, + end: { column: 7, line: 1 }, }, }, Punctuator { type: "Punctuator", value: ";", - range: [5, 6], + range: [7, 8], loc: { - start: { column: 5, line: 1 }, - end: { column: 6, line: 1 }, + start: { column: 7, line: 1 }, + end: { column: 8, line: 1 }, }, }, ] diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/var-without-value/snapshots/3-Babel-AST.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/var-id-no-init/snapshots/3-Babel-AST.shot similarity index 68% rename from packages/ast-spec/src/declaration/VariableDeclaration/fixtures/var-without-value/snapshots/3-Babel-AST.shot rename to packages/ast-spec/src/declaration/VariableDeclaration/fixtures/var-id-no-init/snapshots/3-Babel-AST.shot index 7e7606329055..1131af75a946 100644 --- a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/var-without-value/snapshots/3-Babel-AST.shot +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/var-id-no-init/snapshots/3-Babel-AST.shot @@ -1,6 +1,6 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`AST Fixtures declaration VariableDeclaration var-without-value Babel - AST 1`] = ` +exports[`AST Fixtures declaration VariableDeclaration var-id-no-init Babel - AST 1`] = ` Program { type: "Program", body: [ @@ -11,35 +11,35 @@ Program { type: "VariableDeclarator", id: Identifier { type: "Identifier", - name: "x", + name: "foo", - range: [4, 5], + range: [4, 7], loc: { start: { column: 4, line: 1 }, - end: { column: 5, line: 1 }, + end: { column: 7, line: 1 }, }, }, init: null, - range: [4, 5], + range: [4, 7], loc: { start: { column: 4, line: 1 }, - end: { column: 5, line: 1 }, + end: { column: 7, line: 1 }, }, }, ], kind: "var", - range: [0, 6], + range: [0, 8], loc: { start: { column: 0, line: 1 }, - end: { column: 6, line: 1 }, + end: { column: 8, line: 1 }, }, }, ], sourceType: "script", - range: [0, 7], + range: [0, 9], loc: { start: { column: 0, line: 1 }, end: { column: 0, line: 2 }, diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/var-without-value/snapshots/4-Babel-Tokens.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/var-id-no-init/snapshots/4-Babel-Tokens.shot similarity index 60% rename from packages/ast-spec/src/declaration/VariableDeclaration/fixtures/var-without-value/snapshots/4-Babel-Tokens.shot rename to packages/ast-spec/src/declaration/VariableDeclaration/fixtures/var-id-no-init/snapshots/4-Babel-Tokens.shot index 7b337d25bad6..34d7140dabd6 100644 --- a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/var-without-value/snapshots/4-Babel-Tokens.shot +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/var-id-no-init/snapshots/4-Babel-Tokens.shot @@ -1,6 +1,6 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`AST Fixtures declaration VariableDeclaration var-without-value Babel - Tokens 1`] = ` +exports[`AST Fixtures declaration VariableDeclaration var-id-no-init Babel - Tokens 1`] = ` [ Keyword { type: "Keyword", @@ -14,22 +14,22 @@ exports[`AST Fixtures declaration VariableDeclaration var-without-value Babel - }, Identifier { type: "Identifier", - value: "x", + value: "foo", - range: [4, 5], + range: [4, 7], loc: { start: { column: 4, line: 1 }, - end: { column: 5, line: 1 }, + end: { column: 7, line: 1 }, }, }, Punctuator { type: "Punctuator", value: ";", - range: [5, 6], + range: [7, 8], loc: { - start: { column: 5, line: 1 }, - end: { column: 6, line: 1 }, + start: { column: 7, line: 1 }, + end: { column: 8, line: 1 }, }, }, ] diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/var-without-value/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/var-id-no-init/snapshots/5-AST-Alignment-AST.shot similarity index 72% rename from packages/ast-spec/src/declaration/VariableDeclaration/fixtures/var-without-value/snapshots/5-AST-Alignment-AST.shot rename to packages/ast-spec/src/declaration/VariableDeclaration/fixtures/var-id-no-init/snapshots/5-AST-Alignment-AST.shot index af47a7b5819f..c9aa09767c6d 100644 --- a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/var-without-value/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/var-id-no-init/snapshots/5-AST-Alignment-AST.shot @@ -1,6 +1,6 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`AST Fixtures declaration VariableDeclaration var-without-value AST Alignment - AST 1`] = ` +exports[`AST Fixtures declaration VariableDeclaration var-id-no-init AST Alignment - AST 1`] = ` "Snapshot Diff: - TSESTree + Babel @@ -17,37 +17,37 @@ exports[`AST Fixtures declaration VariableDeclaration var-without-value AST Alig id: Identifier { type: 'Identifier', - decorators: Array [], - name: 'x', + name: 'foo', - optional: false, - range: [4, 5], + range: [4, 7], loc: { start: { column: 4, line: 1 }, - end: { column: 5, line: 1 }, + end: { column: 7, line: 1 }, }, }, init: null, - range: [4, 5], + range: [4, 7], loc: { start: { column: 4, line: 1 }, - end: { column: 5, line: 1 }, + end: { column: 7, line: 1 }, }, }, ], - declare: false, kind: 'var', - range: [0, 6], + range: [0, 8], loc: { start: { column: 0, line: 1 }, - end: { column: 6, line: 1 }, + end: { column: 8, line: 1 }, }, }, ], sourceType: 'script', - range: [0, 7], + range: [0, 9], loc: { start: { column: 0, line: 1 }, end: { column: 0, line: 2 }, diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/var-without-value/snapshots/6-AST-Alignment-Tokens.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/var-id-no-init/snapshots/6-AST-Alignment-Tokens.shot similarity index 51% rename from packages/ast-spec/src/declaration/VariableDeclaration/fixtures/var-without-value/snapshots/6-AST-Alignment-Tokens.shot rename to packages/ast-spec/src/declaration/VariableDeclaration/fixtures/var-id-no-init/snapshots/6-AST-Alignment-Tokens.shot index 3d401ca8c69e..8ae502837dc6 100644 --- a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/var-without-value/snapshots/6-AST-Alignment-Tokens.shot +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/var-id-no-init/snapshots/6-AST-Alignment-Tokens.shot @@ -1,6 +1,6 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`AST Fixtures declaration VariableDeclaration var-without-value AST Alignment - Token 1`] = ` +exports[`AST Fixtures declaration VariableDeclaration var-id-no-init AST Alignment - Token 1`] = ` "Snapshot Diff: Compared values have no visual difference." `; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/var-id-type-init/fixture.ts b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/var-id-type-init/fixture.ts new file mode 100644 index 000000000000..5ff8fcd31411 --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/var-id-type-init/fixture.ts @@ -0,0 +1 @@ +var foo: any = 1; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/var-id-type-init/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/var-id-type-init/snapshots/1-TSESTree-AST.shot new file mode 100644 index 000000000000..cbe1945efc89 --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/var-id-type-init/snapshots/1-TSESTree-AST.shot @@ -0,0 +1,80 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration VariableDeclaration var-id-type-init TSESTree - AST 1`] = ` +Program { + type: "Program", + body: [ + VariableDeclaration { + type: "VariableDeclaration", + declarations: [ + VariableDeclarator { + type: "VariableDeclarator", + definite: false, + id: Identifier { + type: "Identifier", + decorators: [], + name: "foo", + optional: false, + typeAnnotation: TSTypeAnnotation { + type: "TSTypeAnnotation", + typeAnnotation: TSAnyKeyword { + type: "TSAnyKeyword", + + range: [9, 12], + loc: { + start: { column: 9, line: 1 }, + end: { column: 12, line: 1 }, + }, + }, + + range: [7, 12], + loc: { + start: { column: 7, line: 1 }, + end: { column: 12, line: 1 }, + }, + }, + + range: [4, 12], + loc: { + start: { column: 4, line: 1 }, + end: { column: 12, line: 1 }, + }, + }, + init: Literal { + type: "Literal", + raw: "1", + value: 1, + + range: [15, 16], + loc: { + start: { column: 15, line: 1 }, + end: { column: 16, line: 1 }, + }, + }, + + range: [4, 16], + loc: { + start: { column: 4, line: 1 }, + end: { column: 16, line: 1 }, + }, + }, + ], + declare: false, + kind: "var", + + range: [0, 17], + loc: { + start: { column: 0, line: 1 }, + end: { column: 17, line: 1 }, + }, + }, + ], + sourceType: "script", + + range: [0, 18], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 2 }, + }, +} +`; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/var-id-type-init/snapshots/2-TSESTree-Tokens.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/var-id-type-init/snapshots/2-TSESTree-Tokens.shot new file mode 100644 index 000000000000..7b6b08ec0190 --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/var-id-type-init/snapshots/2-TSESTree-Tokens.shot @@ -0,0 +1,76 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration VariableDeclaration var-id-type-init TSESTree - Tokens 1`] = ` +[ + Keyword { + type: "Keyword", + value: "var", + + range: [0, 3], + loc: { + start: { column: 0, line: 1 }, + end: { column: 3, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "foo", + + range: [4, 7], + loc: { + start: { column: 4, line: 1 }, + end: { column: 7, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ":", + + range: [7, 8], + loc: { + start: { column: 7, line: 1 }, + end: { column: 8, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "any", + + range: [9, 12], + loc: { + start: { column: 9, line: 1 }, + end: { column: 12, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "=", + + range: [13, 14], + loc: { + start: { column: 13, line: 1 }, + end: { column: 14, line: 1 }, + }, + }, + Numeric { + type: "Numeric", + value: "1", + + range: [15, 16], + loc: { + start: { column: 15, line: 1 }, + end: { column: 16, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ";", + + range: [16, 17], + loc: { + start: { column: 16, line: 1 }, + end: { column: 17, line: 1 }, + }, + }, +] +`; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/var-id-type-init/snapshots/3-Babel-AST.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/var-id-type-init/snapshots/3-Babel-AST.shot new file mode 100644 index 000000000000..483700e3ed10 --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/var-id-type-init/snapshots/3-Babel-AST.shot @@ -0,0 +1,76 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration VariableDeclaration var-id-type-init Babel - AST 1`] = ` +Program { + type: "Program", + body: [ + VariableDeclaration { + type: "VariableDeclaration", + declarations: [ + VariableDeclarator { + type: "VariableDeclarator", + id: Identifier { + type: "Identifier", + name: "foo", + typeAnnotation: TSTypeAnnotation { + type: "TSTypeAnnotation", + typeAnnotation: TSAnyKeyword { + type: "TSAnyKeyword", + + range: [9, 12], + loc: { + start: { column: 9, line: 1 }, + end: { column: 12, line: 1 }, + }, + }, + + range: [7, 12], + loc: { + start: { column: 7, line: 1 }, + end: { column: 12, line: 1 }, + }, + }, + + range: [4, 12], + loc: { + start: { column: 4, line: 1 }, + end: { column: 12, line: 1 }, + }, + }, + init: Literal { + type: "Literal", + raw: "1", + value: 1, + + range: [15, 16], + loc: { + start: { column: 15, line: 1 }, + end: { column: 16, line: 1 }, + }, + }, + + range: [4, 16], + loc: { + start: { column: 4, line: 1 }, + end: { column: 16, line: 1 }, + }, + }, + ], + kind: "var", + + range: [0, 17], + loc: { + start: { column: 0, line: 1 }, + end: { column: 17, line: 1 }, + }, + }, + ], + sourceType: "script", + + range: [0, 18], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 2 }, + }, +} +`; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/var-id-type-init/snapshots/4-Babel-Tokens.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/var-id-type-init/snapshots/4-Babel-Tokens.shot new file mode 100644 index 000000000000..d8346c2b0f4c --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/var-id-type-init/snapshots/4-Babel-Tokens.shot @@ -0,0 +1,76 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration VariableDeclaration var-id-type-init Babel - Tokens 1`] = ` +[ + Keyword { + type: "Keyword", + value: "var", + + range: [0, 3], + loc: { + start: { column: 0, line: 1 }, + end: { column: 3, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "foo", + + range: [4, 7], + loc: { + start: { column: 4, line: 1 }, + end: { column: 7, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ":", + + range: [7, 8], + loc: { + start: { column: 7, line: 1 }, + end: { column: 8, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "any", + + range: [9, 12], + loc: { + start: { column: 9, line: 1 }, + end: { column: 12, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "=", + + range: [13, 14], + loc: { + start: { column: 13, line: 1 }, + end: { column: 14, line: 1 }, + }, + }, + Numeric { + type: "Numeric", + value: "1", + + range: [15, 16], + loc: { + start: { column: 15, line: 1 }, + end: { column: 16, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ";", + + range: [16, 17], + loc: { + start: { column: 16, line: 1 }, + end: { column: 17, line: 1 }, + }, + }, +] +`; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/var-id-type-init/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/var-id-type-init/snapshots/5-AST-Alignment-AST.shot new file mode 100644 index 000000000000..01054c51a075 --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/var-id-type-init/snapshots/5-AST-Alignment-AST.shot @@ -0,0 +1,84 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration VariableDeclaration var-id-type-init AST Alignment - AST 1`] = ` +"Snapshot Diff: +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + VariableDeclaration { + type: 'VariableDeclaration', + declarations: Array [ + VariableDeclarator { + type: 'VariableDeclarator', +- definite: false, + id: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'foo', +- optional: false, + typeAnnotation: TSTypeAnnotation { + type: 'TSTypeAnnotation', + typeAnnotation: TSAnyKeyword { + type: 'TSAnyKeyword', + + range: [9, 12], + loc: { + start: { column: 9, line: 1 }, + end: { column: 12, line: 1 }, + }, + }, + + range: [7, 12], + loc: { + start: { column: 7, line: 1 }, + end: { column: 12, line: 1 }, + }, + }, + + range: [4, 12], + loc: { + start: { column: 4, line: 1 }, + end: { column: 12, line: 1 }, + }, + }, + init: Literal { + type: 'Literal', + raw: '1', + value: 1, + + range: [15, 16], + loc: { + start: { column: 15, line: 1 }, + end: { column: 16, line: 1 }, + }, + }, + + range: [4, 16], + loc: { + start: { column: 4, line: 1 }, + end: { column: 16, line: 1 }, + }, + }, + ], +- declare: false, + kind: 'var', + + range: [0, 17], + loc: { + start: { column: 0, line: 1 }, + end: { column: 17, line: 1 }, + }, + }, + ], + sourceType: 'script', + + range: [0, 18], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 2 }, + }, + }" +`; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/var-id-type-init/snapshots/6-AST-Alignment-Tokens.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/var-id-type-init/snapshots/6-AST-Alignment-Tokens.shot new file mode 100644 index 000000000000..778c2f324991 --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/var-id-type-init/snapshots/6-AST-Alignment-Tokens.shot @@ -0,0 +1,6 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration VariableDeclaration var-id-type-init AST Alignment - Token 1`] = ` +"Snapshot Diff: +Compared values have no visual difference." +`; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/var-id-type-no-init/fixture.ts b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/var-id-type-no-init/fixture.ts new file mode 100644 index 000000000000..e38b40aa77b2 --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/var-id-type-no-init/fixture.ts @@ -0,0 +1 @@ +var foo: any; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/var-id-type-no-init/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/var-id-type-no-init/snapshots/1-TSESTree-AST.shot new file mode 100644 index 000000000000..d67a2e33e190 --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/var-id-type-no-init/snapshots/1-TSESTree-AST.shot @@ -0,0 +1,70 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration VariableDeclaration var-id-type-no-init TSESTree - AST 1`] = ` +Program { + type: "Program", + body: [ + VariableDeclaration { + type: "VariableDeclaration", + declarations: [ + VariableDeclarator { + type: "VariableDeclarator", + definite: false, + id: Identifier { + type: "Identifier", + decorators: [], + name: "foo", + optional: false, + typeAnnotation: TSTypeAnnotation { + type: "TSTypeAnnotation", + typeAnnotation: TSAnyKeyword { + type: "TSAnyKeyword", + + range: [9, 12], + loc: { + start: { column: 9, line: 1 }, + end: { column: 12, line: 1 }, + }, + }, + + range: [7, 12], + loc: { + start: { column: 7, line: 1 }, + end: { column: 12, line: 1 }, + }, + }, + + range: [4, 12], + loc: { + start: { column: 4, line: 1 }, + end: { column: 12, line: 1 }, + }, + }, + init: null, + + range: [4, 12], + loc: { + start: { column: 4, line: 1 }, + end: { column: 12, line: 1 }, + }, + }, + ], + declare: false, + kind: "var", + + range: [0, 13], + loc: { + start: { column: 0, line: 1 }, + end: { column: 13, line: 1 }, + }, + }, + ], + sourceType: "script", + + range: [0, 14], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 2 }, + }, +} +`; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/var-with-value/snapshots/2-TSESTree-Tokens.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/var-id-type-no-init/snapshots/2-TSESTree-Tokens.shot similarity index 55% rename from packages/ast-spec/src/declaration/VariableDeclaration/fixtures/var-with-value/snapshots/2-TSESTree-Tokens.shot rename to packages/ast-spec/src/declaration/VariableDeclaration/fixtures/var-id-type-no-init/snapshots/2-TSESTree-Tokens.shot index 68912eb8c571..b0e8bee1ea75 100644 --- a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/var-with-value/snapshots/2-TSESTree-Tokens.shot +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/var-id-type-no-init/snapshots/2-TSESTree-Tokens.shot @@ -1,6 +1,6 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`AST Fixtures declaration VariableDeclaration var-with-value TSESTree - Tokens 1`] = ` +exports[`AST Fixtures declaration VariableDeclaration var-id-type-no-init TSESTree - Tokens 1`] = ` [ Keyword { type: "Keyword", @@ -14,42 +14,42 @@ exports[`AST Fixtures declaration VariableDeclaration var-with-value TSESTree - }, Identifier { type: "Identifier", - value: "x", + value: "foo", - range: [4, 5], + range: [4, 7], loc: { start: { column: 4, line: 1 }, - end: { column: 5, line: 1 }, + end: { column: 7, line: 1 }, }, }, Punctuator { type: "Punctuator", - value: "=", + value: ":", - range: [6, 7], + range: [7, 8], loc: { - start: { column: 6, line: 1 }, - end: { column: 7, line: 1 }, + start: { column: 7, line: 1 }, + end: { column: 8, line: 1 }, }, }, - Numeric { - type: "Numeric", - value: "1", + Identifier { + type: "Identifier", + value: "any", - range: [8, 9], + range: [9, 12], loc: { - start: { column: 8, line: 1 }, - end: { column: 9, line: 1 }, + start: { column: 9, line: 1 }, + end: { column: 12, line: 1 }, }, }, Punctuator { type: "Punctuator", value: ";", - range: [9, 10], + range: [12, 13], loc: { - start: { column: 9, line: 1 }, - end: { column: 10, line: 1 }, + start: { column: 12, line: 1 }, + end: { column: 13, line: 1 }, }, }, ] diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/var-id-type-no-init/snapshots/3-Babel-AST.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/var-id-type-no-init/snapshots/3-Babel-AST.shot new file mode 100644 index 000000000000..cd0c7b58d491 --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/var-id-type-no-init/snapshots/3-Babel-AST.shot @@ -0,0 +1,66 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration VariableDeclaration var-id-type-no-init Babel - AST 1`] = ` +Program { + type: "Program", + body: [ + VariableDeclaration { + type: "VariableDeclaration", + declarations: [ + VariableDeclarator { + type: "VariableDeclarator", + id: Identifier { + type: "Identifier", + name: "foo", + typeAnnotation: TSTypeAnnotation { + type: "TSTypeAnnotation", + typeAnnotation: TSAnyKeyword { + type: "TSAnyKeyword", + + range: [9, 12], + loc: { + start: { column: 9, line: 1 }, + end: { column: 12, line: 1 }, + }, + }, + + range: [7, 12], + loc: { + start: { column: 7, line: 1 }, + end: { column: 12, line: 1 }, + }, + }, + + range: [4, 12], + loc: { + start: { column: 4, line: 1 }, + end: { column: 12, line: 1 }, + }, + }, + init: null, + + range: [4, 12], + loc: { + start: { column: 4, line: 1 }, + end: { column: 12, line: 1 }, + }, + }, + ], + kind: "var", + + range: [0, 13], + loc: { + start: { column: 0, line: 1 }, + end: { column: 13, line: 1 }, + }, + }, + ], + sourceType: "script", + + range: [0, 14], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 2 }, + }, +} +`; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/var-with-value/snapshots/4-Babel-Tokens.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/var-id-type-no-init/snapshots/4-Babel-Tokens.shot similarity index 55% rename from packages/ast-spec/src/declaration/VariableDeclaration/fixtures/var-with-value/snapshots/4-Babel-Tokens.shot rename to packages/ast-spec/src/declaration/VariableDeclaration/fixtures/var-id-type-no-init/snapshots/4-Babel-Tokens.shot index 3e7a7a82f18d..ae6473e6c381 100644 --- a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/var-with-value/snapshots/4-Babel-Tokens.shot +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/var-id-type-no-init/snapshots/4-Babel-Tokens.shot @@ -1,6 +1,6 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`AST Fixtures declaration VariableDeclaration var-with-value Babel - Tokens 1`] = ` +exports[`AST Fixtures declaration VariableDeclaration var-id-type-no-init Babel - Tokens 1`] = ` [ Keyword { type: "Keyword", @@ -14,42 +14,42 @@ exports[`AST Fixtures declaration VariableDeclaration var-with-value Babel - Tok }, Identifier { type: "Identifier", - value: "x", + value: "foo", - range: [4, 5], + range: [4, 7], loc: { start: { column: 4, line: 1 }, - end: { column: 5, line: 1 }, + end: { column: 7, line: 1 }, }, }, Punctuator { type: "Punctuator", - value: "=", + value: ":", - range: [6, 7], + range: [7, 8], loc: { - start: { column: 6, line: 1 }, - end: { column: 7, line: 1 }, + start: { column: 7, line: 1 }, + end: { column: 8, line: 1 }, }, }, - Numeric { - type: "Numeric", - value: "1", + Identifier { + type: "Identifier", + value: "any", - range: [8, 9], + range: [9, 12], loc: { - start: { column: 8, line: 1 }, - end: { column: 9, line: 1 }, + start: { column: 9, line: 1 }, + end: { column: 12, line: 1 }, }, }, Punctuator { type: "Punctuator", value: ";", - range: [9, 10], + range: [12, 13], loc: { - start: { column: 9, line: 1 }, - end: { column: 10, line: 1 }, + start: { column: 12, line: 1 }, + end: { column: 13, line: 1 }, }, }, ] diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/var-id-type-no-init/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/var-id-type-no-init/snapshots/5-AST-Alignment-AST.shot new file mode 100644 index 000000000000..44de412a3657 --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/var-id-type-no-init/snapshots/5-AST-Alignment-AST.shot @@ -0,0 +1,74 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration VariableDeclaration var-id-type-no-init AST Alignment - AST 1`] = ` +"Snapshot Diff: +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + VariableDeclaration { + type: 'VariableDeclaration', + declarations: Array [ + VariableDeclarator { + type: 'VariableDeclarator', +- definite: false, + id: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'foo', +- optional: false, + typeAnnotation: TSTypeAnnotation { + type: 'TSTypeAnnotation', + typeAnnotation: TSAnyKeyword { + type: 'TSAnyKeyword', + + range: [9, 12], + loc: { + start: { column: 9, line: 1 }, + end: { column: 12, line: 1 }, + }, + }, + + range: [7, 12], + loc: { + start: { column: 7, line: 1 }, + end: { column: 12, line: 1 }, + }, + }, + + range: [4, 12], + loc: { + start: { column: 4, line: 1 }, + end: { column: 12, line: 1 }, + }, + }, + init: null, + + range: [4, 12], + loc: { + start: { column: 4, line: 1 }, + end: { column: 12, line: 1 }, + }, + }, + ], +- declare: false, + kind: 'var', + + range: [0, 13], + loc: { + start: { column: 0, line: 1 }, + end: { column: 13, line: 1 }, + }, + }, + ], + sourceType: 'script', + + range: [0, 14], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 2 }, + }, + }" +`; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/const-without-value/snapshots/6-AST-Alignment-Tokens.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/var-id-type-no-init/snapshots/6-AST-Alignment-Tokens.shot similarity index 50% rename from packages/ast-spec/src/declaration/VariableDeclaration/fixtures/const-without-value/snapshots/6-AST-Alignment-Tokens.shot rename to packages/ast-spec/src/declaration/VariableDeclaration/fixtures/var-id-type-no-init/snapshots/6-AST-Alignment-Tokens.shot index cc37accf3c50..61ce09b93248 100644 --- a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/const-without-value/snapshots/6-AST-Alignment-Tokens.shot +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/var-id-type-no-init/snapshots/6-AST-Alignment-Tokens.shot @@ -1,6 +1,6 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`AST Fixtures declaration VariableDeclaration const-without-value AST Alignment - Token 1`] = ` +exports[`AST Fixtures declaration VariableDeclaration var-id-type-no-init AST Alignment - Token 1`] = ` "Snapshot Diff: Compared values have no visual difference." `; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/var-with-value/fixture.ts b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/var-with-value/fixture.ts deleted file mode 100644 index b506100a909f..000000000000 --- a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/var-with-value/fixture.ts +++ /dev/null @@ -1 +0,0 @@ -var x = 1; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/var-with-value/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/var-with-value/snapshots/1-TSESTree-AST.shot deleted file mode 100644 index a0dc5de12b90..000000000000 --- a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/var-with-value/snapshots/1-TSESTree-AST.shot +++ /dev/null @@ -1,62 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`AST Fixtures declaration VariableDeclaration var-with-value TSESTree - AST 1`] = ` -Program { - type: "Program", - body: [ - VariableDeclaration { - type: "VariableDeclaration", - declarations: [ - VariableDeclarator { - type: "VariableDeclarator", - definite: false, - id: Identifier { - type: "Identifier", - decorators: [], - name: "x", - optional: false, - - range: [4, 5], - loc: { - start: { column: 4, line: 1 }, - end: { column: 5, line: 1 }, - }, - }, - init: Literal { - type: "Literal", - raw: "1", - value: 1, - - range: [8, 9], - loc: { - start: { column: 8, line: 1 }, - end: { column: 9, line: 1 }, - }, - }, - - range: [4, 9], - loc: { - start: { column: 4, line: 1 }, - end: { column: 9, line: 1 }, - }, - }, - ], - declare: false, - kind: "var", - - range: [0, 10], - loc: { - start: { column: 0, line: 1 }, - end: { column: 10, line: 1 }, - }, - }, - ], - sourceType: "script", - - range: [0, 11], - loc: { - start: { column: 0, line: 1 }, - end: { column: 0, line: 2 }, - }, -} -`; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/var-with-value/snapshots/3-Babel-AST.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/var-with-value/snapshots/3-Babel-AST.shot deleted file mode 100644 index af4bcbf01be6..000000000000 --- a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/var-with-value/snapshots/3-Babel-AST.shot +++ /dev/null @@ -1,58 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`AST Fixtures declaration VariableDeclaration var-with-value Babel - AST 1`] = ` -Program { - type: "Program", - body: [ - VariableDeclaration { - type: "VariableDeclaration", - declarations: [ - VariableDeclarator { - type: "VariableDeclarator", - id: Identifier { - type: "Identifier", - name: "x", - - range: [4, 5], - loc: { - start: { column: 4, line: 1 }, - end: { column: 5, line: 1 }, - }, - }, - init: Literal { - type: "Literal", - raw: "1", - value: 1, - - range: [8, 9], - loc: { - start: { column: 8, line: 1 }, - end: { column: 9, line: 1 }, - }, - }, - - range: [4, 9], - loc: { - start: { column: 4, line: 1 }, - end: { column: 9, line: 1 }, - }, - }, - ], - kind: "var", - - range: [0, 10], - loc: { - start: { column: 0, line: 1 }, - end: { column: 10, line: 1 }, - }, - }, - ], - sourceType: "script", - - range: [0, 11], - loc: { - start: { column: 0, line: 1 }, - end: { column: 0, line: 2 }, - }, -} -`; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/var-without-value/fixture.ts b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/var-without-value/fixture.ts deleted file mode 100644 index 96f6d3a3f15b..000000000000 --- a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/var-without-value/fixture.ts +++ /dev/null @@ -1 +0,0 @@ -var x; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/spec.ts b/packages/ast-spec/src/declaration/VariableDeclaration/spec.ts index 23a04b683248..4f89f4aaec07 100644 --- a/packages/ast-spec/src/declaration/VariableDeclaration/spec.ts +++ b/packages/ast-spec/src/declaration/VariableDeclaration/spec.ts @@ -2,15 +2,18 @@ import type { AST_NODE_TYPES } from '../../ast-node-types'; import type { BaseNode } from '../../base/BaseNode'; import type { LetOrConstOrVarDeclarator, + VariableDeclaratorNoInit, + VariableDeclaratorMaybeInit, + VariableDeclaratorDefiniteAssignment, UsingInForOfDeclarator, - UsingInNomalConextDeclarator, + UsingInNomalContextDeclarator, } from '../../special/VariableDeclarator/spec'; -export interface LetOrConstOrVarDeclaration extends BaseNode { +export interface LetOrConstOrVarDeclarationBase extends BaseNode { type: AST_NODE_TYPES.VariableDeclaration; /** * The variables declared by this declaration. - * Note that there may be 0 declarations (i.e. `const;`). + * Always non-empty. * ``` * let x; * let y, z; @@ -36,18 +39,55 @@ export interface LetOrConstOrVarDeclaration extends BaseNode { kind: 'const' | 'let' | 'var'; } -export interface UsingInNormalContextDeclaration extends BaseNode { - type: AST_NODE_TYPES.VariableDeclaration; +export interface LetOrVarDeclaredDeclaration + extends LetOrConstOrVarDeclarationBase { + kind: 'let' | 'var'; + declare: true; /** - * The variables declared by this declaration. - * Note that there may be 0 declarations (i.e. `const;`). + * In a `declare let` declaration, the declarators must not have definite assignment + * assertions or initializers. * ``` - * using x = 1; - * using y =1, z = 2; + * declare let x: number; + * declare let y, z; * ``` */ - // TODO(#1852) - this should be guaranteed to have at least 1 element in it. - declarations: UsingInNomalConextDeclarator[]; + declarations: VariableDeclaratorNoInit[]; +} + +export interface LetOrVarNonDeclaredDeclaration + extends LetOrConstOrVarDeclarationBase { + kind: 'let' | 'var'; + declare: false; + /** + * In a `let`/`var` declaration, the declarators may have definite assignment + * assertions or initializers, but not both. + */ + declarations: ( + | VariableDeclaratorDefiniteAssignment + | VariableDeclaratorMaybeInit + )[]; +} + +export interface ConstDeclaration extends LetOrConstOrVarDeclarationBase { + kind: 'const'; + /** + * In a `declare const` declaration, the declarators may have initializers, but + * not definite assignment assertions. Each declarator cannot have both an + * initializer and a type annotation. + * + * Even if the declaration has no `declare`, it may still be ambient and have + * no initializer. + */ + declarations: VariableDeclaratorMaybeInit[]; +} + +export type LetOrConstOrVarDeclaration = + | LetOrVarDeclaredDeclaration + | LetOrVarNonDeclaredDeclaration + | ConstDeclaration; + +interface UsingDeclarationBase extends BaseNode { + type: AST_NODE_TYPES.VariableDeclaration; /** * This value will always be `false` * because 'declare' modifier cannot appear on a 'using' declaration. @@ -63,30 +103,28 @@ export interface UsingInNormalContextDeclaration extends BaseNode { kind: 'await using' | 'using'; } -export interface UsingInForOfDeclaration extends BaseNode { - type: AST_NODE_TYPES.VariableDeclaration; +export interface UsingInNormalContextDeclaration extends UsingDeclarationBase { /** * The variables declared by this declaration. - * Note that there may be 0 declarations (i.e. `const;`). + * Always non-empty. * ``` - * for(using x of y){} + * using x = 1; + * using y = 1, z = 2; * ``` */ - // TODO - this should be guaranteed to have 1 element in it. - declarations: UsingInForOfDeclarator[]; - /** - * This value will always be `false` - * because 'declare' modifier cannot appear on a 'using' declaration. - */ - declare: false; + // TODO(#1852) - this should be guaranteed to have at least 1 element in it. + declarations: UsingInNomalContextDeclarator[]; +} + +export interface UsingInForOfDeclaration extends UsingDeclarationBase { /** - * The keyword used to declare the variable(s) + * The variables declared by this declaration. + * Always has exactly one element. * ``` - * for(using x of y){} - * for(await using x of y){} + * for (using x of y) {} * ``` */ - kind: 'await using' | 'using'; + declarations: [UsingInForOfDeclarator]; } export type UsingDeclaration = diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/_error_/var-with-definite-assignment/snapshots/1-TSESTree-Error.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/_error_/var-with-definite-assignment/snapshots/1-TSESTree-Error.shot index ca5dbb187d38..f71c40b3cd20 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/_error_/var-with-definite-assignment/snapshots/1-TSESTree-Error.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/_error_/var-with-definite-assignment/snapshots/1-TSESTree-Error.shot @@ -1,3 +1,12 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`AST Fixtures legacy-fixtures basics _error_ var-with-definite-assignment TSESTree - Error 1`] = `"NO ERROR"`; +exports[`AST Fixtures legacy-fixtures basics _error_ var-with-definite-assignment TSESTree - Error 1`] = ` +"TSError + 1 | // TODO: This fixture might be too large, and if so should be split up. + 2 | +> 3 | const x!: string; + | ^^^^^^^^^^ A definite assignment assertion '!' is not permitted in this context. + 4 | var y!: number; + 5 | let z!: object; + 6 |" +`; diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/_error_/var-with-definite-assignment/snapshots/3-Alignment-Error.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/_error_/var-with-definite-assignment/snapshots/3-Alignment-Error.shot index 3dcc38e06038..a815026262cf 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/_error_/var-with-definite-assignment/snapshots/3-Alignment-Error.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/_error_/var-with-definite-assignment/snapshots/3-Alignment-Error.shot @@ -1,3 +1,3 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`AST Fixtures legacy-fixtures basics _error_ var-with-definite-assignment Error Alignment 1`] = `"Babel errored but TSESTree didn't"`; +exports[`AST Fixtures legacy-fixtures basics _error_ var-with-definite-assignment Error Alignment 1`] = `"Both errored"`; diff --git a/packages/ast-spec/src/special/VariableDeclarator/spec.ts b/packages/ast-spec/src/special/VariableDeclarator/spec.ts index f8246b6a479a..971befefcbd0 100644 --- a/packages/ast-spec/src/special/VariableDeclarator/spec.ts +++ b/packages/ast-spec/src/special/VariableDeclarator/spec.ts @@ -4,29 +4,65 @@ import type { Identifier } from '../../expression/Identifier/spec'; import type { BindingName } from '../../unions/BindingName'; import type { Expression } from '../../unions/Expression'; -export interface LetOrConstOrVarDeclarator extends BaseNode { +// TODO: these declarator types can probably be refined further, especially +// their differences when used in different contexts (e.g. for...of) +interface VariableDeclaratorBase extends BaseNode { type: AST_NODE_TYPES.VariableDeclarator; + /** + * The name(s) of the variable(s). + */ id: BindingName; + /** + * The initializer expression of the variable. Must be present for `const` unless + * in a `declare const`. + */ init: Expression | null; + /** + * Whether there's definite assignment assertion (`let x!: number`). + * If `true`, then: `id` must be an identifier with a type annotation, + * `init` must be `null`, and the declarator must be a `var`/`let` declarator. + */ definite: boolean; } -export interface UsingInNomalConextDeclarator extends BaseNode { - type: AST_NODE_TYPES.VariableDeclarator; +export interface VariableDeclaratorNoInit extends VariableDeclaratorBase { + init: null; + definite: false; +} + +export interface VariableDeclaratorMaybeInit extends VariableDeclaratorBase { + definite: false; +} + +export interface VariableDeclaratorDefiniteAssignment + extends VariableDeclaratorBase { + /** + * The name of the variable. Must have a type annotation. + */ + id: Identifier; + init: null; + definite: true; +} + +export type LetOrConstOrVarDeclarator = + | VariableDeclaratorDefiniteAssignment + | VariableDeclaratorMaybeInit + | VariableDeclaratorNoInit; + +export interface UsingInNomalContextDeclarator extends VariableDeclaratorBase { id: Identifier; init: Expression; - definite: boolean; + definite: false; } -export interface UsingInForOfDeclarator extends BaseNode { - type: AST_NODE_TYPES.VariableDeclarator; +export interface UsingInForOfDeclarator extends VariableDeclaratorBase { id: Identifier; init: null; - definite: boolean; + definite: false; } export type UsingDeclarator = | UsingInForOfDeclarator - | UsingInNomalConextDeclarator; + | UsingInNomalContextDeclarator; export type VariableDeclarator = LetOrConstOrVarDeclarator | UsingDeclarator; diff --git a/packages/ast-spec/tests/fixtures-with-differences-ast.shot b/packages/ast-spec/tests/fixtures-with-differences-ast.shot index 409216445120..9e862ac31cd9 100644 --- a/packages/ast-spec/tests/fixtures-with-differences-ast.shot +++ b/packages/ast-spec/tests/fixtures-with-differences-ast.shot @@ -104,16 +104,42 @@ exports[`AST Fixtures List fixtures with AST differences 1`] = ` "declaration/TSTypeAliasDeclaration/fixtures/valid/fixture.ts", "declaration/VariableDeclaration/fixtures/await-using-multiple-declarations/fixture.ts", "declaration/VariableDeclaration/fixtures/await-using-with-value/fixture.ts", - "declaration/VariableDeclaration/fixtures/const-with-value/fixture.ts", - "declaration/VariableDeclaration/fixtures/const-without-value/fixture.ts", - "declaration/VariableDeclaration/fixtures/declare/fixture.ts", - "declaration/VariableDeclaration/fixtures/let-with-value/fixture.ts", - "declaration/VariableDeclaration/fixtures/let-without-value/fixture.ts", + "declaration/VariableDeclaration/fixtures/const-destructure-init/fixture.ts", + "declaration/VariableDeclaration/fixtures/const-destructure-type-init/fixture.ts", + "declaration/VariableDeclaration/fixtures/const-id-init/fixture.ts", + "declaration/VariableDeclaration/fixtures/const-id-type-init/fixture.ts", + "declaration/VariableDeclaration/fixtures/declare-const-destructure-init/fixture.ts", + "declaration/VariableDeclaration/fixtures/declare-const-destructure-no-init/fixture.ts", + "declaration/VariableDeclaration/fixtures/declare-const-destructure-type-no-init/fixture.ts", + "declaration/VariableDeclaration/fixtures/declare-const-id-init/fixture.ts", + "declaration/VariableDeclaration/fixtures/declare-const-id-no-init/fixture.ts", + "declaration/VariableDeclaration/fixtures/declare-const-id-type-no-init/fixture.ts", + "declaration/VariableDeclaration/fixtures/declare-let-destructure-no-init/fixture.ts", + "declaration/VariableDeclaration/fixtures/declare-let-destructure-type-no-init/fixture.ts", + "declaration/VariableDeclaration/fixtures/declare-let-id-no-init/fixture.ts", + "declaration/VariableDeclaration/fixtures/declare-let-id-type-no-init/fixture.ts", + "declaration/VariableDeclaration/fixtures/declare-var-destructure-no-init/fixture.ts", + "declaration/VariableDeclaration/fixtures/declare-var-destructure-type-no-init/fixture.ts", + "declaration/VariableDeclaration/fixtures/declare-var-id-no-init/fixture.ts", + "declaration/VariableDeclaration/fixtures/declare-var-id-type-no-init/fixture.ts", + "declaration/VariableDeclaration/fixtures/let-destructure-init/fixture.ts", + "declaration/VariableDeclaration/fixtures/let-destructure-type-init/fixture.ts", + "declaration/VariableDeclaration/fixtures/let-id-definite-type-no-init/fixture.ts", + "declaration/VariableDeclaration/fixtures/let-id-init/fixture.ts", + "declaration/VariableDeclaration/fixtures/let-id-no-init/fixture.ts", + "declaration/VariableDeclaration/fixtures/let-id-type-init/fixture.ts", + "declaration/VariableDeclaration/fixtures/let-id-type-no-init/fixture.ts", "declaration/VariableDeclaration/fixtures/multiple-declarations/fixture.ts", + "declaration/VariableDeclaration/fixtures/using-id-init/fixture.ts", + "declaration/VariableDeclaration/fixtures/using-id-type-init/fixture.ts", "declaration/VariableDeclaration/fixtures/using-multiple-declarations/fixture.ts", - "declaration/VariableDeclaration/fixtures/using-with-value/fixture.ts", - "declaration/VariableDeclaration/fixtures/var-with-value/fixture.ts", - "declaration/VariableDeclaration/fixtures/var-without-value/fixture.ts", + "declaration/VariableDeclaration/fixtures/var-destructure-init/fixture.ts", + "declaration/VariableDeclaration/fixtures/var-destructure-type-init/fixture.ts", + "declaration/VariableDeclaration/fixtures/var-id-definite-type-no-init/fixture.ts", + "declaration/VariableDeclaration/fixtures/var-id-init/fixture.ts", + "declaration/VariableDeclaration/fixtures/var-id-no-init/fixture.ts", + "declaration/VariableDeclaration/fixtures/var-id-type-init/fixture.ts", + "declaration/VariableDeclaration/fixtures/var-id-type-no-init/fixture.ts", "element/AccessorProperty/fixtures/key-computed-complex/fixture.ts", "element/AccessorProperty/fixtures/key-computed-number/fixture.ts", "element/AccessorProperty/fixtures/key-computed-string/fixture.ts", diff --git a/packages/ast-spec/tests/fixtures-with-differences-errors.shot b/packages/ast-spec/tests/fixtures-with-differences-errors.shot index 3baa5a85efca..17412356fa60 100644 --- a/packages/ast-spec/tests/fixtures-with-differences-errors.shot +++ b/packages/ast-spec/tests/fixtures-with-differences-errors.shot @@ -17,6 +17,14 @@ exports[`AST Fixtures List fixtures with Error differences 1`] = ` "declaration/TSInterfaceDeclaration/fixtures/_error_/missing-type-param/fixture.ts", "declaration/TSInterfaceDeclaration/fixtures/_error_/non-identifier-extends/fixture.ts", "declaration/TSTypeAliasDeclaration/fixtures/_error_/missing-type-parameter/fixture.ts", + "declaration/VariableDeclaration/fixtures/_error_/const-destructure-no-init/fixture.ts", + "declaration/VariableDeclaration/fixtures/_error_/const-destructure-type-no-init/fixture.ts", + "declaration/VariableDeclaration/fixtures/_error_/const-id-no-init/fixture.ts", + "declaration/VariableDeclaration/fixtures/_error_/const-id-type-no-init/fixture.ts", + "declaration/VariableDeclaration/fixtures/_error_/let-destructure-no-init/fixture.ts", + "declaration/VariableDeclaration/fixtures/_error_/let-destructure-type-no-init/fixture.ts", + "declaration/VariableDeclaration/fixtures/_error_/var-destructure-no-init/fixture.ts", + "declaration/VariableDeclaration/fixtures/_error_/var-destructure-type-no-init/fixture.ts", "element/AccessorProperty/fixtures/_error_/modifier-override-with-no-extends/fixture.ts", "legacy-fixtures/basics/fixtures/_error_/await-without-async-function/fixture.ts", "legacy-fixtures/basics/fixtures/_error_/class-private-identifier-field-with-accessibility-error/fixture.ts", @@ -29,7 +37,6 @@ exports[`AST Fixtures List fixtures with Error differences 1`] = ` "legacy-fixtures/basics/fixtures/_error_/export-with-import-assertions/fixture.ts", "legacy-fixtures/basics/fixtures/_error_/import-type-error/fixture.ts", "legacy-fixtures/basics/fixtures/_error_/new-target-in-arrow-function-body/fixture.ts", - "legacy-fixtures/basics/fixtures/_error_/var-with-definite-assignment/fixture.ts", "legacy-fixtures/errorRecovery/fixtures/_error_/empty-type-arguments-in-call-expression/fixture.ts", "legacy-fixtures/errorRecovery/fixtures/_error_/empty-type-arguments-in-new-expression/fixture.ts", "legacy-fixtures/errorRecovery/fixtures/_error_/empty-type-arguments/fixture.ts", @@ -49,6 +56,23 @@ exports[`AST Fixtures List fixtures with Error differences 1`] = ` "TSESTree errored but Babel didn't": [ "declaration/ExportAllDeclaration/fixtures/_error_/named-non-identifier/fixture.ts", "declaration/ExportNamedDeclaration/fixtures/_error_/aliased-literal/fixture.ts", + "declaration/VariableDeclaration/fixtures/_error_/const-id-definite-init/fixture.ts", + "declaration/VariableDeclaration/fixtures/_error_/const-id-definite-type-init/fixture.ts", + "declaration/VariableDeclaration/fixtures/_error_/declare-const-id-definite-init/fixture.ts", + "declaration/VariableDeclaration/fixtures/_error_/declare-const-id-definite-no-init/fixture.ts", + "declaration/VariableDeclaration/fixtures/_error_/declare-const-id-definite-type-no-init/fixture.ts", + "declaration/VariableDeclaration/fixtures/_error_/declare-let-id-definite-no-init/fixture.ts", + "declaration/VariableDeclaration/fixtures/_error_/declare-let-id-definite-type-no-init/fixture.ts", + "declaration/VariableDeclaration/fixtures/_error_/declare-var-id-definite-no-init/fixture.ts", + "declaration/VariableDeclaration/fixtures/_error_/declare-var-id-definite-type-no-init/fixture.ts", + "declaration/VariableDeclaration/fixtures/_error_/let-id-definite-init/fixture.ts", + "declaration/VariableDeclaration/fixtures/_error_/let-id-definite-no-init/fixture.ts", + "declaration/VariableDeclaration/fixtures/_error_/let-id-definite-type-init/fixture.ts", + "declaration/VariableDeclaration/fixtures/_error_/using-id-definite-init/fixture.ts", + "declaration/VariableDeclaration/fixtures/_error_/using-id-definite-type-init/fixture.ts", + "declaration/VariableDeclaration/fixtures/_error_/var-id-definite-init/fixture.ts", + "declaration/VariableDeclaration/fixtures/_error_/var-id-definite-no-init/fixture.ts", + "declaration/VariableDeclaration/fixtures/_error_/var-id-definite-type-init/fixture.ts", "element/AccessorProperty/fixtures/_error_/modifier-abstract-accessor-with-value/fixture.ts", "legacy-fixtures/basics/fixtures/_error_/abstract-class-with-abstract-constructor/fixture.ts", "legacy-fixtures/expressions/fixtures/_error_/instantiation-expression/fixture.ts", diff --git a/packages/ast-spec/tests/fixtures-with-differences-tokens.shot b/packages/ast-spec/tests/fixtures-with-differences-tokens.shot index 43ef25b5170b..55d43529e897 100644 --- a/packages/ast-spec/tests/fixtures-with-differences-tokens.shot +++ b/packages/ast-spec/tests/fixtures-with-differences-tokens.shot @@ -18,9 +18,17 @@ exports[`AST Fixtures List fixtures with Token differences 1`] = ` "declaration/TSInterfaceDeclaration/fixtures/type-param-many/fixture.ts", "declaration/TSInterfaceDeclaration/fixtures/type-param-one/fixture.ts", "declaration/TSInterfaceDeclaration/fixtures/with-member-one/fixture.ts", - "declaration/VariableDeclaration/fixtures/declare/fixture.ts", - "declaration/VariableDeclaration/fixtures/let-with-value/fixture.ts", - "declaration/VariableDeclaration/fixtures/let-without-value/fixture.ts", + "declaration/VariableDeclaration/fixtures/declare-let-destructure-no-init/fixture.ts", + "declaration/VariableDeclaration/fixtures/declare-let-destructure-type-no-init/fixture.ts", + "declaration/VariableDeclaration/fixtures/declare-let-id-no-init/fixture.ts", + "declaration/VariableDeclaration/fixtures/declare-let-id-type-no-init/fixture.ts", + "declaration/VariableDeclaration/fixtures/let-destructure-init/fixture.ts", + "declaration/VariableDeclaration/fixtures/let-destructure-type-init/fixture.ts", + "declaration/VariableDeclaration/fixtures/let-id-definite-type-no-init/fixture.ts", + "declaration/VariableDeclaration/fixtures/let-id-init/fixture.ts", + "declaration/VariableDeclaration/fixtures/let-id-no-init/fixture.ts", + "declaration/VariableDeclaration/fixtures/let-id-type-init/fixture.ts", + "declaration/VariableDeclaration/fixtures/let-id-type-no-init/fixture.ts", "declaration/VariableDeclaration/fixtures/multiple-declarations/fixture.ts", "element/AccessorProperty/fixtures/key-private/fixture.ts", "element/AccessorProperty/fixtures/modifier-private/fixture.ts", diff --git a/packages/eslint-plugin/src/rules/indent.ts b/packages/eslint-plugin/src/rules/indent.ts index 9ebb23d75844..f24111e9f4a8 100644 --- a/packages/eslint-plugin/src/rules/indent.ts +++ b/packages/eslint-plugin/src/rules/indent.ts @@ -306,7 +306,7 @@ export default createRule({ range: moduleReference.range, loc: moduleReference.loc, }, - } as TSESTree.VariableDeclarator, + } as TSESTree.VariableDeclaratorMaybeInit, ], declare: false, diff --git a/packages/typescript-estree/src/convert.ts b/packages/typescript-estree/src/convert.ts index 9d068cbf2432..7c4783407699 100644 --- a/packages/typescript-estree/src/convert.ts +++ b/packages/typescript-estree/src/convert.ts @@ -990,15 +990,34 @@ export class Converter { } case SyntaxKind.VariableDeclaration: { + const definite = !!node.exclamationToken; + const init = this.convertChild(node.initializer); + const id = this.convertBindingNameWithTypeAnnotation( + node.name, + node.type, + node, + ); + if (definite) { + if (init) { + this.#throwError( + node, + 'Declarations with initializers cannot also have definite assignment assertions.', + ); + } else if ( + id.type !== AST_NODE_TYPES.Identifier || + !id.typeAnnotation + ) { + this.#throwError( + node, + 'Declarations with definite assignment assertions must also have type annotations.', + ); + } + } return this.createNode(node, { type: AST_NODE_TYPES.VariableDeclarator, - definite: !!node.exclamationToken, - id: this.convertBindingNameWithTypeAnnotation( - node.name, - node.type, - node, - ), - init: this.convertChild(node.initializer), + definite, + id, + init, }); } @@ -1034,6 +1053,41 @@ export class Converter { } }); } + // Definite assignment only allowed for non-declare let and var + if ( + result.declare || + ['using', 'await using', 'const'].includes(result.kind) + ) { + node.declarationList.declarations.forEach((declaration, i) => { + if (result.declarations[i].definite) { + this.#throwError( + declaration, + `A definite assignment assertion '!' is not permitted in this context.`, + ); + } + }); + } + if (result.declare) { + node.declarationList.declarations.forEach((declaration, i) => { + if ( + result.declarations[i].init && + (['let', 'var'].includes(result.kind) || + result.declarations[i].id.typeAnnotation) + ) { + this.#throwError( + declaration, + `Initializers are not permitted in ambient contexts.`, + ); + } + }); + // Theoretically, only certain initializers are allowed for declare const, + // (TS1254: A 'const' initializer in an ambient context must be a string + // or numeric literal or literal enum reference.) but we just allow + // all expressions + } + // Note! No-declare does not mean the variable is not ambient, because + // it can be further nested in other declare contexts. Therefore we cannot + // check for const initializers. /** * Semantically, decorators are not allowed on variable declarations, From cea3f68537835e53a86b5beee715eed301aa0732 Mon Sep 17 00:00:00 2001 From: Joshua Chen Date: Mon, 3 Jun 2024 23:23:30 +0800 Subject: [PATCH 2/8] Fix test --- .../tests/rules/init-declarations.test.ts | 16 ---------------- .../rules/no-unused-vars/no-unused-vars.test.ts | 6 +++--- 2 files changed, 3 insertions(+), 19 deletions(-) diff --git a/packages/eslint-plugin/tests/rules/init-declarations.test.ts b/packages/eslint-plugin/tests/rules/init-declarations.test.ts index f284cd101853..f402e862ae7c 100644 --- a/packages/eslint-plugin/tests/rules/init-declarations.test.ts +++ b/packages/eslint-plugin/tests/rules/init-declarations.test.ts @@ -313,11 +313,6 @@ interface IEmployee { `, options: ['never'], }, - { - code: "declare const foo: number = 'asd';", - options: ['always'], - }, - { code: "const foo: number = 'asd';", options: ['always'], @@ -713,17 +708,6 @@ const class1 = class NAME { }, ], }, - { - code: "declare var foo: number = 'asd';", - options: ['never'], - errors: [ - { - messageId: 'notInitialized', - data: { idName: 'foo' }, - type: AST_NODE_TYPES.VariableDeclarator, - }, - ], - }, { code: ` namespace myLib { diff --git a/packages/eslint-plugin/tests/rules/no-unused-vars/no-unused-vars.test.ts b/packages/eslint-plugin/tests/rules/no-unused-vars/no-unused-vars.test.ts index c810f351c0ae..edb14ee3db71 100644 --- a/packages/eslint-plugin/tests/rules/no-unused-vars/no-unused-vars.test.ts +++ b/packages/eslint-plugin/tests/rules/no-unused-vars/no-unused-vars.test.ts @@ -829,9 +829,9 @@ declare class Clazz {} declare function func(); declare enum Enum {} declare namespace Name {} -declare const v1 = 1; -declare var v2 = 1; -declare let v3 = 1; +declare const v1; +declare var v2; +declare let v3; declare const { v4 }; declare const { v4: v5 }; declare const [v6]; From f894e218c75c7ca8b77be28b829094cdeb0c8531 Mon Sep 17 00:00:00 2001 From: Joshua Chen Date: Mon, 3 Jun 2024 23:49:51 +0800 Subject: [PATCH 3/8] Ok linter --- .../src/declaration/VariableDeclaration/spec.ts | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/spec.ts b/packages/ast-spec/src/declaration/VariableDeclaration/spec.ts index 4f89f4aaec07..c05995667190 100644 --- a/packages/ast-spec/src/declaration/VariableDeclaration/spec.ts +++ b/packages/ast-spec/src/declaration/VariableDeclaration/spec.ts @@ -2,11 +2,11 @@ import type { AST_NODE_TYPES } from '../../ast-node-types'; import type { BaseNode } from '../../base/BaseNode'; import type { LetOrConstOrVarDeclarator, - VariableDeclaratorNoInit, - VariableDeclaratorMaybeInit, - VariableDeclaratorDefiniteAssignment, UsingInForOfDeclarator, UsingInNomalContextDeclarator, + VariableDeclaratorDefiniteAssignment, + VariableDeclaratorMaybeInit, + VariableDeclaratorNoInit, } from '../../special/VariableDeclarator/spec'; export interface LetOrConstOrVarDeclarationBase extends BaseNode { @@ -82,9 +82,9 @@ export interface ConstDeclaration extends LetOrConstOrVarDeclarationBase { } export type LetOrConstOrVarDeclaration = + | ConstDeclaration | LetOrVarDeclaredDeclaration - | LetOrVarNonDeclaredDeclaration - | ConstDeclaration; + | LetOrVarNonDeclaredDeclaration; interface UsingDeclarationBase extends BaseNode { type: AST_NODE_TYPES.VariableDeclaration; From 5220af0340d37e6c40ba4d76142700fa70c7f7cb Mon Sep 17 00:00:00 2001 From: Joshua Chen Date: Tue, 4 Jun 2024 18:42:08 +0800 Subject: [PATCH 4/8] Fix for...of loop checking logic, other review --- .../declaration/VariableDeclaration/spec.ts | 8 +- .../src/special/VariableDeclarator/spec.ts | 4 +- .../fixtures/expr-init/fixture.ts | 10 + .../expr-init/snapshots/1-TSESTree-AST.shot | 335 ++++++++++++ .../snapshots/2-TSESTree-Tokens.shot | 506 ++++++++++++++++++ .../expr-init/snapshots/3-Babel-AST.shot | 309 +++++++++++ .../expr-init/snapshots/4-Babel-Tokens.shot | 506 ++++++++++++++++++ .../snapshots/5-AST-Alignment-AST.shot | 339 ++++++++++++ .../snapshots/6-AST-Alignment-Tokens.shot | 6 + .../fixtures/_error_/decl-definite/fixture.ts | 1 + .../snapshots/1-TSESTree-Error.shot | 8 + .../snapshots/2-Babel-Error.shot | 3 + .../snapshots/3-Alignment-Error.shot | 3 + .../fixtures/_error_/decl-init/fixture.ts | 1 + .../decl-init/snapshots/1-TSESTree-Error.shot | 8 + .../decl-init/snapshots/2-Babel-Error.shot | 3 + .../snapshots/3-Alignment-Error.shot | 3 + .../fixtures/_error_/decl-multi/fixture.ts | 1 + .../snapshots/1-TSESTree-Error.shot | 8 + .../decl-multi/snapshots/2-Babel-Error.shot | 3 + .../snapshots/3-Alignment-Error.shot | 3 + .../fixtures/_error_/decl-type/fixture.ts | 1 + .../decl-type/snapshots/1-TSESTree-Error.shot | 8 + .../decl-type/snapshots/2-Babel-Error.shot | 3 + .../snapshots/3-Alignment-Error.shot | 3 + .../expr-not-assignment-target/fixture.ts | 1 + .../snapshots/1-TSESTree-Error.shot | 8 + .../snapshots/2-Babel-Error.shot | 3 + .../snapshots/3-Alignment-Error.shot | 3 + .../fixtures/expr-init/fixture.ts | 8 + .../expr-init/snapshots/1-TSESTree-AST.shot | 339 ++++++++++++ .../snapshots/2-TSESTree-Tokens.shot | 506 ++++++++++++++++++ .../expr-init/snapshots/3-Babel-AST.shot | 313 +++++++++++ .../expr-init/snapshots/4-Babel-Tokens.shot | 506 ++++++++++++++++++ .../snapshots/5-AST-Alignment-AST.shot | 343 ++++++++++++ .../snapshots/6-AST-Alignment-Tokens.shot | 6 + .../fixtures/using-declaration/fixture.ts | 2 + .../snapshots/1-TSESTree-AST.shot | 2 +- .../snapshots/2-TSESTree-Tokens.shot | 2 +- .../snapshots/3-Babel-AST.shot | 2 +- .../snapshots/4-Babel-Tokens.shot | 2 +- .../snapshots/5-AST-Alignment-AST.shot | 2 +- .../snapshots/6-AST-Alignment-Tokens.shot | 2 +- .../fixtures/using-decralation/fixture.ts | 1 - .../tests/fixtures-with-differences-ast.shot | 4 +- .../fixtures-with-differences-errors.shot | 2 + packages/typescript-estree/src/convert.ts | 45 +- packages/typescript-estree/src/node-utils.ts | 2 + 48 files changed, 4168 insertions(+), 19 deletions(-) create mode 100644 packages/ast-spec/src/statement/ForInStatement/fixtures/expr-init/fixture.ts create mode 100644 packages/ast-spec/src/statement/ForInStatement/fixtures/expr-init/snapshots/1-TSESTree-AST.shot create mode 100644 packages/ast-spec/src/statement/ForInStatement/fixtures/expr-init/snapshots/2-TSESTree-Tokens.shot create mode 100644 packages/ast-spec/src/statement/ForInStatement/fixtures/expr-init/snapshots/3-Babel-AST.shot create mode 100644 packages/ast-spec/src/statement/ForInStatement/fixtures/expr-init/snapshots/4-Babel-Tokens.shot create mode 100644 packages/ast-spec/src/statement/ForInStatement/fixtures/expr-init/snapshots/5-AST-Alignment-AST.shot create mode 100644 packages/ast-spec/src/statement/ForInStatement/fixtures/expr-init/snapshots/6-AST-Alignment-Tokens.shot create mode 100644 packages/ast-spec/src/statement/ForOfStatement/fixtures/_error_/decl-definite/fixture.ts create mode 100644 packages/ast-spec/src/statement/ForOfStatement/fixtures/_error_/decl-definite/snapshots/1-TSESTree-Error.shot create mode 100644 packages/ast-spec/src/statement/ForOfStatement/fixtures/_error_/decl-definite/snapshots/2-Babel-Error.shot create mode 100644 packages/ast-spec/src/statement/ForOfStatement/fixtures/_error_/decl-definite/snapshots/3-Alignment-Error.shot create mode 100644 packages/ast-spec/src/statement/ForOfStatement/fixtures/_error_/decl-init/fixture.ts create mode 100644 packages/ast-spec/src/statement/ForOfStatement/fixtures/_error_/decl-init/snapshots/1-TSESTree-Error.shot create mode 100644 packages/ast-spec/src/statement/ForOfStatement/fixtures/_error_/decl-init/snapshots/2-Babel-Error.shot create mode 100644 packages/ast-spec/src/statement/ForOfStatement/fixtures/_error_/decl-init/snapshots/3-Alignment-Error.shot create mode 100644 packages/ast-spec/src/statement/ForOfStatement/fixtures/_error_/decl-multi/fixture.ts create mode 100644 packages/ast-spec/src/statement/ForOfStatement/fixtures/_error_/decl-multi/snapshots/1-TSESTree-Error.shot create mode 100644 packages/ast-spec/src/statement/ForOfStatement/fixtures/_error_/decl-multi/snapshots/2-Babel-Error.shot create mode 100644 packages/ast-spec/src/statement/ForOfStatement/fixtures/_error_/decl-multi/snapshots/3-Alignment-Error.shot create mode 100644 packages/ast-spec/src/statement/ForOfStatement/fixtures/_error_/decl-type/fixture.ts create mode 100644 packages/ast-spec/src/statement/ForOfStatement/fixtures/_error_/decl-type/snapshots/1-TSESTree-Error.shot create mode 100644 packages/ast-spec/src/statement/ForOfStatement/fixtures/_error_/decl-type/snapshots/2-Babel-Error.shot create mode 100644 packages/ast-spec/src/statement/ForOfStatement/fixtures/_error_/decl-type/snapshots/3-Alignment-Error.shot create mode 100644 packages/ast-spec/src/statement/ForOfStatement/fixtures/_error_/expr-not-assignment-target/fixture.ts create mode 100644 packages/ast-spec/src/statement/ForOfStatement/fixtures/_error_/expr-not-assignment-target/snapshots/1-TSESTree-Error.shot create mode 100644 packages/ast-spec/src/statement/ForOfStatement/fixtures/_error_/expr-not-assignment-target/snapshots/2-Babel-Error.shot create mode 100644 packages/ast-spec/src/statement/ForOfStatement/fixtures/_error_/expr-not-assignment-target/snapshots/3-Alignment-Error.shot create mode 100644 packages/ast-spec/src/statement/ForOfStatement/fixtures/expr-init/fixture.ts create mode 100644 packages/ast-spec/src/statement/ForOfStatement/fixtures/expr-init/snapshots/1-TSESTree-AST.shot create mode 100644 packages/ast-spec/src/statement/ForOfStatement/fixtures/expr-init/snapshots/2-TSESTree-Tokens.shot create mode 100644 packages/ast-spec/src/statement/ForOfStatement/fixtures/expr-init/snapshots/3-Babel-AST.shot create mode 100644 packages/ast-spec/src/statement/ForOfStatement/fixtures/expr-init/snapshots/4-Babel-Tokens.shot create mode 100644 packages/ast-spec/src/statement/ForOfStatement/fixtures/expr-init/snapshots/5-AST-Alignment-AST.shot create mode 100644 packages/ast-spec/src/statement/ForOfStatement/fixtures/expr-init/snapshots/6-AST-Alignment-Tokens.shot create mode 100644 packages/ast-spec/src/statement/ForOfStatement/fixtures/using-declaration/fixture.ts rename packages/ast-spec/src/statement/ForOfStatement/fixtures/{using-decralation => using-declaration}/snapshots/1-TSESTree-AST.shot (96%) rename packages/ast-spec/src/statement/ForOfStatement/fixtures/{using-decralation => using-declaration}/snapshots/2-TSESTree-Tokens.shot (96%) rename packages/ast-spec/src/statement/ForOfStatement/fixtures/{using-decralation => using-declaration}/snapshots/3-Babel-AST.shot (96%) rename packages/ast-spec/src/statement/ForOfStatement/fixtures/{using-decralation => using-declaration}/snapshots/4-Babel-Tokens.shot (96%) rename packages/ast-spec/src/statement/ForOfStatement/fixtures/{using-decralation => using-declaration}/snapshots/5-AST-Alignment-AST.shot (96%) rename packages/ast-spec/src/statement/ForOfStatement/fixtures/{using-decralation => using-declaration}/snapshots/6-AST-Alignment-Tokens.shot (68%) delete mode 100644 packages/ast-spec/src/statement/ForOfStatement/fixtures/using-decralation/fixture.ts diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/spec.ts b/packages/ast-spec/src/declaration/VariableDeclaration/spec.ts index c05995667190..c38d3834be40 100644 --- a/packages/ast-spec/src/declaration/VariableDeclaration/spec.ts +++ b/packages/ast-spec/src/declaration/VariableDeclaration/spec.ts @@ -3,13 +3,13 @@ import type { BaseNode } from '../../base/BaseNode'; import type { LetOrConstOrVarDeclarator, UsingInForOfDeclarator, - UsingInNomalContextDeclarator, + UsingInNormalContextDeclarator, VariableDeclaratorDefiniteAssignment, VariableDeclaratorMaybeInit, VariableDeclaratorNoInit, } from '../../special/VariableDeclarator/spec'; -export interface LetOrConstOrVarDeclarationBase extends BaseNode { +interface LetOrConstOrVarDeclarationBase extends BaseNode { type: AST_NODE_TYPES.VariableDeclaration; /** * The variables declared by this declaration. @@ -19,7 +19,6 @@ export interface LetOrConstOrVarDeclarationBase extends BaseNode { * let y, z; * ``` */ - // TODO(#1852) - this should be guaranteed to have at least 1 element in it. declarations: LetOrConstOrVarDeclarator[]; /** * Whether the declaration is `declare`d @@ -112,8 +111,7 @@ export interface UsingInNormalContextDeclaration extends UsingDeclarationBase { * using y = 1, z = 2; * ``` */ - // TODO(#1852) - this should be guaranteed to have at least 1 element in it. - declarations: UsingInNomalContextDeclarator[]; + declarations: UsingInNormalContextDeclarator[]; } export interface UsingInForOfDeclaration extends UsingDeclarationBase { diff --git a/packages/ast-spec/src/special/VariableDeclarator/spec.ts b/packages/ast-spec/src/special/VariableDeclarator/spec.ts index 971befefcbd0..12b0b83c3862 100644 --- a/packages/ast-spec/src/special/VariableDeclarator/spec.ts +++ b/packages/ast-spec/src/special/VariableDeclarator/spec.ts @@ -49,7 +49,7 @@ export type LetOrConstOrVarDeclarator = | VariableDeclaratorMaybeInit | VariableDeclaratorNoInit; -export interface UsingInNomalContextDeclarator extends VariableDeclaratorBase { +export interface UsingInNormalContextDeclarator extends VariableDeclaratorBase { id: Identifier; init: Expression; definite: false; @@ -63,6 +63,6 @@ export interface UsingInForOfDeclarator extends VariableDeclaratorBase { export type UsingDeclarator = | UsingInForOfDeclarator - | UsingInNomalContextDeclarator; + | UsingInNormalContextDeclarator; export type VariableDeclarator = LetOrConstOrVarDeclarator | UsingDeclarator; diff --git a/packages/ast-spec/src/statement/ForInStatement/fixtures/expr-init/fixture.ts b/packages/ast-spec/src/statement/ForInStatement/fixtures/expr-init/fixture.ts new file mode 100644 index 000000000000..49a2cb06c7ff --- /dev/null +++ b/packages/ast-spec/src/statement/ForInStatement/fixtures/expr-init/fixture.ts @@ -0,0 +1,10 @@ +// NOTE: TS2491: The left-hand side of a 'for...in' statement cannot be a destructuring pattern. +// But this is valid JavaScript +for ({ x, y } in []) { +} +for ([x, y] in []) { +} +for (x.y in []) { +} +for (x as T in []) { +} diff --git a/packages/ast-spec/src/statement/ForInStatement/fixtures/expr-init/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/statement/ForInStatement/fixtures/expr-init/snapshots/1-TSESTree-AST.shot new file mode 100644 index 000000000000..c1a465d714bc --- /dev/null +++ b/packages/ast-spec/src/statement/ForInStatement/fixtures/expr-init/snapshots/1-TSESTree-AST.shot @@ -0,0 +1,335 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures statement ForInStatement expr-init TSESTree - AST 1`] = ` +Program { + type: "Program", + body: [ + ForInStatement { + type: "ForInStatement", + body: BlockStatement { + type: "BlockStatement", + body: [], + + range: [150, 152], + loc: { + start: { column: 21, line: 3 }, + end: { column: 23, line: 3 }, + }, + }, + left: ObjectPattern { + type: "ObjectPattern", + decorators: [], + optional: false, + properties: [ + Property { + type: "Property", + computed: false, + key: Identifier { + type: "Identifier", + decorators: [], + name: "x", + optional: false, + + range: [136, 137], + loc: { + start: { column: 7, line: 3 }, + end: { column: 8, line: 3 }, + }, + }, + kind: "init", + method: false, + optional: false, + shorthand: true, + value: Identifier { + type: "Identifier", + decorators: [], + name: "x", + optional: false, + + range: [136, 137], + loc: { + start: { column: 7, line: 3 }, + end: { column: 8, line: 3 }, + }, + }, + + range: [136, 137], + loc: { + start: { column: 7, line: 3 }, + end: { column: 8, line: 3 }, + }, + }, + Property { + type: "Property", + computed: false, + key: Identifier { + type: "Identifier", + decorators: [], + name: "y", + optional: false, + + range: [139, 140], + loc: { + start: { column: 10, line: 3 }, + end: { column: 11, line: 3 }, + }, + }, + kind: "init", + method: false, + optional: false, + shorthand: true, + value: Identifier { + type: "Identifier", + decorators: [], + name: "y", + optional: false, + + range: [139, 140], + loc: { + start: { column: 10, line: 3 }, + end: { column: 11, line: 3 }, + }, + }, + + range: [139, 140], + loc: { + start: { column: 10, line: 3 }, + end: { column: 11, line: 3 }, + }, + }, + ], + + range: [134, 142], + loc: { + start: { column: 5, line: 3 }, + end: { column: 13, line: 3 }, + }, + }, + right: ArrayExpression { + type: "ArrayExpression", + elements: [], + + range: [146, 148], + loc: { + start: { column: 17, line: 3 }, + end: { column: 19, line: 3 }, + }, + }, + + range: [129, 152], + loc: { + start: { column: 0, line: 3 }, + end: { column: 23, line: 3 }, + }, + }, + ForInStatement { + type: "ForInStatement", + body: BlockStatement { + type: "BlockStatement", + body: [], + + range: [172, 174], + loc: { + start: { column: 19, line: 4 }, + end: { column: 21, line: 4 }, + }, + }, + left: ArrayPattern { + type: "ArrayPattern", + decorators: [], + elements: [ + Identifier { + type: "Identifier", + decorators: [], + name: "x", + optional: false, + + range: [159, 160], + loc: { + start: { column: 6, line: 4 }, + end: { column: 7, line: 4 }, + }, + }, + Identifier { + type: "Identifier", + decorators: [], + name: "y", + optional: false, + + range: [162, 163], + loc: { + start: { column: 9, line: 4 }, + end: { column: 10, line: 4 }, + }, + }, + ], + optional: false, + + range: [158, 164], + loc: { + start: { column: 5, line: 4 }, + end: { column: 11, line: 4 }, + }, + }, + right: ArrayExpression { + type: "ArrayExpression", + elements: [], + + range: [168, 170], + loc: { + start: { column: 15, line: 4 }, + end: { column: 17, line: 4 }, + }, + }, + + range: [153, 174], + loc: { + start: { column: 0, line: 4 }, + end: { column: 21, line: 4 }, + }, + }, + ForInStatement { + type: "ForInStatement", + body: BlockStatement { + type: "BlockStatement", + body: [], + + range: [191, 193], + loc: { + start: { column: 16, line: 5 }, + end: { column: 18, line: 5 }, + }, + }, + left: MemberExpression { + type: "MemberExpression", + computed: false, + object: Identifier { + type: "Identifier", + decorators: [], + name: "x", + optional: false, + + range: [180, 181], + loc: { + start: { column: 5, line: 5 }, + end: { column: 6, line: 5 }, + }, + }, + optional: false, + property: Identifier { + type: "Identifier", + decorators: [], + name: "y", + optional: false, + + range: [182, 183], + loc: { + start: { column: 7, line: 5 }, + end: { column: 8, line: 5 }, + }, + }, + + range: [180, 183], + loc: { + start: { column: 5, line: 5 }, + end: { column: 8, line: 5 }, + }, + }, + right: ArrayExpression { + type: "ArrayExpression", + elements: [], + + range: [187, 189], + loc: { + start: { column: 12, line: 5 }, + end: { column: 14, line: 5 }, + }, + }, + + range: [175, 193], + loc: { + start: { column: 0, line: 5 }, + end: { column: 18, line: 5 }, + }, + }, + ForInStatement { + type: "ForInStatement", + body: BlockStatement { + type: "BlockStatement", + body: [], + + range: [215, 217], + loc: { + start: { column: 21, line: 6 }, + end: { column: 23, line: 6 }, + }, + }, + left: TSAsExpression { + type: "TSAsExpression", + expression: Identifier { + type: "Identifier", + decorators: [], + name: "x", + optional: false, + + range: [200, 201], + loc: { + start: { column: 6, line: 6 }, + end: { column: 7, line: 6 }, + }, + }, + typeAnnotation: TSTypeReference { + type: "TSTypeReference", + typeName: Identifier { + type: "Identifier", + decorators: [], + name: "T", + optional: false, + + range: [205, 206], + loc: { + start: { column: 11, line: 6 }, + end: { column: 12, line: 6 }, + }, + }, + + range: [205, 206], + loc: { + start: { column: 11, line: 6 }, + end: { column: 12, line: 6 }, + }, + }, + + range: [200, 206], + loc: { + start: { column: 6, line: 6 }, + end: { column: 12, line: 6 }, + }, + }, + right: ArrayExpression { + type: "ArrayExpression", + elements: [], + + range: [211, 213], + loc: { + start: { column: 17, line: 6 }, + end: { column: 19, line: 6 }, + }, + }, + + range: [194, 217], + loc: { + start: { column: 0, line: 6 }, + end: { column: 23, line: 6 }, + }, + }, + ], + sourceType: "script", + + range: [129, 218], + loc: { + start: { column: 0, line: 3 }, + end: { column: 0, line: 7 }, + }, +} +`; diff --git a/packages/ast-spec/src/statement/ForInStatement/fixtures/expr-init/snapshots/2-TSESTree-Tokens.shot b/packages/ast-spec/src/statement/ForInStatement/fixtures/expr-init/snapshots/2-TSESTree-Tokens.shot new file mode 100644 index 000000000000..cd1783a9f401 --- /dev/null +++ b/packages/ast-spec/src/statement/ForInStatement/fixtures/expr-init/snapshots/2-TSESTree-Tokens.shot @@ -0,0 +1,506 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures statement ForInStatement expr-init TSESTree - Tokens 1`] = ` +[ + Keyword { + type: "Keyword", + value: "for", + + range: [129, 132], + loc: { + start: { column: 0, line: 3 }, + end: { column: 3, line: 3 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "(", + + range: [133, 134], + loc: { + start: { column: 4, line: 3 }, + end: { column: 5, line: 3 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "{", + + range: [134, 135], + loc: { + start: { column: 5, line: 3 }, + end: { column: 6, line: 3 }, + }, + }, + Identifier { + type: "Identifier", + value: "x", + + range: [136, 137], + loc: { + start: { column: 7, line: 3 }, + end: { column: 8, line: 3 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ",", + + range: [137, 138], + loc: { + start: { column: 8, line: 3 }, + end: { column: 9, line: 3 }, + }, + }, + Identifier { + type: "Identifier", + value: "y", + + range: [139, 140], + loc: { + start: { column: 10, line: 3 }, + end: { column: 11, line: 3 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "}", + + range: [141, 142], + loc: { + start: { column: 12, line: 3 }, + end: { column: 13, line: 3 }, + }, + }, + Keyword { + type: "Keyword", + value: "in", + + range: [143, 145], + loc: { + start: { column: 14, line: 3 }, + end: { column: 16, line: 3 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "[", + + range: [146, 147], + loc: { + start: { column: 17, line: 3 }, + end: { column: 18, line: 3 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "]", + + range: [147, 148], + loc: { + start: { column: 18, line: 3 }, + end: { column: 19, line: 3 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ")", + + range: [148, 149], + loc: { + start: { column: 19, line: 3 }, + end: { column: 20, line: 3 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "{", + + range: [150, 151], + loc: { + start: { column: 21, line: 3 }, + end: { column: 22, line: 3 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "}", + + range: [151, 152], + loc: { + start: { column: 22, line: 3 }, + end: { column: 23, line: 3 }, + }, + }, + Keyword { + type: "Keyword", + value: "for", + + range: [153, 156], + loc: { + start: { column: 0, line: 4 }, + end: { column: 3, line: 4 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "(", + + range: [157, 158], + loc: { + start: { column: 4, line: 4 }, + end: { column: 5, line: 4 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "[", + + range: [158, 159], + loc: { + start: { column: 5, line: 4 }, + end: { column: 6, line: 4 }, + }, + }, + Identifier { + type: "Identifier", + value: "x", + + range: [159, 160], + loc: { + start: { column: 6, line: 4 }, + end: { column: 7, line: 4 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ",", + + range: [160, 161], + loc: { + start: { column: 7, line: 4 }, + end: { column: 8, line: 4 }, + }, + }, + Identifier { + type: "Identifier", + value: "y", + + range: [162, 163], + loc: { + start: { column: 9, line: 4 }, + end: { column: 10, line: 4 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "]", + + range: [163, 164], + loc: { + start: { column: 10, line: 4 }, + end: { column: 11, line: 4 }, + }, + }, + Keyword { + type: "Keyword", + value: "in", + + range: [165, 167], + loc: { + start: { column: 12, line: 4 }, + end: { column: 14, line: 4 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "[", + + range: [168, 169], + loc: { + start: { column: 15, line: 4 }, + end: { column: 16, line: 4 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "]", + + range: [169, 170], + loc: { + start: { column: 16, line: 4 }, + end: { column: 17, line: 4 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ")", + + range: [170, 171], + loc: { + start: { column: 17, line: 4 }, + end: { column: 18, line: 4 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "{", + + range: [172, 173], + loc: { + start: { column: 19, line: 4 }, + end: { column: 20, line: 4 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "}", + + range: [173, 174], + loc: { + start: { column: 20, line: 4 }, + end: { column: 21, line: 4 }, + }, + }, + Keyword { + type: "Keyword", + value: "for", + + range: [175, 178], + loc: { + start: { column: 0, line: 5 }, + end: { column: 3, line: 5 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "(", + + range: [179, 180], + loc: { + start: { column: 4, line: 5 }, + end: { column: 5, line: 5 }, + }, + }, + Identifier { + type: "Identifier", + value: "x", + + range: [180, 181], + loc: { + start: { column: 5, line: 5 }, + end: { column: 6, line: 5 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ".", + + range: [181, 182], + loc: { + start: { column: 6, line: 5 }, + end: { column: 7, line: 5 }, + }, + }, + Identifier { + type: "Identifier", + value: "y", + + range: [182, 183], + loc: { + start: { column: 7, line: 5 }, + end: { column: 8, line: 5 }, + }, + }, + Keyword { + type: "Keyword", + value: "in", + + range: [184, 186], + loc: { + start: { column: 9, line: 5 }, + end: { column: 11, line: 5 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "[", + + range: [187, 188], + loc: { + start: { column: 12, line: 5 }, + end: { column: 13, line: 5 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "]", + + range: [188, 189], + loc: { + start: { column: 13, line: 5 }, + end: { column: 14, line: 5 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ")", + + range: [189, 190], + loc: { + start: { column: 14, line: 5 }, + end: { column: 15, line: 5 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "{", + + range: [191, 192], + loc: { + start: { column: 16, line: 5 }, + end: { column: 17, line: 5 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "}", + + range: [192, 193], + loc: { + start: { column: 17, line: 5 }, + end: { column: 18, line: 5 }, + }, + }, + Keyword { + type: "Keyword", + value: "for", + + range: [194, 197], + loc: { + start: { column: 0, line: 6 }, + end: { column: 3, line: 6 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "(", + + range: [198, 199], + loc: { + start: { column: 4, line: 6 }, + end: { column: 5, line: 6 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "(", + + range: [199, 200], + loc: { + start: { column: 5, line: 6 }, + end: { column: 6, line: 6 }, + }, + }, + Identifier { + type: "Identifier", + value: "x", + + range: [200, 201], + loc: { + start: { column: 6, line: 6 }, + end: { column: 7, line: 6 }, + }, + }, + Identifier { + type: "Identifier", + value: "as", + + range: [202, 204], + loc: { + start: { column: 8, line: 6 }, + end: { column: 10, line: 6 }, + }, + }, + Identifier { + type: "Identifier", + value: "T", + + range: [205, 206], + loc: { + start: { column: 11, line: 6 }, + end: { column: 12, line: 6 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ")", + + range: [206, 207], + loc: { + start: { column: 12, line: 6 }, + end: { column: 13, line: 6 }, + }, + }, + Keyword { + type: "Keyword", + value: "in", + + range: [208, 210], + loc: { + start: { column: 14, line: 6 }, + end: { column: 16, line: 6 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "[", + + range: [211, 212], + loc: { + start: { column: 17, line: 6 }, + end: { column: 18, line: 6 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "]", + + range: [212, 213], + loc: { + start: { column: 18, line: 6 }, + end: { column: 19, line: 6 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ")", + + range: [213, 214], + loc: { + start: { column: 19, line: 6 }, + end: { column: 20, line: 6 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "{", + + range: [215, 216], + loc: { + start: { column: 21, line: 6 }, + end: { column: 22, line: 6 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "}", + + range: [216, 217], + loc: { + start: { column: 22, line: 6 }, + end: { column: 23, line: 6 }, + }, + }, +] +`; diff --git a/packages/ast-spec/src/statement/ForInStatement/fixtures/expr-init/snapshots/3-Babel-AST.shot b/packages/ast-spec/src/statement/ForInStatement/fixtures/expr-init/snapshots/3-Babel-AST.shot new file mode 100644 index 000000000000..16c9d6e357e8 --- /dev/null +++ b/packages/ast-spec/src/statement/ForInStatement/fixtures/expr-init/snapshots/3-Babel-AST.shot @@ -0,0 +1,309 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures statement ForInStatement expr-init Babel - AST 1`] = ` +Program { + type: "Program", + body: [ + ForInStatement { + type: "ForInStatement", + body: BlockStatement { + type: "BlockStatement", + body: [], + + range: [150, 152], + loc: { + start: { column: 21, line: 3 }, + end: { column: 23, line: 3 }, + }, + }, + left: ObjectPattern { + type: "ObjectPattern", + properties: [ + Property { + type: "Property", + computed: false, + key: Identifier { + type: "Identifier", + name: "x", + + range: [136, 137], + loc: { + start: { column: 7, line: 3 }, + end: { column: 8, line: 3 }, + }, + }, + kind: "init", + method: false, + shorthand: true, + value: Identifier { + type: "Identifier", + name: "x", + + range: [136, 137], + loc: { + start: { column: 7, line: 3 }, + end: { column: 8, line: 3 }, + }, + }, + + range: [136, 137], + loc: { + start: { column: 7, line: 3 }, + end: { column: 8, line: 3 }, + }, + }, + Property { + type: "Property", + computed: false, + key: Identifier { + type: "Identifier", + name: "y", + + range: [139, 140], + loc: { + start: { column: 10, line: 3 }, + end: { column: 11, line: 3 }, + }, + }, + kind: "init", + method: false, + shorthand: true, + value: Identifier { + type: "Identifier", + name: "y", + + range: [139, 140], + loc: { + start: { column: 10, line: 3 }, + end: { column: 11, line: 3 }, + }, + }, + + range: [139, 140], + loc: { + start: { column: 10, line: 3 }, + end: { column: 11, line: 3 }, + }, + }, + ], + + range: [134, 142], + loc: { + start: { column: 5, line: 3 }, + end: { column: 13, line: 3 }, + }, + }, + right: ArrayExpression { + type: "ArrayExpression", + elements: [], + + range: [146, 148], + loc: { + start: { column: 17, line: 3 }, + end: { column: 19, line: 3 }, + }, + }, + + range: [129, 152], + loc: { + start: { column: 0, line: 3 }, + end: { column: 23, line: 3 }, + }, + }, + ForInStatement { + type: "ForInStatement", + body: BlockStatement { + type: "BlockStatement", + body: [], + + range: [172, 174], + loc: { + start: { column: 19, line: 4 }, + end: { column: 21, line: 4 }, + }, + }, + left: ArrayPattern { + type: "ArrayPattern", + elements: [ + Identifier { + type: "Identifier", + name: "x", + + range: [159, 160], + loc: { + start: { column: 6, line: 4 }, + end: { column: 7, line: 4 }, + }, + }, + Identifier { + type: "Identifier", + name: "y", + + range: [162, 163], + loc: { + start: { column: 9, line: 4 }, + end: { column: 10, line: 4 }, + }, + }, + ], + + range: [158, 164], + loc: { + start: { column: 5, line: 4 }, + end: { column: 11, line: 4 }, + }, + }, + right: ArrayExpression { + type: "ArrayExpression", + elements: [], + + range: [168, 170], + loc: { + start: { column: 15, line: 4 }, + end: { column: 17, line: 4 }, + }, + }, + + range: [153, 174], + loc: { + start: { column: 0, line: 4 }, + end: { column: 21, line: 4 }, + }, + }, + ForInStatement { + type: "ForInStatement", + body: BlockStatement { + type: "BlockStatement", + body: [], + + range: [191, 193], + loc: { + start: { column: 16, line: 5 }, + end: { column: 18, line: 5 }, + }, + }, + left: MemberExpression { + type: "MemberExpression", + computed: false, + object: Identifier { + type: "Identifier", + name: "x", + + range: [180, 181], + loc: { + start: { column: 5, line: 5 }, + end: { column: 6, line: 5 }, + }, + }, + optional: false, + property: Identifier { + type: "Identifier", + name: "y", + + range: [182, 183], + loc: { + start: { column: 7, line: 5 }, + end: { column: 8, line: 5 }, + }, + }, + + range: [180, 183], + loc: { + start: { column: 5, line: 5 }, + end: { column: 8, line: 5 }, + }, + }, + right: ArrayExpression { + type: "ArrayExpression", + elements: [], + + range: [187, 189], + loc: { + start: { column: 12, line: 5 }, + end: { column: 14, line: 5 }, + }, + }, + + range: [175, 193], + loc: { + start: { column: 0, line: 5 }, + end: { column: 18, line: 5 }, + }, + }, + ForInStatement { + type: "ForInStatement", + body: BlockStatement { + type: "BlockStatement", + body: [], + + range: [215, 217], + loc: { + start: { column: 21, line: 6 }, + end: { column: 23, line: 6 }, + }, + }, + left: TSAsExpression { + type: "TSAsExpression", + expression: Identifier { + type: "Identifier", + name: "x", + + range: [200, 201], + loc: { + start: { column: 6, line: 6 }, + end: { column: 7, line: 6 }, + }, + }, + typeAnnotation: TSTypeReference { + type: "TSTypeReference", + typeName: Identifier { + type: "Identifier", + name: "T", + + range: [205, 206], + loc: { + start: { column: 11, line: 6 }, + end: { column: 12, line: 6 }, + }, + }, + + range: [205, 206], + loc: { + start: { column: 11, line: 6 }, + end: { column: 12, line: 6 }, + }, + }, + + range: [200, 206], + loc: { + start: { column: 6, line: 6 }, + end: { column: 12, line: 6 }, + }, + }, + right: ArrayExpression { + type: "ArrayExpression", + elements: [], + + range: [211, 213], + loc: { + start: { column: 17, line: 6 }, + end: { column: 19, line: 6 }, + }, + }, + + range: [194, 217], + loc: { + start: { column: 0, line: 6 }, + end: { column: 23, line: 6 }, + }, + }, + ], + sourceType: "script", + + range: [129, 218], + loc: { + start: { column: 0, line: 3 }, + end: { column: 0, line: 7 }, + }, +} +`; diff --git a/packages/ast-spec/src/statement/ForInStatement/fixtures/expr-init/snapshots/4-Babel-Tokens.shot b/packages/ast-spec/src/statement/ForInStatement/fixtures/expr-init/snapshots/4-Babel-Tokens.shot new file mode 100644 index 000000000000..56cec4813296 --- /dev/null +++ b/packages/ast-spec/src/statement/ForInStatement/fixtures/expr-init/snapshots/4-Babel-Tokens.shot @@ -0,0 +1,506 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures statement ForInStatement expr-init Babel - Tokens 1`] = ` +[ + Keyword { + type: "Keyword", + value: "for", + + range: [129, 132], + loc: { + start: { column: 0, line: 3 }, + end: { column: 3, line: 3 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "(", + + range: [133, 134], + loc: { + start: { column: 4, line: 3 }, + end: { column: 5, line: 3 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "{", + + range: [134, 135], + loc: { + start: { column: 5, line: 3 }, + end: { column: 6, line: 3 }, + }, + }, + Identifier { + type: "Identifier", + value: "x", + + range: [136, 137], + loc: { + start: { column: 7, line: 3 }, + end: { column: 8, line: 3 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ",", + + range: [137, 138], + loc: { + start: { column: 8, line: 3 }, + end: { column: 9, line: 3 }, + }, + }, + Identifier { + type: "Identifier", + value: "y", + + range: [139, 140], + loc: { + start: { column: 10, line: 3 }, + end: { column: 11, line: 3 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "}", + + range: [141, 142], + loc: { + start: { column: 12, line: 3 }, + end: { column: 13, line: 3 }, + }, + }, + Keyword { + type: "Keyword", + value: "in", + + range: [143, 145], + loc: { + start: { column: 14, line: 3 }, + end: { column: 16, line: 3 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "[", + + range: [146, 147], + loc: { + start: { column: 17, line: 3 }, + end: { column: 18, line: 3 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "]", + + range: [147, 148], + loc: { + start: { column: 18, line: 3 }, + end: { column: 19, line: 3 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ")", + + range: [148, 149], + loc: { + start: { column: 19, line: 3 }, + end: { column: 20, line: 3 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "{", + + range: [150, 151], + loc: { + start: { column: 21, line: 3 }, + end: { column: 22, line: 3 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "}", + + range: [151, 152], + loc: { + start: { column: 22, line: 3 }, + end: { column: 23, line: 3 }, + }, + }, + Keyword { + type: "Keyword", + value: "for", + + range: [153, 156], + loc: { + start: { column: 0, line: 4 }, + end: { column: 3, line: 4 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "(", + + range: [157, 158], + loc: { + start: { column: 4, line: 4 }, + end: { column: 5, line: 4 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "[", + + range: [158, 159], + loc: { + start: { column: 5, line: 4 }, + end: { column: 6, line: 4 }, + }, + }, + Identifier { + type: "Identifier", + value: "x", + + range: [159, 160], + loc: { + start: { column: 6, line: 4 }, + end: { column: 7, line: 4 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ",", + + range: [160, 161], + loc: { + start: { column: 7, line: 4 }, + end: { column: 8, line: 4 }, + }, + }, + Identifier { + type: "Identifier", + value: "y", + + range: [162, 163], + loc: { + start: { column: 9, line: 4 }, + end: { column: 10, line: 4 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "]", + + range: [163, 164], + loc: { + start: { column: 10, line: 4 }, + end: { column: 11, line: 4 }, + }, + }, + Keyword { + type: "Keyword", + value: "in", + + range: [165, 167], + loc: { + start: { column: 12, line: 4 }, + end: { column: 14, line: 4 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "[", + + range: [168, 169], + loc: { + start: { column: 15, line: 4 }, + end: { column: 16, line: 4 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "]", + + range: [169, 170], + loc: { + start: { column: 16, line: 4 }, + end: { column: 17, line: 4 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ")", + + range: [170, 171], + loc: { + start: { column: 17, line: 4 }, + end: { column: 18, line: 4 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "{", + + range: [172, 173], + loc: { + start: { column: 19, line: 4 }, + end: { column: 20, line: 4 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "}", + + range: [173, 174], + loc: { + start: { column: 20, line: 4 }, + end: { column: 21, line: 4 }, + }, + }, + Keyword { + type: "Keyword", + value: "for", + + range: [175, 178], + loc: { + start: { column: 0, line: 5 }, + end: { column: 3, line: 5 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "(", + + range: [179, 180], + loc: { + start: { column: 4, line: 5 }, + end: { column: 5, line: 5 }, + }, + }, + Identifier { + type: "Identifier", + value: "x", + + range: [180, 181], + loc: { + start: { column: 5, line: 5 }, + end: { column: 6, line: 5 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ".", + + range: [181, 182], + loc: { + start: { column: 6, line: 5 }, + end: { column: 7, line: 5 }, + }, + }, + Identifier { + type: "Identifier", + value: "y", + + range: [182, 183], + loc: { + start: { column: 7, line: 5 }, + end: { column: 8, line: 5 }, + }, + }, + Keyword { + type: "Keyword", + value: "in", + + range: [184, 186], + loc: { + start: { column: 9, line: 5 }, + end: { column: 11, line: 5 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "[", + + range: [187, 188], + loc: { + start: { column: 12, line: 5 }, + end: { column: 13, line: 5 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "]", + + range: [188, 189], + loc: { + start: { column: 13, line: 5 }, + end: { column: 14, line: 5 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ")", + + range: [189, 190], + loc: { + start: { column: 14, line: 5 }, + end: { column: 15, line: 5 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "{", + + range: [191, 192], + loc: { + start: { column: 16, line: 5 }, + end: { column: 17, line: 5 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "}", + + range: [192, 193], + loc: { + start: { column: 17, line: 5 }, + end: { column: 18, line: 5 }, + }, + }, + Keyword { + type: "Keyword", + value: "for", + + range: [194, 197], + loc: { + start: { column: 0, line: 6 }, + end: { column: 3, line: 6 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "(", + + range: [198, 199], + loc: { + start: { column: 4, line: 6 }, + end: { column: 5, line: 6 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "(", + + range: [199, 200], + loc: { + start: { column: 5, line: 6 }, + end: { column: 6, line: 6 }, + }, + }, + Identifier { + type: "Identifier", + value: "x", + + range: [200, 201], + loc: { + start: { column: 6, line: 6 }, + end: { column: 7, line: 6 }, + }, + }, + Identifier { + type: "Identifier", + value: "as", + + range: [202, 204], + loc: { + start: { column: 8, line: 6 }, + end: { column: 10, line: 6 }, + }, + }, + Identifier { + type: "Identifier", + value: "T", + + range: [205, 206], + loc: { + start: { column: 11, line: 6 }, + end: { column: 12, line: 6 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ")", + + range: [206, 207], + loc: { + start: { column: 12, line: 6 }, + end: { column: 13, line: 6 }, + }, + }, + Keyword { + type: "Keyword", + value: "in", + + range: [208, 210], + loc: { + start: { column: 14, line: 6 }, + end: { column: 16, line: 6 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "[", + + range: [211, 212], + loc: { + start: { column: 17, line: 6 }, + end: { column: 18, line: 6 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "]", + + range: [212, 213], + loc: { + start: { column: 18, line: 6 }, + end: { column: 19, line: 6 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ")", + + range: [213, 214], + loc: { + start: { column: 19, line: 6 }, + end: { column: 20, line: 6 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "{", + + range: [215, 216], + loc: { + start: { column: 21, line: 6 }, + end: { column: 22, line: 6 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "}", + + range: [216, 217], + loc: { + start: { column: 22, line: 6 }, + end: { column: 23, line: 6 }, + }, + }, +] +`; diff --git a/packages/ast-spec/src/statement/ForInStatement/fixtures/expr-init/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/statement/ForInStatement/fixtures/expr-init/snapshots/5-AST-Alignment-AST.shot new file mode 100644 index 000000000000..b33f93c97ada --- /dev/null +++ b/packages/ast-spec/src/statement/ForInStatement/fixtures/expr-init/snapshots/5-AST-Alignment-AST.shot @@ -0,0 +1,339 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures statement ForInStatement expr-init AST Alignment - AST 1`] = ` +"Snapshot Diff: +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + ForInStatement { + type: 'ForInStatement', + body: BlockStatement { + type: 'BlockStatement', + body: Array [], + + range: [150, 152], + loc: { + start: { column: 21, line: 3 }, + end: { column: 23, line: 3 }, + }, + }, + left: ObjectPattern { + type: 'ObjectPattern', +- decorators: Array [], +- optional: false, + properties: Array [ + Property { + type: 'Property', + computed: false, + key: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'x', +- optional: false, + + range: [136, 137], + loc: { + start: { column: 7, line: 3 }, + end: { column: 8, line: 3 }, + }, + }, + kind: 'init', + method: false, +- optional: false, + shorthand: true, + value: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'x', +- optional: false, + + range: [136, 137], + loc: { + start: { column: 7, line: 3 }, + end: { column: 8, line: 3 }, + }, + }, + + range: [136, 137], + loc: { + start: { column: 7, line: 3 }, + end: { column: 8, line: 3 }, + }, + }, + Property { + type: 'Property', + computed: false, + key: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'y', +- optional: false, + + range: [139, 140], + loc: { + start: { column: 10, line: 3 }, + end: { column: 11, line: 3 }, + }, + }, + kind: 'init', + method: false, +- optional: false, + shorthand: true, + value: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'y', +- optional: false, + + range: [139, 140], + loc: { + start: { column: 10, line: 3 }, + end: { column: 11, line: 3 }, + }, + }, + + range: [139, 140], + loc: { + start: { column: 10, line: 3 }, + end: { column: 11, line: 3 }, + }, + }, + ], + + range: [134, 142], + loc: { + start: { column: 5, line: 3 }, + end: { column: 13, line: 3 }, + }, + }, + right: ArrayExpression { + type: 'ArrayExpression', + elements: Array [], + + range: [146, 148], + loc: { + start: { column: 17, line: 3 }, + end: { column: 19, line: 3 }, + }, + }, + + range: [129, 152], + loc: { + start: { column: 0, line: 3 }, + end: { column: 23, line: 3 }, + }, + }, + ForInStatement { + type: 'ForInStatement', + body: BlockStatement { + type: 'BlockStatement', + body: Array [], + + range: [172, 174], + loc: { + start: { column: 19, line: 4 }, + end: { column: 21, line: 4 }, + }, + }, + left: ArrayPattern { + type: 'ArrayPattern', +- decorators: Array [], + elements: Array [ + Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'x', +- optional: false, + + range: [159, 160], + loc: { + start: { column: 6, line: 4 }, + end: { column: 7, line: 4 }, + }, + }, + Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'y', +- optional: false, + + range: [162, 163], + loc: { + start: { column: 9, line: 4 }, + end: { column: 10, line: 4 }, + }, + }, + ], +- optional: false, + + range: [158, 164], + loc: { + start: { column: 5, line: 4 }, + end: { column: 11, line: 4 }, + }, + }, + right: ArrayExpression { + type: 'ArrayExpression', + elements: Array [], + + range: [168, 170], + loc: { + start: { column: 15, line: 4 }, + end: { column: 17, line: 4 }, + }, + }, + + range: [153, 174], + loc: { + start: { column: 0, line: 4 }, + end: { column: 21, line: 4 }, + }, + }, + ForInStatement { + type: 'ForInStatement', + body: BlockStatement { + type: 'BlockStatement', + body: Array [], + + range: [191, 193], + loc: { + start: { column: 16, line: 5 }, + end: { column: 18, line: 5 }, + }, + }, + left: MemberExpression { + type: 'MemberExpression', + computed: false, + object: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'x', +- optional: false, + + range: [180, 181], + loc: { + start: { column: 5, line: 5 }, + end: { column: 6, line: 5 }, + }, + }, + optional: false, + property: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'y', +- optional: false, + + range: [182, 183], + loc: { + start: { column: 7, line: 5 }, + end: { column: 8, line: 5 }, + }, + }, + + range: [180, 183], + loc: { + start: { column: 5, line: 5 }, + end: { column: 8, line: 5 }, + }, + }, + right: ArrayExpression { + type: 'ArrayExpression', + elements: Array [], + + range: [187, 189], + loc: { + start: { column: 12, line: 5 }, + end: { column: 14, line: 5 }, + }, + }, + + range: [175, 193], + loc: { + start: { column: 0, line: 5 }, + end: { column: 18, line: 5 }, + }, + }, + ForInStatement { + type: 'ForInStatement', + body: BlockStatement { + type: 'BlockStatement', + body: Array [], + + range: [215, 217], + loc: { + start: { column: 21, line: 6 }, + end: { column: 23, line: 6 }, + }, + }, + left: TSAsExpression { + type: 'TSAsExpression', + expression: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'x', +- optional: false, + + range: [200, 201], + loc: { + start: { column: 6, line: 6 }, + end: { column: 7, line: 6 }, + }, + }, + typeAnnotation: TSTypeReference { + type: 'TSTypeReference', + typeName: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'T', +- optional: false, + + range: [205, 206], + loc: { + start: { column: 11, line: 6 }, + end: { column: 12, line: 6 }, + }, + }, + + range: [205, 206], + loc: { + start: { column: 11, line: 6 }, + end: { column: 12, line: 6 }, + }, + }, + + range: [200, 206], + loc: { + start: { column: 6, line: 6 }, + end: { column: 12, line: 6 }, + }, + }, + right: ArrayExpression { + type: 'ArrayExpression', + elements: Array [], + + range: [211, 213], + loc: { + start: { column: 17, line: 6 }, + end: { column: 19, line: 6 }, + }, + }, + + range: [194, 217], + loc: { + start: { column: 0, line: 6 }, + end: { column: 23, line: 6 }, + }, + }, + ], + sourceType: 'script', + + range: [129, 218], + loc: { + start: { column: 0, line: 3 }, + end: { column: 0, line: 7 }, + }, + }" +`; diff --git a/packages/ast-spec/src/statement/ForInStatement/fixtures/expr-init/snapshots/6-AST-Alignment-Tokens.shot b/packages/ast-spec/src/statement/ForInStatement/fixtures/expr-init/snapshots/6-AST-Alignment-Tokens.shot new file mode 100644 index 000000000000..03a236c142bf --- /dev/null +++ b/packages/ast-spec/src/statement/ForInStatement/fixtures/expr-init/snapshots/6-AST-Alignment-Tokens.shot @@ -0,0 +1,6 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures statement ForInStatement expr-init AST Alignment - Token 1`] = ` +"Snapshot Diff: +Compared values have no visual difference." +`; diff --git a/packages/ast-spec/src/statement/ForOfStatement/fixtures/_error_/decl-definite/fixture.ts b/packages/ast-spec/src/statement/ForOfStatement/fixtures/_error_/decl-definite/fixture.ts new file mode 100644 index 000000000000..39a2e2d528b4 --- /dev/null +++ b/packages/ast-spec/src/statement/ForOfStatement/fixtures/_error_/decl-definite/fixture.ts @@ -0,0 +1 @@ +for (let x! of []) {} diff --git a/packages/ast-spec/src/statement/ForOfStatement/fixtures/_error_/decl-definite/snapshots/1-TSESTree-Error.shot b/packages/ast-spec/src/statement/ForOfStatement/fixtures/_error_/decl-definite/snapshots/1-TSESTree-Error.shot new file mode 100644 index 000000000000..674e6e785dcf --- /dev/null +++ b/packages/ast-spec/src/statement/ForOfStatement/fixtures/_error_/decl-definite/snapshots/1-TSESTree-Error.shot @@ -0,0 +1,8 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures statement ForOfStatement _error_ decl-definite TSESTree - Error 1`] = ` +"TSError +> 1 | for (let x! of []) {} + | ^ ',' expected. + 2 |" +`; diff --git a/packages/ast-spec/src/statement/ForOfStatement/fixtures/_error_/decl-definite/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/statement/ForOfStatement/fixtures/_error_/decl-definite/snapshots/2-Babel-Error.shot new file mode 100644 index 000000000000..5adc29afdca0 --- /dev/null +++ b/packages/ast-spec/src/statement/ForOfStatement/fixtures/_error_/decl-definite/snapshots/2-Babel-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures statement ForOfStatement _error_ decl-definite Babel - Error 1`] = `"NO ERROR"`; diff --git a/packages/ast-spec/src/statement/ForOfStatement/fixtures/_error_/decl-definite/snapshots/3-Alignment-Error.shot b/packages/ast-spec/src/statement/ForOfStatement/fixtures/_error_/decl-definite/snapshots/3-Alignment-Error.shot new file mode 100644 index 000000000000..4845482cc667 --- /dev/null +++ b/packages/ast-spec/src/statement/ForOfStatement/fixtures/_error_/decl-definite/snapshots/3-Alignment-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures statement ForOfStatement _error_ decl-definite Error Alignment 1`] = `"TSESTree errored but Babel didn't"`; diff --git a/packages/ast-spec/src/statement/ForOfStatement/fixtures/_error_/decl-init/fixture.ts b/packages/ast-spec/src/statement/ForOfStatement/fixtures/_error_/decl-init/fixture.ts new file mode 100644 index 000000000000..2aeae62c4dd5 --- /dev/null +++ b/packages/ast-spec/src/statement/ForOfStatement/fixtures/_error_/decl-init/fixture.ts @@ -0,0 +1 @@ +for (const x = 1 of []) {} diff --git a/packages/ast-spec/src/statement/ForOfStatement/fixtures/_error_/decl-init/snapshots/1-TSESTree-Error.shot b/packages/ast-spec/src/statement/ForOfStatement/fixtures/_error_/decl-init/snapshots/1-TSESTree-Error.shot new file mode 100644 index 000000000000..5b0085daafe1 --- /dev/null +++ b/packages/ast-spec/src/statement/ForOfStatement/fixtures/_error_/decl-init/snapshots/1-TSESTree-Error.shot @@ -0,0 +1,8 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures statement ForOfStatement _error_ decl-init TSESTree - Error 1`] = ` +"TSError +> 1 | for (const x = 1 of []) {} + | ^^^^^ The variable declaration of a 'for...of' statement cannot have an initializer. + 2 |" +`; diff --git a/packages/ast-spec/src/statement/ForOfStatement/fixtures/_error_/decl-init/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/statement/ForOfStatement/fixtures/_error_/decl-init/snapshots/2-Babel-Error.shot new file mode 100644 index 000000000000..6fd930fccb57 --- /dev/null +++ b/packages/ast-spec/src/statement/ForOfStatement/fixtures/_error_/decl-init/snapshots/2-Babel-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures statement ForOfStatement _error_ decl-init Babel - Error 1`] = `[SyntaxError: 'for-of' loop variable declaration may not have an initializer. (1:5)]`; diff --git a/packages/ast-spec/src/statement/ForOfStatement/fixtures/_error_/decl-init/snapshots/3-Alignment-Error.shot b/packages/ast-spec/src/statement/ForOfStatement/fixtures/_error_/decl-init/snapshots/3-Alignment-Error.shot new file mode 100644 index 000000000000..8e4eb4f4b763 --- /dev/null +++ b/packages/ast-spec/src/statement/ForOfStatement/fixtures/_error_/decl-init/snapshots/3-Alignment-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures statement ForOfStatement _error_ decl-init Error Alignment 1`] = `"Both errored"`; diff --git a/packages/ast-spec/src/statement/ForOfStatement/fixtures/_error_/decl-multi/fixture.ts b/packages/ast-spec/src/statement/ForOfStatement/fixtures/_error_/decl-multi/fixture.ts new file mode 100644 index 000000000000..b8c35c8f7e48 --- /dev/null +++ b/packages/ast-spec/src/statement/ForOfStatement/fixtures/_error_/decl-multi/fixture.ts @@ -0,0 +1 @@ +for (const x, y of []) {} diff --git a/packages/ast-spec/src/statement/ForOfStatement/fixtures/_error_/decl-multi/snapshots/1-TSESTree-Error.shot b/packages/ast-spec/src/statement/ForOfStatement/fixtures/_error_/decl-multi/snapshots/1-TSESTree-Error.shot new file mode 100644 index 000000000000..24e0f153a8c7 --- /dev/null +++ b/packages/ast-spec/src/statement/ForOfStatement/fixtures/_error_/decl-multi/snapshots/1-TSESTree-Error.shot @@ -0,0 +1,8 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures statement ForOfStatement _error_ decl-multi TSESTree - Error 1`] = ` +"TSError +> 1 | for (const x, y of []) {} + | ^^^^^^^^^^ Only a single variable declaration is allowed in a 'for...of' statement. + 2 |" +`; diff --git a/packages/ast-spec/src/statement/ForOfStatement/fixtures/_error_/decl-multi/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/statement/ForOfStatement/fixtures/_error_/decl-multi/snapshots/2-Babel-Error.shot new file mode 100644 index 000000000000..bf19dacc1793 --- /dev/null +++ b/packages/ast-spec/src/statement/ForOfStatement/fixtures/_error_/decl-multi/snapshots/2-Babel-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures statement ForOfStatement _error_ decl-multi Babel - Error 1`] = `[SyntaxError: Missing initializer in const declaration. (1:12)]`; diff --git a/packages/ast-spec/src/statement/ForOfStatement/fixtures/_error_/decl-multi/snapshots/3-Alignment-Error.shot b/packages/ast-spec/src/statement/ForOfStatement/fixtures/_error_/decl-multi/snapshots/3-Alignment-Error.shot new file mode 100644 index 000000000000..a6962d2b8f3f --- /dev/null +++ b/packages/ast-spec/src/statement/ForOfStatement/fixtures/_error_/decl-multi/snapshots/3-Alignment-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures statement ForOfStatement _error_ decl-multi Error Alignment 1`] = `"Both errored"`; diff --git a/packages/ast-spec/src/statement/ForOfStatement/fixtures/_error_/decl-type/fixture.ts b/packages/ast-spec/src/statement/ForOfStatement/fixtures/_error_/decl-type/fixture.ts new file mode 100644 index 000000000000..ad08b255479e --- /dev/null +++ b/packages/ast-spec/src/statement/ForOfStatement/fixtures/_error_/decl-type/fixture.ts @@ -0,0 +1 @@ +for (const x: string of []) {} diff --git a/packages/ast-spec/src/statement/ForOfStatement/fixtures/_error_/decl-type/snapshots/1-TSESTree-Error.shot b/packages/ast-spec/src/statement/ForOfStatement/fixtures/_error_/decl-type/snapshots/1-TSESTree-Error.shot new file mode 100644 index 000000000000..dacfca1a32e2 --- /dev/null +++ b/packages/ast-spec/src/statement/ForOfStatement/fixtures/_error_/decl-type/snapshots/1-TSESTree-Error.shot @@ -0,0 +1,8 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures statement ForOfStatement _error_ decl-type TSESTree - Error 1`] = ` +"TSError +> 1 | for (const x: string of []) {} + | ^^^^^^^^^ The variable declaration of a 'for...of' statement cannot have a type annotation. + 2 |" +`; diff --git a/packages/ast-spec/src/statement/ForOfStatement/fixtures/_error_/decl-type/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/statement/ForOfStatement/fixtures/_error_/decl-type/snapshots/2-Babel-Error.shot new file mode 100644 index 000000000000..d5c5bf024296 --- /dev/null +++ b/packages/ast-spec/src/statement/ForOfStatement/fixtures/_error_/decl-type/snapshots/2-Babel-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures statement ForOfStatement _error_ decl-type Babel - Error 1`] = `"NO ERROR"`; diff --git a/packages/ast-spec/src/statement/ForOfStatement/fixtures/_error_/decl-type/snapshots/3-Alignment-Error.shot b/packages/ast-spec/src/statement/ForOfStatement/fixtures/_error_/decl-type/snapshots/3-Alignment-Error.shot new file mode 100644 index 000000000000..145f2294c2e0 --- /dev/null +++ b/packages/ast-spec/src/statement/ForOfStatement/fixtures/_error_/decl-type/snapshots/3-Alignment-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures statement ForOfStatement _error_ decl-type Error Alignment 1`] = `"TSESTree errored but Babel didn't"`; diff --git a/packages/ast-spec/src/statement/ForOfStatement/fixtures/_error_/expr-not-assignment-target/fixture.ts b/packages/ast-spec/src/statement/ForOfStatement/fixtures/_error_/expr-not-assignment-target/fixture.ts new file mode 100644 index 000000000000..6729c4d9a319 --- /dev/null +++ b/packages/ast-spec/src/statement/ForOfStatement/fixtures/_error_/expr-not-assignment-target/fixture.ts @@ -0,0 +1 @@ +for (1 of []) {} diff --git a/packages/ast-spec/src/statement/ForOfStatement/fixtures/_error_/expr-not-assignment-target/snapshots/1-TSESTree-Error.shot b/packages/ast-spec/src/statement/ForOfStatement/fixtures/_error_/expr-not-assignment-target/snapshots/1-TSESTree-Error.shot new file mode 100644 index 000000000000..f4fa1d2a41fb --- /dev/null +++ b/packages/ast-spec/src/statement/ForOfStatement/fixtures/_error_/expr-not-assignment-target/snapshots/1-TSESTree-Error.shot @@ -0,0 +1,8 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures statement ForOfStatement _error_ expr-not-assignment-target TSESTree - Error 1`] = ` +"TSError +> 1 | for (1 of []) {} + | ^ The left-hand side of a 'for...of' statement must be a variable or a property access. + 2 |" +`; diff --git a/packages/ast-spec/src/statement/ForOfStatement/fixtures/_error_/expr-not-assignment-target/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/statement/ForOfStatement/fixtures/_error_/expr-not-assignment-target/snapshots/2-Babel-Error.shot new file mode 100644 index 000000000000..ba94e7475f39 --- /dev/null +++ b/packages/ast-spec/src/statement/ForOfStatement/fixtures/_error_/expr-not-assignment-target/snapshots/2-Babel-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures statement ForOfStatement _error_ expr-not-assignment-target Babel - Error 1`] = `[SyntaxError: Invalid left-hand side in for-of statement. (1:5)]`; diff --git a/packages/ast-spec/src/statement/ForOfStatement/fixtures/_error_/expr-not-assignment-target/snapshots/3-Alignment-Error.shot b/packages/ast-spec/src/statement/ForOfStatement/fixtures/_error_/expr-not-assignment-target/snapshots/3-Alignment-Error.shot new file mode 100644 index 000000000000..5d0ce6cff922 --- /dev/null +++ b/packages/ast-spec/src/statement/ForOfStatement/fixtures/_error_/expr-not-assignment-target/snapshots/3-Alignment-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures statement ForOfStatement _error_ expr-not-assignment-target Error Alignment 1`] = `"Both errored"`; diff --git a/packages/ast-spec/src/statement/ForOfStatement/fixtures/expr-init/fixture.ts b/packages/ast-spec/src/statement/ForOfStatement/fixtures/expr-init/fixture.ts new file mode 100644 index 000000000000..e8f83c49d579 --- /dev/null +++ b/packages/ast-spec/src/statement/ForOfStatement/fixtures/expr-init/fixture.ts @@ -0,0 +1,8 @@ +for ({ x, y } of []) { +} +for ([x, y] of []) { +} +for (x.y of []) { +} +for (x as T of []) { +} diff --git a/packages/ast-spec/src/statement/ForOfStatement/fixtures/expr-init/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/statement/ForOfStatement/fixtures/expr-init/snapshots/1-TSESTree-AST.shot new file mode 100644 index 000000000000..5d795bfa2d94 --- /dev/null +++ b/packages/ast-spec/src/statement/ForOfStatement/fixtures/expr-init/snapshots/1-TSESTree-AST.shot @@ -0,0 +1,339 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures statement ForOfStatement expr-init TSESTree - AST 1`] = ` +Program { + type: "Program", + body: [ + ForOfStatement { + type: "ForOfStatement", + await: false, + body: BlockStatement { + type: "BlockStatement", + body: [], + + range: [21, 23], + loc: { + start: { column: 21, line: 1 }, + end: { column: 23, line: 1 }, + }, + }, + left: ObjectPattern { + type: "ObjectPattern", + decorators: [], + optional: false, + properties: [ + Property { + type: "Property", + computed: false, + key: Identifier { + type: "Identifier", + decorators: [], + name: "x", + optional: false, + + range: [7, 8], + loc: { + start: { column: 7, line: 1 }, + end: { column: 8, line: 1 }, + }, + }, + kind: "init", + method: false, + optional: false, + shorthand: true, + value: Identifier { + type: "Identifier", + decorators: [], + name: "x", + optional: false, + + range: [7, 8], + loc: { + start: { column: 7, line: 1 }, + end: { column: 8, line: 1 }, + }, + }, + + range: [7, 8], + loc: { + start: { column: 7, line: 1 }, + end: { column: 8, line: 1 }, + }, + }, + Property { + type: "Property", + computed: false, + key: Identifier { + type: "Identifier", + decorators: [], + name: "y", + optional: false, + + range: [10, 11], + loc: { + start: { column: 10, line: 1 }, + end: { column: 11, line: 1 }, + }, + }, + kind: "init", + method: false, + optional: false, + shorthand: true, + value: Identifier { + type: "Identifier", + decorators: [], + name: "y", + optional: false, + + range: [10, 11], + loc: { + start: { column: 10, line: 1 }, + end: { column: 11, line: 1 }, + }, + }, + + range: [10, 11], + loc: { + start: { column: 10, line: 1 }, + end: { column: 11, line: 1 }, + }, + }, + ], + + range: [5, 13], + loc: { + start: { column: 5, line: 1 }, + end: { column: 13, line: 1 }, + }, + }, + right: ArrayExpression { + type: "ArrayExpression", + elements: [], + + range: [17, 19], + loc: { + start: { column: 17, line: 1 }, + end: { column: 19, line: 1 }, + }, + }, + + range: [0, 23], + loc: { + start: { column: 0, line: 1 }, + end: { column: 23, line: 1 }, + }, + }, + ForOfStatement { + type: "ForOfStatement", + await: false, + body: BlockStatement { + type: "BlockStatement", + body: [], + + range: [43, 45], + loc: { + start: { column: 19, line: 2 }, + end: { column: 21, line: 2 }, + }, + }, + left: ArrayPattern { + type: "ArrayPattern", + decorators: [], + elements: [ + Identifier { + type: "Identifier", + decorators: [], + name: "x", + optional: false, + + range: [30, 31], + loc: { + start: { column: 6, line: 2 }, + end: { column: 7, line: 2 }, + }, + }, + Identifier { + type: "Identifier", + decorators: [], + name: "y", + optional: false, + + range: [33, 34], + loc: { + start: { column: 9, line: 2 }, + end: { column: 10, line: 2 }, + }, + }, + ], + optional: false, + + range: [29, 35], + loc: { + start: { column: 5, line: 2 }, + end: { column: 11, line: 2 }, + }, + }, + right: ArrayExpression { + type: "ArrayExpression", + elements: [], + + range: [39, 41], + loc: { + start: { column: 15, line: 2 }, + end: { column: 17, line: 2 }, + }, + }, + + range: [24, 45], + loc: { + start: { column: 0, line: 2 }, + end: { column: 21, line: 2 }, + }, + }, + ForOfStatement { + type: "ForOfStatement", + await: false, + body: BlockStatement { + type: "BlockStatement", + body: [], + + range: [62, 64], + loc: { + start: { column: 16, line: 3 }, + end: { column: 18, line: 3 }, + }, + }, + left: MemberExpression { + type: "MemberExpression", + computed: false, + object: Identifier { + type: "Identifier", + decorators: [], + name: "x", + optional: false, + + range: [51, 52], + loc: { + start: { column: 5, line: 3 }, + end: { column: 6, line: 3 }, + }, + }, + optional: false, + property: Identifier { + type: "Identifier", + decorators: [], + name: "y", + optional: false, + + range: [53, 54], + loc: { + start: { column: 7, line: 3 }, + end: { column: 8, line: 3 }, + }, + }, + + range: [51, 54], + loc: { + start: { column: 5, line: 3 }, + end: { column: 8, line: 3 }, + }, + }, + right: ArrayExpression { + type: "ArrayExpression", + elements: [], + + range: [58, 60], + loc: { + start: { column: 12, line: 3 }, + end: { column: 14, line: 3 }, + }, + }, + + range: [46, 64], + loc: { + start: { column: 0, line: 3 }, + end: { column: 18, line: 3 }, + }, + }, + ForOfStatement { + type: "ForOfStatement", + await: false, + body: BlockStatement { + type: "BlockStatement", + body: [], + + range: [86, 88], + loc: { + start: { column: 21, line: 4 }, + end: { column: 23, line: 4 }, + }, + }, + left: TSAsExpression { + type: "TSAsExpression", + expression: Identifier { + type: "Identifier", + decorators: [], + name: "x", + optional: false, + + range: [71, 72], + loc: { + start: { column: 6, line: 4 }, + end: { column: 7, line: 4 }, + }, + }, + typeAnnotation: TSTypeReference { + type: "TSTypeReference", + typeName: Identifier { + type: "Identifier", + decorators: [], + name: "T", + optional: false, + + range: [76, 77], + loc: { + start: { column: 11, line: 4 }, + end: { column: 12, line: 4 }, + }, + }, + + range: [76, 77], + loc: { + start: { column: 11, line: 4 }, + end: { column: 12, line: 4 }, + }, + }, + + range: [71, 77], + loc: { + start: { column: 6, line: 4 }, + end: { column: 12, line: 4 }, + }, + }, + right: ArrayExpression { + type: "ArrayExpression", + elements: [], + + range: [82, 84], + loc: { + start: { column: 17, line: 4 }, + end: { column: 19, line: 4 }, + }, + }, + + range: [65, 88], + loc: { + start: { column: 0, line: 4 }, + end: { column: 23, line: 4 }, + }, + }, + ], + sourceType: "script", + + range: [0, 89], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 5 }, + }, +} +`; diff --git a/packages/ast-spec/src/statement/ForOfStatement/fixtures/expr-init/snapshots/2-TSESTree-Tokens.shot b/packages/ast-spec/src/statement/ForOfStatement/fixtures/expr-init/snapshots/2-TSESTree-Tokens.shot new file mode 100644 index 000000000000..7379cd5f70f1 --- /dev/null +++ b/packages/ast-spec/src/statement/ForOfStatement/fixtures/expr-init/snapshots/2-TSESTree-Tokens.shot @@ -0,0 +1,506 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures statement ForOfStatement expr-init TSESTree - Tokens 1`] = ` +[ + Keyword { + type: "Keyword", + value: "for", + + range: [0, 3], + loc: { + start: { column: 0, line: 1 }, + end: { column: 3, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "(", + + range: [4, 5], + loc: { + start: { column: 4, line: 1 }, + end: { column: 5, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "{", + + range: [5, 6], + loc: { + start: { column: 5, line: 1 }, + end: { column: 6, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "x", + + range: [7, 8], + loc: { + start: { column: 7, line: 1 }, + end: { column: 8, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ",", + + range: [8, 9], + loc: { + start: { column: 8, line: 1 }, + end: { column: 9, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "y", + + range: [10, 11], + loc: { + start: { column: 10, line: 1 }, + end: { column: 11, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "}", + + range: [12, 13], + loc: { + start: { column: 12, line: 1 }, + end: { column: 13, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "of", + + range: [14, 16], + loc: { + start: { column: 14, line: 1 }, + end: { column: 16, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "[", + + range: [17, 18], + loc: { + start: { column: 17, line: 1 }, + end: { column: 18, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "]", + + range: [18, 19], + loc: { + start: { column: 18, line: 1 }, + end: { column: 19, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ")", + + range: [19, 20], + loc: { + start: { column: 19, line: 1 }, + end: { column: 20, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "{", + + range: [21, 22], + loc: { + start: { column: 21, line: 1 }, + end: { column: 22, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "}", + + range: [22, 23], + loc: { + start: { column: 22, line: 1 }, + end: { column: 23, line: 1 }, + }, + }, + Keyword { + type: "Keyword", + value: "for", + + range: [24, 27], + loc: { + start: { column: 0, line: 2 }, + end: { column: 3, line: 2 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "(", + + range: [28, 29], + loc: { + start: { column: 4, line: 2 }, + end: { column: 5, line: 2 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "[", + + range: [29, 30], + loc: { + start: { column: 5, line: 2 }, + end: { column: 6, line: 2 }, + }, + }, + Identifier { + type: "Identifier", + value: "x", + + range: [30, 31], + loc: { + start: { column: 6, line: 2 }, + end: { column: 7, line: 2 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ",", + + range: [31, 32], + loc: { + start: { column: 7, line: 2 }, + end: { column: 8, line: 2 }, + }, + }, + Identifier { + type: "Identifier", + value: "y", + + range: [33, 34], + loc: { + start: { column: 9, line: 2 }, + end: { column: 10, line: 2 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "]", + + range: [34, 35], + loc: { + start: { column: 10, line: 2 }, + end: { column: 11, line: 2 }, + }, + }, + Identifier { + type: "Identifier", + value: "of", + + range: [36, 38], + loc: { + start: { column: 12, line: 2 }, + end: { column: 14, line: 2 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "[", + + range: [39, 40], + loc: { + start: { column: 15, line: 2 }, + end: { column: 16, line: 2 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "]", + + range: [40, 41], + loc: { + start: { column: 16, line: 2 }, + end: { column: 17, line: 2 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ")", + + range: [41, 42], + loc: { + start: { column: 17, line: 2 }, + end: { column: 18, line: 2 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "{", + + range: [43, 44], + loc: { + start: { column: 19, line: 2 }, + end: { column: 20, line: 2 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "}", + + range: [44, 45], + loc: { + start: { column: 20, line: 2 }, + end: { column: 21, line: 2 }, + }, + }, + Keyword { + type: "Keyword", + value: "for", + + range: [46, 49], + loc: { + start: { column: 0, line: 3 }, + end: { column: 3, line: 3 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "(", + + range: [50, 51], + loc: { + start: { column: 4, line: 3 }, + end: { column: 5, line: 3 }, + }, + }, + Identifier { + type: "Identifier", + value: "x", + + range: [51, 52], + loc: { + start: { column: 5, line: 3 }, + end: { column: 6, line: 3 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ".", + + range: [52, 53], + loc: { + start: { column: 6, line: 3 }, + end: { column: 7, line: 3 }, + }, + }, + Identifier { + type: "Identifier", + value: "y", + + range: [53, 54], + loc: { + start: { column: 7, line: 3 }, + end: { column: 8, line: 3 }, + }, + }, + Identifier { + type: "Identifier", + value: "of", + + range: [55, 57], + loc: { + start: { column: 9, line: 3 }, + end: { column: 11, line: 3 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "[", + + range: [58, 59], + loc: { + start: { column: 12, line: 3 }, + end: { column: 13, line: 3 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "]", + + range: [59, 60], + loc: { + start: { column: 13, line: 3 }, + end: { column: 14, line: 3 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ")", + + range: [60, 61], + loc: { + start: { column: 14, line: 3 }, + end: { column: 15, line: 3 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "{", + + range: [62, 63], + loc: { + start: { column: 16, line: 3 }, + end: { column: 17, line: 3 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "}", + + range: [63, 64], + loc: { + start: { column: 17, line: 3 }, + end: { column: 18, line: 3 }, + }, + }, + Keyword { + type: "Keyword", + value: "for", + + range: [65, 68], + loc: { + start: { column: 0, line: 4 }, + end: { column: 3, line: 4 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "(", + + range: [69, 70], + loc: { + start: { column: 4, line: 4 }, + end: { column: 5, line: 4 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "(", + + range: [70, 71], + loc: { + start: { column: 5, line: 4 }, + end: { column: 6, line: 4 }, + }, + }, + Identifier { + type: "Identifier", + value: "x", + + range: [71, 72], + loc: { + start: { column: 6, line: 4 }, + end: { column: 7, line: 4 }, + }, + }, + Identifier { + type: "Identifier", + value: "as", + + range: [73, 75], + loc: { + start: { column: 8, line: 4 }, + end: { column: 10, line: 4 }, + }, + }, + Identifier { + type: "Identifier", + value: "T", + + range: [76, 77], + loc: { + start: { column: 11, line: 4 }, + end: { column: 12, line: 4 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ")", + + range: [77, 78], + loc: { + start: { column: 12, line: 4 }, + end: { column: 13, line: 4 }, + }, + }, + Identifier { + type: "Identifier", + value: "of", + + range: [79, 81], + loc: { + start: { column: 14, line: 4 }, + end: { column: 16, line: 4 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "[", + + range: [82, 83], + loc: { + start: { column: 17, line: 4 }, + end: { column: 18, line: 4 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "]", + + range: [83, 84], + loc: { + start: { column: 18, line: 4 }, + end: { column: 19, line: 4 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ")", + + range: [84, 85], + loc: { + start: { column: 19, line: 4 }, + end: { column: 20, line: 4 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "{", + + range: [86, 87], + loc: { + start: { column: 21, line: 4 }, + end: { column: 22, line: 4 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "}", + + range: [87, 88], + loc: { + start: { column: 22, line: 4 }, + end: { column: 23, line: 4 }, + }, + }, +] +`; diff --git a/packages/ast-spec/src/statement/ForOfStatement/fixtures/expr-init/snapshots/3-Babel-AST.shot b/packages/ast-spec/src/statement/ForOfStatement/fixtures/expr-init/snapshots/3-Babel-AST.shot new file mode 100644 index 000000000000..68989eea7c41 --- /dev/null +++ b/packages/ast-spec/src/statement/ForOfStatement/fixtures/expr-init/snapshots/3-Babel-AST.shot @@ -0,0 +1,313 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures statement ForOfStatement expr-init Babel - AST 1`] = ` +Program { + type: "Program", + body: [ + ForOfStatement { + type: "ForOfStatement", + await: false, + body: BlockStatement { + type: "BlockStatement", + body: [], + + range: [21, 23], + loc: { + start: { column: 21, line: 1 }, + end: { column: 23, line: 1 }, + }, + }, + left: ObjectPattern { + type: "ObjectPattern", + properties: [ + Property { + type: "Property", + computed: false, + key: Identifier { + type: "Identifier", + name: "x", + + range: [7, 8], + loc: { + start: { column: 7, line: 1 }, + end: { column: 8, line: 1 }, + }, + }, + kind: "init", + method: false, + shorthand: true, + value: Identifier { + type: "Identifier", + name: "x", + + range: [7, 8], + loc: { + start: { column: 7, line: 1 }, + end: { column: 8, line: 1 }, + }, + }, + + range: [7, 8], + loc: { + start: { column: 7, line: 1 }, + end: { column: 8, line: 1 }, + }, + }, + Property { + type: "Property", + computed: false, + key: Identifier { + type: "Identifier", + name: "y", + + range: [10, 11], + loc: { + start: { column: 10, line: 1 }, + end: { column: 11, line: 1 }, + }, + }, + kind: "init", + method: false, + shorthand: true, + value: Identifier { + type: "Identifier", + name: "y", + + range: [10, 11], + loc: { + start: { column: 10, line: 1 }, + end: { column: 11, line: 1 }, + }, + }, + + range: [10, 11], + loc: { + start: { column: 10, line: 1 }, + end: { column: 11, line: 1 }, + }, + }, + ], + + range: [5, 13], + loc: { + start: { column: 5, line: 1 }, + end: { column: 13, line: 1 }, + }, + }, + right: ArrayExpression { + type: "ArrayExpression", + elements: [], + + range: [17, 19], + loc: { + start: { column: 17, line: 1 }, + end: { column: 19, line: 1 }, + }, + }, + + range: [0, 23], + loc: { + start: { column: 0, line: 1 }, + end: { column: 23, line: 1 }, + }, + }, + ForOfStatement { + type: "ForOfStatement", + await: false, + body: BlockStatement { + type: "BlockStatement", + body: [], + + range: [43, 45], + loc: { + start: { column: 19, line: 2 }, + end: { column: 21, line: 2 }, + }, + }, + left: ArrayPattern { + type: "ArrayPattern", + elements: [ + Identifier { + type: "Identifier", + name: "x", + + range: [30, 31], + loc: { + start: { column: 6, line: 2 }, + end: { column: 7, line: 2 }, + }, + }, + Identifier { + type: "Identifier", + name: "y", + + range: [33, 34], + loc: { + start: { column: 9, line: 2 }, + end: { column: 10, line: 2 }, + }, + }, + ], + + range: [29, 35], + loc: { + start: { column: 5, line: 2 }, + end: { column: 11, line: 2 }, + }, + }, + right: ArrayExpression { + type: "ArrayExpression", + elements: [], + + range: [39, 41], + loc: { + start: { column: 15, line: 2 }, + end: { column: 17, line: 2 }, + }, + }, + + range: [24, 45], + loc: { + start: { column: 0, line: 2 }, + end: { column: 21, line: 2 }, + }, + }, + ForOfStatement { + type: "ForOfStatement", + await: false, + body: BlockStatement { + type: "BlockStatement", + body: [], + + range: [62, 64], + loc: { + start: { column: 16, line: 3 }, + end: { column: 18, line: 3 }, + }, + }, + left: MemberExpression { + type: "MemberExpression", + computed: false, + object: Identifier { + type: "Identifier", + name: "x", + + range: [51, 52], + loc: { + start: { column: 5, line: 3 }, + end: { column: 6, line: 3 }, + }, + }, + optional: false, + property: Identifier { + type: "Identifier", + name: "y", + + range: [53, 54], + loc: { + start: { column: 7, line: 3 }, + end: { column: 8, line: 3 }, + }, + }, + + range: [51, 54], + loc: { + start: { column: 5, line: 3 }, + end: { column: 8, line: 3 }, + }, + }, + right: ArrayExpression { + type: "ArrayExpression", + elements: [], + + range: [58, 60], + loc: { + start: { column: 12, line: 3 }, + end: { column: 14, line: 3 }, + }, + }, + + range: [46, 64], + loc: { + start: { column: 0, line: 3 }, + end: { column: 18, line: 3 }, + }, + }, + ForOfStatement { + type: "ForOfStatement", + await: false, + body: BlockStatement { + type: "BlockStatement", + body: [], + + range: [86, 88], + loc: { + start: { column: 21, line: 4 }, + end: { column: 23, line: 4 }, + }, + }, + left: TSAsExpression { + type: "TSAsExpression", + expression: Identifier { + type: "Identifier", + name: "x", + + range: [71, 72], + loc: { + start: { column: 6, line: 4 }, + end: { column: 7, line: 4 }, + }, + }, + typeAnnotation: TSTypeReference { + type: "TSTypeReference", + typeName: Identifier { + type: "Identifier", + name: "T", + + range: [76, 77], + loc: { + start: { column: 11, line: 4 }, + end: { column: 12, line: 4 }, + }, + }, + + range: [76, 77], + loc: { + start: { column: 11, line: 4 }, + end: { column: 12, line: 4 }, + }, + }, + + range: [71, 77], + loc: { + start: { column: 6, line: 4 }, + end: { column: 12, line: 4 }, + }, + }, + right: ArrayExpression { + type: "ArrayExpression", + elements: [], + + range: [82, 84], + loc: { + start: { column: 17, line: 4 }, + end: { column: 19, line: 4 }, + }, + }, + + range: [65, 88], + loc: { + start: { column: 0, line: 4 }, + end: { column: 23, line: 4 }, + }, + }, + ], + sourceType: "script", + + range: [0, 89], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 5 }, + }, +} +`; diff --git a/packages/ast-spec/src/statement/ForOfStatement/fixtures/expr-init/snapshots/4-Babel-Tokens.shot b/packages/ast-spec/src/statement/ForOfStatement/fixtures/expr-init/snapshots/4-Babel-Tokens.shot new file mode 100644 index 000000000000..deed95a03887 --- /dev/null +++ b/packages/ast-spec/src/statement/ForOfStatement/fixtures/expr-init/snapshots/4-Babel-Tokens.shot @@ -0,0 +1,506 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures statement ForOfStatement expr-init Babel - Tokens 1`] = ` +[ + Keyword { + type: "Keyword", + value: "for", + + range: [0, 3], + loc: { + start: { column: 0, line: 1 }, + end: { column: 3, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "(", + + range: [4, 5], + loc: { + start: { column: 4, line: 1 }, + end: { column: 5, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "{", + + range: [5, 6], + loc: { + start: { column: 5, line: 1 }, + end: { column: 6, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "x", + + range: [7, 8], + loc: { + start: { column: 7, line: 1 }, + end: { column: 8, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ",", + + range: [8, 9], + loc: { + start: { column: 8, line: 1 }, + end: { column: 9, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "y", + + range: [10, 11], + loc: { + start: { column: 10, line: 1 }, + end: { column: 11, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "}", + + range: [12, 13], + loc: { + start: { column: 12, line: 1 }, + end: { column: 13, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "of", + + range: [14, 16], + loc: { + start: { column: 14, line: 1 }, + end: { column: 16, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "[", + + range: [17, 18], + loc: { + start: { column: 17, line: 1 }, + end: { column: 18, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "]", + + range: [18, 19], + loc: { + start: { column: 18, line: 1 }, + end: { column: 19, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ")", + + range: [19, 20], + loc: { + start: { column: 19, line: 1 }, + end: { column: 20, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "{", + + range: [21, 22], + loc: { + start: { column: 21, line: 1 }, + end: { column: 22, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "}", + + range: [22, 23], + loc: { + start: { column: 22, line: 1 }, + end: { column: 23, line: 1 }, + }, + }, + Keyword { + type: "Keyword", + value: "for", + + range: [24, 27], + loc: { + start: { column: 0, line: 2 }, + end: { column: 3, line: 2 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "(", + + range: [28, 29], + loc: { + start: { column: 4, line: 2 }, + end: { column: 5, line: 2 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "[", + + range: [29, 30], + loc: { + start: { column: 5, line: 2 }, + end: { column: 6, line: 2 }, + }, + }, + Identifier { + type: "Identifier", + value: "x", + + range: [30, 31], + loc: { + start: { column: 6, line: 2 }, + end: { column: 7, line: 2 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ",", + + range: [31, 32], + loc: { + start: { column: 7, line: 2 }, + end: { column: 8, line: 2 }, + }, + }, + Identifier { + type: "Identifier", + value: "y", + + range: [33, 34], + loc: { + start: { column: 9, line: 2 }, + end: { column: 10, line: 2 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "]", + + range: [34, 35], + loc: { + start: { column: 10, line: 2 }, + end: { column: 11, line: 2 }, + }, + }, + Identifier { + type: "Identifier", + value: "of", + + range: [36, 38], + loc: { + start: { column: 12, line: 2 }, + end: { column: 14, line: 2 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "[", + + range: [39, 40], + loc: { + start: { column: 15, line: 2 }, + end: { column: 16, line: 2 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "]", + + range: [40, 41], + loc: { + start: { column: 16, line: 2 }, + end: { column: 17, line: 2 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ")", + + range: [41, 42], + loc: { + start: { column: 17, line: 2 }, + end: { column: 18, line: 2 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "{", + + range: [43, 44], + loc: { + start: { column: 19, line: 2 }, + end: { column: 20, line: 2 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "}", + + range: [44, 45], + loc: { + start: { column: 20, line: 2 }, + end: { column: 21, line: 2 }, + }, + }, + Keyword { + type: "Keyword", + value: "for", + + range: [46, 49], + loc: { + start: { column: 0, line: 3 }, + end: { column: 3, line: 3 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "(", + + range: [50, 51], + loc: { + start: { column: 4, line: 3 }, + end: { column: 5, line: 3 }, + }, + }, + Identifier { + type: "Identifier", + value: "x", + + range: [51, 52], + loc: { + start: { column: 5, line: 3 }, + end: { column: 6, line: 3 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ".", + + range: [52, 53], + loc: { + start: { column: 6, line: 3 }, + end: { column: 7, line: 3 }, + }, + }, + Identifier { + type: "Identifier", + value: "y", + + range: [53, 54], + loc: { + start: { column: 7, line: 3 }, + end: { column: 8, line: 3 }, + }, + }, + Identifier { + type: "Identifier", + value: "of", + + range: [55, 57], + loc: { + start: { column: 9, line: 3 }, + end: { column: 11, line: 3 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "[", + + range: [58, 59], + loc: { + start: { column: 12, line: 3 }, + end: { column: 13, line: 3 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "]", + + range: [59, 60], + loc: { + start: { column: 13, line: 3 }, + end: { column: 14, line: 3 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ")", + + range: [60, 61], + loc: { + start: { column: 14, line: 3 }, + end: { column: 15, line: 3 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "{", + + range: [62, 63], + loc: { + start: { column: 16, line: 3 }, + end: { column: 17, line: 3 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "}", + + range: [63, 64], + loc: { + start: { column: 17, line: 3 }, + end: { column: 18, line: 3 }, + }, + }, + Keyword { + type: "Keyword", + value: "for", + + range: [65, 68], + loc: { + start: { column: 0, line: 4 }, + end: { column: 3, line: 4 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "(", + + range: [69, 70], + loc: { + start: { column: 4, line: 4 }, + end: { column: 5, line: 4 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "(", + + range: [70, 71], + loc: { + start: { column: 5, line: 4 }, + end: { column: 6, line: 4 }, + }, + }, + Identifier { + type: "Identifier", + value: "x", + + range: [71, 72], + loc: { + start: { column: 6, line: 4 }, + end: { column: 7, line: 4 }, + }, + }, + Identifier { + type: "Identifier", + value: "as", + + range: [73, 75], + loc: { + start: { column: 8, line: 4 }, + end: { column: 10, line: 4 }, + }, + }, + Identifier { + type: "Identifier", + value: "T", + + range: [76, 77], + loc: { + start: { column: 11, line: 4 }, + end: { column: 12, line: 4 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ")", + + range: [77, 78], + loc: { + start: { column: 12, line: 4 }, + end: { column: 13, line: 4 }, + }, + }, + Identifier { + type: "Identifier", + value: "of", + + range: [79, 81], + loc: { + start: { column: 14, line: 4 }, + end: { column: 16, line: 4 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "[", + + range: [82, 83], + loc: { + start: { column: 17, line: 4 }, + end: { column: 18, line: 4 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "]", + + range: [83, 84], + loc: { + start: { column: 18, line: 4 }, + end: { column: 19, line: 4 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ")", + + range: [84, 85], + loc: { + start: { column: 19, line: 4 }, + end: { column: 20, line: 4 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "{", + + range: [86, 87], + loc: { + start: { column: 21, line: 4 }, + end: { column: 22, line: 4 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "}", + + range: [87, 88], + loc: { + start: { column: 22, line: 4 }, + end: { column: 23, line: 4 }, + }, + }, +] +`; diff --git a/packages/ast-spec/src/statement/ForOfStatement/fixtures/expr-init/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/statement/ForOfStatement/fixtures/expr-init/snapshots/5-AST-Alignment-AST.shot new file mode 100644 index 000000000000..f0c5bd6aef5e --- /dev/null +++ b/packages/ast-spec/src/statement/ForOfStatement/fixtures/expr-init/snapshots/5-AST-Alignment-AST.shot @@ -0,0 +1,343 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures statement ForOfStatement expr-init AST Alignment - AST 1`] = ` +"Snapshot Diff: +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + ForOfStatement { + type: 'ForOfStatement', + await: false, + body: BlockStatement { + type: 'BlockStatement', + body: Array [], + + range: [21, 23], + loc: { + start: { column: 21, line: 1 }, + end: { column: 23, line: 1 }, + }, + }, + left: ObjectPattern { + type: 'ObjectPattern', +- decorators: Array [], +- optional: false, + properties: Array [ + Property { + type: 'Property', + computed: false, + key: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'x', +- optional: false, + + range: [7, 8], + loc: { + start: { column: 7, line: 1 }, + end: { column: 8, line: 1 }, + }, + }, + kind: 'init', + method: false, +- optional: false, + shorthand: true, + value: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'x', +- optional: false, + + range: [7, 8], + loc: { + start: { column: 7, line: 1 }, + end: { column: 8, line: 1 }, + }, + }, + + range: [7, 8], + loc: { + start: { column: 7, line: 1 }, + end: { column: 8, line: 1 }, + }, + }, + Property { + type: 'Property', + computed: false, + key: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'y', +- optional: false, + + range: [10, 11], + loc: { + start: { column: 10, line: 1 }, + end: { column: 11, line: 1 }, + }, + }, + kind: 'init', + method: false, +- optional: false, + shorthand: true, + value: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'y', +- optional: false, + + range: [10, 11], + loc: { + start: { column: 10, line: 1 }, + end: { column: 11, line: 1 }, + }, + }, + + range: [10, 11], + loc: { + start: { column: 10, line: 1 }, + end: { column: 11, line: 1 }, + }, + }, + ], + + range: [5, 13], + loc: { + start: { column: 5, line: 1 }, + end: { column: 13, line: 1 }, + }, + }, + right: ArrayExpression { + type: 'ArrayExpression', + elements: Array [], + + range: [17, 19], + loc: { + start: { column: 17, line: 1 }, + end: { column: 19, line: 1 }, + }, + }, + + range: [0, 23], + loc: { + start: { column: 0, line: 1 }, + end: { column: 23, line: 1 }, + }, + }, + ForOfStatement { + type: 'ForOfStatement', + await: false, + body: BlockStatement { + type: 'BlockStatement', + body: Array [], + + range: [43, 45], + loc: { + start: { column: 19, line: 2 }, + end: { column: 21, line: 2 }, + }, + }, + left: ArrayPattern { + type: 'ArrayPattern', +- decorators: Array [], + elements: Array [ + Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'x', +- optional: false, + + range: [30, 31], + loc: { + start: { column: 6, line: 2 }, + end: { column: 7, line: 2 }, + }, + }, + Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'y', +- optional: false, + + range: [33, 34], + loc: { + start: { column: 9, line: 2 }, + end: { column: 10, line: 2 }, + }, + }, + ], +- optional: false, + + range: [29, 35], + loc: { + start: { column: 5, line: 2 }, + end: { column: 11, line: 2 }, + }, + }, + right: ArrayExpression { + type: 'ArrayExpression', + elements: Array [], + + range: [39, 41], + loc: { + start: { column: 15, line: 2 }, + end: { column: 17, line: 2 }, + }, + }, + + range: [24, 45], + loc: { + start: { column: 0, line: 2 }, + end: { column: 21, line: 2 }, + }, + }, + ForOfStatement { + type: 'ForOfStatement', + await: false, + body: BlockStatement { + type: 'BlockStatement', + body: Array [], + + range: [62, 64], + loc: { + start: { column: 16, line: 3 }, + end: { column: 18, line: 3 }, + }, + }, + left: MemberExpression { + type: 'MemberExpression', + computed: false, + object: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'x', +- optional: false, + + range: [51, 52], + loc: { + start: { column: 5, line: 3 }, + end: { column: 6, line: 3 }, + }, + }, + optional: false, + property: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'y', +- optional: false, + + range: [53, 54], + loc: { + start: { column: 7, line: 3 }, + end: { column: 8, line: 3 }, + }, + }, + + range: [51, 54], + loc: { + start: { column: 5, line: 3 }, + end: { column: 8, line: 3 }, + }, + }, + right: ArrayExpression { + type: 'ArrayExpression', + elements: Array [], + + range: [58, 60], + loc: { + start: { column: 12, line: 3 }, + end: { column: 14, line: 3 }, + }, + }, + + range: [46, 64], + loc: { + start: { column: 0, line: 3 }, + end: { column: 18, line: 3 }, + }, + }, + ForOfStatement { + type: 'ForOfStatement', + await: false, + body: BlockStatement { + type: 'BlockStatement', + body: Array [], + + range: [86, 88], + loc: { + start: { column: 21, line: 4 }, + end: { column: 23, line: 4 }, + }, + }, + left: TSAsExpression { + type: 'TSAsExpression', + expression: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'x', +- optional: false, + + range: [71, 72], + loc: { + start: { column: 6, line: 4 }, + end: { column: 7, line: 4 }, + }, + }, + typeAnnotation: TSTypeReference { + type: 'TSTypeReference', + typeName: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'T', +- optional: false, + + range: [76, 77], + loc: { + start: { column: 11, line: 4 }, + end: { column: 12, line: 4 }, + }, + }, + + range: [76, 77], + loc: { + start: { column: 11, line: 4 }, + end: { column: 12, line: 4 }, + }, + }, + + range: [71, 77], + loc: { + start: { column: 6, line: 4 }, + end: { column: 12, line: 4 }, + }, + }, + right: ArrayExpression { + type: 'ArrayExpression', + elements: Array [], + + range: [82, 84], + loc: { + start: { column: 17, line: 4 }, + end: { column: 19, line: 4 }, + }, + }, + + range: [65, 88], + loc: { + start: { column: 0, line: 4 }, + end: { column: 23, line: 4 }, + }, + }, + ], + sourceType: 'script', + + range: [0, 89], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 5 }, + }, + }" +`; diff --git a/packages/ast-spec/src/statement/ForOfStatement/fixtures/expr-init/snapshots/6-AST-Alignment-Tokens.shot b/packages/ast-spec/src/statement/ForOfStatement/fixtures/expr-init/snapshots/6-AST-Alignment-Tokens.shot new file mode 100644 index 000000000000..c1f72f87510f --- /dev/null +++ b/packages/ast-spec/src/statement/ForOfStatement/fixtures/expr-init/snapshots/6-AST-Alignment-Tokens.shot @@ -0,0 +1,6 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures statement ForOfStatement expr-init AST Alignment - Token 1`] = ` +"Snapshot Diff: +Compared values have no visual difference." +`; diff --git a/packages/ast-spec/src/statement/ForOfStatement/fixtures/using-declaration/fixture.ts b/packages/ast-spec/src/statement/ForOfStatement/fixtures/using-declaration/fixture.ts new file mode 100644 index 000000000000..c426d1c579a1 --- /dev/null +++ b/packages/ast-spec/src/statement/ForOfStatement/fixtures/using-declaration/fixture.ts @@ -0,0 +1,2 @@ +for (await using a of b) { +} diff --git a/packages/ast-spec/src/statement/ForOfStatement/fixtures/using-decralation/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/statement/ForOfStatement/fixtures/using-declaration/snapshots/1-TSESTree-AST.shot similarity index 96% rename from packages/ast-spec/src/statement/ForOfStatement/fixtures/using-decralation/snapshots/1-TSESTree-AST.shot rename to packages/ast-spec/src/statement/ForOfStatement/fixtures/using-declaration/snapshots/1-TSESTree-AST.shot index 977879fa9d10..0350eacaa598 100644 --- a/packages/ast-spec/src/statement/ForOfStatement/fixtures/using-decralation/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/statement/ForOfStatement/fixtures/using-declaration/snapshots/1-TSESTree-AST.shot @@ -1,6 +1,6 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`AST Fixtures statement ForOfStatement using-decralation TSESTree - AST 1`] = ` +exports[`AST Fixtures statement ForOfStatement using-declaration TSESTree - AST 1`] = ` Program { type: "Program", body: [ diff --git a/packages/ast-spec/src/statement/ForOfStatement/fixtures/using-decralation/snapshots/2-TSESTree-Tokens.shot b/packages/ast-spec/src/statement/ForOfStatement/fixtures/using-declaration/snapshots/2-TSESTree-Tokens.shot similarity index 96% rename from packages/ast-spec/src/statement/ForOfStatement/fixtures/using-decralation/snapshots/2-TSESTree-Tokens.shot rename to packages/ast-spec/src/statement/ForOfStatement/fixtures/using-declaration/snapshots/2-TSESTree-Tokens.shot index bee539e6a68c..9a3f59d0078d 100644 --- a/packages/ast-spec/src/statement/ForOfStatement/fixtures/using-decralation/snapshots/2-TSESTree-Tokens.shot +++ b/packages/ast-spec/src/statement/ForOfStatement/fixtures/using-declaration/snapshots/2-TSESTree-Tokens.shot @@ -1,6 +1,6 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`AST Fixtures statement ForOfStatement using-decralation TSESTree - Tokens 1`] = ` +exports[`AST Fixtures statement ForOfStatement using-declaration TSESTree - Tokens 1`] = ` [ Keyword { type: "Keyword", diff --git a/packages/ast-spec/src/statement/ForOfStatement/fixtures/using-decralation/snapshots/3-Babel-AST.shot b/packages/ast-spec/src/statement/ForOfStatement/fixtures/using-declaration/snapshots/3-Babel-AST.shot similarity index 96% rename from packages/ast-spec/src/statement/ForOfStatement/fixtures/using-decralation/snapshots/3-Babel-AST.shot rename to packages/ast-spec/src/statement/ForOfStatement/fixtures/using-declaration/snapshots/3-Babel-AST.shot index 59be4b7440ab..477f5f417b07 100644 --- a/packages/ast-spec/src/statement/ForOfStatement/fixtures/using-decralation/snapshots/3-Babel-AST.shot +++ b/packages/ast-spec/src/statement/ForOfStatement/fixtures/using-declaration/snapshots/3-Babel-AST.shot @@ -1,6 +1,6 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`AST Fixtures statement ForOfStatement using-decralation Babel - AST 1`] = ` +exports[`AST Fixtures statement ForOfStatement using-declaration Babel - AST 1`] = ` Program { type: "Program", body: [ diff --git a/packages/ast-spec/src/statement/ForOfStatement/fixtures/using-decralation/snapshots/4-Babel-Tokens.shot b/packages/ast-spec/src/statement/ForOfStatement/fixtures/using-declaration/snapshots/4-Babel-Tokens.shot similarity index 96% rename from packages/ast-spec/src/statement/ForOfStatement/fixtures/using-decralation/snapshots/4-Babel-Tokens.shot rename to packages/ast-spec/src/statement/ForOfStatement/fixtures/using-declaration/snapshots/4-Babel-Tokens.shot index 70b06aff6fb2..fd3d844dfc39 100644 --- a/packages/ast-spec/src/statement/ForOfStatement/fixtures/using-decralation/snapshots/4-Babel-Tokens.shot +++ b/packages/ast-spec/src/statement/ForOfStatement/fixtures/using-declaration/snapshots/4-Babel-Tokens.shot @@ -1,6 +1,6 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`AST Fixtures statement ForOfStatement using-decralation Babel - Tokens 1`] = ` +exports[`AST Fixtures statement ForOfStatement using-declaration Babel - Tokens 1`] = ` [ Keyword { type: "Keyword", diff --git a/packages/ast-spec/src/statement/ForOfStatement/fixtures/using-decralation/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/statement/ForOfStatement/fixtures/using-declaration/snapshots/5-AST-Alignment-AST.shot similarity index 96% rename from packages/ast-spec/src/statement/ForOfStatement/fixtures/using-decralation/snapshots/5-AST-Alignment-AST.shot rename to packages/ast-spec/src/statement/ForOfStatement/fixtures/using-declaration/snapshots/5-AST-Alignment-AST.shot index 7a0a435dcec7..197c4c56bbe4 100644 --- a/packages/ast-spec/src/statement/ForOfStatement/fixtures/using-decralation/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/statement/ForOfStatement/fixtures/using-declaration/snapshots/5-AST-Alignment-AST.shot @@ -1,6 +1,6 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`AST Fixtures statement ForOfStatement using-decralation AST Alignment - AST 1`] = ` +exports[`AST Fixtures statement ForOfStatement using-declaration AST Alignment - AST 1`] = ` "Snapshot Diff: - TSESTree + Babel diff --git a/packages/ast-spec/src/statement/ForOfStatement/fixtures/using-decralation/snapshots/6-AST-Alignment-Tokens.shot b/packages/ast-spec/src/statement/ForOfStatement/fixtures/using-declaration/snapshots/6-AST-Alignment-Tokens.shot similarity index 68% rename from packages/ast-spec/src/statement/ForOfStatement/fixtures/using-decralation/snapshots/6-AST-Alignment-Tokens.shot rename to packages/ast-spec/src/statement/ForOfStatement/fixtures/using-declaration/snapshots/6-AST-Alignment-Tokens.shot index dade88548450..7b8de17cb66b 100644 --- a/packages/ast-spec/src/statement/ForOfStatement/fixtures/using-decralation/snapshots/6-AST-Alignment-Tokens.shot +++ b/packages/ast-spec/src/statement/ForOfStatement/fixtures/using-declaration/snapshots/6-AST-Alignment-Tokens.shot @@ -1,6 +1,6 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`AST Fixtures statement ForOfStatement using-decralation AST Alignment - Token 1`] = ` +exports[`AST Fixtures statement ForOfStatement using-declaration AST Alignment - Token 1`] = ` "Snapshot Diff: Compared values have no visual difference." `; diff --git a/packages/ast-spec/src/statement/ForOfStatement/fixtures/using-decralation/fixture.ts b/packages/ast-spec/src/statement/ForOfStatement/fixtures/using-decralation/fixture.ts deleted file mode 100644 index 8ad968c27b69..000000000000 --- a/packages/ast-spec/src/statement/ForOfStatement/fixtures/using-decralation/fixture.ts +++ /dev/null @@ -1 +0,0 @@ -for (await using a of b) {} diff --git a/packages/ast-spec/tests/fixtures-with-differences-ast.shot b/packages/ast-spec/tests/fixtures-with-differences-ast.shot index 9e862ac31cd9..8e4985e06ca1 100644 --- a/packages/ast-spec/tests/fixtures-with-differences-ast.shot +++ b/packages/ast-spec/tests/fixtures-with-differences-ast.shot @@ -503,6 +503,8 @@ exports[`AST Fixtures List fixtures with AST differences 1`] = ` "special/TSTypeParameter/fixtures/interface-const-modifier/fixture.ts", "special/TSTypeParameter/fixtures/interface-in-const-modifier-multiple/fixture.ts", "special/TSTypeParameter/fixtures/method-const-modifiers/fixture.ts", - "statement/ForOfStatement/fixtures/using-decralation/fixture.ts", + "statement/ForInStatement/fixtures/expr-init/fixture.ts", + "statement/ForOfStatement/fixtures/expr-init/fixture.ts", + "statement/ForOfStatement/fixtures/using-declaration/fixture.ts", ] `; diff --git a/packages/ast-spec/tests/fixtures-with-differences-errors.shot b/packages/ast-spec/tests/fixtures-with-differences-errors.shot index 17412356fa60..c72ecb6cd1aa 100644 --- a/packages/ast-spec/tests/fixtures-with-differences-errors.shot +++ b/packages/ast-spec/tests/fixtures-with-differences-errors.shot @@ -76,6 +76,8 @@ exports[`AST Fixtures List fixtures with Error differences 1`] = ` "element/AccessorProperty/fixtures/_error_/modifier-abstract-accessor-with-value/fixture.ts", "legacy-fixtures/basics/fixtures/_error_/abstract-class-with-abstract-constructor/fixture.ts", "legacy-fixtures/expressions/fixtures/_error_/instantiation-expression/fixture.ts", + "statement/ForOfStatement/fixtures/_error_/decl-definite/fixture.ts", + "statement/ForOfStatement/fixtures/_error_/decl-type/fixture.ts", ], } `; diff --git a/packages/typescript-estree/src/convert.ts b/packages/typescript-estree/src/convert.ts index 7c4783407699..538966f828c0 100644 --- a/packages/typescript-estree/src/convert.ts +++ b/packages/typescript-estree/src/convert.ts @@ -939,7 +939,7 @@ export class Converter { }); case SyntaxKind.ForInStatement: - this.#checkForStatementDeclaration(node.initializer); + this.#checkForStatementDeclaration(node.initializer, node.kind); return this.createNode(node, { type: AST_NODE_TYPES.ForInStatement, left: this.convertPattern(node.initializer), @@ -947,7 +947,8 @@ export class Converter { body: this.convertChild(node.statement), }); - case SyntaxKind.ForOfStatement: + case SyntaxKind.ForOfStatement: { + this.#checkForStatementDeclaration(node.initializer, node.kind); return this.createNode(node, { type: AST_NODE_TYPES.ForOfStatement, left: this.convertPattern(node.initializer), @@ -958,6 +959,7 @@ export class Converter { node.awaitModifier.kind === SyntaxKind.AwaitKeyword, ), }); + } // Declarations @@ -3584,14 +3586,49 @@ export class Converter { throw createError(message, this.ast, start, end); } - #checkForStatementDeclaration(initializer: ts.ForInitializer): void { + #checkForStatementDeclaration( + initializer: ts.ForInitializer, + kind: ts.SyntaxKind.ForInStatement | ts.SyntaxKind.ForOfStatement, + ): void { + const loop = + kind === ts.SyntaxKind.ForInStatement ? 'for...in' : 'for...of'; if (ts.isVariableDeclarationList(initializer)) { - if ((initializer.flags & ts.NodeFlags.Using) !== 0) { + if (initializer.declarations.length !== 1) { + this.#throwError( + initializer, + `Only a single variable declaration is allowed in a '${loop}' statement.`, + ); + } + const declaration = initializer.declarations[0]; + if (declaration.initializer) { + this.#throwError( + declaration, + `The variable declaration of a '${loop}' statement cannot have an initializer.`, + ); + } else if (declaration.type) { + this.#throwError( + declaration, + `The variable declaration of a '${loop}' statement cannot have a type annotation.`, + ); + } + if ( + kind === ts.SyntaxKind.ForInStatement && + initializer.flags & ts.NodeFlags.Using + ) { this.#throwError( initializer, "The left-hand side of a 'for...in' statement cannot be a 'using' declaration.", ); } + } else if ( + !isValidAssignmentTarget(initializer) && + initializer.kind !== ts.SyntaxKind.ObjectLiteralExpression && + initializer.kind !== ts.SyntaxKind.ArrayLiteralExpression + ) { + this.#throwError( + initializer, + `The left-hand side of a '${loop}' statement must be a variable or a property access.`, + ); } } } diff --git a/packages/typescript-estree/src/node-utils.ts b/packages/typescript-estree/src/node-utils.ts index 5dc42f06dbb1..94765b1368cb 100644 --- a/packages/typescript-estree/src/node-utils.ts +++ b/packages/typescript-estree/src/node-utils.ts @@ -937,6 +937,7 @@ export function isValidAssignmentTarget(node: ts.Node): boolean { case SyntaxKind.TypeAssertionExpression: case SyntaxKind.AsExpression: case SyntaxKind.SatisfiesExpression: + case SyntaxKind.ExpressionWithTypeArguments: case SyntaxKind.NonNullExpression: return isValidAssignmentTarget( ( @@ -944,6 +945,7 @@ export function isValidAssignmentTarget(node: ts.Node): boolean { | ts.ParenthesizedExpression | ts.AssertionExpression | ts.SatisfiesExpression + | ts.ExpressionWithTypeArguments | ts.NonNullExpression ).expression, ); From eec9d960e6d310106e8e2f39d955dd557ba3b261 Mon Sep 17 00:00:00 2001 From: Joshua Chen Date: Tue, 4 Jun 2024 18:45:20 +0800 Subject: [PATCH 5/8] Fix snapshots --- .../expr-init/snapshots/1-TSESTree-AST.shot | 126 +++++----- .../snapshots/2-TSESTree-Tokens.shot | 236 ++++++++---------- .../expr-init/snapshots/3-Babel-AST.shot | 126 +++++----- .../expr-init/snapshots/4-Babel-Tokens.shot | 236 ++++++++---------- .../snapshots/5-AST-Alignment-AST.shot | 126 +++++----- .../expr-init/snapshots/1-TSESTree-AST.shot | 126 +++++----- .../snapshots/2-TSESTree-Tokens.shot | 236 ++++++++---------- .../expr-init/snapshots/3-Babel-AST.shot | 126 +++++----- .../expr-init/snapshots/4-Babel-Tokens.shot | 236 ++++++++---------- .../snapshots/5-AST-Alignment-AST.shot | 126 +++++----- .../snapshots/1-TSESTree-AST.shot | 12 +- .../snapshots/2-TSESTree-Tokens.shot | 6 +- .../snapshots/3-Babel-AST.shot | 12 +- .../snapshots/4-Babel-Tokens.shot | 6 +- .../snapshots/5-AST-Alignment-AST.shot | 12 +- 15 files changed, 834 insertions(+), 914 deletions(-) diff --git a/packages/ast-spec/src/statement/ForInStatement/fixtures/expr-init/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/statement/ForInStatement/fixtures/expr-init/snapshots/1-TSESTree-AST.shot index c1a465d714bc..4a605a03c84f 100644 --- a/packages/ast-spec/src/statement/ForInStatement/fixtures/expr-init/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/statement/ForInStatement/fixtures/expr-init/snapshots/1-TSESTree-AST.shot @@ -10,10 +10,10 @@ Program { type: "BlockStatement", body: [], - range: [150, 152], + range: [150, 153], loc: { start: { column: 21, line: 3 }, - end: { column: 23, line: 3 }, + end: { column: 1, line: 4 }, }, }, left: ObjectPattern { @@ -116,10 +116,10 @@ Program { }, }, - range: [129, 152], + range: [129, 153], loc: { start: { column: 0, line: 3 }, - end: { column: 23, line: 3 }, + end: { column: 1, line: 4 }, }, }, ForInStatement { @@ -128,10 +128,10 @@ Program { type: "BlockStatement", body: [], - range: [172, 174], + range: [173, 176], loc: { - start: { column: 19, line: 4 }, - end: { column: 21, line: 4 }, + start: { column: 19, line: 5 }, + end: { column: 1, line: 6 }, }, }, left: ArrayPattern { @@ -144,10 +144,10 @@ Program { name: "x", optional: false, - range: [159, 160], + range: [160, 161], loc: { - start: { column: 6, line: 4 }, - end: { column: 7, line: 4 }, + start: { column: 6, line: 5 }, + end: { column: 7, line: 5 }, }, }, Identifier { @@ -156,36 +156,36 @@ Program { name: "y", optional: false, - range: [162, 163], + range: [163, 164], loc: { - start: { column: 9, line: 4 }, - end: { column: 10, line: 4 }, + start: { column: 9, line: 5 }, + end: { column: 10, line: 5 }, }, }, ], optional: false, - range: [158, 164], + range: [159, 165], loc: { - start: { column: 5, line: 4 }, - end: { column: 11, line: 4 }, + start: { column: 5, line: 5 }, + end: { column: 11, line: 5 }, }, }, right: ArrayExpression { type: "ArrayExpression", elements: [], - range: [168, 170], + range: [169, 171], loc: { - start: { column: 15, line: 4 }, - end: { column: 17, line: 4 }, + start: { column: 15, line: 5 }, + end: { column: 17, line: 5 }, }, }, - range: [153, 174], + range: [154, 176], loc: { - start: { column: 0, line: 4 }, - end: { column: 21, line: 4 }, + start: { column: 0, line: 5 }, + end: { column: 1, line: 6 }, }, }, ForInStatement { @@ -194,10 +194,10 @@ Program { type: "BlockStatement", body: [], - range: [191, 193], + range: [193, 196], loc: { - start: { column: 16, line: 5 }, - end: { column: 18, line: 5 }, + start: { column: 16, line: 7 }, + end: { column: 1, line: 8 }, }, }, left: MemberExpression { @@ -209,10 +209,10 @@ Program { name: "x", optional: false, - range: [180, 181], + range: [182, 183], loc: { - start: { column: 5, line: 5 }, - end: { column: 6, line: 5 }, + start: { column: 5, line: 7 }, + end: { column: 6, line: 7 }, }, }, optional: false, @@ -222,34 +222,34 @@ Program { name: "y", optional: false, - range: [182, 183], + range: [184, 185], loc: { - start: { column: 7, line: 5 }, - end: { column: 8, line: 5 }, + start: { column: 7, line: 7 }, + end: { column: 8, line: 7 }, }, }, - range: [180, 183], + range: [182, 185], loc: { - start: { column: 5, line: 5 }, - end: { column: 8, line: 5 }, + start: { column: 5, line: 7 }, + end: { column: 8, line: 7 }, }, }, right: ArrayExpression { type: "ArrayExpression", elements: [], - range: [187, 189], + range: [189, 191], loc: { - start: { column: 12, line: 5 }, - end: { column: 14, line: 5 }, + start: { column: 12, line: 7 }, + end: { column: 14, line: 7 }, }, }, - range: [175, 193], + range: [177, 196], loc: { - start: { column: 0, line: 5 }, - end: { column: 18, line: 5 }, + start: { column: 0, line: 7 }, + end: { column: 1, line: 8 }, }, }, ForInStatement { @@ -258,10 +258,10 @@ Program { type: "BlockStatement", body: [], - range: [215, 217], + range: [216, 219], loc: { - start: { column: 21, line: 6 }, - end: { column: 23, line: 6 }, + start: { column: 19, line: 9 }, + end: { column: 1, line: 10 }, }, }, left: TSAsExpression { @@ -272,10 +272,10 @@ Program { name: "x", optional: false, - range: [200, 201], + range: [202, 203], loc: { - start: { column: 6, line: 6 }, - end: { column: 7, line: 6 }, + start: { column: 5, line: 9 }, + end: { column: 6, line: 9 }, }, }, typeAnnotation: TSTypeReference { @@ -286,50 +286,50 @@ Program { name: "T", optional: false, - range: [205, 206], + range: [207, 208], loc: { - start: { column: 11, line: 6 }, - end: { column: 12, line: 6 }, + start: { column: 10, line: 9 }, + end: { column: 11, line: 9 }, }, }, - range: [205, 206], + range: [207, 208], loc: { - start: { column: 11, line: 6 }, - end: { column: 12, line: 6 }, + start: { column: 10, line: 9 }, + end: { column: 11, line: 9 }, }, }, - range: [200, 206], + range: [202, 208], loc: { - start: { column: 6, line: 6 }, - end: { column: 12, line: 6 }, + start: { column: 5, line: 9 }, + end: { column: 11, line: 9 }, }, }, right: ArrayExpression { type: "ArrayExpression", elements: [], - range: [211, 213], + range: [212, 214], loc: { - start: { column: 17, line: 6 }, - end: { column: 19, line: 6 }, + start: { column: 15, line: 9 }, + end: { column: 17, line: 9 }, }, }, - range: [194, 217], + range: [197, 219], loc: { - start: { column: 0, line: 6 }, - end: { column: 23, line: 6 }, + start: { column: 0, line: 9 }, + end: { column: 1, line: 10 }, }, }, ], sourceType: "script", - range: [129, 218], + range: [129, 220], loc: { start: { column: 0, line: 3 }, - end: { column: 0, line: 7 }, + end: { column: 0, line: 11 }, }, } `; diff --git a/packages/ast-spec/src/statement/ForInStatement/fixtures/expr-init/snapshots/2-TSESTree-Tokens.shot b/packages/ast-spec/src/statement/ForInStatement/fixtures/expr-init/snapshots/2-TSESTree-Tokens.shot index cd1783a9f401..16d0b4aaa2a0 100644 --- a/packages/ast-spec/src/statement/ForInStatement/fixtures/expr-init/snapshots/2-TSESTree-Tokens.shot +++ b/packages/ast-spec/src/statement/ForInStatement/fixtures/expr-init/snapshots/2-TSESTree-Tokens.shot @@ -126,380 +126,360 @@ exports[`AST Fixtures statement ForInStatement expr-init TSESTree - Tokens 1`] = type: "Punctuator", value: "}", - range: [151, 152], + range: [152, 153], loc: { - start: { column: 22, line: 3 }, - end: { column: 23, line: 3 }, + start: { column: 0, line: 4 }, + end: { column: 1, line: 4 }, }, }, Keyword { type: "Keyword", value: "for", - range: [153, 156], + range: [154, 157], loc: { - start: { column: 0, line: 4 }, - end: { column: 3, line: 4 }, + start: { column: 0, line: 5 }, + end: { column: 3, line: 5 }, }, }, Punctuator { type: "Punctuator", value: "(", - range: [157, 158], + range: [158, 159], loc: { - start: { column: 4, line: 4 }, - end: { column: 5, line: 4 }, + start: { column: 4, line: 5 }, + end: { column: 5, line: 5 }, }, }, Punctuator { type: "Punctuator", value: "[", - range: [158, 159], + range: [159, 160], loc: { - start: { column: 5, line: 4 }, - end: { column: 6, line: 4 }, + start: { column: 5, line: 5 }, + end: { column: 6, line: 5 }, }, }, Identifier { type: "Identifier", value: "x", - range: [159, 160], + range: [160, 161], loc: { - start: { column: 6, line: 4 }, - end: { column: 7, line: 4 }, + start: { column: 6, line: 5 }, + end: { column: 7, line: 5 }, }, }, Punctuator { type: "Punctuator", value: ",", - range: [160, 161], + range: [161, 162], loc: { - start: { column: 7, line: 4 }, - end: { column: 8, line: 4 }, + start: { column: 7, line: 5 }, + end: { column: 8, line: 5 }, }, }, Identifier { type: "Identifier", value: "y", - range: [162, 163], + range: [163, 164], loc: { - start: { column: 9, line: 4 }, - end: { column: 10, line: 4 }, + start: { column: 9, line: 5 }, + end: { column: 10, line: 5 }, }, }, Punctuator { type: "Punctuator", value: "]", - range: [163, 164], + range: [164, 165], loc: { - start: { column: 10, line: 4 }, - end: { column: 11, line: 4 }, + start: { column: 10, line: 5 }, + end: { column: 11, line: 5 }, }, }, Keyword { type: "Keyword", value: "in", - range: [165, 167], + range: [166, 168], loc: { - start: { column: 12, line: 4 }, - end: { column: 14, line: 4 }, + start: { column: 12, line: 5 }, + end: { column: 14, line: 5 }, }, }, Punctuator { type: "Punctuator", value: "[", - range: [168, 169], + range: [169, 170], loc: { - start: { column: 15, line: 4 }, - end: { column: 16, line: 4 }, + start: { column: 15, line: 5 }, + end: { column: 16, line: 5 }, }, }, Punctuator { type: "Punctuator", value: "]", - range: [169, 170], + range: [170, 171], loc: { - start: { column: 16, line: 4 }, - end: { column: 17, line: 4 }, + start: { column: 16, line: 5 }, + end: { column: 17, line: 5 }, }, }, Punctuator { type: "Punctuator", value: ")", - range: [170, 171], + range: [171, 172], loc: { - start: { column: 17, line: 4 }, - end: { column: 18, line: 4 }, + start: { column: 17, line: 5 }, + end: { column: 18, line: 5 }, }, }, Punctuator { type: "Punctuator", value: "{", - range: [172, 173], + range: [173, 174], loc: { - start: { column: 19, line: 4 }, - end: { column: 20, line: 4 }, + start: { column: 19, line: 5 }, + end: { column: 20, line: 5 }, }, }, Punctuator { type: "Punctuator", value: "}", - range: [173, 174], + range: [175, 176], loc: { - start: { column: 20, line: 4 }, - end: { column: 21, line: 4 }, + start: { column: 0, line: 6 }, + end: { column: 1, line: 6 }, }, }, Keyword { type: "Keyword", value: "for", - range: [175, 178], + range: [177, 180], loc: { - start: { column: 0, line: 5 }, - end: { column: 3, line: 5 }, + start: { column: 0, line: 7 }, + end: { column: 3, line: 7 }, }, }, Punctuator { type: "Punctuator", value: "(", - range: [179, 180], + range: [181, 182], loc: { - start: { column: 4, line: 5 }, - end: { column: 5, line: 5 }, + start: { column: 4, line: 7 }, + end: { column: 5, line: 7 }, }, }, Identifier { type: "Identifier", value: "x", - range: [180, 181], + range: [182, 183], loc: { - start: { column: 5, line: 5 }, - end: { column: 6, line: 5 }, + start: { column: 5, line: 7 }, + end: { column: 6, line: 7 }, }, }, Punctuator { type: "Punctuator", value: ".", - range: [181, 182], + range: [183, 184], loc: { - start: { column: 6, line: 5 }, - end: { column: 7, line: 5 }, + start: { column: 6, line: 7 }, + end: { column: 7, line: 7 }, }, }, Identifier { type: "Identifier", value: "y", - range: [182, 183], + range: [184, 185], loc: { - start: { column: 7, line: 5 }, - end: { column: 8, line: 5 }, + start: { column: 7, line: 7 }, + end: { column: 8, line: 7 }, }, }, Keyword { type: "Keyword", value: "in", - range: [184, 186], + range: [186, 188], loc: { - start: { column: 9, line: 5 }, - end: { column: 11, line: 5 }, + start: { column: 9, line: 7 }, + end: { column: 11, line: 7 }, }, }, Punctuator { type: "Punctuator", value: "[", - range: [187, 188], + range: [189, 190], loc: { - start: { column: 12, line: 5 }, - end: { column: 13, line: 5 }, + start: { column: 12, line: 7 }, + end: { column: 13, line: 7 }, }, }, Punctuator { type: "Punctuator", value: "]", - range: [188, 189], + range: [190, 191], loc: { - start: { column: 13, line: 5 }, - end: { column: 14, line: 5 }, + start: { column: 13, line: 7 }, + end: { column: 14, line: 7 }, }, }, Punctuator { type: "Punctuator", value: ")", - range: [189, 190], + range: [191, 192], loc: { - start: { column: 14, line: 5 }, - end: { column: 15, line: 5 }, + start: { column: 14, line: 7 }, + end: { column: 15, line: 7 }, }, }, Punctuator { type: "Punctuator", value: "{", - range: [191, 192], + range: [193, 194], loc: { - start: { column: 16, line: 5 }, - end: { column: 17, line: 5 }, + start: { column: 16, line: 7 }, + end: { column: 17, line: 7 }, }, }, Punctuator { type: "Punctuator", value: "}", - range: [192, 193], + range: [195, 196], loc: { - start: { column: 17, line: 5 }, - end: { column: 18, line: 5 }, + start: { column: 0, line: 8 }, + end: { column: 1, line: 8 }, }, }, Keyword { type: "Keyword", value: "for", - range: [194, 197], + range: [197, 200], loc: { - start: { column: 0, line: 6 }, - end: { column: 3, line: 6 }, + start: { column: 0, line: 9 }, + end: { column: 3, line: 9 }, }, }, Punctuator { type: "Punctuator", value: "(", - range: [198, 199], + range: [201, 202], loc: { - start: { column: 4, line: 6 }, - end: { column: 5, line: 6 }, - }, - }, - Punctuator { - type: "Punctuator", - value: "(", - - range: [199, 200], - loc: { - start: { column: 5, line: 6 }, - end: { column: 6, line: 6 }, + start: { column: 4, line: 9 }, + end: { column: 5, line: 9 }, }, }, Identifier { type: "Identifier", value: "x", - range: [200, 201], + range: [202, 203], loc: { - start: { column: 6, line: 6 }, - end: { column: 7, line: 6 }, + start: { column: 5, line: 9 }, + end: { column: 6, line: 9 }, }, }, Identifier { type: "Identifier", value: "as", - range: [202, 204], + range: [204, 206], loc: { - start: { column: 8, line: 6 }, - end: { column: 10, line: 6 }, + start: { column: 7, line: 9 }, + end: { column: 9, line: 9 }, }, }, Identifier { type: "Identifier", value: "T", - range: [205, 206], - loc: { - start: { column: 11, line: 6 }, - end: { column: 12, line: 6 }, - }, - }, - Punctuator { - type: "Punctuator", - value: ")", - - range: [206, 207], + range: [207, 208], loc: { - start: { column: 12, line: 6 }, - end: { column: 13, line: 6 }, + start: { column: 10, line: 9 }, + end: { column: 11, line: 9 }, }, }, Keyword { type: "Keyword", value: "in", - range: [208, 210], + range: [209, 211], loc: { - start: { column: 14, line: 6 }, - end: { column: 16, line: 6 }, + start: { column: 12, line: 9 }, + end: { column: 14, line: 9 }, }, }, Punctuator { type: "Punctuator", value: "[", - range: [211, 212], + range: [212, 213], loc: { - start: { column: 17, line: 6 }, - end: { column: 18, line: 6 }, + start: { column: 15, line: 9 }, + end: { column: 16, line: 9 }, }, }, Punctuator { type: "Punctuator", value: "]", - range: [212, 213], + range: [213, 214], loc: { - start: { column: 18, line: 6 }, - end: { column: 19, line: 6 }, + start: { column: 16, line: 9 }, + end: { column: 17, line: 9 }, }, }, Punctuator { type: "Punctuator", value: ")", - range: [213, 214], + range: [214, 215], loc: { - start: { column: 19, line: 6 }, - end: { column: 20, line: 6 }, + start: { column: 17, line: 9 }, + end: { column: 18, line: 9 }, }, }, Punctuator { type: "Punctuator", value: "{", - range: [215, 216], + range: [216, 217], loc: { - start: { column: 21, line: 6 }, - end: { column: 22, line: 6 }, + start: { column: 19, line: 9 }, + end: { column: 20, line: 9 }, }, }, Punctuator { type: "Punctuator", value: "}", - range: [216, 217], + range: [218, 219], loc: { - start: { column: 22, line: 6 }, - end: { column: 23, line: 6 }, + start: { column: 0, line: 10 }, + end: { column: 1, line: 10 }, }, }, ] diff --git a/packages/ast-spec/src/statement/ForInStatement/fixtures/expr-init/snapshots/3-Babel-AST.shot b/packages/ast-spec/src/statement/ForInStatement/fixtures/expr-init/snapshots/3-Babel-AST.shot index 16c9d6e357e8..b71035a74ddd 100644 --- a/packages/ast-spec/src/statement/ForInStatement/fixtures/expr-init/snapshots/3-Babel-AST.shot +++ b/packages/ast-spec/src/statement/ForInStatement/fixtures/expr-init/snapshots/3-Babel-AST.shot @@ -10,10 +10,10 @@ Program { type: "BlockStatement", body: [], - range: [150, 152], + range: [150, 153], loc: { start: { column: 21, line: 3 }, - end: { column: 23, line: 3 }, + end: { column: 1, line: 4 }, }, }, left: ObjectPattern { @@ -104,10 +104,10 @@ Program { }, }, - range: [129, 152], + range: [129, 153], loc: { start: { column: 0, line: 3 }, - end: { column: 23, line: 3 }, + end: { column: 1, line: 4 }, }, }, ForInStatement { @@ -116,10 +116,10 @@ Program { type: "BlockStatement", body: [], - range: [172, 174], + range: [173, 176], loc: { - start: { column: 19, line: 4 }, - end: { column: 21, line: 4 }, + start: { column: 19, line: 5 }, + end: { column: 1, line: 6 }, }, }, left: ArrayPattern { @@ -129,45 +129,45 @@ Program { type: "Identifier", name: "x", - range: [159, 160], + range: [160, 161], loc: { - start: { column: 6, line: 4 }, - end: { column: 7, line: 4 }, + start: { column: 6, line: 5 }, + end: { column: 7, line: 5 }, }, }, Identifier { type: "Identifier", name: "y", - range: [162, 163], + range: [163, 164], loc: { - start: { column: 9, line: 4 }, - end: { column: 10, line: 4 }, + start: { column: 9, line: 5 }, + end: { column: 10, line: 5 }, }, }, ], - range: [158, 164], + range: [159, 165], loc: { - start: { column: 5, line: 4 }, - end: { column: 11, line: 4 }, + start: { column: 5, line: 5 }, + end: { column: 11, line: 5 }, }, }, right: ArrayExpression { type: "ArrayExpression", elements: [], - range: [168, 170], + range: [169, 171], loc: { - start: { column: 15, line: 4 }, - end: { column: 17, line: 4 }, + start: { column: 15, line: 5 }, + end: { column: 17, line: 5 }, }, }, - range: [153, 174], + range: [154, 176], loc: { - start: { column: 0, line: 4 }, - end: { column: 21, line: 4 }, + start: { column: 0, line: 5 }, + end: { column: 1, line: 6 }, }, }, ForInStatement { @@ -176,10 +176,10 @@ Program { type: "BlockStatement", body: [], - range: [191, 193], + range: [193, 196], loc: { - start: { column: 16, line: 5 }, - end: { column: 18, line: 5 }, + start: { column: 16, line: 7 }, + end: { column: 1, line: 8 }, }, }, left: MemberExpression { @@ -189,10 +189,10 @@ Program { type: "Identifier", name: "x", - range: [180, 181], + range: [182, 183], loc: { - start: { column: 5, line: 5 }, - end: { column: 6, line: 5 }, + start: { column: 5, line: 7 }, + end: { column: 6, line: 7 }, }, }, optional: false, @@ -200,34 +200,34 @@ Program { type: "Identifier", name: "y", - range: [182, 183], + range: [184, 185], loc: { - start: { column: 7, line: 5 }, - end: { column: 8, line: 5 }, + start: { column: 7, line: 7 }, + end: { column: 8, line: 7 }, }, }, - range: [180, 183], + range: [182, 185], loc: { - start: { column: 5, line: 5 }, - end: { column: 8, line: 5 }, + start: { column: 5, line: 7 }, + end: { column: 8, line: 7 }, }, }, right: ArrayExpression { type: "ArrayExpression", elements: [], - range: [187, 189], + range: [189, 191], loc: { - start: { column: 12, line: 5 }, - end: { column: 14, line: 5 }, + start: { column: 12, line: 7 }, + end: { column: 14, line: 7 }, }, }, - range: [175, 193], + range: [177, 196], loc: { - start: { column: 0, line: 5 }, - end: { column: 18, line: 5 }, + start: { column: 0, line: 7 }, + end: { column: 1, line: 8 }, }, }, ForInStatement { @@ -236,10 +236,10 @@ Program { type: "BlockStatement", body: [], - range: [215, 217], + range: [216, 219], loc: { - start: { column: 21, line: 6 }, - end: { column: 23, line: 6 }, + start: { column: 19, line: 9 }, + end: { column: 1, line: 10 }, }, }, left: TSAsExpression { @@ -248,10 +248,10 @@ Program { type: "Identifier", name: "x", - range: [200, 201], + range: [202, 203], loc: { - start: { column: 6, line: 6 }, - end: { column: 7, line: 6 }, + start: { column: 5, line: 9 }, + end: { column: 6, line: 9 }, }, }, typeAnnotation: TSTypeReference { @@ -260,50 +260,50 @@ Program { type: "Identifier", name: "T", - range: [205, 206], + range: [207, 208], loc: { - start: { column: 11, line: 6 }, - end: { column: 12, line: 6 }, + start: { column: 10, line: 9 }, + end: { column: 11, line: 9 }, }, }, - range: [205, 206], + range: [207, 208], loc: { - start: { column: 11, line: 6 }, - end: { column: 12, line: 6 }, + start: { column: 10, line: 9 }, + end: { column: 11, line: 9 }, }, }, - range: [200, 206], + range: [202, 208], loc: { - start: { column: 6, line: 6 }, - end: { column: 12, line: 6 }, + start: { column: 5, line: 9 }, + end: { column: 11, line: 9 }, }, }, right: ArrayExpression { type: "ArrayExpression", elements: [], - range: [211, 213], + range: [212, 214], loc: { - start: { column: 17, line: 6 }, - end: { column: 19, line: 6 }, + start: { column: 15, line: 9 }, + end: { column: 17, line: 9 }, }, }, - range: [194, 217], + range: [197, 219], loc: { - start: { column: 0, line: 6 }, - end: { column: 23, line: 6 }, + start: { column: 0, line: 9 }, + end: { column: 1, line: 10 }, }, }, ], sourceType: "script", - range: [129, 218], + range: [129, 220], loc: { start: { column: 0, line: 3 }, - end: { column: 0, line: 7 }, + end: { column: 0, line: 11 }, }, } `; diff --git a/packages/ast-spec/src/statement/ForInStatement/fixtures/expr-init/snapshots/4-Babel-Tokens.shot b/packages/ast-spec/src/statement/ForInStatement/fixtures/expr-init/snapshots/4-Babel-Tokens.shot index 56cec4813296..e1f9bc7d63d7 100644 --- a/packages/ast-spec/src/statement/ForInStatement/fixtures/expr-init/snapshots/4-Babel-Tokens.shot +++ b/packages/ast-spec/src/statement/ForInStatement/fixtures/expr-init/snapshots/4-Babel-Tokens.shot @@ -126,380 +126,360 @@ exports[`AST Fixtures statement ForInStatement expr-init Babel - Tokens 1`] = ` type: "Punctuator", value: "}", - range: [151, 152], + range: [152, 153], loc: { - start: { column: 22, line: 3 }, - end: { column: 23, line: 3 }, + start: { column: 0, line: 4 }, + end: { column: 1, line: 4 }, }, }, Keyword { type: "Keyword", value: "for", - range: [153, 156], + range: [154, 157], loc: { - start: { column: 0, line: 4 }, - end: { column: 3, line: 4 }, + start: { column: 0, line: 5 }, + end: { column: 3, line: 5 }, }, }, Punctuator { type: "Punctuator", value: "(", - range: [157, 158], + range: [158, 159], loc: { - start: { column: 4, line: 4 }, - end: { column: 5, line: 4 }, + start: { column: 4, line: 5 }, + end: { column: 5, line: 5 }, }, }, Punctuator { type: "Punctuator", value: "[", - range: [158, 159], + range: [159, 160], loc: { - start: { column: 5, line: 4 }, - end: { column: 6, line: 4 }, + start: { column: 5, line: 5 }, + end: { column: 6, line: 5 }, }, }, Identifier { type: "Identifier", value: "x", - range: [159, 160], + range: [160, 161], loc: { - start: { column: 6, line: 4 }, - end: { column: 7, line: 4 }, + start: { column: 6, line: 5 }, + end: { column: 7, line: 5 }, }, }, Punctuator { type: "Punctuator", value: ",", - range: [160, 161], + range: [161, 162], loc: { - start: { column: 7, line: 4 }, - end: { column: 8, line: 4 }, + start: { column: 7, line: 5 }, + end: { column: 8, line: 5 }, }, }, Identifier { type: "Identifier", value: "y", - range: [162, 163], + range: [163, 164], loc: { - start: { column: 9, line: 4 }, - end: { column: 10, line: 4 }, + start: { column: 9, line: 5 }, + end: { column: 10, line: 5 }, }, }, Punctuator { type: "Punctuator", value: "]", - range: [163, 164], + range: [164, 165], loc: { - start: { column: 10, line: 4 }, - end: { column: 11, line: 4 }, + start: { column: 10, line: 5 }, + end: { column: 11, line: 5 }, }, }, Keyword { type: "Keyword", value: "in", - range: [165, 167], + range: [166, 168], loc: { - start: { column: 12, line: 4 }, - end: { column: 14, line: 4 }, + start: { column: 12, line: 5 }, + end: { column: 14, line: 5 }, }, }, Punctuator { type: "Punctuator", value: "[", - range: [168, 169], + range: [169, 170], loc: { - start: { column: 15, line: 4 }, - end: { column: 16, line: 4 }, + start: { column: 15, line: 5 }, + end: { column: 16, line: 5 }, }, }, Punctuator { type: "Punctuator", value: "]", - range: [169, 170], + range: [170, 171], loc: { - start: { column: 16, line: 4 }, - end: { column: 17, line: 4 }, + start: { column: 16, line: 5 }, + end: { column: 17, line: 5 }, }, }, Punctuator { type: "Punctuator", value: ")", - range: [170, 171], + range: [171, 172], loc: { - start: { column: 17, line: 4 }, - end: { column: 18, line: 4 }, + start: { column: 17, line: 5 }, + end: { column: 18, line: 5 }, }, }, Punctuator { type: "Punctuator", value: "{", - range: [172, 173], + range: [173, 174], loc: { - start: { column: 19, line: 4 }, - end: { column: 20, line: 4 }, + start: { column: 19, line: 5 }, + end: { column: 20, line: 5 }, }, }, Punctuator { type: "Punctuator", value: "}", - range: [173, 174], + range: [175, 176], loc: { - start: { column: 20, line: 4 }, - end: { column: 21, line: 4 }, + start: { column: 0, line: 6 }, + end: { column: 1, line: 6 }, }, }, Keyword { type: "Keyword", value: "for", - range: [175, 178], + range: [177, 180], loc: { - start: { column: 0, line: 5 }, - end: { column: 3, line: 5 }, + start: { column: 0, line: 7 }, + end: { column: 3, line: 7 }, }, }, Punctuator { type: "Punctuator", value: "(", - range: [179, 180], + range: [181, 182], loc: { - start: { column: 4, line: 5 }, - end: { column: 5, line: 5 }, + start: { column: 4, line: 7 }, + end: { column: 5, line: 7 }, }, }, Identifier { type: "Identifier", value: "x", - range: [180, 181], + range: [182, 183], loc: { - start: { column: 5, line: 5 }, - end: { column: 6, line: 5 }, + start: { column: 5, line: 7 }, + end: { column: 6, line: 7 }, }, }, Punctuator { type: "Punctuator", value: ".", - range: [181, 182], + range: [183, 184], loc: { - start: { column: 6, line: 5 }, - end: { column: 7, line: 5 }, + start: { column: 6, line: 7 }, + end: { column: 7, line: 7 }, }, }, Identifier { type: "Identifier", value: "y", - range: [182, 183], + range: [184, 185], loc: { - start: { column: 7, line: 5 }, - end: { column: 8, line: 5 }, + start: { column: 7, line: 7 }, + end: { column: 8, line: 7 }, }, }, Keyword { type: "Keyword", value: "in", - range: [184, 186], + range: [186, 188], loc: { - start: { column: 9, line: 5 }, - end: { column: 11, line: 5 }, + start: { column: 9, line: 7 }, + end: { column: 11, line: 7 }, }, }, Punctuator { type: "Punctuator", value: "[", - range: [187, 188], + range: [189, 190], loc: { - start: { column: 12, line: 5 }, - end: { column: 13, line: 5 }, + start: { column: 12, line: 7 }, + end: { column: 13, line: 7 }, }, }, Punctuator { type: "Punctuator", value: "]", - range: [188, 189], + range: [190, 191], loc: { - start: { column: 13, line: 5 }, - end: { column: 14, line: 5 }, + start: { column: 13, line: 7 }, + end: { column: 14, line: 7 }, }, }, Punctuator { type: "Punctuator", value: ")", - range: [189, 190], + range: [191, 192], loc: { - start: { column: 14, line: 5 }, - end: { column: 15, line: 5 }, + start: { column: 14, line: 7 }, + end: { column: 15, line: 7 }, }, }, Punctuator { type: "Punctuator", value: "{", - range: [191, 192], + range: [193, 194], loc: { - start: { column: 16, line: 5 }, - end: { column: 17, line: 5 }, + start: { column: 16, line: 7 }, + end: { column: 17, line: 7 }, }, }, Punctuator { type: "Punctuator", value: "}", - range: [192, 193], + range: [195, 196], loc: { - start: { column: 17, line: 5 }, - end: { column: 18, line: 5 }, + start: { column: 0, line: 8 }, + end: { column: 1, line: 8 }, }, }, Keyword { type: "Keyword", value: "for", - range: [194, 197], + range: [197, 200], loc: { - start: { column: 0, line: 6 }, - end: { column: 3, line: 6 }, + start: { column: 0, line: 9 }, + end: { column: 3, line: 9 }, }, }, Punctuator { type: "Punctuator", value: "(", - range: [198, 199], + range: [201, 202], loc: { - start: { column: 4, line: 6 }, - end: { column: 5, line: 6 }, - }, - }, - Punctuator { - type: "Punctuator", - value: "(", - - range: [199, 200], - loc: { - start: { column: 5, line: 6 }, - end: { column: 6, line: 6 }, + start: { column: 4, line: 9 }, + end: { column: 5, line: 9 }, }, }, Identifier { type: "Identifier", value: "x", - range: [200, 201], + range: [202, 203], loc: { - start: { column: 6, line: 6 }, - end: { column: 7, line: 6 }, + start: { column: 5, line: 9 }, + end: { column: 6, line: 9 }, }, }, Identifier { type: "Identifier", value: "as", - range: [202, 204], + range: [204, 206], loc: { - start: { column: 8, line: 6 }, - end: { column: 10, line: 6 }, + start: { column: 7, line: 9 }, + end: { column: 9, line: 9 }, }, }, Identifier { type: "Identifier", value: "T", - range: [205, 206], - loc: { - start: { column: 11, line: 6 }, - end: { column: 12, line: 6 }, - }, - }, - Punctuator { - type: "Punctuator", - value: ")", - - range: [206, 207], + range: [207, 208], loc: { - start: { column: 12, line: 6 }, - end: { column: 13, line: 6 }, + start: { column: 10, line: 9 }, + end: { column: 11, line: 9 }, }, }, Keyword { type: "Keyword", value: "in", - range: [208, 210], + range: [209, 211], loc: { - start: { column: 14, line: 6 }, - end: { column: 16, line: 6 }, + start: { column: 12, line: 9 }, + end: { column: 14, line: 9 }, }, }, Punctuator { type: "Punctuator", value: "[", - range: [211, 212], + range: [212, 213], loc: { - start: { column: 17, line: 6 }, - end: { column: 18, line: 6 }, + start: { column: 15, line: 9 }, + end: { column: 16, line: 9 }, }, }, Punctuator { type: "Punctuator", value: "]", - range: [212, 213], + range: [213, 214], loc: { - start: { column: 18, line: 6 }, - end: { column: 19, line: 6 }, + start: { column: 16, line: 9 }, + end: { column: 17, line: 9 }, }, }, Punctuator { type: "Punctuator", value: ")", - range: [213, 214], + range: [214, 215], loc: { - start: { column: 19, line: 6 }, - end: { column: 20, line: 6 }, + start: { column: 17, line: 9 }, + end: { column: 18, line: 9 }, }, }, Punctuator { type: "Punctuator", value: "{", - range: [215, 216], + range: [216, 217], loc: { - start: { column: 21, line: 6 }, - end: { column: 22, line: 6 }, + start: { column: 19, line: 9 }, + end: { column: 20, line: 9 }, }, }, Punctuator { type: "Punctuator", value: "}", - range: [216, 217], + range: [218, 219], loc: { - start: { column: 22, line: 6 }, - end: { column: 23, line: 6 }, + start: { column: 0, line: 10 }, + end: { column: 1, line: 10 }, }, }, ] diff --git a/packages/ast-spec/src/statement/ForInStatement/fixtures/expr-init/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/statement/ForInStatement/fixtures/expr-init/snapshots/5-AST-Alignment-AST.shot index b33f93c97ada..7e020e66ddae 100644 --- a/packages/ast-spec/src/statement/ForInStatement/fixtures/expr-init/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/statement/ForInStatement/fixtures/expr-init/snapshots/5-AST-Alignment-AST.shot @@ -14,10 +14,10 @@ exports[`AST Fixtures statement ForInStatement expr-init AST Alignment - AST 1`] type: 'BlockStatement', body: Array [], - range: [150, 152], + range: [150, 153], loc: { start: { column: 21, line: 3 }, - end: { column: 23, line: 3 }, + end: { column: 1, line: 4 }, }, }, left: ObjectPattern { @@ -120,10 +120,10 @@ exports[`AST Fixtures statement ForInStatement expr-init AST Alignment - AST 1`] }, }, - range: [129, 152], + range: [129, 153], loc: { start: { column: 0, line: 3 }, - end: { column: 23, line: 3 }, + end: { column: 1, line: 4 }, }, }, ForInStatement { @@ -132,10 +132,10 @@ exports[`AST Fixtures statement ForInStatement expr-init AST Alignment - AST 1`] type: 'BlockStatement', body: Array [], - range: [172, 174], + range: [173, 176], loc: { - start: { column: 19, line: 4 }, - end: { column: 21, line: 4 }, + start: { column: 19, line: 5 }, + end: { column: 1, line: 6 }, }, }, left: ArrayPattern { @@ -148,10 +148,10 @@ exports[`AST Fixtures statement ForInStatement expr-init AST Alignment - AST 1`] name: 'x', - optional: false, - range: [159, 160], + range: [160, 161], loc: { - start: { column: 6, line: 4 }, - end: { column: 7, line: 4 }, + start: { column: 6, line: 5 }, + end: { column: 7, line: 5 }, }, }, Identifier { @@ -160,36 +160,36 @@ exports[`AST Fixtures statement ForInStatement expr-init AST Alignment - AST 1`] name: 'y', - optional: false, - range: [162, 163], + range: [163, 164], loc: { - start: { column: 9, line: 4 }, - end: { column: 10, line: 4 }, + start: { column: 9, line: 5 }, + end: { column: 10, line: 5 }, }, }, ], - optional: false, - range: [158, 164], + range: [159, 165], loc: { - start: { column: 5, line: 4 }, - end: { column: 11, line: 4 }, + start: { column: 5, line: 5 }, + end: { column: 11, line: 5 }, }, }, right: ArrayExpression { type: 'ArrayExpression', elements: Array [], - range: [168, 170], + range: [169, 171], loc: { - start: { column: 15, line: 4 }, - end: { column: 17, line: 4 }, + start: { column: 15, line: 5 }, + end: { column: 17, line: 5 }, }, }, - range: [153, 174], + range: [154, 176], loc: { - start: { column: 0, line: 4 }, - end: { column: 21, line: 4 }, + start: { column: 0, line: 5 }, + end: { column: 1, line: 6 }, }, }, ForInStatement { @@ -198,10 +198,10 @@ exports[`AST Fixtures statement ForInStatement expr-init AST Alignment - AST 1`] type: 'BlockStatement', body: Array [], - range: [191, 193], + range: [193, 196], loc: { - start: { column: 16, line: 5 }, - end: { column: 18, line: 5 }, + start: { column: 16, line: 7 }, + end: { column: 1, line: 8 }, }, }, left: MemberExpression { @@ -213,10 +213,10 @@ exports[`AST Fixtures statement ForInStatement expr-init AST Alignment - AST 1`] name: 'x', - optional: false, - range: [180, 181], + range: [182, 183], loc: { - start: { column: 5, line: 5 }, - end: { column: 6, line: 5 }, + start: { column: 5, line: 7 }, + end: { column: 6, line: 7 }, }, }, optional: false, @@ -226,34 +226,34 @@ exports[`AST Fixtures statement ForInStatement expr-init AST Alignment - AST 1`] name: 'y', - optional: false, - range: [182, 183], + range: [184, 185], loc: { - start: { column: 7, line: 5 }, - end: { column: 8, line: 5 }, + start: { column: 7, line: 7 }, + end: { column: 8, line: 7 }, }, }, - range: [180, 183], + range: [182, 185], loc: { - start: { column: 5, line: 5 }, - end: { column: 8, line: 5 }, + start: { column: 5, line: 7 }, + end: { column: 8, line: 7 }, }, }, right: ArrayExpression { type: 'ArrayExpression', elements: Array [], - range: [187, 189], + range: [189, 191], loc: { - start: { column: 12, line: 5 }, - end: { column: 14, line: 5 }, + start: { column: 12, line: 7 }, + end: { column: 14, line: 7 }, }, }, - range: [175, 193], + range: [177, 196], loc: { - start: { column: 0, line: 5 }, - end: { column: 18, line: 5 }, + start: { column: 0, line: 7 }, + end: { column: 1, line: 8 }, }, }, ForInStatement { @@ -262,10 +262,10 @@ exports[`AST Fixtures statement ForInStatement expr-init AST Alignment - AST 1`] type: 'BlockStatement', body: Array [], - range: [215, 217], + range: [216, 219], loc: { - start: { column: 21, line: 6 }, - end: { column: 23, line: 6 }, + start: { column: 19, line: 9 }, + end: { column: 1, line: 10 }, }, }, left: TSAsExpression { @@ -276,10 +276,10 @@ exports[`AST Fixtures statement ForInStatement expr-init AST Alignment - AST 1`] name: 'x', - optional: false, - range: [200, 201], + range: [202, 203], loc: { - start: { column: 6, line: 6 }, - end: { column: 7, line: 6 }, + start: { column: 5, line: 9 }, + end: { column: 6, line: 9 }, }, }, typeAnnotation: TSTypeReference { @@ -290,50 +290,50 @@ exports[`AST Fixtures statement ForInStatement expr-init AST Alignment - AST 1`] name: 'T', - optional: false, - range: [205, 206], + range: [207, 208], loc: { - start: { column: 11, line: 6 }, - end: { column: 12, line: 6 }, + start: { column: 10, line: 9 }, + end: { column: 11, line: 9 }, }, }, - range: [205, 206], + range: [207, 208], loc: { - start: { column: 11, line: 6 }, - end: { column: 12, line: 6 }, + start: { column: 10, line: 9 }, + end: { column: 11, line: 9 }, }, }, - range: [200, 206], + range: [202, 208], loc: { - start: { column: 6, line: 6 }, - end: { column: 12, line: 6 }, + start: { column: 5, line: 9 }, + end: { column: 11, line: 9 }, }, }, right: ArrayExpression { type: 'ArrayExpression', elements: Array [], - range: [211, 213], + range: [212, 214], loc: { - start: { column: 17, line: 6 }, - end: { column: 19, line: 6 }, + start: { column: 15, line: 9 }, + end: { column: 17, line: 9 }, }, }, - range: [194, 217], + range: [197, 219], loc: { - start: { column: 0, line: 6 }, - end: { column: 23, line: 6 }, + start: { column: 0, line: 9 }, + end: { column: 1, line: 10 }, }, }, ], sourceType: 'script', - range: [129, 218], + range: [129, 220], loc: { start: { column: 0, line: 3 }, - end: { column: 0, line: 7 }, + end: { column: 0, line: 11 }, }, }" `; diff --git a/packages/ast-spec/src/statement/ForOfStatement/fixtures/expr-init/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/statement/ForOfStatement/fixtures/expr-init/snapshots/1-TSESTree-AST.shot index 5d795bfa2d94..4db8325e9410 100644 --- a/packages/ast-spec/src/statement/ForOfStatement/fixtures/expr-init/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/statement/ForOfStatement/fixtures/expr-init/snapshots/1-TSESTree-AST.shot @@ -11,10 +11,10 @@ Program { type: "BlockStatement", body: [], - range: [21, 23], + range: [21, 24], loc: { start: { column: 21, line: 1 }, - end: { column: 23, line: 1 }, + end: { column: 1, line: 2 }, }, }, left: ObjectPattern { @@ -117,10 +117,10 @@ Program { }, }, - range: [0, 23], + range: [0, 24], loc: { start: { column: 0, line: 1 }, - end: { column: 23, line: 1 }, + end: { column: 1, line: 2 }, }, }, ForOfStatement { @@ -130,10 +130,10 @@ Program { type: "BlockStatement", body: [], - range: [43, 45], + range: [44, 47], loc: { - start: { column: 19, line: 2 }, - end: { column: 21, line: 2 }, + start: { column: 19, line: 3 }, + end: { column: 1, line: 4 }, }, }, left: ArrayPattern { @@ -146,10 +146,10 @@ Program { name: "x", optional: false, - range: [30, 31], + range: [31, 32], loc: { - start: { column: 6, line: 2 }, - end: { column: 7, line: 2 }, + start: { column: 6, line: 3 }, + end: { column: 7, line: 3 }, }, }, Identifier { @@ -158,36 +158,36 @@ Program { name: "y", optional: false, - range: [33, 34], + range: [34, 35], loc: { - start: { column: 9, line: 2 }, - end: { column: 10, line: 2 }, + start: { column: 9, line: 3 }, + end: { column: 10, line: 3 }, }, }, ], optional: false, - range: [29, 35], + range: [30, 36], loc: { - start: { column: 5, line: 2 }, - end: { column: 11, line: 2 }, + start: { column: 5, line: 3 }, + end: { column: 11, line: 3 }, }, }, right: ArrayExpression { type: "ArrayExpression", elements: [], - range: [39, 41], + range: [40, 42], loc: { - start: { column: 15, line: 2 }, - end: { column: 17, line: 2 }, + start: { column: 15, line: 3 }, + end: { column: 17, line: 3 }, }, }, - range: [24, 45], + range: [25, 47], loc: { - start: { column: 0, line: 2 }, - end: { column: 21, line: 2 }, + start: { column: 0, line: 3 }, + end: { column: 1, line: 4 }, }, }, ForOfStatement { @@ -197,10 +197,10 @@ Program { type: "BlockStatement", body: [], - range: [62, 64], + range: [64, 67], loc: { - start: { column: 16, line: 3 }, - end: { column: 18, line: 3 }, + start: { column: 16, line: 5 }, + end: { column: 1, line: 6 }, }, }, left: MemberExpression { @@ -212,10 +212,10 @@ Program { name: "x", optional: false, - range: [51, 52], + range: [53, 54], loc: { - start: { column: 5, line: 3 }, - end: { column: 6, line: 3 }, + start: { column: 5, line: 5 }, + end: { column: 6, line: 5 }, }, }, optional: false, @@ -225,34 +225,34 @@ Program { name: "y", optional: false, - range: [53, 54], + range: [55, 56], loc: { - start: { column: 7, line: 3 }, - end: { column: 8, line: 3 }, + start: { column: 7, line: 5 }, + end: { column: 8, line: 5 }, }, }, - range: [51, 54], + range: [53, 56], loc: { - start: { column: 5, line: 3 }, - end: { column: 8, line: 3 }, + start: { column: 5, line: 5 }, + end: { column: 8, line: 5 }, }, }, right: ArrayExpression { type: "ArrayExpression", elements: [], - range: [58, 60], + range: [60, 62], loc: { - start: { column: 12, line: 3 }, - end: { column: 14, line: 3 }, + start: { column: 12, line: 5 }, + end: { column: 14, line: 5 }, }, }, - range: [46, 64], + range: [48, 67], loc: { - start: { column: 0, line: 3 }, - end: { column: 18, line: 3 }, + start: { column: 0, line: 5 }, + end: { column: 1, line: 6 }, }, }, ForOfStatement { @@ -262,10 +262,10 @@ Program { type: "BlockStatement", body: [], - range: [86, 88], + range: [87, 90], loc: { - start: { column: 21, line: 4 }, - end: { column: 23, line: 4 }, + start: { column: 19, line: 7 }, + end: { column: 1, line: 8 }, }, }, left: TSAsExpression { @@ -276,10 +276,10 @@ Program { name: "x", optional: false, - range: [71, 72], + range: [73, 74], loc: { - start: { column: 6, line: 4 }, - end: { column: 7, line: 4 }, + start: { column: 5, line: 7 }, + end: { column: 6, line: 7 }, }, }, typeAnnotation: TSTypeReference { @@ -290,50 +290,50 @@ Program { name: "T", optional: false, - range: [76, 77], + range: [78, 79], loc: { - start: { column: 11, line: 4 }, - end: { column: 12, line: 4 }, + start: { column: 10, line: 7 }, + end: { column: 11, line: 7 }, }, }, - range: [76, 77], + range: [78, 79], loc: { - start: { column: 11, line: 4 }, - end: { column: 12, line: 4 }, + start: { column: 10, line: 7 }, + end: { column: 11, line: 7 }, }, }, - range: [71, 77], + range: [73, 79], loc: { - start: { column: 6, line: 4 }, - end: { column: 12, line: 4 }, + start: { column: 5, line: 7 }, + end: { column: 11, line: 7 }, }, }, right: ArrayExpression { type: "ArrayExpression", elements: [], - range: [82, 84], + range: [83, 85], loc: { - start: { column: 17, line: 4 }, - end: { column: 19, line: 4 }, + start: { column: 15, line: 7 }, + end: { column: 17, line: 7 }, }, }, - range: [65, 88], + range: [68, 90], loc: { - start: { column: 0, line: 4 }, - end: { column: 23, line: 4 }, + start: { column: 0, line: 7 }, + end: { column: 1, line: 8 }, }, }, ], sourceType: "script", - range: [0, 89], + range: [0, 91], loc: { start: { column: 0, line: 1 }, - end: { column: 0, line: 5 }, + end: { column: 0, line: 9 }, }, } `; diff --git a/packages/ast-spec/src/statement/ForOfStatement/fixtures/expr-init/snapshots/2-TSESTree-Tokens.shot b/packages/ast-spec/src/statement/ForOfStatement/fixtures/expr-init/snapshots/2-TSESTree-Tokens.shot index 7379cd5f70f1..a5ff0a0c4602 100644 --- a/packages/ast-spec/src/statement/ForOfStatement/fixtures/expr-init/snapshots/2-TSESTree-Tokens.shot +++ b/packages/ast-spec/src/statement/ForOfStatement/fixtures/expr-init/snapshots/2-TSESTree-Tokens.shot @@ -126,380 +126,360 @@ exports[`AST Fixtures statement ForOfStatement expr-init TSESTree - Tokens 1`] = type: "Punctuator", value: "}", - range: [22, 23], + range: [23, 24], loc: { - start: { column: 22, line: 1 }, - end: { column: 23, line: 1 }, + start: { column: 0, line: 2 }, + end: { column: 1, line: 2 }, }, }, Keyword { type: "Keyword", value: "for", - range: [24, 27], + range: [25, 28], loc: { - start: { column: 0, line: 2 }, - end: { column: 3, line: 2 }, + start: { column: 0, line: 3 }, + end: { column: 3, line: 3 }, }, }, Punctuator { type: "Punctuator", value: "(", - range: [28, 29], + range: [29, 30], loc: { - start: { column: 4, line: 2 }, - end: { column: 5, line: 2 }, + start: { column: 4, line: 3 }, + end: { column: 5, line: 3 }, }, }, Punctuator { type: "Punctuator", value: "[", - range: [29, 30], + range: [30, 31], loc: { - start: { column: 5, line: 2 }, - end: { column: 6, line: 2 }, + start: { column: 5, line: 3 }, + end: { column: 6, line: 3 }, }, }, Identifier { type: "Identifier", value: "x", - range: [30, 31], + range: [31, 32], loc: { - start: { column: 6, line: 2 }, - end: { column: 7, line: 2 }, + start: { column: 6, line: 3 }, + end: { column: 7, line: 3 }, }, }, Punctuator { type: "Punctuator", value: ",", - range: [31, 32], + range: [32, 33], loc: { - start: { column: 7, line: 2 }, - end: { column: 8, line: 2 }, + start: { column: 7, line: 3 }, + end: { column: 8, line: 3 }, }, }, Identifier { type: "Identifier", value: "y", - range: [33, 34], + range: [34, 35], loc: { - start: { column: 9, line: 2 }, - end: { column: 10, line: 2 }, + start: { column: 9, line: 3 }, + end: { column: 10, line: 3 }, }, }, Punctuator { type: "Punctuator", value: "]", - range: [34, 35], + range: [35, 36], loc: { - start: { column: 10, line: 2 }, - end: { column: 11, line: 2 }, + start: { column: 10, line: 3 }, + end: { column: 11, line: 3 }, }, }, Identifier { type: "Identifier", value: "of", - range: [36, 38], + range: [37, 39], loc: { - start: { column: 12, line: 2 }, - end: { column: 14, line: 2 }, + start: { column: 12, line: 3 }, + end: { column: 14, line: 3 }, }, }, Punctuator { type: "Punctuator", value: "[", - range: [39, 40], + range: [40, 41], loc: { - start: { column: 15, line: 2 }, - end: { column: 16, line: 2 }, + start: { column: 15, line: 3 }, + end: { column: 16, line: 3 }, }, }, Punctuator { type: "Punctuator", value: "]", - range: [40, 41], + range: [41, 42], loc: { - start: { column: 16, line: 2 }, - end: { column: 17, line: 2 }, + start: { column: 16, line: 3 }, + end: { column: 17, line: 3 }, }, }, Punctuator { type: "Punctuator", value: ")", - range: [41, 42], + range: [42, 43], loc: { - start: { column: 17, line: 2 }, - end: { column: 18, line: 2 }, + start: { column: 17, line: 3 }, + end: { column: 18, line: 3 }, }, }, Punctuator { type: "Punctuator", value: "{", - range: [43, 44], + range: [44, 45], loc: { - start: { column: 19, line: 2 }, - end: { column: 20, line: 2 }, + start: { column: 19, line: 3 }, + end: { column: 20, line: 3 }, }, }, Punctuator { type: "Punctuator", value: "}", - range: [44, 45], + range: [46, 47], loc: { - start: { column: 20, line: 2 }, - end: { column: 21, line: 2 }, + start: { column: 0, line: 4 }, + end: { column: 1, line: 4 }, }, }, Keyword { type: "Keyword", value: "for", - range: [46, 49], + range: [48, 51], loc: { - start: { column: 0, line: 3 }, - end: { column: 3, line: 3 }, + start: { column: 0, line: 5 }, + end: { column: 3, line: 5 }, }, }, Punctuator { type: "Punctuator", value: "(", - range: [50, 51], + range: [52, 53], loc: { - start: { column: 4, line: 3 }, - end: { column: 5, line: 3 }, + start: { column: 4, line: 5 }, + end: { column: 5, line: 5 }, }, }, Identifier { type: "Identifier", value: "x", - range: [51, 52], + range: [53, 54], loc: { - start: { column: 5, line: 3 }, - end: { column: 6, line: 3 }, + start: { column: 5, line: 5 }, + end: { column: 6, line: 5 }, }, }, Punctuator { type: "Punctuator", value: ".", - range: [52, 53], + range: [54, 55], loc: { - start: { column: 6, line: 3 }, - end: { column: 7, line: 3 }, + start: { column: 6, line: 5 }, + end: { column: 7, line: 5 }, }, }, Identifier { type: "Identifier", value: "y", - range: [53, 54], + range: [55, 56], loc: { - start: { column: 7, line: 3 }, - end: { column: 8, line: 3 }, + start: { column: 7, line: 5 }, + end: { column: 8, line: 5 }, }, }, Identifier { type: "Identifier", value: "of", - range: [55, 57], + range: [57, 59], loc: { - start: { column: 9, line: 3 }, - end: { column: 11, line: 3 }, + start: { column: 9, line: 5 }, + end: { column: 11, line: 5 }, }, }, Punctuator { type: "Punctuator", value: "[", - range: [58, 59], + range: [60, 61], loc: { - start: { column: 12, line: 3 }, - end: { column: 13, line: 3 }, + start: { column: 12, line: 5 }, + end: { column: 13, line: 5 }, }, }, Punctuator { type: "Punctuator", value: "]", - range: [59, 60], + range: [61, 62], loc: { - start: { column: 13, line: 3 }, - end: { column: 14, line: 3 }, + start: { column: 13, line: 5 }, + end: { column: 14, line: 5 }, }, }, Punctuator { type: "Punctuator", value: ")", - range: [60, 61], + range: [62, 63], loc: { - start: { column: 14, line: 3 }, - end: { column: 15, line: 3 }, + start: { column: 14, line: 5 }, + end: { column: 15, line: 5 }, }, }, Punctuator { type: "Punctuator", value: "{", - range: [62, 63], + range: [64, 65], loc: { - start: { column: 16, line: 3 }, - end: { column: 17, line: 3 }, + start: { column: 16, line: 5 }, + end: { column: 17, line: 5 }, }, }, Punctuator { type: "Punctuator", value: "}", - range: [63, 64], + range: [66, 67], loc: { - start: { column: 17, line: 3 }, - end: { column: 18, line: 3 }, + start: { column: 0, line: 6 }, + end: { column: 1, line: 6 }, }, }, Keyword { type: "Keyword", value: "for", - range: [65, 68], + range: [68, 71], loc: { - start: { column: 0, line: 4 }, - end: { column: 3, line: 4 }, + start: { column: 0, line: 7 }, + end: { column: 3, line: 7 }, }, }, Punctuator { type: "Punctuator", value: "(", - range: [69, 70], + range: [72, 73], loc: { - start: { column: 4, line: 4 }, - end: { column: 5, line: 4 }, - }, - }, - Punctuator { - type: "Punctuator", - value: "(", - - range: [70, 71], - loc: { - start: { column: 5, line: 4 }, - end: { column: 6, line: 4 }, + start: { column: 4, line: 7 }, + end: { column: 5, line: 7 }, }, }, Identifier { type: "Identifier", value: "x", - range: [71, 72], + range: [73, 74], loc: { - start: { column: 6, line: 4 }, - end: { column: 7, line: 4 }, + start: { column: 5, line: 7 }, + end: { column: 6, line: 7 }, }, }, Identifier { type: "Identifier", value: "as", - range: [73, 75], + range: [75, 77], loc: { - start: { column: 8, line: 4 }, - end: { column: 10, line: 4 }, + start: { column: 7, line: 7 }, + end: { column: 9, line: 7 }, }, }, Identifier { type: "Identifier", value: "T", - range: [76, 77], - loc: { - start: { column: 11, line: 4 }, - end: { column: 12, line: 4 }, - }, - }, - Punctuator { - type: "Punctuator", - value: ")", - - range: [77, 78], + range: [78, 79], loc: { - start: { column: 12, line: 4 }, - end: { column: 13, line: 4 }, + start: { column: 10, line: 7 }, + end: { column: 11, line: 7 }, }, }, Identifier { type: "Identifier", value: "of", - range: [79, 81], + range: [80, 82], loc: { - start: { column: 14, line: 4 }, - end: { column: 16, line: 4 }, + start: { column: 12, line: 7 }, + end: { column: 14, line: 7 }, }, }, Punctuator { type: "Punctuator", value: "[", - range: [82, 83], + range: [83, 84], loc: { - start: { column: 17, line: 4 }, - end: { column: 18, line: 4 }, + start: { column: 15, line: 7 }, + end: { column: 16, line: 7 }, }, }, Punctuator { type: "Punctuator", value: "]", - range: [83, 84], + range: [84, 85], loc: { - start: { column: 18, line: 4 }, - end: { column: 19, line: 4 }, + start: { column: 16, line: 7 }, + end: { column: 17, line: 7 }, }, }, Punctuator { type: "Punctuator", value: ")", - range: [84, 85], + range: [85, 86], loc: { - start: { column: 19, line: 4 }, - end: { column: 20, line: 4 }, + start: { column: 17, line: 7 }, + end: { column: 18, line: 7 }, }, }, Punctuator { type: "Punctuator", value: "{", - range: [86, 87], + range: [87, 88], loc: { - start: { column: 21, line: 4 }, - end: { column: 22, line: 4 }, + start: { column: 19, line: 7 }, + end: { column: 20, line: 7 }, }, }, Punctuator { type: "Punctuator", value: "}", - range: [87, 88], + range: [89, 90], loc: { - start: { column: 22, line: 4 }, - end: { column: 23, line: 4 }, + start: { column: 0, line: 8 }, + end: { column: 1, line: 8 }, }, }, ] diff --git a/packages/ast-spec/src/statement/ForOfStatement/fixtures/expr-init/snapshots/3-Babel-AST.shot b/packages/ast-spec/src/statement/ForOfStatement/fixtures/expr-init/snapshots/3-Babel-AST.shot index 68989eea7c41..1b5a2b088d65 100644 --- a/packages/ast-spec/src/statement/ForOfStatement/fixtures/expr-init/snapshots/3-Babel-AST.shot +++ b/packages/ast-spec/src/statement/ForOfStatement/fixtures/expr-init/snapshots/3-Babel-AST.shot @@ -11,10 +11,10 @@ Program { type: "BlockStatement", body: [], - range: [21, 23], + range: [21, 24], loc: { start: { column: 21, line: 1 }, - end: { column: 23, line: 1 }, + end: { column: 1, line: 2 }, }, }, left: ObjectPattern { @@ -105,10 +105,10 @@ Program { }, }, - range: [0, 23], + range: [0, 24], loc: { start: { column: 0, line: 1 }, - end: { column: 23, line: 1 }, + end: { column: 1, line: 2 }, }, }, ForOfStatement { @@ -118,10 +118,10 @@ Program { type: "BlockStatement", body: [], - range: [43, 45], + range: [44, 47], loc: { - start: { column: 19, line: 2 }, - end: { column: 21, line: 2 }, + start: { column: 19, line: 3 }, + end: { column: 1, line: 4 }, }, }, left: ArrayPattern { @@ -131,45 +131,45 @@ Program { type: "Identifier", name: "x", - range: [30, 31], + range: [31, 32], loc: { - start: { column: 6, line: 2 }, - end: { column: 7, line: 2 }, + start: { column: 6, line: 3 }, + end: { column: 7, line: 3 }, }, }, Identifier { type: "Identifier", name: "y", - range: [33, 34], + range: [34, 35], loc: { - start: { column: 9, line: 2 }, - end: { column: 10, line: 2 }, + start: { column: 9, line: 3 }, + end: { column: 10, line: 3 }, }, }, ], - range: [29, 35], + range: [30, 36], loc: { - start: { column: 5, line: 2 }, - end: { column: 11, line: 2 }, + start: { column: 5, line: 3 }, + end: { column: 11, line: 3 }, }, }, right: ArrayExpression { type: "ArrayExpression", elements: [], - range: [39, 41], + range: [40, 42], loc: { - start: { column: 15, line: 2 }, - end: { column: 17, line: 2 }, + start: { column: 15, line: 3 }, + end: { column: 17, line: 3 }, }, }, - range: [24, 45], + range: [25, 47], loc: { - start: { column: 0, line: 2 }, - end: { column: 21, line: 2 }, + start: { column: 0, line: 3 }, + end: { column: 1, line: 4 }, }, }, ForOfStatement { @@ -179,10 +179,10 @@ Program { type: "BlockStatement", body: [], - range: [62, 64], + range: [64, 67], loc: { - start: { column: 16, line: 3 }, - end: { column: 18, line: 3 }, + start: { column: 16, line: 5 }, + end: { column: 1, line: 6 }, }, }, left: MemberExpression { @@ -192,10 +192,10 @@ Program { type: "Identifier", name: "x", - range: [51, 52], + range: [53, 54], loc: { - start: { column: 5, line: 3 }, - end: { column: 6, line: 3 }, + start: { column: 5, line: 5 }, + end: { column: 6, line: 5 }, }, }, optional: false, @@ -203,34 +203,34 @@ Program { type: "Identifier", name: "y", - range: [53, 54], + range: [55, 56], loc: { - start: { column: 7, line: 3 }, - end: { column: 8, line: 3 }, + start: { column: 7, line: 5 }, + end: { column: 8, line: 5 }, }, }, - range: [51, 54], + range: [53, 56], loc: { - start: { column: 5, line: 3 }, - end: { column: 8, line: 3 }, + start: { column: 5, line: 5 }, + end: { column: 8, line: 5 }, }, }, right: ArrayExpression { type: "ArrayExpression", elements: [], - range: [58, 60], + range: [60, 62], loc: { - start: { column: 12, line: 3 }, - end: { column: 14, line: 3 }, + start: { column: 12, line: 5 }, + end: { column: 14, line: 5 }, }, }, - range: [46, 64], + range: [48, 67], loc: { - start: { column: 0, line: 3 }, - end: { column: 18, line: 3 }, + start: { column: 0, line: 5 }, + end: { column: 1, line: 6 }, }, }, ForOfStatement { @@ -240,10 +240,10 @@ Program { type: "BlockStatement", body: [], - range: [86, 88], + range: [87, 90], loc: { - start: { column: 21, line: 4 }, - end: { column: 23, line: 4 }, + start: { column: 19, line: 7 }, + end: { column: 1, line: 8 }, }, }, left: TSAsExpression { @@ -252,10 +252,10 @@ Program { type: "Identifier", name: "x", - range: [71, 72], + range: [73, 74], loc: { - start: { column: 6, line: 4 }, - end: { column: 7, line: 4 }, + start: { column: 5, line: 7 }, + end: { column: 6, line: 7 }, }, }, typeAnnotation: TSTypeReference { @@ -264,50 +264,50 @@ Program { type: "Identifier", name: "T", - range: [76, 77], + range: [78, 79], loc: { - start: { column: 11, line: 4 }, - end: { column: 12, line: 4 }, + start: { column: 10, line: 7 }, + end: { column: 11, line: 7 }, }, }, - range: [76, 77], + range: [78, 79], loc: { - start: { column: 11, line: 4 }, - end: { column: 12, line: 4 }, + start: { column: 10, line: 7 }, + end: { column: 11, line: 7 }, }, }, - range: [71, 77], + range: [73, 79], loc: { - start: { column: 6, line: 4 }, - end: { column: 12, line: 4 }, + start: { column: 5, line: 7 }, + end: { column: 11, line: 7 }, }, }, right: ArrayExpression { type: "ArrayExpression", elements: [], - range: [82, 84], + range: [83, 85], loc: { - start: { column: 17, line: 4 }, - end: { column: 19, line: 4 }, + start: { column: 15, line: 7 }, + end: { column: 17, line: 7 }, }, }, - range: [65, 88], + range: [68, 90], loc: { - start: { column: 0, line: 4 }, - end: { column: 23, line: 4 }, + start: { column: 0, line: 7 }, + end: { column: 1, line: 8 }, }, }, ], sourceType: "script", - range: [0, 89], + range: [0, 91], loc: { start: { column: 0, line: 1 }, - end: { column: 0, line: 5 }, + end: { column: 0, line: 9 }, }, } `; diff --git a/packages/ast-spec/src/statement/ForOfStatement/fixtures/expr-init/snapshots/4-Babel-Tokens.shot b/packages/ast-spec/src/statement/ForOfStatement/fixtures/expr-init/snapshots/4-Babel-Tokens.shot index deed95a03887..d15dfa3bbe38 100644 --- a/packages/ast-spec/src/statement/ForOfStatement/fixtures/expr-init/snapshots/4-Babel-Tokens.shot +++ b/packages/ast-spec/src/statement/ForOfStatement/fixtures/expr-init/snapshots/4-Babel-Tokens.shot @@ -126,380 +126,360 @@ exports[`AST Fixtures statement ForOfStatement expr-init Babel - Tokens 1`] = ` type: "Punctuator", value: "}", - range: [22, 23], + range: [23, 24], loc: { - start: { column: 22, line: 1 }, - end: { column: 23, line: 1 }, + start: { column: 0, line: 2 }, + end: { column: 1, line: 2 }, }, }, Keyword { type: "Keyword", value: "for", - range: [24, 27], + range: [25, 28], loc: { - start: { column: 0, line: 2 }, - end: { column: 3, line: 2 }, + start: { column: 0, line: 3 }, + end: { column: 3, line: 3 }, }, }, Punctuator { type: "Punctuator", value: "(", - range: [28, 29], + range: [29, 30], loc: { - start: { column: 4, line: 2 }, - end: { column: 5, line: 2 }, + start: { column: 4, line: 3 }, + end: { column: 5, line: 3 }, }, }, Punctuator { type: "Punctuator", value: "[", - range: [29, 30], + range: [30, 31], loc: { - start: { column: 5, line: 2 }, - end: { column: 6, line: 2 }, + start: { column: 5, line: 3 }, + end: { column: 6, line: 3 }, }, }, Identifier { type: "Identifier", value: "x", - range: [30, 31], + range: [31, 32], loc: { - start: { column: 6, line: 2 }, - end: { column: 7, line: 2 }, + start: { column: 6, line: 3 }, + end: { column: 7, line: 3 }, }, }, Punctuator { type: "Punctuator", value: ",", - range: [31, 32], + range: [32, 33], loc: { - start: { column: 7, line: 2 }, - end: { column: 8, line: 2 }, + start: { column: 7, line: 3 }, + end: { column: 8, line: 3 }, }, }, Identifier { type: "Identifier", value: "y", - range: [33, 34], + range: [34, 35], loc: { - start: { column: 9, line: 2 }, - end: { column: 10, line: 2 }, + start: { column: 9, line: 3 }, + end: { column: 10, line: 3 }, }, }, Punctuator { type: "Punctuator", value: "]", - range: [34, 35], + range: [35, 36], loc: { - start: { column: 10, line: 2 }, - end: { column: 11, line: 2 }, + start: { column: 10, line: 3 }, + end: { column: 11, line: 3 }, }, }, Identifier { type: "Identifier", value: "of", - range: [36, 38], + range: [37, 39], loc: { - start: { column: 12, line: 2 }, - end: { column: 14, line: 2 }, + start: { column: 12, line: 3 }, + end: { column: 14, line: 3 }, }, }, Punctuator { type: "Punctuator", value: "[", - range: [39, 40], + range: [40, 41], loc: { - start: { column: 15, line: 2 }, - end: { column: 16, line: 2 }, + start: { column: 15, line: 3 }, + end: { column: 16, line: 3 }, }, }, Punctuator { type: "Punctuator", value: "]", - range: [40, 41], + range: [41, 42], loc: { - start: { column: 16, line: 2 }, - end: { column: 17, line: 2 }, + start: { column: 16, line: 3 }, + end: { column: 17, line: 3 }, }, }, Punctuator { type: "Punctuator", value: ")", - range: [41, 42], + range: [42, 43], loc: { - start: { column: 17, line: 2 }, - end: { column: 18, line: 2 }, + start: { column: 17, line: 3 }, + end: { column: 18, line: 3 }, }, }, Punctuator { type: "Punctuator", value: "{", - range: [43, 44], + range: [44, 45], loc: { - start: { column: 19, line: 2 }, - end: { column: 20, line: 2 }, + start: { column: 19, line: 3 }, + end: { column: 20, line: 3 }, }, }, Punctuator { type: "Punctuator", value: "}", - range: [44, 45], + range: [46, 47], loc: { - start: { column: 20, line: 2 }, - end: { column: 21, line: 2 }, + start: { column: 0, line: 4 }, + end: { column: 1, line: 4 }, }, }, Keyword { type: "Keyword", value: "for", - range: [46, 49], + range: [48, 51], loc: { - start: { column: 0, line: 3 }, - end: { column: 3, line: 3 }, + start: { column: 0, line: 5 }, + end: { column: 3, line: 5 }, }, }, Punctuator { type: "Punctuator", value: "(", - range: [50, 51], + range: [52, 53], loc: { - start: { column: 4, line: 3 }, - end: { column: 5, line: 3 }, + start: { column: 4, line: 5 }, + end: { column: 5, line: 5 }, }, }, Identifier { type: "Identifier", value: "x", - range: [51, 52], + range: [53, 54], loc: { - start: { column: 5, line: 3 }, - end: { column: 6, line: 3 }, + start: { column: 5, line: 5 }, + end: { column: 6, line: 5 }, }, }, Punctuator { type: "Punctuator", value: ".", - range: [52, 53], + range: [54, 55], loc: { - start: { column: 6, line: 3 }, - end: { column: 7, line: 3 }, + start: { column: 6, line: 5 }, + end: { column: 7, line: 5 }, }, }, Identifier { type: "Identifier", value: "y", - range: [53, 54], + range: [55, 56], loc: { - start: { column: 7, line: 3 }, - end: { column: 8, line: 3 }, + start: { column: 7, line: 5 }, + end: { column: 8, line: 5 }, }, }, Identifier { type: "Identifier", value: "of", - range: [55, 57], + range: [57, 59], loc: { - start: { column: 9, line: 3 }, - end: { column: 11, line: 3 }, + start: { column: 9, line: 5 }, + end: { column: 11, line: 5 }, }, }, Punctuator { type: "Punctuator", value: "[", - range: [58, 59], + range: [60, 61], loc: { - start: { column: 12, line: 3 }, - end: { column: 13, line: 3 }, + start: { column: 12, line: 5 }, + end: { column: 13, line: 5 }, }, }, Punctuator { type: "Punctuator", value: "]", - range: [59, 60], + range: [61, 62], loc: { - start: { column: 13, line: 3 }, - end: { column: 14, line: 3 }, + start: { column: 13, line: 5 }, + end: { column: 14, line: 5 }, }, }, Punctuator { type: "Punctuator", value: ")", - range: [60, 61], + range: [62, 63], loc: { - start: { column: 14, line: 3 }, - end: { column: 15, line: 3 }, + start: { column: 14, line: 5 }, + end: { column: 15, line: 5 }, }, }, Punctuator { type: "Punctuator", value: "{", - range: [62, 63], + range: [64, 65], loc: { - start: { column: 16, line: 3 }, - end: { column: 17, line: 3 }, + start: { column: 16, line: 5 }, + end: { column: 17, line: 5 }, }, }, Punctuator { type: "Punctuator", value: "}", - range: [63, 64], + range: [66, 67], loc: { - start: { column: 17, line: 3 }, - end: { column: 18, line: 3 }, + start: { column: 0, line: 6 }, + end: { column: 1, line: 6 }, }, }, Keyword { type: "Keyword", value: "for", - range: [65, 68], + range: [68, 71], loc: { - start: { column: 0, line: 4 }, - end: { column: 3, line: 4 }, + start: { column: 0, line: 7 }, + end: { column: 3, line: 7 }, }, }, Punctuator { type: "Punctuator", value: "(", - range: [69, 70], + range: [72, 73], loc: { - start: { column: 4, line: 4 }, - end: { column: 5, line: 4 }, - }, - }, - Punctuator { - type: "Punctuator", - value: "(", - - range: [70, 71], - loc: { - start: { column: 5, line: 4 }, - end: { column: 6, line: 4 }, + start: { column: 4, line: 7 }, + end: { column: 5, line: 7 }, }, }, Identifier { type: "Identifier", value: "x", - range: [71, 72], + range: [73, 74], loc: { - start: { column: 6, line: 4 }, - end: { column: 7, line: 4 }, + start: { column: 5, line: 7 }, + end: { column: 6, line: 7 }, }, }, Identifier { type: "Identifier", value: "as", - range: [73, 75], + range: [75, 77], loc: { - start: { column: 8, line: 4 }, - end: { column: 10, line: 4 }, + start: { column: 7, line: 7 }, + end: { column: 9, line: 7 }, }, }, Identifier { type: "Identifier", value: "T", - range: [76, 77], - loc: { - start: { column: 11, line: 4 }, - end: { column: 12, line: 4 }, - }, - }, - Punctuator { - type: "Punctuator", - value: ")", - - range: [77, 78], + range: [78, 79], loc: { - start: { column: 12, line: 4 }, - end: { column: 13, line: 4 }, + start: { column: 10, line: 7 }, + end: { column: 11, line: 7 }, }, }, Identifier { type: "Identifier", value: "of", - range: [79, 81], + range: [80, 82], loc: { - start: { column: 14, line: 4 }, - end: { column: 16, line: 4 }, + start: { column: 12, line: 7 }, + end: { column: 14, line: 7 }, }, }, Punctuator { type: "Punctuator", value: "[", - range: [82, 83], + range: [83, 84], loc: { - start: { column: 17, line: 4 }, - end: { column: 18, line: 4 }, + start: { column: 15, line: 7 }, + end: { column: 16, line: 7 }, }, }, Punctuator { type: "Punctuator", value: "]", - range: [83, 84], + range: [84, 85], loc: { - start: { column: 18, line: 4 }, - end: { column: 19, line: 4 }, + start: { column: 16, line: 7 }, + end: { column: 17, line: 7 }, }, }, Punctuator { type: "Punctuator", value: ")", - range: [84, 85], + range: [85, 86], loc: { - start: { column: 19, line: 4 }, - end: { column: 20, line: 4 }, + start: { column: 17, line: 7 }, + end: { column: 18, line: 7 }, }, }, Punctuator { type: "Punctuator", value: "{", - range: [86, 87], + range: [87, 88], loc: { - start: { column: 21, line: 4 }, - end: { column: 22, line: 4 }, + start: { column: 19, line: 7 }, + end: { column: 20, line: 7 }, }, }, Punctuator { type: "Punctuator", value: "}", - range: [87, 88], + range: [89, 90], loc: { - start: { column: 22, line: 4 }, - end: { column: 23, line: 4 }, + start: { column: 0, line: 8 }, + end: { column: 1, line: 8 }, }, }, ] diff --git a/packages/ast-spec/src/statement/ForOfStatement/fixtures/expr-init/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/statement/ForOfStatement/fixtures/expr-init/snapshots/5-AST-Alignment-AST.shot index f0c5bd6aef5e..20afbfeb9696 100644 --- a/packages/ast-spec/src/statement/ForOfStatement/fixtures/expr-init/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/statement/ForOfStatement/fixtures/expr-init/snapshots/5-AST-Alignment-AST.shot @@ -15,10 +15,10 @@ exports[`AST Fixtures statement ForOfStatement expr-init AST Alignment - AST 1`] type: 'BlockStatement', body: Array [], - range: [21, 23], + range: [21, 24], loc: { start: { column: 21, line: 1 }, - end: { column: 23, line: 1 }, + end: { column: 1, line: 2 }, }, }, left: ObjectPattern { @@ -121,10 +121,10 @@ exports[`AST Fixtures statement ForOfStatement expr-init AST Alignment - AST 1`] }, }, - range: [0, 23], + range: [0, 24], loc: { start: { column: 0, line: 1 }, - end: { column: 23, line: 1 }, + end: { column: 1, line: 2 }, }, }, ForOfStatement { @@ -134,10 +134,10 @@ exports[`AST Fixtures statement ForOfStatement expr-init AST Alignment - AST 1`] type: 'BlockStatement', body: Array [], - range: [43, 45], + range: [44, 47], loc: { - start: { column: 19, line: 2 }, - end: { column: 21, line: 2 }, + start: { column: 19, line: 3 }, + end: { column: 1, line: 4 }, }, }, left: ArrayPattern { @@ -150,10 +150,10 @@ exports[`AST Fixtures statement ForOfStatement expr-init AST Alignment - AST 1`] name: 'x', - optional: false, - range: [30, 31], + range: [31, 32], loc: { - start: { column: 6, line: 2 }, - end: { column: 7, line: 2 }, + start: { column: 6, line: 3 }, + end: { column: 7, line: 3 }, }, }, Identifier { @@ -162,36 +162,36 @@ exports[`AST Fixtures statement ForOfStatement expr-init AST Alignment - AST 1`] name: 'y', - optional: false, - range: [33, 34], + range: [34, 35], loc: { - start: { column: 9, line: 2 }, - end: { column: 10, line: 2 }, + start: { column: 9, line: 3 }, + end: { column: 10, line: 3 }, }, }, ], - optional: false, - range: [29, 35], + range: [30, 36], loc: { - start: { column: 5, line: 2 }, - end: { column: 11, line: 2 }, + start: { column: 5, line: 3 }, + end: { column: 11, line: 3 }, }, }, right: ArrayExpression { type: 'ArrayExpression', elements: Array [], - range: [39, 41], + range: [40, 42], loc: { - start: { column: 15, line: 2 }, - end: { column: 17, line: 2 }, + start: { column: 15, line: 3 }, + end: { column: 17, line: 3 }, }, }, - range: [24, 45], + range: [25, 47], loc: { - start: { column: 0, line: 2 }, - end: { column: 21, line: 2 }, + start: { column: 0, line: 3 }, + end: { column: 1, line: 4 }, }, }, ForOfStatement { @@ -201,10 +201,10 @@ exports[`AST Fixtures statement ForOfStatement expr-init AST Alignment - AST 1`] type: 'BlockStatement', body: Array [], - range: [62, 64], + range: [64, 67], loc: { - start: { column: 16, line: 3 }, - end: { column: 18, line: 3 }, + start: { column: 16, line: 5 }, + end: { column: 1, line: 6 }, }, }, left: MemberExpression { @@ -216,10 +216,10 @@ exports[`AST Fixtures statement ForOfStatement expr-init AST Alignment - AST 1`] name: 'x', - optional: false, - range: [51, 52], + range: [53, 54], loc: { - start: { column: 5, line: 3 }, - end: { column: 6, line: 3 }, + start: { column: 5, line: 5 }, + end: { column: 6, line: 5 }, }, }, optional: false, @@ -229,34 +229,34 @@ exports[`AST Fixtures statement ForOfStatement expr-init AST Alignment - AST 1`] name: 'y', - optional: false, - range: [53, 54], + range: [55, 56], loc: { - start: { column: 7, line: 3 }, - end: { column: 8, line: 3 }, + start: { column: 7, line: 5 }, + end: { column: 8, line: 5 }, }, }, - range: [51, 54], + range: [53, 56], loc: { - start: { column: 5, line: 3 }, - end: { column: 8, line: 3 }, + start: { column: 5, line: 5 }, + end: { column: 8, line: 5 }, }, }, right: ArrayExpression { type: 'ArrayExpression', elements: Array [], - range: [58, 60], + range: [60, 62], loc: { - start: { column: 12, line: 3 }, - end: { column: 14, line: 3 }, + start: { column: 12, line: 5 }, + end: { column: 14, line: 5 }, }, }, - range: [46, 64], + range: [48, 67], loc: { - start: { column: 0, line: 3 }, - end: { column: 18, line: 3 }, + start: { column: 0, line: 5 }, + end: { column: 1, line: 6 }, }, }, ForOfStatement { @@ -266,10 +266,10 @@ exports[`AST Fixtures statement ForOfStatement expr-init AST Alignment - AST 1`] type: 'BlockStatement', body: Array [], - range: [86, 88], + range: [87, 90], loc: { - start: { column: 21, line: 4 }, - end: { column: 23, line: 4 }, + start: { column: 19, line: 7 }, + end: { column: 1, line: 8 }, }, }, left: TSAsExpression { @@ -280,10 +280,10 @@ exports[`AST Fixtures statement ForOfStatement expr-init AST Alignment - AST 1`] name: 'x', - optional: false, - range: [71, 72], + range: [73, 74], loc: { - start: { column: 6, line: 4 }, - end: { column: 7, line: 4 }, + start: { column: 5, line: 7 }, + end: { column: 6, line: 7 }, }, }, typeAnnotation: TSTypeReference { @@ -294,50 +294,50 @@ exports[`AST Fixtures statement ForOfStatement expr-init AST Alignment - AST 1`] name: 'T', - optional: false, - range: [76, 77], + range: [78, 79], loc: { - start: { column: 11, line: 4 }, - end: { column: 12, line: 4 }, + start: { column: 10, line: 7 }, + end: { column: 11, line: 7 }, }, }, - range: [76, 77], + range: [78, 79], loc: { - start: { column: 11, line: 4 }, - end: { column: 12, line: 4 }, + start: { column: 10, line: 7 }, + end: { column: 11, line: 7 }, }, }, - range: [71, 77], + range: [73, 79], loc: { - start: { column: 6, line: 4 }, - end: { column: 12, line: 4 }, + start: { column: 5, line: 7 }, + end: { column: 11, line: 7 }, }, }, right: ArrayExpression { type: 'ArrayExpression', elements: Array [], - range: [82, 84], + range: [83, 85], loc: { - start: { column: 17, line: 4 }, - end: { column: 19, line: 4 }, + start: { column: 15, line: 7 }, + end: { column: 17, line: 7 }, }, }, - range: [65, 88], + range: [68, 90], loc: { - start: { column: 0, line: 4 }, - end: { column: 23, line: 4 }, + start: { column: 0, line: 7 }, + end: { column: 1, line: 8 }, }, }, ], sourceType: 'script', - range: [0, 89], + range: [0, 91], loc: { start: { column: 0, line: 1 }, - end: { column: 0, line: 5 }, + end: { column: 0, line: 9 }, }, }" `; diff --git a/packages/ast-spec/src/statement/ForOfStatement/fixtures/using-declaration/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/statement/ForOfStatement/fixtures/using-declaration/snapshots/1-TSESTree-AST.shot index 0350eacaa598..a8833a1143cc 100644 --- a/packages/ast-spec/src/statement/ForOfStatement/fixtures/using-declaration/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/statement/ForOfStatement/fixtures/using-declaration/snapshots/1-TSESTree-AST.shot @@ -11,10 +11,10 @@ Program { type: "BlockStatement", body: [], - range: [25, 27], + range: [25, 28], loc: { start: { column: 25, line: 1 }, - end: { column: 27, line: 1 }, + end: { column: 1, line: 2 }, }, }, left: VariableDeclaration { @@ -66,19 +66,19 @@ Program { }, }, - range: [0, 27], + range: [0, 28], loc: { start: { column: 0, line: 1 }, - end: { column: 27, line: 1 }, + end: { column: 1, line: 2 }, }, }, ], sourceType: "script", - range: [0, 28], + range: [0, 29], loc: { start: { column: 0, line: 1 }, - end: { column: 0, line: 2 }, + end: { column: 0, line: 3 }, }, } `; diff --git a/packages/ast-spec/src/statement/ForOfStatement/fixtures/using-declaration/snapshots/2-TSESTree-Tokens.shot b/packages/ast-spec/src/statement/ForOfStatement/fixtures/using-declaration/snapshots/2-TSESTree-Tokens.shot index 9a3f59d0078d..269b9d63b9c5 100644 --- a/packages/ast-spec/src/statement/ForOfStatement/fixtures/using-declaration/snapshots/2-TSESTree-Tokens.shot +++ b/packages/ast-spec/src/statement/ForOfStatement/fixtures/using-declaration/snapshots/2-TSESTree-Tokens.shot @@ -96,10 +96,10 @@ exports[`AST Fixtures statement ForOfStatement using-declaration TSESTree - Toke type: "Punctuator", value: "}", - range: [26, 27], + range: [27, 28], loc: { - start: { column: 26, line: 1 }, - end: { column: 27, line: 1 }, + start: { column: 0, line: 2 }, + end: { column: 1, line: 2 }, }, }, ] diff --git a/packages/ast-spec/src/statement/ForOfStatement/fixtures/using-declaration/snapshots/3-Babel-AST.shot b/packages/ast-spec/src/statement/ForOfStatement/fixtures/using-declaration/snapshots/3-Babel-AST.shot index 477f5f417b07..cf1e05e9d78f 100644 --- a/packages/ast-spec/src/statement/ForOfStatement/fixtures/using-declaration/snapshots/3-Babel-AST.shot +++ b/packages/ast-spec/src/statement/ForOfStatement/fixtures/using-declaration/snapshots/3-Babel-AST.shot @@ -11,10 +11,10 @@ Program { type: "BlockStatement", body: [], - range: [25, 27], + range: [25, 28], loc: { start: { column: 25, line: 1 }, - end: { column: 27, line: 1 }, + end: { column: 1, line: 2 }, }, }, left: VariableDeclaration { @@ -60,19 +60,19 @@ Program { }, }, - range: [0, 27], + range: [0, 28], loc: { start: { column: 0, line: 1 }, - end: { column: 27, line: 1 }, + end: { column: 1, line: 2 }, }, }, ], sourceType: "script", - range: [0, 28], + range: [0, 29], loc: { start: { column: 0, line: 1 }, - end: { column: 0, line: 2 }, + end: { column: 0, line: 3 }, }, } `; diff --git a/packages/ast-spec/src/statement/ForOfStatement/fixtures/using-declaration/snapshots/4-Babel-Tokens.shot b/packages/ast-spec/src/statement/ForOfStatement/fixtures/using-declaration/snapshots/4-Babel-Tokens.shot index fd3d844dfc39..478f25c4eb8c 100644 --- a/packages/ast-spec/src/statement/ForOfStatement/fixtures/using-declaration/snapshots/4-Babel-Tokens.shot +++ b/packages/ast-spec/src/statement/ForOfStatement/fixtures/using-declaration/snapshots/4-Babel-Tokens.shot @@ -96,10 +96,10 @@ exports[`AST Fixtures statement ForOfStatement using-declaration Babel - Tokens type: "Punctuator", value: "}", - range: [26, 27], + range: [27, 28], loc: { - start: { column: 26, line: 1 }, - end: { column: 27, line: 1 }, + start: { column: 0, line: 2 }, + end: { column: 1, line: 2 }, }, }, ] diff --git a/packages/ast-spec/src/statement/ForOfStatement/fixtures/using-declaration/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/statement/ForOfStatement/fixtures/using-declaration/snapshots/5-AST-Alignment-AST.shot index 197c4c56bbe4..a82646dcaf32 100644 --- a/packages/ast-spec/src/statement/ForOfStatement/fixtures/using-declaration/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/statement/ForOfStatement/fixtures/using-declaration/snapshots/5-AST-Alignment-AST.shot @@ -15,10 +15,10 @@ exports[`AST Fixtures statement ForOfStatement using-declaration AST Alignment - type: 'BlockStatement', body: Array [], - range: [25, 27], + range: [25, 28], loc: { start: { column: 25, line: 1 }, - end: { column: 27, line: 1 }, + end: { column: 1, line: 2 }, }, }, left: VariableDeclaration { @@ -70,19 +70,19 @@ exports[`AST Fixtures statement ForOfStatement using-declaration AST Alignment - }, }, - range: [0, 27], + range: [0, 28], loc: { start: { column: 0, line: 1 }, - end: { column: 27, line: 1 }, + end: { column: 1, line: 2 }, }, }, ], sourceType: 'script', - range: [0, 28], + range: [0, 29], loc: { start: { column: 0, line: 1 }, - end: { column: 0, line: 2 }, + end: { column: 0, line: 3 }, }, }" `; From a088f9cefada5123531db68c14f31287cc27578c Mon Sep 17 00:00:00 2001 From: Joshua Chen Date: Fri, 19 Jul 2024 11:36:07 -0400 Subject: [PATCH 6/8] Add snapshot --- .../fixtures/_error_/decl-definite-using/fixture.ts | 1 + .../decl-definite-using/snapshots/1-TSESTree-Error.shot | 8 ++++++++ .../decl-definite-using/snapshots/2-Babel-Error.shot | 3 +++ .../decl-definite-using/snapshots/3-Alignment-Error.shot | 3 +++ .../ast-spec/tests/fixtures-with-differences-errors.shot | 1 + 5 files changed, 16 insertions(+) create mode 100644 packages/ast-spec/src/statement/ForOfStatement/fixtures/_error_/decl-definite-using/fixture.ts create mode 100644 packages/ast-spec/src/statement/ForOfStatement/fixtures/_error_/decl-definite-using/snapshots/1-TSESTree-Error.shot create mode 100644 packages/ast-spec/src/statement/ForOfStatement/fixtures/_error_/decl-definite-using/snapshots/2-Babel-Error.shot create mode 100644 packages/ast-spec/src/statement/ForOfStatement/fixtures/_error_/decl-definite-using/snapshots/3-Alignment-Error.shot diff --git a/packages/ast-spec/src/statement/ForOfStatement/fixtures/_error_/decl-definite-using/fixture.ts b/packages/ast-spec/src/statement/ForOfStatement/fixtures/_error_/decl-definite-using/fixture.ts new file mode 100644 index 000000000000..7f37bb8c8d89 --- /dev/null +++ b/packages/ast-spec/src/statement/ForOfStatement/fixtures/_error_/decl-definite-using/fixture.ts @@ -0,0 +1 @@ +for (using x! of []) {} diff --git a/packages/ast-spec/src/statement/ForOfStatement/fixtures/_error_/decl-definite-using/snapshots/1-TSESTree-Error.shot b/packages/ast-spec/src/statement/ForOfStatement/fixtures/_error_/decl-definite-using/snapshots/1-TSESTree-Error.shot new file mode 100644 index 000000000000..dd69f9363f3d --- /dev/null +++ b/packages/ast-spec/src/statement/ForOfStatement/fixtures/_error_/decl-definite-using/snapshots/1-TSESTree-Error.shot @@ -0,0 +1,8 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures statement ForOfStatement _error_ decl-definite-using TSESTree - Error 1`] = ` +"TSError +> 1 | for (using x! of []) {} + | ^ ',' expected. + 2 |" +`; diff --git a/packages/ast-spec/src/statement/ForOfStatement/fixtures/_error_/decl-definite-using/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/statement/ForOfStatement/fixtures/_error_/decl-definite-using/snapshots/2-Babel-Error.shot new file mode 100644 index 000000000000..c2d44975f3b7 --- /dev/null +++ b/packages/ast-spec/src/statement/ForOfStatement/fixtures/_error_/decl-definite-using/snapshots/2-Babel-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures statement ForOfStatement _error_ decl-definite-using Babel - Error 1`] = `"NO ERROR"`; diff --git a/packages/ast-spec/src/statement/ForOfStatement/fixtures/_error_/decl-definite-using/snapshots/3-Alignment-Error.shot b/packages/ast-spec/src/statement/ForOfStatement/fixtures/_error_/decl-definite-using/snapshots/3-Alignment-Error.shot new file mode 100644 index 000000000000..91d3427f2596 --- /dev/null +++ b/packages/ast-spec/src/statement/ForOfStatement/fixtures/_error_/decl-definite-using/snapshots/3-Alignment-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures statement ForOfStatement _error_ decl-definite-using Error Alignment 1`] = `"TSESTree errored but Babel didn't"`; diff --git a/packages/ast-spec/tests/fixtures-with-differences-errors.shot b/packages/ast-spec/tests/fixtures-with-differences-errors.shot index 6201b1b9663a..a641afd174c2 100644 --- a/packages/ast-spec/tests/fixtures-with-differences-errors.shot +++ b/packages/ast-spec/tests/fixtures-with-differences-errors.shot @@ -76,6 +76,7 @@ exports[`AST Fixtures List fixtures with Error differences 1`] = ` "element/AccessorProperty/fixtures/_error_/modifier-abstract-accessor-with-value/fixture.ts", "legacy-fixtures/basics/fixtures/_error_/abstract-class-with-abstract-constructor/fixture.ts", "legacy-fixtures/expressions/fixtures/_error_/instantiation-expression/fixture.ts", + "statement/ForOfStatement/fixtures/_error_/decl-definite-using/fixture.ts", "statement/ForOfStatement/fixtures/_error_/decl-definite/fixture.ts", "statement/ForOfStatement/fixtures/_error_/decl-type/fixture.ts", ], From d6d7404877662916eb6cf8515317e88bbf2a61c3 Mon Sep 17 00:00:00 2001 From: Joshua Chen Date: Fri, 19 Jul 2024 21:26:46 -0400 Subject: [PATCH 7/8] Add all parents --- packages/types/src/ts-estree.ts | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/packages/types/src/ts-estree.ts b/packages/types/src/ts-estree.ts index 464ff4dc620c..bab986dbf2df 100644 --- a/packages/types/src/ts-estree.ts +++ b/packages/types/src/ts-estree.ts @@ -20,6 +20,26 @@ declare module './generated/ast-spec' { interface AccessorPropertyNonComputedName { parent: TSESTree.ClassBody; } + + interface VariableDeclaratorDefiniteAssignment { + parent: TSESTree.VariableDeclaration; + } + + interface VariableDeclaratorMaybeInit { + parent: TSESTree.VariableDeclaration; + } + + interface VariableDeclaratorNoInit { + parent: TSESTree.VariableDeclaration; + } + + interface UsingInForOfDeclarator { + parent: TSESTree.VariableDeclaration; + } + + interface UsingInNormalContextDeclarator { + parent: TSESTree.VariableDeclaration; + } } export * as TSESTree from './generated/ast-spec'; From d765c760a903441aadb578f091e580e6375ad6e7 Mon Sep 17 00:00:00 2001 From: Joshua Chen Date: Fri, 19 Jul 2024 22:15:19 -0400 Subject: [PATCH 8/8] Fix lint --- .../eslint-plugin/src/rules/naming-convention.ts | 12 +++++------- packages/eslint-plugin/src/rules/no-shadow.ts | 4 ++-- .../eslint-plugin/src/rules/no-use-before-define.ts | 4 ++-- 3 files changed, 9 insertions(+), 11 deletions(-) diff --git a/packages/eslint-plugin/src/rules/naming-convention.ts b/packages/eslint-plugin/src/rules/naming-convention.ts index c5c36436bc2e..414d8801d666 100644 --- a/packages/eslint-plugin/src/rules/naming-convention.ts +++ b/packages/eslint-plugin/src/rules/naming-convention.ts @@ -276,14 +276,12 @@ export default createRule({ const baseModifiers = new Set(); const parent = node.parent; - if (parent.type === AST_NODE_TYPES.VariableDeclaration) { - if (parent.kind === 'const') { - baseModifiers.add(Modifiers.const); - } + if (parent.kind === 'const') { + baseModifiers.add(Modifiers.const); + } - if (isGlobal(context.sourceCode.getScope(node))) { - baseModifiers.add(Modifiers.global); - } + if (isGlobal(context.sourceCode.getScope(node))) { + baseModifiers.add(Modifiers.global); } identifiers.forEach(id => { diff --git a/packages/eslint-plugin/src/rules/no-shadow.ts b/packages/eslint-plugin/src/rules/no-shadow.ts index f66c21f6cdb1..e7a5d2fab546 100644 --- a/packages/eslint-plugin/src/rules/no-shadow.ts +++ b/packages/eslint-plugin/src/rules/no-shadow.ts @@ -421,8 +421,8 @@ export default createRule({ return true; } if ( - (node.parent.parent?.type === AST_NODE_TYPES.ForInStatement || - node.parent.parent?.type === AST_NODE_TYPES.ForOfStatement) && + (node.parent.parent.type === AST_NODE_TYPES.ForInStatement || + node.parent.parent.type === AST_NODE_TYPES.ForOfStatement) && isInRange(node.parent.parent.right, location) ) { return true; diff --git a/packages/eslint-plugin/src/rules/no-use-before-define.ts b/packages/eslint-plugin/src/rules/no-use-before-define.ts index d577773de9ef..9548917960a7 100644 --- a/packages/eslint-plugin/src/rules/no-use-before-define.ts +++ b/packages/eslint-plugin/src/rules/no-use-before-define.ts @@ -198,8 +198,8 @@ function isInInitializer( return true; } if ( - (node.parent.parent?.type === AST_NODE_TYPES.ForInStatement || - node.parent.parent?.type === AST_NODE_TYPES.ForOfStatement) && + (node.parent.parent.type === AST_NODE_TYPES.ForInStatement || + node.parent.parent.type === AST_NODE_TYPES.ForOfStatement) && isInRange(node.parent.parent.right, location) ) { return true;