From e6d672ffe94dd97ddefba7ab7defbc41c3378551 Mon Sep 17 00:00:00 2001 From: ntdiary <2471314@gmail.com> Date: Sun, 8 Jun 2025 15:56:29 +0800 Subject: [PATCH] change the token type of null from Keyword to Null --- .../snapshots/2-TSESTree-Tokens.shot | 4 ++-- .../snapshots/6-AST-Alignment-Tokens.shot | 6 ++---- .../snapshots/2-TSESTree-Tokens.shot | 12 ++++++------ .../snapshots/2-TSESTree-Tokens.shot | 4 ++-- .../snapshots/2-TSESTree-Tokens.shot | 4 ++-- .../snapshots/6-AST-Alignment-Tokens.shot | 6 ++---- .../snapshots/2-TSESTree-Tokens.shot | 4 ++-- .../snapshots/6-AST-Alignment-Tokens.shot | 6 ++---- .../nested-types/snapshots/2-TSESTree-Tokens.shot | 4 ++-- .../snapshots/2-TSESTree-Tokens.shot | 4 ++-- .../snapshots/6-AST-Alignment-Tokens.shot | 6 ++---- .../tests/fixtures-with-differences-tokens.shot | 3 --- packages/typescript-estree/src/node-utils.ts | 3 +++ 13 files changed, 29 insertions(+), 37 deletions(-) diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/null-and-undefined-type-annotations/snapshots/2-TSESTree-Tokens.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/null-and-undefined-type-annotations/snapshots/2-TSESTree-Tokens.shot index c0d2cc8c0600..d7da87a7a9d7 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/null-and-undefined-type-annotations/snapshots/2-TSESTree-Tokens.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/null-and-undefined-type-annotations/snapshots/2-TSESTree-Tokens.shot @@ -29,8 +29,8 @@ end: { column: 6, line: 3 }, }, }, - Keyword { - type: "Keyword", + Null { + type: "Null", value: "null", range: [80, 84], diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/null-and-undefined-type-annotations/snapshots/6-AST-Alignment-Tokens.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/null-and-undefined-type-annotations/snapshots/6-AST-Alignment-Tokens.shot index bfef506c822e..2fc7fb8f35c0 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/null-and-undefined-type-annotations/snapshots/6-AST-Alignment-Tokens.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/null-and-undefined-type-annotations/snapshots/6-AST-Alignment-Tokens.shot @@ -38,10 +38,8 @@ Snapshot Diff: end: { column: 6, line: 3 }, }, }, -- Keyword { -- type: 'Keyword', -+ Null { -+ type: 'Null', + Null { + type: 'Null', value: 'null', range: [80, 84], diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/object-with-escaped-properties/snapshots/2-TSESTree-Tokens.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/object-with-escaped-properties/snapshots/2-TSESTree-Tokens.shot index c79f24defb00..2449e4574bc0 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/object-with-escaped-properties/snapshots/2-TSESTree-Tokens.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/object-with-escaped-properties/snapshots/2-TSESTree-Tokens.shot @@ -39,8 +39,8 @@ end: { column: 6, line: 3 }, }, }, - Keyword { - type: "Keyword", + Null { + type: "Null", value: "null", range: [80, 84], @@ -239,8 +239,8 @@ end: { column: 10, line: 7 }, }, }, - Keyword { - type: "Keyword", + Null { + type: "Null", value: "null", range: [117, 121], @@ -329,8 +329,8 @@ end: { column: 8, line: 10 }, }, }, - Keyword { - type: "Keyword", + Null { + type: "Null", value: "null", range: [146, 150], diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/typed-keyword-null/snapshots/2-TSESTree-Tokens.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/typed-keyword-null/snapshots/2-TSESTree-Tokens.shot index f3c7150f41d1..fed3e2747887 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/typed-keyword-null/snapshots/2-TSESTree-Tokens.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/typed-keyword-null/snapshots/2-TSESTree-Tokens.shot @@ -29,8 +29,8 @@ end: { column: 10, line: 3 }, }, }, - Keyword { - type: "Keyword", + Null { + type: "Null", value: "null", range: [84, 88], diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/union-intersection/snapshots/2-TSESTree-Tokens.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/union-intersection/snapshots/2-TSESTree-Tokens.shot index d17773cf1d68..c5d1e3db16f5 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/union-intersection/snapshots/2-TSESTree-Tokens.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/union-intersection/snapshots/2-TSESTree-Tokens.shot @@ -49,8 +49,8 @@ end: { column: 19, line: 3 }, }, }, - Keyword { - type: "Keyword", + Null { + type: "Null", value: "null", range: [93, 97], diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/union-intersection/snapshots/6-AST-Alignment-Tokens.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/union-intersection/snapshots/6-AST-Alignment-Tokens.shot index d746756b46c1..1270fb2681e8 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/union-intersection/snapshots/6-AST-Alignment-Tokens.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/union-intersection/snapshots/6-AST-Alignment-Tokens.shot @@ -58,10 +58,8 @@ Snapshot Diff: end: { column: 19, line: 3 }, }, }, -- Keyword { -- type: 'Keyword', -+ Null { -+ type: 'Null', + Null { + type: 'Null', value: 'null', range: [93, 97], diff --git a/packages/ast-spec/src/legacy-fixtures/types/fixtures/conditional-with-null/snapshots/2-TSESTree-Tokens.shot b/packages/ast-spec/src/legacy-fixtures/types/fixtures/conditional-with-null/snapshots/2-TSESTree-Tokens.shot index 19f272b4f0a1..8e7e2549262f 100644 --- a/packages/ast-spec/src/legacy-fixtures/types/fixtures/conditional-with-null/snapshots/2-TSESTree-Tokens.shot +++ b/packages/ast-spec/src/legacy-fixtures/types/fixtures/conditional-with-null/snapshots/2-TSESTree-Tokens.shot @@ -89,8 +89,8 @@ end: { column: 40, line: 3 }, }, }, - Keyword { - type: "Keyword", + Null { + type: "Null", value: "null", range: [114, 118], diff --git a/packages/ast-spec/src/legacy-fixtures/types/fixtures/conditional-with-null/snapshots/6-AST-Alignment-Tokens.shot b/packages/ast-spec/src/legacy-fixtures/types/fixtures/conditional-with-null/snapshots/6-AST-Alignment-Tokens.shot index 56c8590cf6bb..56f0dedb193b 100644 --- a/packages/ast-spec/src/legacy-fixtures/types/fixtures/conditional-with-null/snapshots/6-AST-Alignment-Tokens.shot +++ b/packages/ast-spec/src/legacy-fixtures/types/fixtures/conditional-with-null/snapshots/6-AST-Alignment-Tokens.shot @@ -98,10 +98,8 @@ Snapshot Diff: end: { column: 40, line: 3 }, }, }, -- Keyword { -- type: 'Keyword', -+ Null { -+ type: 'Null', + Null { + type: 'Null', value: 'null', range: [114, 118], diff --git a/packages/ast-spec/src/legacy-fixtures/types/fixtures/nested-types/snapshots/2-TSESTree-Tokens.shot b/packages/ast-spec/src/legacy-fixtures/types/fixtures/nested-types/snapshots/2-TSESTree-Tokens.shot index a22433f5c8ca..f33dd4aed51b 100644 --- a/packages/ast-spec/src/legacy-fixtures/types/fixtures/nested-types/snapshots/2-TSESTree-Tokens.shot +++ b/packages/ast-spec/src/legacy-fixtures/types/fixtures/nested-types/snapshots/2-TSESTree-Tokens.shot @@ -249,8 +249,8 @@ end: { column: 23, line: 5 }, }, }, - Keyword { - type: "Keyword", + Null { + type: "Null", value: "null", range: [139, 143], diff --git a/packages/ast-spec/src/legacy-fixtures/types/fixtures/union-intersection/snapshots/2-TSESTree-Tokens.shot b/packages/ast-spec/src/legacy-fixtures/types/fixtures/union-intersection/snapshots/2-TSESTree-Tokens.shot index c5159511416e..547dd756f9d3 100644 --- a/packages/ast-spec/src/legacy-fixtures/types/fixtures/union-intersection/snapshots/2-TSESTree-Tokens.shot +++ b/packages/ast-spec/src/legacy-fixtures/types/fixtures/union-intersection/snapshots/2-TSESTree-Tokens.shot @@ -49,8 +49,8 @@ end: { column: 19, line: 3 }, }, }, - Keyword { - type: "Keyword", + Null { + type: "Null", value: "null", range: [93, 97], diff --git a/packages/ast-spec/src/legacy-fixtures/types/fixtures/union-intersection/snapshots/6-AST-Alignment-Tokens.shot b/packages/ast-spec/src/legacy-fixtures/types/fixtures/union-intersection/snapshots/6-AST-Alignment-Tokens.shot index f8ff003d5c8e..0f245d08a17f 100644 --- a/packages/ast-spec/src/legacy-fixtures/types/fixtures/union-intersection/snapshots/6-AST-Alignment-Tokens.shot +++ b/packages/ast-spec/src/legacy-fixtures/types/fixtures/union-intersection/snapshots/6-AST-Alignment-Tokens.shot @@ -58,10 +58,8 @@ Snapshot Diff: end: { column: 19, line: 3 }, }, }, -- Keyword { -- type: 'Keyword', -+ Null { -+ type: 'Null', + Null { + type: 'Null', value: 'null', range: [93, 97], diff --git a/packages/ast-spec/tests/fixtures-with-differences-tokens.shot b/packages/ast-spec/tests/fixtures-with-differences-tokens.shot index fc6544193cf1..6afa608f53fd 100644 --- a/packages/ast-spec/tests/fixtures-with-differences-tokens.shot +++ b/packages/ast-spec/tests/fixtures-with-differences-tokens.shot @@ -76,12 +76,10 @@ exports[`AST Fixtures > List fixtures with Token differences`] "legacy-fixtures/basics/fixtures/non-null-assertion-operator/fixture.ts", "legacy-fixtures/basics/fixtures/null-and-undefined-type-annotations/fixture.ts", "legacy-fixtures/basics/fixtures/nullish-coalescing/fixture.ts", - "legacy-fixtures/basics/fixtures/object-with-escaped-properties/fixture.ts", "legacy-fixtures/basics/fixtures/type-assertion-in-interface/fixture.ts", "legacy-fixtures/basics/fixtures/type-assertion-with-guard-in-interface/fixture.ts", "legacy-fixtures/basics/fixtures/type-guard-in-interface/fixture.ts", "legacy-fixtures/basics/fixtures/type-parameters-comments-heritage/fixture.ts", - "legacy-fixtures/basics/fixtures/typed-keyword-null/fixture.ts", "legacy-fixtures/basics/fixtures/typed-this/fixture.ts", "legacy-fixtures/basics/fixtures/union-intersection/fixture.ts", "legacy-fixtures/basics/fixtures/unknown-type-annotation/fixture.ts", @@ -111,7 +109,6 @@ exports[`AST Fixtures > List fixtures with Token differences`] "legacy-fixtures/types/fixtures/mapped-readonly/fixture.ts", "legacy-fixtures/types/fixtures/mapped-untypped/fixture.ts", "legacy-fixtures/types/fixtures/mapped/fixture.ts", - "legacy-fixtures/types/fixtures/nested-types/fixture.ts", "legacy-fixtures/types/fixtures/reference-generic-nested/fixture.ts", "legacy-fixtures/types/fixtures/reference-generic/fixture.ts", "legacy-fixtures/types/fixtures/reference/fixture.ts", diff --git a/packages/typescript-estree/src/node-utils.ts b/packages/typescript-estree/src/node-utils.ts index f2f60c777bd1..16054dfc9960 100644 --- a/packages/typescript-estree/src/node-utils.ts +++ b/packages/typescript-estree/src/node-utils.ts @@ -477,6 +477,9 @@ export function isChildUnwrappableOptionalChain( export function getTokenType( token: ts.Identifier | ts.Token, ): Exclude { + if (token.kind === SyntaxKind.NullKeyword) { + return AST_TOKEN_TYPES.Null; + } let keywordKind: ts.SyntaxKind | undefined; if (isAtLeast50 && token.kind === SyntaxKind.Identifier) { keywordKind = ts.identifierToKeywordKind(token as ts.Identifier); pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy