From be7a623dee0fd2c306580bbffad88865c84ce3b7 Mon Sep 17 00:00:00 2001 From: Sosuke Suzuki Date: Sun, 2 Oct 2022 18:28:26 +0900 Subject: [PATCH 01/20] feat: update typescript to 4.9.1 --- package.json | 4 ++-- yarn.lock | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/package.json b/package.json index 77e222ad7a8..ca2f8a48a26 100644 --- a/package.json +++ b/package.json @@ -104,10 +104,10 @@ "tmp": "^0.2.1", "ts-node": "^10.7.0", "tslint": "^6.1.3", - "typescript": ">=3.3.1 <4.9.0" + "typescript": ">=3.3.1 <4.8.3 || 4.9.1-beta" }, "resolutions": { - "typescript": "~4.8.3", + "typescript": "~4.9.1-beta", "@types/node": "^18.0.0", "//": "Pin jest to v29 across the repo", "@jest/create-cache-key-function": "^29", diff --git a/yarn.lock b/yarn.lock index 543fa9bbc68..44197b74548 100644 --- a/yarn.lock +++ b/yarn.lock @@ -13622,10 +13622,10 @@ typedarray@^0.0.6: resolved "https://registry.yarnpkg.com/typedarray/-/typedarray-0.0.6.tgz#867ac74e3864187b1d3d47d996a78ec5c8830777" integrity sha1-hnrHTjhkGHsdPUfZlqeOxciDB3c= -typescript@*, "typescript@>=3.3.1 <4.9.0", "typescript@^3 || ^4", typescript@next, typescript@~4.8.3, typescript@~4.8.4: - version "4.8.4" - resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.8.4.tgz#c464abca159669597be5f96b8943500b238e60e6" - integrity sha512-QCh+85mCy+h0IGff8r5XWzOVSbBO+KfeYrMQh7NJ58QujwcE22u+NUSmUxqF+un70P9GXKxa2HCNiTTMJknyjQ== +typescript@*, "typescript@>=3.3.1 <4.8.3 || 4.9.1-beta", "typescript@^3 || ^4", typescript@next, typescript@~4.8.4, typescript@~4.9.1-beta: + version "4.9.1-beta" + resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.9.1-beta.tgz#b5fe1b26f2fe3aeb14790927b25372bebf351c67" + integrity sha512-D4c0t1+sMOS5Hy8DQsGFfEYUuKzolXhf+7e/N0Td5etBPflEYzVwWLBrbVgHpLpLC53OJQCtxk31+NWO2SBPaA== ua-parser-js@^0.7.30: version "0.7.31" From 00882c29ccabdc25796b6332755a541741060837 Mon Sep 17 00:00:00 2001 From: Sosuke Suzuki Date: Sun, 2 Oct 2022 18:28:46 +0900 Subject: [PATCH 02/20] fix: add patch file for 4.9.1-beta --- ....8.3.patch => typescript+4.9.1-beta.patch} | 36 ++++++------------- 1 file changed, 11 insertions(+), 25 deletions(-) rename patches/{typescript+4.8.3.patch => typescript+4.9.1-beta.patch} (51%) diff --git a/patches/typescript+4.8.3.patch b/patches/typescript+4.9.1-beta.patch similarity index 51% rename from patches/typescript+4.8.3.patch rename to patches/typescript+4.9.1-beta.patch index a33162f7dec..574addc105f 100644 --- a/patches/typescript+4.8.3.patch +++ b/patches/typescript+4.9.1-beta.patch @@ -1,32 +1,18 @@ diff --git a/node_modules/typescript/lib/typescript.d.ts b/node_modules/typescript/lib/typescript.d.ts -index 0fd60ae..02f4fe7 100644 +index 0e6b255..92d7cf6 100644 --- a/node_modules/typescript/lib/typescript.d.ts +++ b/node_modules/typescript/lib/typescript.d.ts -@@ -425,8 +425,8 @@ declare namespace ts { - JSDocFunctionType = 317, - JSDocVariadicType = 318, - JSDocNamepathType = 319, +@@ -428,8 +428,8 @@ declare namespace ts { + JSDocFunctionType = 320, + JSDocVariadicType = 321, + JSDocNamepathType = 322, + /** @deprecated This was only added in 4.7 */ - JSDoc = 320, + JSDoc = 323, - /** @deprecated Use SyntaxKind.JSDoc */ - JSDocComment = 320, - JSDocText = 321, - JSDocTypeLiteral = 322, -@@ -4374,7 +4374,13 @@ declare namespace ts { - function symbolName(symbol: Symbol): string; - function getNameOfJSDocTypedef(declaration: JSDocTypedefTag): Identifier | PrivateIdentifier | undefined; - function getNameOfDeclaration(declaration: Declaration | Expression | undefined): DeclarationName | undefined; -+ /** -+ * @deprecated don't use this directly as it does not exist pre-4.8; instead use getModifiers from `@typescript-eslint/type-utils`. -+ */ - function getDecorators(node: HasDecorators): readonly Decorator[] | undefined; -+ /** -+ * @deprecated don't use this directly as it does not exist pre-4.8; instead use getDecorators from `@typescript-eslint/type-utils`. -+ */ - function getModifiers(node: HasModifiers): readonly Modifier[] | undefined; - /** - * Gets the JSDoc parameter tags for the node if present. -@@ -4834,7 +4840,13 @@ declare namespace ts { + JSDocComment = 323, + JSDocText = 324, + JSDocTypeLiteral = 325, +@@ -4857,7 +4857,13 @@ declare namespace ts { } declare namespace ts { function setTextRange(range: T, location: TextRange | undefined): T; @@ -40,7 +26,7 @@ index 0fd60ae..02f4fe7 100644 function canHaveDecorators(node: Node): node is HasDecorators; } declare namespace ts { -@@ -7924,7 +7936,7 @@ declare namespace ts { +@@ -7951,7 +7957,7 @@ declare namespace ts { * const decorators = ts.canHaveDecorators(node) ? ts.getDecorators(node) : undefined; * ``` */ From 692b86c1d5431da33dd87e5fed6e78e974c9178f Mon Sep 17 00:00:00 2001 From: Sosuke Suzuki Date: Sun, 2 Oct 2022 18:36:53 +0900 Subject: [PATCH 03/20] feat(typescript-estree): update version range --- .../typescript-estree/src/parseSettings/warnAboutTSVersion.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/typescript-estree/src/parseSettings/warnAboutTSVersion.ts b/packages/typescript-estree/src/parseSettings/warnAboutTSVersion.ts index 6bd890bdae9..b5dc97358e5 100644 --- a/packages/typescript-estree/src/parseSettings/warnAboutTSVersion.ts +++ b/packages/typescript-estree/src/parseSettings/warnAboutTSVersion.ts @@ -6,13 +6,13 @@ import type { ParseSettings } from './index'; * This needs to be kept in sync with the top-level README.md in the * typescript-eslint monorepo */ -const SUPPORTED_TYPESCRIPT_VERSIONS = '>=3.3.1 <4.9.0'; +const SUPPORTED_TYPESCRIPT_VERSIONS = '>=3.3.1 <5.0.0'; /* * The semver package will ignore prerelease ranges, and we don't want to explicitly document every one * List them all separately here, so we can automatically create the full string */ -const SUPPORTED_PRERELEASE_RANGES: string[] = []; +const SUPPORTED_PRERELEASE_RANGES: string[] = ['4.9.1-beta']; const ACTIVE_TYPESCRIPT_VERSION = ts.version; const isRunningSupportedTypeScriptVersion = semver.satisfies( ACTIVE_TYPESCRIPT_VERSION, From 7e68835dce6d416bcbf0461cfc1f1fd531e0ee22 Mon Sep 17 00:00:00 2001 From: Sosuke Suzuki Date: Sun, 2 Oct 2022 18:56:44 +0900 Subject: [PATCH 04/20] feat: run `generate-lib` script --- .../scope-manager/src/lib/dom.iterable.ts | 2 +- packages/scope-manager/src/lib/dom.ts | 20 ++++-- .../src/lib/es2015.collection.ts | 4 +- packages/scope-manager/src/lib/es2015.core.ts | 2 +- .../scope-manager/src/lib/es2015.generator.ts | 4 +- .../scope-manager/src/lib/es2015.iterable.ts | 4 +- .../scope-manager/src/lib/es2015.promise.ts | 2 +- .../scope-manager/src/lib/es2015.proxy.ts | 2 +- .../scope-manager/src/lib/es2015.reflect.ts | 2 +- .../scope-manager/src/lib/es2015.symbol.ts | 2 +- .../src/lib/es2015.symbol.wellknown.ts | 4 +- packages/scope-manager/src/lib/es2015.ts | 6 +- .../src/lib/es2016.array.include.ts | 2 +- packages/scope-manager/src/lib/es2016.full.ts | 8 +-- packages/scope-manager/src/lib/es2016.ts | 2 +- packages/scope-manager/src/lib/es2017.full.ts | 8 +-- packages/scope-manager/src/lib/es2017.intl.ts | 2 +- .../scope-manager/src/lib/es2017.object.ts | 2 +- .../src/lib/es2017.sharedmemory.ts | 4 +- .../scope-manager/src/lib/es2017.string.ts | 2 +- packages/scope-manager/src/lib/es2017.ts | 4 +- .../src/lib/es2017.typedarrays.ts | 2 +- .../src/lib/es2018.asyncgenerator.ts | 4 +- .../src/lib/es2018.asynciterable.ts | 6 +- packages/scope-manager/src/lib/es2018.full.ts | 8 +-- packages/scope-manager/src/lib/es2018.intl.ts | 2 +- .../scope-manager/src/lib/es2018.promise.ts | 2 +- .../scope-manager/src/lib/es2018.regexp.ts | 2 +- packages/scope-manager/src/lib/es2018.ts | 6 +- .../scope-manager/src/lib/es2019.array.ts | 2 +- packages/scope-manager/src/lib/es2019.full.ts | 8 +-- packages/scope-manager/src/lib/es2019.intl.ts | 11 ++++ .../scope-manager/src/lib/es2019.object.ts | 4 +- .../scope-manager/src/lib/es2019.string.ts | 2 +- .../scope-manager/src/lib/es2019.symbol.ts | 2 +- packages/scope-manager/src/lib/es2019.ts | 4 +- .../scope-manager/src/lib/es2020.bigint.ts | 4 +- packages/scope-manager/src/lib/es2020.date.ts | 4 +- packages/scope-manager/src/lib/es2020.full.ts | 8 +-- packages/scope-manager/src/lib/es2020.intl.ts | 4 +- .../scope-manager/src/lib/es2020.number.ts | 4 +- .../scope-manager/src/lib/es2020.promise.ts | 2 +- .../src/lib/es2020.sharedmemory.ts | 2 +- .../scope-manager/src/lib/es2020.string.ts | 4 +- .../src/lib/es2020.symbol.wellknown.ts | 4 +- packages/scope-manager/src/lib/es2020.ts | 4 +- packages/scope-manager/src/lib/es2021.full.ts | 8 +-- packages/scope-manager/src/lib/es2021.intl.ts | 2 +- .../scope-manager/src/lib/es2021.promise.ts | 4 +- .../scope-manager/src/lib/es2021.string.ts | 2 +- packages/scope-manager/src/lib/es2021.ts | 4 +- .../scope-manager/src/lib/es2021.weakref.ts | 4 +- .../scope-manager/src/lib/es2022.array.ts | 2 +- .../scope-manager/src/lib/es2022.error.ts | 2 +- packages/scope-manager/src/lib/es2022.full.ts | 8 +-- packages/scope-manager/src/lib/es2022.intl.ts | 2 +- .../scope-manager/src/lib/es2022.object.ts | 2 +- .../src/lib/es2022.sharedmemory.ts | 2 +- .../scope-manager/src/lib/es2022.string.ts | 2 +- packages/scope-manager/src/lib/es2022.ts | 2 +- packages/scope-manager/src/lib/es5.ts | 2 +- packages/scope-manager/src/lib/es6.ts | 6 +- packages/scope-manager/src/lib/es7.ts | 2 +- .../scope-manager/src/lib/esnext.array.ts | 2 +- .../src/lib/esnext.asynciterable.ts | 6 +- .../scope-manager/src/lib/esnext.bigint.ts | 4 +- packages/scope-manager/src/lib/esnext.full.ts | 8 +-- packages/scope-manager/src/lib/esnext.intl.ts | 2 +- .../scope-manager/src/lib/esnext.promise.ts | 4 +- .../scope-manager/src/lib/esnext.string.ts | 2 +- .../scope-manager/src/lib/esnext.symbol.ts | 2 +- packages/scope-manager/src/lib/esnext.ts | 2 +- .../scope-manager/src/lib/esnext.weakref.ts | 4 +- packages/scope-manager/src/lib/index.ts | 64 ++++++++++--------- packages/scope-manager/src/lib/lib.ts | 6 +- packages/scope-manager/src/lib/scripthost.ts | 4 +- .../src/lib/webworker.importscripts.ts | 2 +- .../src/lib/webworker.iterable.ts | 2 +- packages/scope-manager/src/lib/webworker.ts | 8 ++- packages/types/src/lib.ts | 1 + 80 files changed, 200 insertions(+), 172 deletions(-) create mode 100644 packages/scope-manager/src/lib/es2019.intl.ts diff --git a/packages/scope-manager/src/lib/dom.iterable.ts b/packages/scope-manager/src/lib/dom.iterable.ts index d294d684ddc..225c4f28b84 100644 --- a/packages/scope-manager/src/lib/dom.iterable.ts +++ b/packages/scope-manager/src/lib/dom.iterable.ts @@ -3,7 +3,7 @@ // RUN THE FOLLOWING COMMAND FROM THE WORKSPACE ROOT TO REGENERATE: // npx nx generate-lib @typescript-eslint/scope-manager -import type { ImplicitLibVariableOptions } from '../variable'; +import { ImplicitLibVariableOptions } from '../variable'; import { TYPE } from './base-config'; export const dom_iterable = { diff --git a/packages/scope-manager/src/lib/dom.ts b/packages/scope-manager/src/lib/dom.ts index dd8523bc66e..311dbe1db7e 100644 --- a/packages/scope-manager/src/lib/dom.ts +++ b/packages/scope-manager/src/lib/dom.ts @@ -3,7 +3,7 @@ // RUN THE FOLLOWING COMMAND FROM THE WORKSPACE ROOT TO REGENERATE: // npx nx generate-lib @typescript-eslint/scope-manager -import type { ImplicitLibVariableOptions } from '../variable'; +import { ImplicitLibVariableOptions } from '../variable'; import { TYPE, TYPE_VALUE } from './base-config'; export const dom = { @@ -66,7 +66,7 @@ export const dom = { DeviceMotionEventInit: TYPE, DeviceMotionEventRotationRateInit: TYPE, DeviceOrientationEventInit: TYPE, - DisplayMediaStreamConstraints: TYPE, + DisplayMediaStreamOptions: TYPE, DocumentTimelineOptions: TYPE, DoubleRange: TYPE, DragEventInit: TYPE, @@ -143,7 +143,6 @@ export const dom = { MediaMetadataInit: TYPE, MediaPositionState: TYPE, MediaQueryListEventInit: TYPE, - MediaRecorderErrorEventInit: TYPE, MediaRecorderOptions: TYPE, MediaSessionActionDetails: TYPE, MediaStreamAudioSourceOptions: TYPE, @@ -184,6 +183,7 @@ export const dom = { PeriodicWaveConstraints: TYPE, PeriodicWaveOptions: TYPE, PermissionDescriptor: TYPE, + PictureInPictureEventInit: TYPE, PointerEventInit: TYPE, PopStateEventInit: TYPE, PositionOptions: TYPE, @@ -243,6 +243,7 @@ export const dom = { RTCStats: TYPE, RTCTrackEventInit: TYPE, RTCTransportStats: TYPE, + ReadableStreamGetReaderOptions: TYPE, ReadableStreamReadDoneResult: TYPE, ReadableStreamReadValueResult: TYPE, ReadableWritablePair: TYPE, @@ -284,6 +285,8 @@ export const dom = { TransitionEventInit: TYPE, UIEventInit: TYPE, ULongRange: TYPE, + UnderlyingByteSource: TYPE, + UnderlyingDefaultSource: TYPE, UnderlyingSink: TYPE, UnderlyingSource: TYPE, ValidityStateFlags: TYPE, @@ -350,10 +353,13 @@ export const dom = { CSSConditionRule: TYPE_VALUE, CSSCounterStyleRule: TYPE_VALUE, CSSFontFaceRule: TYPE_VALUE, + CSSFontPaletteValuesRule: TYPE_VALUE, CSSGroupingRule: TYPE_VALUE, CSSImportRule: TYPE_VALUE, CSSKeyframeRule: TYPE_VALUE, CSSKeyframesRule: TYPE_VALUE, + CSSLayerBlockRule: TYPE_VALUE, + CSSLayerStatementRule: TYPE_VALUE, CSSMediaRule: TYPE_VALUE, CSSNamespaceRule: TYPE_VALUE, CSSPageRule: TYPE_VALUE, @@ -449,6 +455,7 @@ export const dom = { EXT_frag_depth: TYPE, EXT_sRGB: TYPE, EXT_shader_texture_lod: TYPE, + EXT_texture_compression_bptc: TYPE, EXT_texture_compression_rgtc: TYPE, EXT_texture_filter_anisotropic: TYPE, ElementEventMap: TYPE, @@ -641,7 +648,6 @@ export const dom = { MediaQueryListEvent: TYPE_VALUE, MediaRecorderEventMap: TYPE, MediaRecorder: TYPE_VALUE, - MediaRecorderErrorEvent: TYPE_VALUE, MediaSession: TYPE_VALUE, MediaSourceEventMap: TYPE, MediaSource: TYPE_VALUE, @@ -724,6 +730,7 @@ export const dom = { PermissionStatusEventMap: TYPE, PermissionStatus: TYPE_VALUE, Permissions: TYPE_VALUE, + PictureInPictureEvent: TYPE_VALUE, PictureInPictureWindowEventMap: TYPE, PictureInPictureWindow: TYPE_VALUE, Plugin: TYPE_VALUE, @@ -1123,8 +1130,6 @@ export const dom = { TimerHandler: TYPE, Transferable: TYPE, Uint32List: TYPE, - UvmEntries: TYPE, - UvmEntry: TYPE, VibratePattern: TYPE, WindowProxy: TYPE, XMLHttpRequestBodyInit: TYPE, @@ -1227,7 +1232,6 @@ export const dom = { RTCIceCandidateType: TYPE, RTCIceComponent: TYPE, RTCIceConnectionState: TYPE, - RTCIceCredentialType: TYPE, RTCIceGathererState: TYPE, RTCIceGatheringState: TYPE, RTCIceProtocol: TYPE, @@ -1243,6 +1247,8 @@ export const dom = { RTCSignalingState: TYPE, RTCStatsIceCandidatePairState: TYPE, RTCStatsType: TYPE, + ReadableStreamReaderMode: TYPE, + ReadableStreamType: TYPE, ReadyState: TYPE, RecordingState: TYPE, ReferrerPolicy: TYPE, diff --git a/packages/scope-manager/src/lib/es2015.collection.ts b/packages/scope-manager/src/lib/es2015.collection.ts index 51386ebcc74..98933f1c1fd 100644 --- a/packages/scope-manager/src/lib/es2015.collection.ts +++ b/packages/scope-manager/src/lib/es2015.collection.ts @@ -3,8 +3,8 @@ // RUN THE FOLLOWING COMMAND FROM THE WORKSPACE ROOT TO REGENERATE: // npx nx generate-lib @typescript-eslint/scope-manager -import type { ImplicitLibVariableOptions } from '../variable'; -import { TYPE, TYPE_VALUE } from './base-config'; +import { ImplicitLibVariableOptions } from '../variable'; +import { TYPE_VALUE, TYPE } from './base-config'; export const es2015_collection = { Map: TYPE_VALUE, diff --git a/packages/scope-manager/src/lib/es2015.core.ts b/packages/scope-manager/src/lib/es2015.core.ts index f9475d7db1d..ba44cf290b4 100644 --- a/packages/scope-manager/src/lib/es2015.core.ts +++ b/packages/scope-manager/src/lib/es2015.core.ts @@ -3,7 +3,7 @@ // RUN THE FOLLOWING COMMAND FROM THE WORKSPACE ROOT TO REGENERATE: // npx nx generate-lib @typescript-eslint/scope-manager -import type { ImplicitLibVariableOptions } from '../variable'; +import { ImplicitLibVariableOptions } from '../variable'; import { TYPE } from './base-config'; export const es2015_core = { diff --git a/packages/scope-manager/src/lib/es2015.generator.ts b/packages/scope-manager/src/lib/es2015.generator.ts index 90d26e1ea0d..f5dce9611ae 100644 --- a/packages/scope-manager/src/lib/es2015.generator.ts +++ b/packages/scope-manager/src/lib/es2015.generator.ts @@ -3,9 +3,9 @@ // RUN THE FOLLOWING COMMAND FROM THE WORKSPACE ROOT TO REGENERATE: // npx nx generate-lib @typescript-eslint/scope-manager -import type { ImplicitLibVariableOptions } from '../variable'; -import { TYPE } from './base-config'; +import { ImplicitLibVariableOptions } from '../variable'; import { es2015_iterable } from './es2015.iterable'; +import { TYPE } from './base-config'; export const es2015_generator = { ...es2015_iterable, diff --git a/packages/scope-manager/src/lib/es2015.iterable.ts b/packages/scope-manager/src/lib/es2015.iterable.ts index 2ab60a44b84..d27ab2efcc6 100644 --- a/packages/scope-manager/src/lib/es2015.iterable.ts +++ b/packages/scope-manager/src/lib/es2015.iterable.ts @@ -3,9 +3,9 @@ // RUN THE FOLLOWING COMMAND FROM THE WORKSPACE ROOT TO REGENERATE: // npx nx generate-lib @typescript-eslint/scope-manager -import type { ImplicitLibVariableOptions } from '../variable'; -import { TYPE } from './base-config'; +import { ImplicitLibVariableOptions } from '../variable'; import { es2015_symbol } from './es2015.symbol'; +import { TYPE } from './base-config'; export const es2015_iterable = { ...es2015_symbol, diff --git a/packages/scope-manager/src/lib/es2015.promise.ts b/packages/scope-manager/src/lib/es2015.promise.ts index a3896e0f46f..1334b2abca4 100644 --- a/packages/scope-manager/src/lib/es2015.promise.ts +++ b/packages/scope-manager/src/lib/es2015.promise.ts @@ -3,7 +3,7 @@ // RUN THE FOLLOWING COMMAND FROM THE WORKSPACE ROOT TO REGENERATE: // npx nx generate-lib @typescript-eslint/scope-manager -import type { ImplicitLibVariableOptions } from '../variable'; +import { ImplicitLibVariableOptions } from '../variable'; import { TYPE } from './base-config'; export const es2015_promise = { diff --git a/packages/scope-manager/src/lib/es2015.proxy.ts b/packages/scope-manager/src/lib/es2015.proxy.ts index 2dbc6e22263..d2c0d9b6616 100644 --- a/packages/scope-manager/src/lib/es2015.proxy.ts +++ b/packages/scope-manager/src/lib/es2015.proxy.ts @@ -3,7 +3,7 @@ // RUN THE FOLLOWING COMMAND FROM THE WORKSPACE ROOT TO REGENERATE: // npx nx generate-lib @typescript-eslint/scope-manager -import type { ImplicitLibVariableOptions } from '../variable'; +import { ImplicitLibVariableOptions } from '../variable'; import { TYPE } from './base-config'; export const es2015_proxy = { diff --git a/packages/scope-manager/src/lib/es2015.reflect.ts b/packages/scope-manager/src/lib/es2015.reflect.ts index dcc2a5d910b..4a71e4b9def 100644 --- a/packages/scope-manager/src/lib/es2015.reflect.ts +++ b/packages/scope-manager/src/lib/es2015.reflect.ts @@ -3,7 +3,7 @@ // RUN THE FOLLOWING COMMAND FROM THE WORKSPACE ROOT TO REGENERATE: // npx nx generate-lib @typescript-eslint/scope-manager -import type { ImplicitLibVariableOptions } from '../variable'; +import { ImplicitLibVariableOptions } from '../variable'; import { TYPE_VALUE } from './base-config'; export const es2015_reflect = { diff --git a/packages/scope-manager/src/lib/es2015.symbol.ts b/packages/scope-manager/src/lib/es2015.symbol.ts index eef09036f87..c027cae3b38 100644 --- a/packages/scope-manager/src/lib/es2015.symbol.ts +++ b/packages/scope-manager/src/lib/es2015.symbol.ts @@ -3,7 +3,7 @@ // RUN THE FOLLOWING COMMAND FROM THE WORKSPACE ROOT TO REGENERATE: // npx nx generate-lib @typescript-eslint/scope-manager -import type { ImplicitLibVariableOptions } from '../variable'; +import { ImplicitLibVariableOptions } from '../variable'; import { TYPE } from './base-config'; export const es2015_symbol = { diff --git a/packages/scope-manager/src/lib/es2015.symbol.wellknown.ts b/packages/scope-manager/src/lib/es2015.symbol.wellknown.ts index 94fd4ac4e70..16d88e5ca57 100644 --- a/packages/scope-manager/src/lib/es2015.symbol.wellknown.ts +++ b/packages/scope-manager/src/lib/es2015.symbol.wellknown.ts @@ -3,9 +3,9 @@ // RUN THE FOLLOWING COMMAND FROM THE WORKSPACE ROOT TO REGENERATE: // npx nx generate-lib @typescript-eslint/scope-manager -import type { ImplicitLibVariableOptions } from '../variable'; -import { TYPE } from './base-config'; +import { ImplicitLibVariableOptions } from '../variable'; import { es2015_symbol } from './es2015.symbol'; +import { TYPE } from './base-config'; export const es2015_symbol_wellknown = { ...es2015_symbol, diff --git a/packages/scope-manager/src/lib/es2015.ts b/packages/scope-manager/src/lib/es2015.ts index f6a8aa8ab73..9e225bddb33 100644 --- a/packages/scope-manager/src/lib/es2015.ts +++ b/packages/scope-manager/src/lib/es2015.ts @@ -3,12 +3,12 @@ // RUN THE FOLLOWING COMMAND FROM THE WORKSPACE ROOT TO REGENERATE: // npx nx generate-lib @typescript-eslint/scope-manager -import type { ImplicitLibVariableOptions } from '../variable'; +import { ImplicitLibVariableOptions } from '../variable'; import { es5 } from './es5'; -import { es2015_collection } from './es2015.collection'; import { es2015_core } from './es2015.core'; -import { es2015_generator } from './es2015.generator'; +import { es2015_collection } from './es2015.collection'; import { es2015_iterable } from './es2015.iterable'; +import { es2015_generator } from './es2015.generator'; import { es2015_promise } from './es2015.promise'; import { es2015_proxy } from './es2015.proxy'; import { es2015_reflect } from './es2015.reflect'; diff --git a/packages/scope-manager/src/lib/es2016.array.include.ts b/packages/scope-manager/src/lib/es2016.array.include.ts index 17c927bd467..7cab0a4c84d 100644 --- a/packages/scope-manager/src/lib/es2016.array.include.ts +++ b/packages/scope-manager/src/lib/es2016.array.include.ts @@ -3,7 +3,7 @@ // RUN THE FOLLOWING COMMAND FROM THE WORKSPACE ROOT TO REGENERATE: // npx nx generate-lib @typescript-eslint/scope-manager -import type { ImplicitLibVariableOptions } from '../variable'; +import { ImplicitLibVariableOptions } from '../variable'; import { TYPE } from './base-config'; export const es2016_array_include = { diff --git a/packages/scope-manager/src/lib/es2016.full.ts b/packages/scope-manager/src/lib/es2016.full.ts index e7fb9802cb7..cfc4632c7da 100644 --- a/packages/scope-manager/src/lib/es2016.full.ts +++ b/packages/scope-manager/src/lib/es2016.full.ts @@ -3,12 +3,12 @@ // RUN THE FOLLOWING COMMAND FROM THE WORKSPACE ROOT TO REGENERATE: // npx nx generate-lib @typescript-eslint/scope-manager -import type { ImplicitLibVariableOptions } from '../variable'; -import { dom } from './dom'; -import { dom_iterable } from './dom.iterable'; +import { ImplicitLibVariableOptions } from '../variable'; import { es2016 } from './es2016'; -import { scripthost } from './scripthost'; +import { dom } from './dom'; import { webworker_importscripts } from './webworker.importscripts'; +import { scripthost } from './scripthost'; +import { dom_iterable } from './dom.iterable'; export const es2016_full = { ...es2016, diff --git a/packages/scope-manager/src/lib/es2016.ts b/packages/scope-manager/src/lib/es2016.ts index f00abac6c4f..f4ac61374c3 100644 --- a/packages/scope-manager/src/lib/es2016.ts +++ b/packages/scope-manager/src/lib/es2016.ts @@ -3,7 +3,7 @@ // RUN THE FOLLOWING COMMAND FROM THE WORKSPACE ROOT TO REGENERATE: // npx nx generate-lib @typescript-eslint/scope-manager -import type { ImplicitLibVariableOptions } from '../variable'; +import { ImplicitLibVariableOptions } from '../variable'; import { es2015 } from './es2015'; import { es2016_array_include } from './es2016.array.include'; diff --git a/packages/scope-manager/src/lib/es2017.full.ts b/packages/scope-manager/src/lib/es2017.full.ts index a1d8c386bb4..26d2c2b1f8c 100644 --- a/packages/scope-manager/src/lib/es2017.full.ts +++ b/packages/scope-manager/src/lib/es2017.full.ts @@ -3,12 +3,12 @@ // RUN THE FOLLOWING COMMAND FROM THE WORKSPACE ROOT TO REGENERATE: // npx nx generate-lib @typescript-eslint/scope-manager -import type { ImplicitLibVariableOptions } from '../variable'; -import { dom } from './dom'; -import { dom_iterable } from './dom.iterable'; +import { ImplicitLibVariableOptions } from '../variable'; import { es2017 } from './es2017'; -import { scripthost } from './scripthost'; +import { dom } from './dom'; import { webworker_importscripts } from './webworker.importscripts'; +import { scripthost } from './scripthost'; +import { dom_iterable } from './dom.iterable'; export const es2017_full = { ...es2017, diff --git a/packages/scope-manager/src/lib/es2017.intl.ts b/packages/scope-manager/src/lib/es2017.intl.ts index b8f1325672e..48e7fe21715 100644 --- a/packages/scope-manager/src/lib/es2017.intl.ts +++ b/packages/scope-manager/src/lib/es2017.intl.ts @@ -3,7 +3,7 @@ // RUN THE FOLLOWING COMMAND FROM THE WORKSPACE ROOT TO REGENERATE: // npx nx generate-lib @typescript-eslint/scope-manager -import type { ImplicitLibVariableOptions } from '../variable'; +import { ImplicitLibVariableOptions } from '../variable'; import { TYPE_VALUE } from './base-config'; export const es2017_intl = { diff --git a/packages/scope-manager/src/lib/es2017.object.ts b/packages/scope-manager/src/lib/es2017.object.ts index 66bea4e7d3f..17344ec6591 100644 --- a/packages/scope-manager/src/lib/es2017.object.ts +++ b/packages/scope-manager/src/lib/es2017.object.ts @@ -3,7 +3,7 @@ // RUN THE FOLLOWING COMMAND FROM THE WORKSPACE ROOT TO REGENERATE: // npx nx generate-lib @typescript-eslint/scope-manager -import type { ImplicitLibVariableOptions } from '../variable'; +import { ImplicitLibVariableOptions } from '../variable'; import { TYPE } from './base-config'; export const es2017_object = { diff --git a/packages/scope-manager/src/lib/es2017.sharedmemory.ts b/packages/scope-manager/src/lib/es2017.sharedmemory.ts index 998d41493fd..d5f3c8970b2 100644 --- a/packages/scope-manager/src/lib/es2017.sharedmemory.ts +++ b/packages/scope-manager/src/lib/es2017.sharedmemory.ts @@ -3,10 +3,10 @@ // RUN THE FOLLOWING COMMAND FROM THE WORKSPACE ROOT TO REGENERATE: // npx nx generate-lib @typescript-eslint/scope-manager -import type { ImplicitLibVariableOptions } from '../variable'; -import { TYPE, TYPE_VALUE } from './base-config'; +import { ImplicitLibVariableOptions } from '../variable'; import { es2015_symbol } from './es2015.symbol'; import { es2015_symbol_wellknown } from './es2015.symbol.wellknown'; +import { TYPE_VALUE, TYPE } from './base-config'; export const es2017_sharedmemory = { ...es2015_symbol, diff --git a/packages/scope-manager/src/lib/es2017.string.ts b/packages/scope-manager/src/lib/es2017.string.ts index 64ec52f3074..8ca832f3cf8 100644 --- a/packages/scope-manager/src/lib/es2017.string.ts +++ b/packages/scope-manager/src/lib/es2017.string.ts @@ -3,7 +3,7 @@ // RUN THE FOLLOWING COMMAND FROM THE WORKSPACE ROOT TO REGENERATE: // npx nx generate-lib @typescript-eslint/scope-manager -import type { ImplicitLibVariableOptions } from '../variable'; +import { ImplicitLibVariableOptions } from '../variable'; import { TYPE } from './base-config'; export const es2017_string = { diff --git a/packages/scope-manager/src/lib/es2017.ts b/packages/scope-manager/src/lib/es2017.ts index 3cbafd35b16..c28a0b45236 100644 --- a/packages/scope-manager/src/lib/es2017.ts +++ b/packages/scope-manager/src/lib/es2017.ts @@ -3,12 +3,12 @@ // RUN THE FOLLOWING COMMAND FROM THE WORKSPACE ROOT TO REGENERATE: // npx nx generate-lib @typescript-eslint/scope-manager -import type { ImplicitLibVariableOptions } from '../variable'; +import { ImplicitLibVariableOptions } from '../variable'; import { es2016 } from './es2016'; -import { es2017_intl } from './es2017.intl'; import { es2017_object } from './es2017.object'; import { es2017_sharedmemory } from './es2017.sharedmemory'; import { es2017_string } from './es2017.string'; +import { es2017_intl } from './es2017.intl'; import { es2017_typedarrays } from './es2017.typedarrays'; export const es2017 = { diff --git a/packages/scope-manager/src/lib/es2017.typedarrays.ts b/packages/scope-manager/src/lib/es2017.typedarrays.ts index 8fdb9a96281..0c9a43160b8 100644 --- a/packages/scope-manager/src/lib/es2017.typedarrays.ts +++ b/packages/scope-manager/src/lib/es2017.typedarrays.ts @@ -3,7 +3,7 @@ // RUN THE FOLLOWING COMMAND FROM THE WORKSPACE ROOT TO REGENERATE: // npx nx generate-lib @typescript-eslint/scope-manager -import type { ImplicitLibVariableOptions } from '../variable'; +import { ImplicitLibVariableOptions } from '../variable'; import { TYPE } from './base-config'; export const es2017_typedarrays = { diff --git a/packages/scope-manager/src/lib/es2018.asyncgenerator.ts b/packages/scope-manager/src/lib/es2018.asyncgenerator.ts index 5af8bd0a663..68f67bd6483 100644 --- a/packages/scope-manager/src/lib/es2018.asyncgenerator.ts +++ b/packages/scope-manager/src/lib/es2018.asyncgenerator.ts @@ -3,9 +3,9 @@ // RUN THE FOLLOWING COMMAND FROM THE WORKSPACE ROOT TO REGENERATE: // npx nx generate-lib @typescript-eslint/scope-manager -import type { ImplicitLibVariableOptions } from '../variable'; -import { TYPE } from './base-config'; +import { ImplicitLibVariableOptions } from '../variable'; import { es2018_asynciterable } from './es2018.asynciterable'; +import { TYPE } from './base-config'; export const es2018_asyncgenerator = { ...es2018_asynciterable, diff --git a/packages/scope-manager/src/lib/es2018.asynciterable.ts b/packages/scope-manager/src/lib/es2018.asynciterable.ts index 5d4e373ef76..ce4aebafb0d 100644 --- a/packages/scope-manager/src/lib/es2018.asynciterable.ts +++ b/packages/scope-manager/src/lib/es2018.asynciterable.ts @@ -3,10 +3,10 @@ // RUN THE FOLLOWING COMMAND FROM THE WORKSPACE ROOT TO REGENERATE: // npx nx generate-lib @typescript-eslint/scope-manager -import type { ImplicitLibVariableOptions } from '../variable'; -import { TYPE } from './base-config'; -import { es2015_iterable } from './es2015.iterable'; +import { ImplicitLibVariableOptions } from '../variable'; import { es2015_symbol } from './es2015.symbol'; +import { es2015_iterable } from './es2015.iterable'; +import { TYPE } from './base-config'; export const es2018_asynciterable = { ...es2015_symbol, diff --git a/packages/scope-manager/src/lib/es2018.full.ts b/packages/scope-manager/src/lib/es2018.full.ts index 802e30c6659..8e0ab3621f2 100644 --- a/packages/scope-manager/src/lib/es2018.full.ts +++ b/packages/scope-manager/src/lib/es2018.full.ts @@ -3,12 +3,12 @@ // RUN THE FOLLOWING COMMAND FROM THE WORKSPACE ROOT TO REGENERATE: // npx nx generate-lib @typescript-eslint/scope-manager -import type { ImplicitLibVariableOptions } from '../variable'; -import { dom } from './dom'; -import { dom_iterable } from './dom.iterable'; +import { ImplicitLibVariableOptions } from '../variable'; import { es2018 } from './es2018'; -import { scripthost } from './scripthost'; +import { dom } from './dom'; import { webworker_importscripts } from './webworker.importscripts'; +import { scripthost } from './scripthost'; +import { dom_iterable } from './dom.iterable'; export const es2018_full = { ...es2018, diff --git a/packages/scope-manager/src/lib/es2018.intl.ts b/packages/scope-manager/src/lib/es2018.intl.ts index 9736c0ba48a..8496761b2d2 100644 --- a/packages/scope-manager/src/lib/es2018.intl.ts +++ b/packages/scope-manager/src/lib/es2018.intl.ts @@ -3,7 +3,7 @@ // RUN THE FOLLOWING COMMAND FROM THE WORKSPACE ROOT TO REGENERATE: // npx nx generate-lib @typescript-eslint/scope-manager -import type { ImplicitLibVariableOptions } from '../variable'; +import { ImplicitLibVariableOptions } from '../variable'; import { TYPE_VALUE } from './base-config'; export const es2018_intl = { diff --git a/packages/scope-manager/src/lib/es2018.promise.ts b/packages/scope-manager/src/lib/es2018.promise.ts index ac1e02d8a05..cc74f3b02b8 100644 --- a/packages/scope-manager/src/lib/es2018.promise.ts +++ b/packages/scope-manager/src/lib/es2018.promise.ts @@ -3,7 +3,7 @@ // RUN THE FOLLOWING COMMAND FROM THE WORKSPACE ROOT TO REGENERATE: // npx nx generate-lib @typescript-eslint/scope-manager -import type { ImplicitLibVariableOptions } from '../variable'; +import { ImplicitLibVariableOptions } from '../variable'; import { TYPE } from './base-config'; export const es2018_promise = { diff --git a/packages/scope-manager/src/lib/es2018.regexp.ts b/packages/scope-manager/src/lib/es2018.regexp.ts index 0fdf10f793a..7c1ca120117 100644 --- a/packages/scope-manager/src/lib/es2018.regexp.ts +++ b/packages/scope-manager/src/lib/es2018.regexp.ts @@ -3,7 +3,7 @@ // RUN THE FOLLOWING COMMAND FROM THE WORKSPACE ROOT TO REGENERATE: // npx nx generate-lib @typescript-eslint/scope-manager -import type { ImplicitLibVariableOptions } from '../variable'; +import { ImplicitLibVariableOptions } from '../variable'; import { TYPE } from './base-config'; export const es2018_regexp = { diff --git a/packages/scope-manager/src/lib/es2018.ts b/packages/scope-manager/src/lib/es2018.ts index d79390a3b87..a3b3fbe508c 100644 --- a/packages/scope-manager/src/lib/es2018.ts +++ b/packages/scope-manager/src/lib/es2018.ts @@ -3,13 +3,13 @@ // RUN THE FOLLOWING COMMAND FROM THE WORKSPACE ROOT TO REGENERATE: // npx nx generate-lib @typescript-eslint/scope-manager -import type { ImplicitLibVariableOptions } from '../variable'; +import { ImplicitLibVariableOptions } from '../variable'; import { es2017 } from './es2017'; -import { es2018_asyncgenerator } from './es2018.asyncgenerator'; import { es2018_asynciterable } from './es2018.asynciterable'; -import { es2018_intl } from './es2018.intl'; +import { es2018_asyncgenerator } from './es2018.asyncgenerator'; import { es2018_promise } from './es2018.promise'; import { es2018_regexp } from './es2018.regexp'; +import { es2018_intl } from './es2018.intl'; export const es2018 = { ...es2017, diff --git a/packages/scope-manager/src/lib/es2019.array.ts b/packages/scope-manager/src/lib/es2019.array.ts index b682bb04457..6d814131f52 100644 --- a/packages/scope-manager/src/lib/es2019.array.ts +++ b/packages/scope-manager/src/lib/es2019.array.ts @@ -3,7 +3,7 @@ // RUN THE FOLLOWING COMMAND FROM THE WORKSPACE ROOT TO REGENERATE: // npx nx generate-lib @typescript-eslint/scope-manager -import type { ImplicitLibVariableOptions } from '../variable'; +import { ImplicitLibVariableOptions } from '../variable'; import { TYPE } from './base-config'; export const es2019_array = { diff --git a/packages/scope-manager/src/lib/es2019.full.ts b/packages/scope-manager/src/lib/es2019.full.ts index 8cee3178bc6..a97c713f5a0 100644 --- a/packages/scope-manager/src/lib/es2019.full.ts +++ b/packages/scope-manager/src/lib/es2019.full.ts @@ -3,12 +3,12 @@ // RUN THE FOLLOWING COMMAND FROM THE WORKSPACE ROOT TO REGENERATE: // npx nx generate-lib @typescript-eslint/scope-manager -import type { ImplicitLibVariableOptions } from '../variable'; -import { dom } from './dom'; -import { dom_iterable } from './dom.iterable'; +import { ImplicitLibVariableOptions } from '../variable'; import { es2019 } from './es2019'; -import { scripthost } from './scripthost'; +import { dom } from './dom'; import { webworker_importscripts } from './webworker.importscripts'; +import { scripthost } from './scripthost'; +import { dom_iterable } from './dom.iterable'; export const es2019_full = { ...es2019, diff --git a/packages/scope-manager/src/lib/es2019.intl.ts b/packages/scope-manager/src/lib/es2019.intl.ts new file mode 100644 index 00000000000..8e44ef6d0cd --- /dev/null +++ b/packages/scope-manager/src/lib/es2019.intl.ts @@ -0,0 +1,11 @@ +// THIS CODE WAS AUTOMATICALLY GENERATED +// DO NOT EDIT THIS CODE BY HAND +// RUN THE FOLLOWING COMMAND FROM THE WORKSPACE ROOT TO REGENERATE: +// npx nx generate-lib @typescript-eslint/scope-manager + +import { ImplicitLibVariableOptions } from '../variable'; +import { TYPE_VALUE } from './base-config'; + +export const es2019_intl = { + Intl: TYPE_VALUE, +} as Record; diff --git a/packages/scope-manager/src/lib/es2019.object.ts b/packages/scope-manager/src/lib/es2019.object.ts index f1f113ed54d..87f3bb33f45 100644 --- a/packages/scope-manager/src/lib/es2019.object.ts +++ b/packages/scope-manager/src/lib/es2019.object.ts @@ -3,9 +3,9 @@ // RUN THE FOLLOWING COMMAND FROM THE WORKSPACE ROOT TO REGENERATE: // npx nx generate-lib @typescript-eslint/scope-manager -import type { ImplicitLibVariableOptions } from '../variable'; -import { TYPE } from './base-config'; +import { ImplicitLibVariableOptions } from '../variable'; import { es2015_iterable } from './es2015.iterable'; +import { TYPE } from './base-config'; export const es2019_object = { ...es2015_iterable, diff --git a/packages/scope-manager/src/lib/es2019.string.ts b/packages/scope-manager/src/lib/es2019.string.ts index eae2a44d376..af1f1f8f2b5 100644 --- a/packages/scope-manager/src/lib/es2019.string.ts +++ b/packages/scope-manager/src/lib/es2019.string.ts @@ -3,7 +3,7 @@ // RUN THE FOLLOWING COMMAND FROM THE WORKSPACE ROOT TO REGENERATE: // npx nx generate-lib @typescript-eslint/scope-manager -import type { ImplicitLibVariableOptions } from '../variable'; +import { ImplicitLibVariableOptions } from '../variable'; import { TYPE } from './base-config'; export const es2019_string = { diff --git a/packages/scope-manager/src/lib/es2019.symbol.ts b/packages/scope-manager/src/lib/es2019.symbol.ts index b39b41add7a..5c8a1fd2894 100644 --- a/packages/scope-manager/src/lib/es2019.symbol.ts +++ b/packages/scope-manager/src/lib/es2019.symbol.ts @@ -3,7 +3,7 @@ // RUN THE FOLLOWING COMMAND FROM THE WORKSPACE ROOT TO REGENERATE: // npx nx generate-lib @typescript-eslint/scope-manager -import type { ImplicitLibVariableOptions } from '../variable'; +import { ImplicitLibVariableOptions } from '../variable'; import { TYPE } from './base-config'; export const es2019_symbol = { diff --git a/packages/scope-manager/src/lib/es2019.ts b/packages/scope-manager/src/lib/es2019.ts index 43e55a27a3a..e41e53c1524 100644 --- a/packages/scope-manager/src/lib/es2019.ts +++ b/packages/scope-manager/src/lib/es2019.ts @@ -3,12 +3,13 @@ // RUN THE FOLLOWING COMMAND FROM THE WORKSPACE ROOT TO REGENERATE: // npx nx generate-lib @typescript-eslint/scope-manager -import type { ImplicitLibVariableOptions } from '../variable'; +import { ImplicitLibVariableOptions } from '../variable'; import { es2018 } from './es2018'; import { es2019_array } from './es2019.array'; import { es2019_object } from './es2019.object'; import { es2019_string } from './es2019.string'; import { es2019_symbol } from './es2019.symbol'; +import { es2019_intl } from './es2019.intl'; export const es2019 = { ...es2018, @@ -16,4 +17,5 @@ export const es2019 = { ...es2019_object, ...es2019_string, ...es2019_symbol, + ...es2019_intl, } as Record; diff --git a/packages/scope-manager/src/lib/es2020.bigint.ts b/packages/scope-manager/src/lib/es2020.bigint.ts index 52fbba1ca2e..3444dc701a2 100644 --- a/packages/scope-manager/src/lib/es2020.bigint.ts +++ b/packages/scope-manager/src/lib/es2020.bigint.ts @@ -3,9 +3,9 @@ // RUN THE FOLLOWING COMMAND FROM THE WORKSPACE ROOT TO REGENERATE: // npx nx generate-lib @typescript-eslint/scope-manager -import type { ImplicitLibVariableOptions } from '../variable'; -import { TYPE, TYPE_VALUE } from './base-config'; +import { ImplicitLibVariableOptions } from '../variable'; import { es2020_intl } from './es2020.intl'; +import { TYPE, TYPE_VALUE } from './base-config'; export const es2020_bigint = { ...es2020_intl, diff --git a/packages/scope-manager/src/lib/es2020.date.ts b/packages/scope-manager/src/lib/es2020.date.ts index b4c3d319deb..1a5ed0d23f3 100644 --- a/packages/scope-manager/src/lib/es2020.date.ts +++ b/packages/scope-manager/src/lib/es2020.date.ts @@ -3,9 +3,9 @@ // RUN THE FOLLOWING COMMAND FROM THE WORKSPACE ROOT TO REGENERATE: // npx nx generate-lib @typescript-eslint/scope-manager -import type { ImplicitLibVariableOptions } from '../variable'; -import { TYPE } from './base-config'; +import { ImplicitLibVariableOptions } from '../variable'; import { es2020_intl } from './es2020.intl'; +import { TYPE } from './base-config'; export const es2020_date = { ...es2020_intl, diff --git a/packages/scope-manager/src/lib/es2020.full.ts b/packages/scope-manager/src/lib/es2020.full.ts index 1de20eaecc4..6467ba7818d 100644 --- a/packages/scope-manager/src/lib/es2020.full.ts +++ b/packages/scope-manager/src/lib/es2020.full.ts @@ -3,12 +3,12 @@ // RUN THE FOLLOWING COMMAND FROM THE WORKSPACE ROOT TO REGENERATE: // npx nx generate-lib @typescript-eslint/scope-manager -import type { ImplicitLibVariableOptions } from '../variable'; -import { dom } from './dom'; -import { dom_iterable } from './dom.iterable'; +import { ImplicitLibVariableOptions } from '../variable'; import { es2020 } from './es2020'; -import { scripthost } from './scripthost'; +import { dom } from './dom'; import { webworker_importscripts } from './webworker.importscripts'; +import { scripthost } from './scripthost'; +import { dom_iterable } from './dom.iterable'; export const es2020_full = { ...es2020, diff --git a/packages/scope-manager/src/lib/es2020.intl.ts b/packages/scope-manager/src/lib/es2020.intl.ts index 2866dde791e..6cf997c0ca3 100644 --- a/packages/scope-manager/src/lib/es2020.intl.ts +++ b/packages/scope-manager/src/lib/es2020.intl.ts @@ -3,9 +3,9 @@ // RUN THE FOLLOWING COMMAND FROM THE WORKSPACE ROOT TO REGENERATE: // npx nx generate-lib @typescript-eslint/scope-manager -import type { ImplicitLibVariableOptions } from '../variable'; -import { TYPE_VALUE } from './base-config'; +import { ImplicitLibVariableOptions } from '../variable'; import { es2018_intl } from './es2018.intl'; +import { TYPE_VALUE } from './base-config'; export const es2020_intl = { ...es2018_intl, diff --git a/packages/scope-manager/src/lib/es2020.number.ts b/packages/scope-manager/src/lib/es2020.number.ts index 445b6073364..04ba01bc4bf 100644 --- a/packages/scope-manager/src/lib/es2020.number.ts +++ b/packages/scope-manager/src/lib/es2020.number.ts @@ -3,9 +3,9 @@ // RUN THE FOLLOWING COMMAND FROM THE WORKSPACE ROOT TO REGENERATE: // npx nx generate-lib @typescript-eslint/scope-manager -import type { ImplicitLibVariableOptions } from '../variable'; -import { TYPE } from './base-config'; +import { ImplicitLibVariableOptions } from '../variable'; import { es2020_intl } from './es2020.intl'; +import { TYPE } from './base-config'; export const es2020_number = { ...es2020_intl, diff --git a/packages/scope-manager/src/lib/es2020.promise.ts b/packages/scope-manager/src/lib/es2020.promise.ts index 0352586806d..c875a4c7b31 100644 --- a/packages/scope-manager/src/lib/es2020.promise.ts +++ b/packages/scope-manager/src/lib/es2020.promise.ts @@ -3,7 +3,7 @@ // RUN THE FOLLOWING COMMAND FROM THE WORKSPACE ROOT TO REGENERATE: // npx nx generate-lib @typescript-eslint/scope-manager -import type { ImplicitLibVariableOptions } from '../variable'; +import { ImplicitLibVariableOptions } from '../variable'; import { TYPE } from './base-config'; export const es2020_promise = { diff --git a/packages/scope-manager/src/lib/es2020.sharedmemory.ts b/packages/scope-manager/src/lib/es2020.sharedmemory.ts index 180e291c0cc..e927965e621 100644 --- a/packages/scope-manager/src/lib/es2020.sharedmemory.ts +++ b/packages/scope-manager/src/lib/es2020.sharedmemory.ts @@ -3,7 +3,7 @@ // RUN THE FOLLOWING COMMAND FROM THE WORKSPACE ROOT TO REGENERATE: // npx nx generate-lib @typescript-eslint/scope-manager -import type { ImplicitLibVariableOptions } from '../variable'; +import { ImplicitLibVariableOptions } from '../variable'; import { TYPE } from './base-config'; export const es2020_sharedmemory = { diff --git a/packages/scope-manager/src/lib/es2020.string.ts b/packages/scope-manager/src/lib/es2020.string.ts index ef0a81e1ca8..c33be91dd3f 100644 --- a/packages/scope-manager/src/lib/es2020.string.ts +++ b/packages/scope-manager/src/lib/es2020.string.ts @@ -3,9 +3,9 @@ // RUN THE FOLLOWING COMMAND FROM THE WORKSPACE ROOT TO REGENERATE: // npx nx generate-lib @typescript-eslint/scope-manager -import type { ImplicitLibVariableOptions } from '../variable'; -import { TYPE } from './base-config'; +import { ImplicitLibVariableOptions } from '../variable'; import { es2015_iterable } from './es2015.iterable'; +import { TYPE } from './base-config'; export const es2020_string = { ...es2015_iterable, diff --git a/packages/scope-manager/src/lib/es2020.symbol.wellknown.ts b/packages/scope-manager/src/lib/es2020.symbol.wellknown.ts index 1e104700032..db8d79e9f44 100644 --- a/packages/scope-manager/src/lib/es2020.symbol.wellknown.ts +++ b/packages/scope-manager/src/lib/es2020.symbol.wellknown.ts @@ -3,10 +3,10 @@ // RUN THE FOLLOWING COMMAND FROM THE WORKSPACE ROOT TO REGENERATE: // npx nx generate-lib @typescript-eslint/scope-manager -import type { ImplicitLibVariableOptions } from '../variable'; -import { TYPE } from './base-config'; +import { ImplicitLibVariableOptions } from '../variable'; import { es2015_iterable } from './es2015.iterable'; import { es2015_symbol } from './es2015.symbol'; +import { TYPE } from './base-config'; export const es2020_symbol_wellknown = { ...es2015_iterable, diff --git a/packages/scope-manager/src/lib/es2020.ts b/packages/scope-manager/src/lib/es2020.ts index c6b1140596b..3a89464f456 100644 --- a/packages/scope-manager/src/lib/es2020.ts +++ b/packages/scope-manager/src/lib/es2020.ts @@ -3,16 +3,16 @@ // RUN THE FOLLOWING COMMAND FROM THE WORKSPACE ROOT TO REGENERATE: // npx nx generate-lib @typescript-eslint/scope-manager -import type { ImplicitLibVariableOptions } from '../variable'; +import { ImplicitLibVariableOptions } from '../variable'; import { es2019 } from './es2019'; import { es2020_bigint } from './es2020.bigint'; import { es2020_date } from './es2020.date'; -import { es2020_intl } from './es2020.intl'; import { es2020_number } from './es2020.number'; import { es2020_promise } from './es2020.promise'; import { es2020_sharedmemory } from './es2020.sharedmemory'; import { es2020_string } from './es2020.string'; import { es2020_symbol_wellknown } from './es2020.symbol.wellknown'; +import { es2020_intl } from './es2020.intl'; export const es2020 = { ...es2019, diff --git a/packages/scope-manager/src/lib/es2021.full.ts b/packages/scope-manager/src/lib/es2021.full.ts index e45a862ff2b..2bf87c06e1a 100644 --- a/packages/scope-manager/src/lib/es2021.full.ts +++ b/packages/scope-manager/src/lib/es2021.full.ts @@ -3,12 +3,12 @@ // RUN THE FOLLOWING COMMAND FROM THE WORKSPACE ROOT TO REGENERATE: // npx nx generate-lib @typescript-eslint/scope-manager -import type { ImplicitLibVariableOptions } from '../variable'; -import { dom } from './dom'; -import { dom_iterable } from './dom.iterable'; +import { ImplicitLibVariableOptions } from '../variable'; import { es2021 } from './es2021'; -import { scripthost } from './scripthost'; +import { dom } from './dom'; import { webworker_importscripts } from './webworker.importscripts'; +import { scripthost } from './scripthost'; +import { dom_iterable } from './dom.iterable'; export const es2021_full = { ...es2021, diff --git a/packages/scope-manager/src/lib/es2021.intl.ts b/packages/scope-manager/src/lib/es2021.intl.ts index e8cebf8ed07..f73cbe394ab 100644 --- a/packages/scope-manager/src/lib/es2021.intl.ts +++ b/packages/scope-manager/src/lib/es2021.intl.ts @@ -3,7 +3,7 @@ // RUN THE FOLLOWING COMMAND FROM THE WORKSPACE ROOT TO REGENERATE: // npx nx generate-lib @typescript-eslint/scope-manager -import type { ImplicitLibVariableOptions } from '../variable'; +import { ImplicitLibVariableOptions } from '../variable'; import { TYPE_VALUE } from './base-config'; export const es2021_intl = { diff --git a/packages/scope-manager/src/lib/es2021.promise.ts b/packages/scope-manager/src/lib/es2021.promise.ts index 20d1f1b313c..3607632e743 100644 --- a/packages/scope-manager/src/lib/es2021.promise.ts +++ b/packages/scope-manager/src/lib/es2021.promise.ts @@ -3,8 +3,8 @@ // RUN THE FOLLOWING COMMAND FROM THE WORKSPACE ROOT TO REGENERATE: // npx nx generate-lib @typescript-eslint/scope-manager -import type { ImplicitLibVariableOptions } from '../variable'; -import { TYPE, TYPE_VALUE } from './base-config'; +import { ImplicitLibVariableOptions } from '../variable'; +import { TYPE_VALUE, TYPE } from './base-config'; export const es2021_promise = { AggregateError: TYPE_VALUE, diff --git a/packages/scope-manager/src/lib/es2021.string.ts b/packages/scope-manager/src/lib/es2021.string.ts index 8b7aa25c5a5..28e9af00f37 100644 --- a/packages/scope-manager/src/lib/es2021.string.ts +++ b/packages/scope-manager/src/lib/es2021.string.ts @@ -3,7 +3,7 @@ // RUN THE FOLLOWING COMMAND FROM THE WORKSPACE ROOT TO REGENERATE: // npx nx generate-lib @typescript-eslint/scope-manager -import type { ImplicitLibVariableOptions } from '../variable'; +import { ImplicitLibVariableOptions } from '../variable'; import { TYPE } from './base-config'; export const es2021_string = { diff --git a/packages/scope-manager/src/lib/es2021.ts b/packages/scope-manager/src/lib/es2021.ts index c54cfc31ccb..43fd33f9abe 100644 --- a/packages/scope-manager/src/lib/es2021.ts +++ b/packages/scope-manager/src/lib/es2021.ts @@ -3,12 +3,12 @@ // RUN THE FOLLOWING COMMAND FROM THE WORKSPACE ROOT TO REGENERATE: // npx nx generate-lib @typescript-eslint/scope-manager -import type { ImplicitLibVariableOptions } from '../variable'; +import { ImplicitLibVariableOptions } from '../variable'; import { es2020 } from './es2020'; -import { es2021_intl } from './es2021.intl'; import { es2021_promise } from './es2021.promise'; import { es2021_string } from './es2021.string'; import { es2021_weakref } from './es2021.weakref'; +import { es2021_intl } from './es2021.intl'; export const es2021 = { ...es2020, diff --git a/packages/scope-manager/src/lib/es2021.weakref.ts b/packages/scope-manager/src/lib/es2021.weakref.ts index a65c90a8058..4a7ee2ea44c 100644 --- a/packages/scope-manager/src/lib/es2021.weakref.ts +++ b/packages/scope-manager/src/lib/es2021.weakref.ts @@ -3,8 +3,8 @@ // RUN THE FOLLOWING COMMAND FROM THE WORKSPACE ROOT TO REGENERATE: // npx nx generate-lib @typescript-eslint/scope-manager -import type { ImplicitLibVariableOptions } from '../variable'; -import { TYPE, TYPE_VALUE } from './base-config'; +import { ImplicitLibVariableOptions } from '../variable'; +import { TYPE_VALUE, TYPE } from './base-config'; export const es2021_weakref = { WeakRef: TYPE_VALUE, diff --git a/packages/scope-manager/src/lib/es2022.array.ts b/packages/scope-manager/src/lib/es2022.array.ts index 3927f26851e..95785becd3d 100644 --- a/packages/scope-manager/src/lib/es2022.array.ts +++ b/packages/scope-manager/src/lib/es2022.array.ts @@ -3,7 +3,7 @@ // RUN THE FOLLOWING COMMAND FROM THE WORKSPACE ROOT TO REGENERATE: // npx nx generate-lib @typescript-eslint/scope-manager -import type { ImplicitLibVariableOptions } from '../variable'; +import { ImplicitLibVariableOptions } from '../variable'; import { TYPE } from './base-config'; export const es2022_array = { diff --git a/packages/scope-manager/src/lib/es2022.error.ts b/packages/scope-manager/src/lib/es2022.error.ts index 282f66648bb..f1e1bc2fa0f 100644 --- a/packages/scope-manager/src/lib/es2022.error.ts +++ b/packages/scope-manager/src/lib/es2022.error.ts @@ -3,7 +3,7 @@ // RUN THE FOLLOWING COMMAND FROM THE WORKSPACE ROOT TO REGENERATE: // npx nx generate-lib @typescript-eslint/scope-manager -import type { ImplicitLibVariableOptions } from '../variable'; +import { ImplicitLibVariableOptions } from '../variable'; import { TYPE } from './base-config'; export const es2022_error = { diff --git a/packages/scope-manager/src/lib/es2022.full.ts b/packages/scope-manager/src/lib/es2022.full.ts index 1cf84cd17eb..3ef0dd62eca 100644 --- a/packages/scope-manager/src/lib/es2022.full.ts +++ b/packages/scope-manager/src/lib/es2022.full.ts @@ -3,12 +3,12 @@ // RUN THE FOLLOWING COMMAND FROM THE WORKSPACE ROOT TO REGENERATE: // npx nx generate-lib @typescript-eslint/scope-manager -import type { ImplicitLibVariableOptions } from '../variable'; -import { dom } from './dom'; -import { dom_iterable } from './dom.iterable'; +import { ImplicitLibVariableOptions } from '../variable'; import { es2022 } from './es2022'; -import { scripthost } from './scripthost'; +import { dom } from './dom'; import { webworker_importscripts } from './webworker.importscripts'; +import { scripthost } from './scripthost'; +import { dom_iterable } from './dom.iterable'; export const es2022_full = { ...es2022, diff --git a/packages/scope-manager/src/lib/es2022.intl.ts b/packages/scope-manager/src/lib/es2022.intl.ts index 22c7fc5694d..f91ef8640a0 100644 --- a/packages/scope-manager/src/lib/es2022.intl.ts +++ b/packages/scope-manager/src/lib/es2022.intl.ts @@ -3,7 +3,7 @@ // RUN THE FOLLOWING COMMAND FROM THE WORKSPACE ROOT TO REGENERATE: // npx nx generate-lib @typescript-eslint/scope-manager -import type { ImplicitLibVariableOptions } from '../variable'; +import { ImplicitLibVariableOptions } from '../variable'; import { TYPE_VALUE } from './base-config'; export const es2022_intl = { diff --git a/packages/scope-manager/src/lib/es2022.object.ts b/packages/scope-manager/src/lib/es2022.object.ts index ea209894d13..650a01c3835 100644 --- a/packages/scope-manager/src/lib/es2022.object.ts +++ b/packages/scope-manager/src/lib/es2022.object.ts @@ -3,7 +3,7 @@ // RUN THE FOLLOWING COMMAND FROM THE WORKSPACE ROOT TO REGENERATE: // npx nx generate-lib @typescript-eslint/scope-manager -import type { ImplicitLibVariableOptions } from '../variable'; +import { ImplicitLibVariableOptions } from '../variable'; import { TYPE } from './base-config'; export const es2022_object = { diff --git a/packages/scope-manager/src/lib/es2022.sharedmemory.ts b/packages/scope-manager/src/lib/es2022.sharedmemory.ts index 24d82d60912..8efb4b9d8c9 100644 --- a/packages/scope-manager/src/lib/es2022.sharedmemory.ts +++ b/packages/scope-manager/src/lib/es2022.sharedmemory.ts @@ -3,7 +3,7 @@ // RUN THE FOLLOWING COMMAND FROM THE WORKSPACE ROOT TO REGENERATE: // npx nx generate-lib @typescript-eslint/scope-manager -import type { ImplicitLibVariableOptions } from '../variable'; +import { ImplicitLibVariableOptions } from '../variable'; import { TYPE } from './base-config'; export const es2022_sharedmemory = { diff --git a/packages/scope-manager/src/lib/es2022.string.ts b/packages/scope-manager/src/lib/es2022.string.ts index 8cd490c9bc5..3c4e1a766cd 100644 --- a/packages/scope-manager/src/lib/es2022.string.ts +++ b/packages/scope-manager/src/lib/es2022.string.ts @@ -3,7 +3,7 @@ // RUN THE FOLLOWING COMMAND FROM THE WORKSPACE ROOT TO REGENERATE: // npx nx generate-lib @typescript-eslint/scope-manager -import type { ImplicitLibVariableOptions } from '../variable'; +import { ImplicitLibVariableOptions } from '../variable'; import { TYPE } from './base-config'; export const es2022_string = { diff --git a/packages/scope-manager/src/lib/es2022.ts b/packages/scope-manager/src/lib/es2022.ts index 0956c0111d6..6f23b9dcd57 100644 --- a/packages/scope-manager/src/lib/es2022.ts +++ b/packages/scope-manager/src/lib/es2022.ts @@ -3,7 +3,7 @@ // RUN THE FOLLOWING COMMAND FROM THE WORKSPACE ROOT TO REGENERATE: // npx nx generate-lib @typescript-eslint/scope-manager -import type { ImplicitLibVariableOptions } from '../variable'; +import { ImplicitLibVariableOptions } from '../variable'; import { es2021 } from './es2021'; import { es2022_array } from './es2022.array'; import { es2022_error } from './es2022.error'; diff --git a/packages/scope-manager/src/lib/es5.ts b/packages/scope-manager/src/lib/es5.ts index cef8eb253ce..888faf61520 100644 --- a/packages/scope-manager/src/lib/es5.ts +++ b/packages/scope-manager/src/lib/es5.ts @@ -3,7 +3,7 @@ // RUN THE FOLLOWING COMMAND FROM THE WORKSPACE ROOT TO REGENERATE: // npx nx generate-lib @typescript-eslint/scope-manager -import type { ImplicitLibVariableOptions } from '../variable'; +import { ImplicitLibVariableOptions } from '../variable'; import { TYPE, TYPE_VALUE } from './base-config'; export const es5 = { diff --git a/packages/scope-manager/src/lib/es6.ts b/packages/scope-manager/src/lib/es6.ts index 12bf80e84c9..57c3eca6234 100644 --- a/packages/scope-manager/src/lib/es6.ts +++ b/packages/scope-manager/src/lib/es6.ts @@ -3,12 +3,12 @@ // RUN THE FOLLOWING COMMAND FROM THE WORKSPACE ROOT TO REGENERATE: // npx nx generate-lib @typescript-eslint/scope-manager -import type { ImplicitLibVariableOptions } from '../variable'; +import { ImplicitLibVariableOptions } from '../variable'; import { es5 } from './es5'; -import { es2015_collection } from './es2015.collection'; import { es2015_core } from './es2015.core'; -import { es2015_generator } from './es2015.generator'; +import { es2015_collection } from './es2015.collection'; import { es2015_iterable } from './es2015.iterable'; +import { es2015_generator } from './es2015.generator'; import { es2015_promise } from './es2015.promise'; import { es2015_proxy } from './es2015.proxy'; import { es2015_reflect } from './es2015.reflect'; diff --git a/packages/scope-manager/src/lib/es7.ts b/packages/scope-manager/src/lib/es7.ts index e79a1dd39c7..dd0ae5bef60 100644 --- a/packages/scope-manager/src/lib/es7.ts +++ b/packages/scope-manager/src/lib/es7.ts @@ -3,7 +3,7 @@ // RUN THE FOLLOWING COMMAND FROM THE WORKSPACE ROOT TO REGENERATE: // npx nx generate-lib @typescript-eslint/scope-manager -import type { ImplicitLibVariableOptions } from '../variable'; +import { ImplicitLibVariableOptions } from '../variable'; import { es2015 } from './es2015'; import { es2016_array_include } from './es2016.array.include'; diff --git a/packages/scope-manager/src/lib/esnext.array.ts b/packages/scope-manager/src/lib/esnext.array.ts index e7d9824cf8c..87709c583e4 100644 --- a/packages/scope-manager/src/lib/esnext.array.ts +++ b/packages/scope-manager/src/lib/esnext.array.ts @@ -3,7 +3,7 @@ // RUN THE FOLLOWING COMMAND FROM THE WORKSPACE ROOT TO REGENERATE: // npx nx generate-lib @typescript-eslint/scope-manager -import type { ImplicitLibVariableOptions } from '../variable'; +import { ImplicitLibVariableOptions } from '../variable'; import { TYPE } from './base-config'; export const esnext_array = { diff --git a/packages/scope-manager/src/lib/esnext.asynciterable.ts b/packages/scope-manager/src/lib/esnext.asynciterable.ts index 2479b150904..22c97a07040 100644 --- a/packages/scope-manager/src/lib/esnext.asynciterable.ts +++ b/packages/scope-manager/src/lib/esnext.asynciterable.ts @@ -3,10 +3,10 @@ // RUN THE FOLLOWING COMMAND FROM THE WORKSPACE ROOT TO REGENERATE: // npx nx generate-lib @typescript-eslint/scope-manager -import type { ImplicitLibVariableOptions } from '../variable'; -import { TYPE } from './base-config'; -import { es2015_iterable } from './es2015.iterable'; +import { ImplicitLibVariableOptions } from '../variable'; import { es2015_symbol } from './es2015.symbol'; +import { es2015_iterable } from './es2015.iterable'; +import { TYPE } from './base-config'; export const esnext_asynciterable = { ...es2015_symbol, diff --git a/packages/scope-manager/src/lib/esnext.bigint.ts b/packages/scope-manager/src/lib/esnext.bigint.ts index ccd2ae93293..079bc59bf87 100644 --- a/packages/scope-manager/src/lib/esnext.bigint.ts +++ b/packages/scope-manager/src/lib/esnext.bigint.ts @@ -3,9 +3,9 @@ // RUN THE FOLLOWING COMMAND FROM THE WORKSPACE ROOT TO REGENERATE: // npx nx generate-lib @typescript-eslint/scope-manager -import type { ImplicitLibVariableOptions } from '../variable'; -import { TYPE, TYPE_VALUE } from './base-config'; +import { ImplicitLibVariableOptions } from '../variable'; import { es2020_intl } from './es2020.intl'; +import { TYPE, TYPE_VALUE } from './base-config'; export const esnext_bigint = { ...es2020_intl, diff --git a/packages/scope-manager/src/lib/esnext.full.ts b/packages/scope-manager/src/lib/esnext.full.ts index 2bae36c386e..5d7b43c2b66 100644 --- a/packages/scope-manager/src/lib/esnext.full.ts +++ b/packages/scope-manager/src/lib/esnext.full.ts @@ -3,12 +3,12 @@ // RUN THE FOLLOWING COMMAND FROM THE WORKSPACE ROOT TO REGENERATE: // npx nx generate-lib @typescript-eslint/scope-manager -import type { ImplicitLibVariableOptions } from '../variable'; -import { dom } from './dom'; -import { dom_iterable } from './dom.iterable'; +import { ImplicitLibVariableOptions } from '../variable'; import { esnext } from './esnext'; -import { scripthost } from './scripthost'; +import { dom } from './dom'; import { webworker_importscripts } from './webworker.importscripts'; +import { scripthost } from './scripthost'; +import { dom_iterable } from './dom.iterable'; export const esnext_full = { ...esnext, diff --git a/packages/scope-manager/src/lib/esnext.intl.ts b/packages/scope-manager/src/lib/esnext.intl.ts index 35c7ef82ddb..03cc1fb5997 100644 --- a/packages/scope-manager/src/lib/esnext.intl.ts +++ b/packages/scope-manager/src/lib/esnext.intl.ts @@ -3,7 +3,7 @@ // RUN THE FOLLOWING COMMAND FROM THE WORKSPACE ROOT TO REGENERATE: // npx nx generate-lib @typescript-eslint/scope-manager -import type { ImplicitLibVariableOptions } from '../variable'; +import { ImplicitLibVariableOptions } from '../variable'; import { TYPE_VALUE } from './base-config'; export const esnext_intl = { diff --git a/packages/scope-manager/src/lib/esnext.promise.ts b/packages/scope-manager/src/lib/esnext.promise.ts index 08c9e142841..8042c77f8b4 100644 --- a/packages/scope-manager/src/lib/esnext.promise.ts +++ b/packages/scope-manager/src/lib/esnext.promise.ts @@ -3,8 +3,8 @@ // RUN THE FOLLOWING COMMAND FROM THE WORKSPACE ROOT TO REGENERATE: // npx nx generate-lib @typescript-eslint/scope-manager -import type { ImplicitLibVariableOptions } from '../variable'; -import { TYPE, TYPE_VALUE } from './base-config'; +import { ImplicitLibVariableOptions } from '../variable'; +import { TYPE_VALUE, TYPE } from './base-config'; export const esnext_promise = { AggregateError: TYPE_VALUE, diff --git a/packages/scope-manager/src/lib/esnext.string.ts b/packages/scope-manager/src/lib/esnext.string.ts index d0bacb659a4..354c5d6dfea 100644 --- a/packages/scope-manager/src/lib/esnext.string.ts +++ b/packages/scope-manager/src/lib/esnext.string.ts @@ -3,7 +3,7 @@ // RUN THE FOLLOWING COMMAND FROM THE WORKSPACE ROOT TO REGENERATE: // npx nx generate-lib @typescript-eslint/scope-manager -import type { ImplicitLibVariableOptions } from '../variable'; +import { ImplicitLibVariableOptions } from '../variable'; import { TYPE } from './base-config'; export const esnext_string = { diff --git a/packages/scope-manager/src/lib/esnext.symbol.ts b/packages/scope-manager/src/lib/esnext.symbol.ts index fb16e1cb55a..49b2a8c9cd7 100644 --- a/packages/scope-manager/src/lib/esnext.symbol.ts +++ b/packages/scope-manager/src/lib/esnext.symbol.ts @@ -3,7 +3,7 @@ // RUN THE FOLLOWING COMMAND FROM THE WORKSPACE ROOT TO REGENERATE: // npx nx generate-lib @typescript-eslint/scope-manager -import type { ImplicitLibVariableOptions } from '../variable'; +import { ImplicitLibVariableOptions } from '../variable'; import { TYPE } from './base-config'; export const esnext_symbol = { diff --git a/packages/scope-manager/src/lib/esnext.ts b/packages/scope-manager/src/lib/esnext.ts index 31ac2762267..e6c59d96cf2 100644 --- a/packages/scope-manager/src/lib/esnext.ts +++ b/packages/scope-manager/src/lib/esnext.ts @@ -3,7 +3,7 @@ // RUN THE FOLLOWING COMMAND FROM THE WORKSPACE ROOT TO REGENERATE: // npx nx generate-lib @typescript-eslint/scope-manager -import type { ImplicitLibVariableOptions } from '../variable'; +import { ImplicitLibVariableOptions } from '../variable'; import { es2022 } from './es2022'; import { esnext_intl } from './esnext.intl'; diff --git a/packages/scope-manager/src/lib/esnext.weakref.ts b/packages/scope-manager/src/lib/esnext.weakref.ts index 9a7df1c6d58..aec8e3070bf 100644 --- a/packages/scope-manager/src/lib/esnext.weakref.ts +++ b/packages/scope-manager/src/lib/esnext.weakref.ts @@ -3,8 +3,8 @@ // RUN THE FOLLOWING COMMAND FROM THE WORKSPACE ROOT TO REGENERATE: // npx nx generate-lib @typescript-eslint/scope-manager -import type { ImplicitLibVariableOptions } from '../variable'; -import { TYPE, TYPE_VALUE } from './base-config'; +import { ImplicitLibVariableOptions } from '../variable'; +import { TYPE_VALUE, TYPE } from './base-config'; export const esnext_weakref = { WeakRef: TYPE_VALUE, diff --git a/packages/scope-manager/src/lib/index.ts b/packages/scope-manager/src/lib/index.ts index 989857ba152..06888a64238 100644 --- a/packages/scope-manager/src/lib/index.ts +++ b/packages/scope-manager/src/lib/index.ts @@ -3,14 +3,26 @@ // RUN THE FOLLOWING COMMAND FROM THE WORKSPACE ROOT TO REGENERATE: // npx nx generate-lib @typescript-eslint/scope-manager -import { dom } from './dom'; -import { dom_iterable } from './dom.iterable'; import { es5 } from './es5'; import { es6 } from './es6'; -import { es7 } from './es7'; import { es2015 } from './es2015'; -import { es2015_collection } from './es2015.collection'; +import { es7 } from './es7'; +import { es2016 } from './es2016'; +import { es2017 } from './es2017'; +import { es2018 } from './es2018'; +import { es2019 } from './es2019'; +import { es2020 } from './es2020'; +import { es2021 } from './es2021'; +import { es2022 } from './es2022'; +import { esnext } from './esnext'; +import { dom } from './dom'; +import { dom_iterable } from './dom.iterable'; +import { webworker } from './webworker'; +import { webworker_importscripts } from './webworker.importscripts'; +import { webworker_iterable } from './webworker.iterable'; +import { scripthost } from './scripthost'; import { es2015_core } from './es2015.core'; +import { es2015_collection } from './es2015.collection'; import { es2015_generator } from './es2015.generator'; import { es2015_iterable } from './es2015.iterable'; import { es2015_promise } from './es2015.promise'; @@ -18,68 +30,57 @@ import { es2015_proxy } from './es2015.proxy'; import { es2015_reflect } from './es2015.reflect'; import { es2015_symbol } from './es2015.symbol'; import { es2015_symbol_wellknown } from './es2015.symbol.wellknown'; -import { es2016 } from './es2016'; import { es2016_array_include } from './es2016.array.include'; -import { es2016_full } from './es2016.full'; -import { es2017 } from './es2017'; -import { es2017_full } from './es2017.full'; -import { es2017_intl } from './es2017.intl'; import { es2017_object } from './es2017.object'; import { es2017_sharedmemory } from './es2017.sharedmemory'; import { es2017_string } from './es2017.string'; +import { es2017_intl } from './es2017.intl'; import { es2017_typedarrays } from './es2017.typedarrays'; -import { es2018 } from './es2018'; import { es2018_asyncgenerator } from './es2018.asyncgenerator'; import { es2018_asynciterable } from './es2018.asynciterable'; -import { es2018_full } from './es2018.full'; import { es2018_intl } from './es2018.intl'; import { es2018_promise } from './es2018.promise'; import { es2018_regexp } from './es2018.regexp'; -import { es2019 } from './es2019'; import { es2019_array } from './es2019.array'; -import { es2019_full } from './es2019.full'; import { es2019_object } from './es2019.object'; import { es2019_string } from './es2019.string'; import { es2019_symbol } from './es2019.symbol'; -import { es2020 } from './es2020'; +import { es2019_intl } from './es2019.intl'; import { es2020_bigint } from './es2020.bigint'; import { es2020_date } from './es2020.date'; -import { es2020_full } from './es2020.full'; -import { es2020_intl } from './es2020.intl'; -import { es2020_number } from './es2020.number'; import { es2020_promise } from './es2020.promise'; import { es2020_sharedmemory } from './es2020.sharedmemory'; import { es2020_string } from './es2020.string'; import { es2020_symbol_wellknown } from './es2020.symbol.wellknown'; -import { es2021 } from './es2021'; -import { es2021_full } from './es2021.full'; -import { es2021_intl } from './es2021.intl'; +import { es2020_intl } from './es2020.intl'; +import { es2020_number } from './es2020.number'; import { es2021_promise } from './es2021.promise'; import { es2021_string } from './es2021.string'; import { es2021_weakref } from './es2021.weakref'; -import { es2022 } from './es2022'; +import { es2021_intl } from './es2021.intl'; import { es2022_array } from './es2022.array'; import { es2022_error } from './es2022.error'; -import { es2022_full } from './es2022.full'; import { es2022_intl } from './es2022.intl'; import { es2022_object } from './es2022.object'; import { es2022_sharedmemory } from './es2022.sharedmemory'; import { es2022_string } from './es2022.string'; -import { esnext } from './esnext'; import { esnext_array } from './esnext.array'; +import { esnext_symbol } from './esnext.symbol'; import { esnext_asynciterable } from './esnext.asynciterable'; -import { esnext_bigint } from './esnext.bigint'; -import { esnext_full } from './esnext.full'; import { esnext_intl } from './esnext.intl'; -import { esnext_promise } from './esnext.promise'; +import { esnext_bigint } from './esnext.bigint'; import { esnext_string } from './esnext.string'; -import { esnext_symbol } from './esnext.symbol'; +import { esnext_promise } from './esnext.promise'; import { esnext_weakref } from './esnext.weakref'; +import { es2016_full } from './es2016.full'; +import { es2017_full } from './es2017.full'; +import { es2018_full } from './es2018.full'; +import { es2019_full } from './es2019.full'; +import { es2020_full } from './es2020.full'; +import { es2021_full } from './es2021.full'; +import { es2022_full } from './es2022.full'; +import { esnext_full } from './esnext.full'; import { lib as libBase } from './lib'; -import { scripthost } from './scripthost'; -import { webworker } from './webworker'; -import { webworker_importscripts } from './webworker.importscripts'; -import { webworker_iterable } from './webworker.iterable'; const lib = { es5, @@ -124,6 +125,7 @@ const lib = { 'es2019.object': es2019_object, 'es2019.string': es2019_string, 'es2019.symbol': es2019_symbol, + 'es2019.intl': es2019_intl, 'es2020.bigint': es2020_bigint, 'es2020.date': es2020_date, 'es2020.promise': es2020_promise, diff --git a/packages/scope-manager/src/lib/lib.ts b/packages/scope-manager/src/lib/lib.ts index 4ec72e9e80b..68367da23d9 100644 --- a/packages/scope-manager/src/lib/lib.ts +++ b/packages/scope-manager/src/lib/lib.ts @@ -3,11 +3,11 @@ // RUN THE FOLLOWING COMMAND FROM THE WORKSPACE ROOT TO REGENERATE: // npx nx generate-lib @typescript-eslint/scope-manager -import type { ImplicitLibVariableOptions } from '../variable'; -import { dom } from './dom'; +import { ImplicitLibVariableOptions } from '../variable'; import { es5 } from './es5'; -import { scripthost } from './scripthost'; +import { dom } from './dom'; import { webworker_importscripts } from './webworker.importscripts'; +import { scripthost } from './scripthost'; export const lib = { ...es5, diff --git a/packages/scope-manager/src/lib/scripthost.ts b/packages/scope-manager/src/lib/scripthost.ts index cf802a3abad..c143fc8ae59 100644 --- a/packages/scope-manager/src/lib/scripthost.ts +++ b/packages/scope-manager/src/lib/scripthost.ts @@ -3,8 +3,8 @@ // RUN THE FOLLOWING COMMAND FROM THE WORKSPACE ROOT TO REGENERATE: // npx nx generate-lib @typescript-eslint/scope-manager -import type { ImplicitLibVariableOptions } from '../variable'; -import { TYPE, TYPE_VALUE } from './base-config'; +import { ImplicitLibVariableOptions } from '../variable'; +import { TYPE_VALUE, TYPE } from './base-config'; export const scripthost = { ActiveXObject: TYPE_VALUE, diff --git a/packages/scope-manager/src/lib/webworker.importscripts.ts b/packages/scope-manager/src/lib/webworker.importscripts.ts index f7f1cb026bc..4b3bb5f95c6 100644 --- a/packages/scope-manager/src/lib/webworker.importscripts.ts +++ b/packages/scope-manager/src/lib/webworker.importscripts.ts @@ -3,7 +3,7 @@ // RUN THE FOLLOWING COMMAND FROM THE WORKSPACE ROOT TO REGENERATE: // npx nx generate-lib @typescript-eslint/scope-manager -import type { ImplicitLibVariableOptions } from '../variable'; +import { ImplicitLibVariableOptions } from '../variable'; export const webworker_importscripts = {} as Record< string, diff --git a/packages/scope-manager/src/lib/webworker.iterable.ts b/packages/scope-manager/src/lib/webworker.iterable.ts index e4b0fb8b940..80a04c759e4 100644 --- a/packages/scope-manager/src/lib/webworker.iterable.ts +++ b/packages/scope-manager/src/lib/webworker.iterable.ts @@ -3,7 +3,7 @@ // RUN THE FOLLOWING COMMAND FROM THE WORKSPACE ROOT TO REGENERATE: // npx nx generate-lib @typescript-eslint/scope-manager -import type { ImplicitLibVariableOptions } from '../variable'; +import { ImplicitLibVariableOptions } from '../variable'; import { TYPE } from './base-config'; export const webworker_iterable = { diff --git a/packages/scope-manager/src/lib/webworker.ts b/packages/scope-manager/src/lib/webworker.ts index e44ce52113c..7f800409938 100644 --- a/packages/scope-manager/src/lib/webworker.ts +++ b/packages/scope-manager/src/lib/webworker.ts @@ -3,7 +3,7 @@ // RUN THE FOLLOWING COMMAND FROM THE WORKSPACE ROOT TO REGENERATE: // npx nx generate-lib @typescript-eslint/scope-manager -import type { ImplicitLibVariableOptions } from '../variable'; +import { ImplicitLibVariableOptions } from '../variable'; import { TYPE, TYPE_VALUE } from './base-config'; export const webworker = { @@ -88,6 +88,7 @@ export const webworker = { QueuingStrategyInit: TYPE, RTCEncodedAudioFrameMetadata: TYPE, RTCEncodedVideoFrameMetadata: TYPE, + ReadableStreamGetReaderOptions: TYPE, ReadableStreamReadDoneResult: TYPE, ReadableStreamReadValueResult: TYPE, ReadableWritablePair: TYPE, @@ -108,6 +109,8 @@ export const webworker = { TextDecoderOptions: TYPE, TextEncoderEncodeIntoResult: TYPE, Transformer: TYPE, + UnderlyingByteSource: TYPE, + UnderlyingDefaultSource: TYPE, UnderlyingSink: TYPE, UnderlyingSource: TYPE, VideoColorSpaceInit: TYPE, @@ -157,6 +160,7 @@ export const webworker = { EXT_frag_depth: TYPE, EXT_sRGB: TYPE, EXT_shader_texture_lod: TYPE, + EXT_texture_compression_bptc: TYPE, EXT_texture_compression_rgtc: TYPE, EXT_texture_filter_anisotropic: TYPE, ErrorEvent: TYPE_VALUE, @@ -431,6 +435,8 @@ export const webworker = { PremultiplyAlpha: TYPE, PushEncryptionKeyName: TYPE, RTCEncodedVideoFrameType: TYPE, + ReadableStreamReaderMode: TYPE, + ReadableStreamType: TYPE, ReferrerPolicy: TYPE, RequestCache: TYPE, RequestCredentials: TYPE, diff --git a/packages/types/src/lib.ts b/packages/types/src/lib.ts index 0d92717fcb5..880bafe5b5e 100644 --- a/packages/types/src/lib.ts +++ b/packages/types/src/lib.ts @@ -46,6 +46,7 @@ type Lib = | 'es2019.object' | 'es2019.string' | 'es2019.symbol' + | 'es2019.intl' | 'es2020.bigint' | 'es2020.date' | 'es2020.promise' From 2b3bbcd4e41e22c60daab5e52cd0d5b1e0f0e4a3 Mon Sep 17 00:00:00 2001 From: Sosuke Suzuki Date: Mon, 3 Oct 2022 02:02:50 +0900 Subject: [PATCH 05/20] chore: update patch for typescript --- patches/typescript+4.9.1-beta.patch | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/patches/typescript+4.9.1-beta.patch b/patches/typescript+4.9.1-beta.patch index 574addc105f..5e742894909 100644 --- a/patches/typescript+4.9.1-beta.patch +++ b/patches/typescript+4.9.1-beta.patch @@ -1,5 +1,5 @@ diff --git a/node_modules/typescript/lib/typescript.d.ts b/node_modules/typescript/lib/typescript.d.ts -index 0e6b255..92d7cf6 100644 +index 0e6b255..f0a588c 100644 --- a/node_modules/typescript/lib/typescript.d.ts +++ b/node_modules/typescript/lib/typescript.d.ts @@ -428,8 +428,8 @@ declare namespace ts { @@ -12,7 +12,21 @@ index 0e6b255..92d7cf6 100644 JSDocComment = 323, JSDocText = 324, JSDocTypeLiteral = 325, -@@ -4857,7 +4857,13 @@ declare namespace ts { +@@ -4395,7 +4395,13 @@ declare namespace ts { + function symbolName(symbol: Symbol): string; + function getNameOfJSDocTypedef(declaration: JSDocTypedefTag): Identifier | PrivateIdentifier | undefined; + function getNameOfDeclaration(declaration: Declaration | Expression | undefined): DeclarationName | undefined; ++ /** ++ * @deprecated don't use this directly as it does not exist pre-4.8; instead use getModifiers from `@typescript-eslint/type-utils`. ++ */ + function getDecorators(node: HasDecorators): readonly Decorator[] | undefined; ++ /** ++ * @deprecated don't use this directly as it does not exist pre-4.8; instead use getDecorators from `@typescript-eslint/type-utils`. ++ */ + function getModifiers(node: HasModifiers): readonly Modifier[] | undefined; + /** + * Gets the JSDoc parameter tags for the node if present. +@@ -4857,7 +4863,13 @@ declare namespace ts { } declare namespace ts { function setTextRange(range: T, location: TextRange | undefined): T; @@ -26,7 +40,7 @@ index 0e6b255..92d7cf6 100644 function canHaveDecorators(node: Node): node is HasDecorators; } declare namespace ts { -@@ -7951,7 +7957,7 @@ declare namespace ts { +@@ -7951,7 +7963,7 @@ declare namespace ts { * const decorators = ts.canHaveDecorators(node) ? ts.getDecorators(node) : undefined; * ``` */ From 154f540de0c2fcd28a2e85a303d3829b8a877b77 Mon Sep 17 00:00:00 2001 From: Sosuke Suzuki Date: Mon, 3 Oct 2022 02:06:35 +0900 Subject: [PATCH 06/20] fix: run `lint-fix` --- .../scope-manager/src/lib/dom.iterable.ts | 2 +- packages/scope-manager/src/lib/dom.ts | 2 +- .../src/lib/es2015.collection.ts | 4 +- packages/scope-manager/src/lib/es2015.core.ts | 2 +- .../scope-manager/src/lib/es2015.generator.ts | 4 +- .../scope-manager/src/lib/es2015.iterable.ts | 4 +- .../scope-manager/src/lib/es2015.promise.ts | 2 +- .../scope-manager/src/lib/es2015.proxy.ts | 2 +- .../scope-manager/src/lib/es2015.reflect.ts | 2 +- .../scope-manager/src/lib/es2015.symbol.ts | 2 +- .../src/lib/es2015.symbol.wellknown.ts | 4 +- packages/scope-manager/src/lib/es2015.ts | 6 +- .../src/lib/es2016.array.include.ts | 2 +- packages/scope-manager/src/lib/es2016.full.ts | 8 +-- packages/scope-manager/src/lib/es2016.ts | 2 +- packages/scope-manager/src/lib/es2017.full.ts | 8 +-- packages/scope-manager/src/lib/es2017.intl.ts | 2 +- .../scope-manager/src/lib/es2017.object.ts | 2 +- .../src/lib/es2017.sharedmemory.ts | 4 +- .../scope-manager/src/lib/es2017.string.ts | 2 +- packages/scope-manager/src/lib/es2017.ts | 4 +- .../src/lib/es2017.typedarrays.ts | 2 +- .../src/lib/es2018.asyncgenerator.ts | 4 +- .../src/lib/es2018.asynciterable.ts | 6 +- packages/scope-manager/src/lib/es2018.full.ts | 8 +-- packages/scope-manager/src/lib/es2018.intl.ts | 2 +- .../scope-manager/src/lib/es2018.promise.ts | 2 +- .../scope-manager/src/lib/es2018.regexp.ts | 2 +- packages/scope-manager/src/lib/es2018.ts | 6 +- .../scope-manager/src/lib/es2019.array.ts | 2 +- packages/scope-manager/src/lib/es2019.full.ts | 8 +-- packages/scope-manager/src/lib/es2019.intl.ts | 2 +- .../scope-manager/src/lib/es2019.object.ts | 4 +- .../scope-manager/src/lib/es2019.string.ts | 2 +- .../scope-manager/src/lib/es2019.symbol.ts | 2 +- packages/scope-manager/src/lib/es2019.ts | 4 +- .../scope-manager/src/lib/es2020.bigint.ts | 4 +- packages/scope-manager/src/lib/es2020.date.ts | 4 +- packages/scope-manager/src/lib/es2020.full.ts | 8 +-- packages/scope-manager/src/lib/es2020.intl.ts | 4 +- .../scope-manager/src/lib/es2020.number.ts | 4 +- .../scope-manager/src/lib/es2020.promise.ts | 2 +- .../src/lib/es2020.sharedmemory.ts | 2 +- .../scope-manager/src/lib/es2020.string.ts | 4 +- .../src/lib/es2020.symbol.wellknown.ts | 4 +- packages/scope-manager/src/lib/es2020.ts | 4 +- packages/scope-manager/src/lib/es2021.full.ts | 8 +-- packages/scope-manager/src/lib/es2021.intl.ts | 2 +- .../scope-manager/src/lib/es2021.promise.ts | 4 +- .../scope-manager/src/lib/es2021.string.ts | 2 +- packages/scope-manager/src/lib/es2021.ts | 4 +- .../scope-manager/src/lib/es2021.weakref.ts | 4 +- .../scope-manager/src/lib/es2022.array.ts | 2 +- .../scope-manager/src/lib/es2022.error.ts | 2 +- packages/scope-manager/src/lib/es2022.full.ts | 8 +-- packages/scope-manager/src/lib/es2022.intl.ts | 2 +- .../scope-manager/src/lib/es2022.object.ts | 2 +- .../src/lib/es2022.sharedmemory.ts | 2 +- .../scope-manager/src/lib/es2022.string.ts | 2 +- packages/scope-manager/src/lib/es2022.ts | 2 +- packages/scope-manager/src/lib/es5.ts | 2 +- packages/scope-manager/src/lib/es6.ts | 6 +- packages/scope-manager/src/lib/es7.ts | 2 +- .../scope-manager/src/lib/esnext.array.ts | 2 +- .../src/lib/esnext.asynciterable.ts | 6 +- .../scope-manager/src/lib/esnext.bigint.ts | 4 +- packages/scope-manager/src/lib/esnext.full.ts | 8 +-- packages/scope-manager/src/lib/esnext.intl.ts | 2 +- .../scope-manager/src/lib/esnext.promise.ts | 4 +- .../scope-manager/src/lib/esnext.string.ts | 2 +- .../scope-manager/src/lib/esnext.symbol.ts | 2 +- packages/scope-manager/src/lib/esnext.ts | 2 +- .../scope-manager/src/lib/esnext.weakref.ts | 4 +- packages/scope-manager/src/lib/index.ts | 64 +++++++++---------- packages/scope-manager/src/lib/lib.ts | 6 +- packages/scope-manager/src/lib/scripthost.ts | 4 +- .../src/lib/webworker.importscripts.ts | 2 +- .../src/lib/webworker.iterable.ts | 2 +- packages/scope-manager/src/lib/webworker.ts | 2 +- .../src/referencer/Referencer.ts | 2 +- 80 files changed, 170 insertions(+), 170 deletions(-) diff --git a/packages/scope-manager/src/lib/dom.iterable.ts b/packages/scope-manager/src/lib/dom.iterable.ts index 225c4f28b84..d294d684ddc 100644 --- a/packages/scope-manager/src/lib/dom.iterable.ts +++ b/packages/scope-manager/src/lib/dom.iterable.ts @@ -3,7 +3,7 @@ // RUN THE FOLLOWING COMMAND FROM THE WORKSPACE ROOT TO REGENERATE: // npx nx generate-lib @typescript-eslint/scope-manager -import { ImplicitLibVariableOptions } from '../variable'; +import type { ImplicitLibVariableOptions } from '../variable'; import { TYPE } from './base-config'; export const dom_iterable = { diff --git a/packages/scope-manager/src/lib/dom.ts b/packages/scope-manager/src/lib/dom.ts index 311dbe1db7e..d13afa2b57b 100644 --- a/packages/scope-manager/src/lib/dom.ts +++ b/packages/scope-manager/src/lib/dom.ts @@ -3,7 +3,7 @@ // RUN THE FOLLOWING COMMAND FROM THE WORKSPACE ROOT TO REGENERATE: // npx nx generate-lib @typescript-eslint/scope-manager -import { ImplicitLibVariableOptions } from '../variable'; +import type { ImplicitLibVariableOptions } from '../variable'; import { TYPE, TYPE_VALUE } from './base-config'; export const dom = { diff --git a/packages/scope-manager/src/lib/es2015.collection.ts b/packages/scope-manager/src/lib/es2015.collection.ts index 98933f1c1fd..51386ebcc74 100644 --- a/packages/scope-manager/src/lib/es2015.collection.ts +++ b/packages/scope-manager/src/lib/es2015.collection.ts @@ -3,8 +3,8 @@ // RUN THE FOLLOWING COMMAND FROM THE WORKSPACE ROOT TO REGENERATE: // npx nx generate-lib @typescript-eslint/scope-manager -import { ImplicitLibVariableOptions } from '../variable'; -import { TYPE_VALUE, TYPE } from './base-config'; +import type { ImplicitLibVariableOptions } from '../variable'; +import { TYPE, TYPE_VALUE } from './base-config'; export const es2015_collection = { Map: TYPE_VALUE, diff --git a/packages/scope-manager/src/lib/es2015.core.ts b/packages/scope-manager/src/lib/es2015.core.ts index ba44cf290b4..f9475d7db1d 100644 --- a/packages/scope-manager/src/lib/es2015.core.ts +++ b/packages/scope-manager/src/lib/es2015.core.ts @@ -3,7 +3,7 @@ // RUN THE FOLLOWING COMMAND FROM THE WORKSPACE ROOT TO REGENERATE: // npx nx generate-lib @typescript-eslint/scope-manager -import { ImplicitLibVariableOptions } from '../variable'; +import type { ImplicitLibVariableOptions } from '../variable'; import { TYPE } from './base-config'; export const es2015_core = { diff --git a/packages/scope-manager/src/lib/es2015.generator.ts b/packages/scope-manager/src/lib/es2015.generator.ts index f5dce9611ae..90d26e1ea0d 100644 --- a/packages/scope-manager/src/lib/es2015.generator.ts +++ b/packages/scope-manager/src/lib/es2015.generator.ts @@ -3,9 +3,9 @@ // RUN THE FOLLOWING COMMAND FROM THE WORKSPACE ROOT TO REGENERATE: // npx nx generate-lib @typescript-eslint/scope-manager -import { ImplicitLibVariableOptions } from '../variable'; -import { es2015_iterable } from './es2015.iterable'; +import type { ImplicitLibVariableOptions } from '../variable'; import { TYPE } from './base-config'; +import { es2015_iterable } from './es2015.iterable'; export const es2015_generator = { ...es2015_iterable, diff --git a/packages/scope-manager/src/lib/es2015.iterable.ts b/packages/scope-manager/src/lib/es2015.iterable.ts index d27ab2efcc6..2ab60a44b84 100644 --- a/packages/scope-manager/src/lib/es2015.iterable.ts +++ b/packages/scope-manager/src/lib/es2015.iterable.ts @@ -3,9 +3,9 @@ // RUN THE FOLLOWING COMMAND FROM THE WORKSPACE ROOT TO REGENERATE: // npx nx generate-lib @typescript-eslint/scope-manager -import { ImplicitLibVariableOptions } from '../variable'; -import { es2015_symbol } from './es2015.symbol'; +import type { ImplicitLibVariableOptions } from '../variable'; import { TYPE } from './base-config'; +import { es2015_symbol } from './es2015.symbol'; export const es2015_iterable = { ...es2015_symbol, diff --git a/packages/scope-manager/src/lib/es2015.promise.ts b/packages/scope-manager/src/lib/es2015.promise.ts index 1334b2abca4..a3896e0f46f 100644 --- a/packages/scope-manager/src/lib/es2015.promise.ts +++ b/packages/scope-manager/src/lib/es2015.promise.ts @@ -3,7 +3,7 @@ // RUN THE FOLLOWING COMMAND FROM THE WORKSPACE ROOT TO REGENERATE: // npx nx generate-lib @typescript-eslint/scope-manager -import { ImplicitLibVariableOptions } from '../variable'; +import type { ImplicitLibVariableOptions } from '../variable'; import { TYPE } from './base-config'; export const es2015_promise = { diff --git a/packages/scope-manager/src/lib/es2015.proxy.ts b/packages/scope-manager/src/lib/es2015.proxy.ts index d2c0d9b6616..2dbc6e22263 100644 --- a/packages/scope-manager/src/lib/es2015.proxy.ts +++ b/packages/scope-manager/src/lib/es2015.proxy.ts @@ -3,7 +3,7 @@ // RUN THE FOLLOWING COMMAND FROM THE WORKSPACE ROOT TO REGENERATE: // npx nx generate-lib @typescript-eslint/scope-manager -import { ImplicitLibVariableOptions } from '../variable'; +import type { ImplicitLibVariableOptions } from '../variable'; import { TYPE } from './base-config'; export const es2015_proxy = { diff --git a/packages/scope-manager/src/lib/es2015.reflect.ts b/packages/scope-manager/src/lib/es2015.reflect.ts index 4a71e4b9def..dcc2a5d910b 100644 --- a/packages/scope-manager/src/lib/es2015.reflect.ts +++ b/packages/scope-manager/src/lib/es2015.reflect.ts @@ -3,7 +3,7 @@ // RUN THE FOLLOWING COMMAND FROM THE WORKSPACE ROOT TO REGENERATE: // npx nx generate-lib @typescript-eslint/scope-manager -import { ImplicitLibVariableOptions } from '../variable'; +import type { ImplicitLibVariableOptions } from '../variable'; import { TYPE_VALUE } from './base-config'; export const es2015_reflect = { diff --git a/packages/scope-manager/src/lib/es2015.symbol.ts b/packages/scope-manager/src/lib/es2015.symbol.ts index c027cae3b38..eef09036f87 100644 --- a/packages/scope-manager/src/lib/es2015.symbol.ts +++ b/packages/scope-manager/src/lib/es2015.symbol.ts @@ -3,7 +3,7 @@ // RUN THE FOLLOWING COMMAND FROM THE WORKSPACE ROOT TO REGENERATE: // npx nx generate-lib @typescript-eslint/scope-manager -import { ImplicitLibVariableOptions } from '../variable'; +import type { ImplicitLibVariableOptions } from '../variable'; import { TYPE } from './base-config'; export const es2015_symbol = { diff --git a/packages/scope-manager/src/lib/es2015.symbol.wellknown.ts b/packages/scope-manager/src/lib/es2015.symbol.wellknown.ts index 16d88e5ca57..94fd4ac4e70 100644 --- a/packages/scope-manager/src/lib/es2015.symbol.wellknown.ts +++ b/packages/scope-manager/src/lib/es2015.symbol.wellknown.ts @@ -3,9 +3,9 @@ // RUN THE FOLLOWING COMMAND FROM THE WORKSPACE ROOT TO REGENERATE: // npx nx generate-lib @typescript-eslint/scope-manager -import { ImplicitLibVariableOptions } from '../variable'; -import { es2015_symbol } from './es2015.symbol'; +import type { ImplicitLibVariableOptions } from '../variable'; import { TYPE } from './base-config'; +import { es2015_symbol } from './es2015.symbol'; export const es2015_symbol_wellknown = { ...es2015_symbol, diff --git a/packages/scope-manager/src/lib/es2015.ts b/packages/scope-manager/src/lib/es2015.ts index 9e225bddb33..f6a8aa8ab73 100644 --- a/packages/scope-manager/src/lib/es2015.ts +++ b/packages/scope-manager/src/lib/es2015.ts @@ -3,12 +3,12 @@ // RUN THE FOLLOWING COMMAND FROM THE WORKSPACE ROOT TO REGENERATE: // npx nx generate-lib @typescript-eslint/scope-manager -import { ImplicitLibVariableOptions } from '../variable'; +import type { ImplicitLibVariableOptions } from '../variable'; import { es5 } from './es5'; -import { es2015_core } from './es2015.core'; import { es2015_collection } from './es2015.collection'; -import { es2015_iterable } from './es2015.iterable'; +import { es2015_core } from './es2015.core'; import { es2015_generator } from './es2015.generator'; +import { es2015_iterable } from './es2015.iterable'; import { es2015_promise } from './es2015.promise'; import { es2015_proxy } from './es2015.proxy'; import { es2015_reflect } from './es2015.reflect'; diff --git a/packages/scope-manager/src/lib/es2016.array.include.ts b/packages/scope-manager/src/lib/es2016.array.include.ts index 7cab0a4c84d..17c927bd467 100644 --- a/packages/scope-manager/src/lib/es2016.array.include.ts +++ b/packages/scope-manager/src/lib/es2016.array.include.ts @@ -3,7 +3,7 @@ // RUN THE FOLLOWING COMMAND FROM THE WORKSPACE ROOT TO REGENERATE: // npx nx generate-lib @typescript-eslint/scope-manager -import { ImplicitLibVariableOptions } from '../variable'; +import type { ImplicitLibVariableOptions } from '../variable'; import { TYPE } from './base-config'; export const es2016_array_include = { diff --git a/packages/scope-manager/src/lib/es2016.full.ts b/packages/scope-manager/src/lib/es2016.full.ts index cfc4632c7da..e7fb9802cb7 100644 --- a/packages/scope-manager/src/lib/es2016.full.ts +++ b/packages/scope-manager/src/lib/es2016.full.ts @@ -3,12 +3,12 @@ // RUN THE FOLLOWING COMMAND FROM THE WORKSPACE ROOT TO REGENERATE: // npx nx generate-lib @typescript-eslint/scope-manager -import { ImplicitLibVariableOptions } from '../variable'; -import { es2016 } from './es2016'; +import type { ImplicitLibVariableOptions } from '../variable'; import { dom } from './dom'; -import { webworker_importscripts } from './webworker.importscripts'; -import { scripthost } from './scripthost'; import { dom_iterable } from './dom.iterable'; +import { es2016 } from './es2016'; +import { scripthost } from './scripthost'; +import { webworker_importscripts } from './webworker.importscripts'; export const es2016_full = { ...es2016, diff --git a/packages/scope-manager/src/lib/es2016.ts b/packages/scope-manager/src/lib/es2016.ts index f4ac61374c3..f00abac6c4f 100644 --- a/packages/scope-manager/src/lib/es2016.ts +++ b/packages/scope-manager/src/lib/es2016.ts @@ -3,7 +3,7 @@ // RUN THE FOLLOWING COMMAND FROM THE WORKSPACE ROOT TO REGENERATE: // npx nx generate-lib @typescript-eslint/scope-manager -import { ImplicitLibVariableOptions } from '../variable'; +import type { ImplicitLibVariableOptions } from '../variable'; import { es2015 } from './es2015'; import { es2016_array_include } from './es2016.array.include'; diff --git a/packages/scope-manager/src/lib/es2017.full.ts b/packages/scope-manager/src/lib/es2017.full.ts index 26d2c2b1f8c..a1d8c386bb4 100644 --- a/packages/scope-manager/src/lib/es2017.full.ts +++ b/packages/scope-manager/src/lib/es2017.full.ts @@ -3,12 +3,12 @@ // RUN THE FOLLOWING COMMAND FROM THE WORKSPACE ROOT TO REGENERATE: // npx nx generate-lib @typescript-eslint/scope-manager -import { ImplicitLibVariableOptions } from '../variable'; -import { es2017 } from './es2017'; +import type { ImplicitLibVariableOptions } from '../variable'; import { dom } from './dom'; -import { webworker_importscripts } from './webworker.importscripts'; -import { scripthost } from './scripthost'; import { dom_iterable } from './dom.iterable'; +import { es2017 } from './es2017'; +import { scripthost } from './scripthost'; +import { webworker_importscripts } from './webworker.importscripts'; export const es2017_full = { ...es2017, diff --git a/packages/scope-manager/src/lib/es2017.intl.ts b/packages/scope-manager/src/lib/es2017.intl.ts index 48e7fe21715..b8f1325672e 100644 --- a/packages/scope-manager/src/lib/es2017.intl.ts +++ b/packages/scope-manager/src/lib/es2017.intl.ts @@ -3,7 +3,7 @@ // RUN THE FOLLOWING COMMAND FROM THE WORKSPACE ROOT TO REGENERATE: // npx nx generate-lib @typescript-eslint/scope-manager -import { ImplicitLibVariableOptions } from '../variable'; +import type { ImplicitLibVariableOptions } from '../variable'; import { TYPE_VALUE } from './base-config'; export const es2017_intl = { diff --git a/packages/scope-manager/src/lib/es2017.object.ts b/packages/scope-manager/src/lib/es2017.object.ts index 17344ec6591..66bea4e7d3f 100644 --- a/packages/scope-manager/src/lib/es2017.object.ts +++ b/packages/scope-manager/src/lib/es2017.object.ts @@ -3,7 +3,7 @@ // RUN THE FOLLOWING COMMAND FROM THE WORKSPACE ROOT TO REGENERATE: // npx nx generate-lib @typescript-eslint/scope-manager -import { ImplicitLibVariableOptions } from '../variable'; +import type { ImplicitLibVariableOptions } from '../variable'; import { TYPE } from './base-config'; export const es2017_object = { diff --git a/packages/scope-manager/src/lib/es2017.sharedmemory.ts b/packages/scope-manager/src/lib/es2017.sharedmemory.ts index d5f3c8970b2..998d41493fd 100644 --- a/packages/scope-manager/src/lib/es2017.sharedmemory.ts +++ b/packages/scope-manager/src/lib/es2017.sharedmemory.ts @@ -3,10 +3,10 @@ // RUN THE FOLLOWING COMMAND FROM THE WORKSPACE ROOT TO REGENERATE: // npx nx generate-lib @typescript-eslint/scope-manager -import { ImplicitLibVariableOptions } from '../variable'; +import type { ImplicitLibVariableOptions } from '../variable'; +import { TYPE, TYPE_VALUE } from './base-config'; import { es2015_symbol } from './es2015.symbol'; import { es2015_symbol_wellknown } from './es2015.symbol.wellknown'; -import { TYPE_VALUE, TYPE } from './base-config'; export const es2017_sharedmemory = { ...es2015_symbol, diff --git a/packages/scope-manager/src/lib/es2017.string.ts b/packages/scope-manager/src/lib/es2017.string.ts index 8ca832f3cf8..64ec52f3074 100644 --- a/packages/scope-manager/src/lib/es2017.string.ts +++ b/packages/scope-manager/src/lib/es2017.string.ts @@ -3,7 +3,7 @@ // RUN THE FOLLOWING COMMAND FROM THE WORKSPACE ROOT TO REGENERATE: // npx nx generate-lib @typescript-eslint/scope-manager -import { ImplicitLibVariableOptions } from '../variable'; +import type { ImplicitLibVariableOptions } from '../variable'; import { TYPE } from './base-config'; export const es2017_string = { diff --git a/packages/scope-manager/src/lib/es2017.ts b/packages/scope-manager/src/lib/es2017.ts index c28a0b45236..3cbafd35b16 100644 --- a/packages/scope-manager/src/lib/es2017.ts +++ b/packages/scope-manager/src/lib/es2017.ts @@ -3,12 +3,12 @@ // RUN THE FOLLOWING COMMAND FROM THE WORKSPACE ROOT TO REGENERATE: // npx nx generate-lib @typescript-eslint/scope-manager -import { ImplicitLibVariableOptions } from '../variable'; +import type { ImplicitLibVariableOptions } from '../variable'; import { es2016 } from './es2016'; +import { es2017_intl } from './es2017.intl'; import { es2017_object } from './es2017.object'; import { es2017_sharedmemory } from './es2017.sharedmemory'; import { es2017_string } from './es2017.string'; -import { es2017_intl } from './es2017.intl'; import { es2017_typedarrays } from './es2017.typedarrays'; export const es2017 = { diff --git a/packages/scope-manager/src/lib/es2017.typedarrays.ts b/packages/scope-manager/src/lib/es2017.typedarrays.ts index 0c9a43160b8..8fdb9a96281 100644 --- a/packages/scope-manager/src/lib/es2017.typedarrays.ts +++ b/packages/scope-manager/src/lib/es2017.typedarrays.ts @@ -3,7 +3,7 @@ // RUN THE FOLLOWING COMMAND FROM THE WORKSPACE ROOT TO REGENERATE: // npx nx generate-lib @typescript-eslint/scope-manager -import { ImplicitLibVariableOptions } from '../variable'; +import type { ImplicitLibVariableOptions } from '../variable'; import { TYPE } from './base-config'; export const es2017_typedarrays = { diff --git a/packages/scope-manager/src/lib/es2018.asyncgenerator.ts b/packages/scope-manager/src/lib/es2018.asyncgenerator.ts index 68f67bd6483..5af8bd0a663 100644 --- a/packages/scope-manager/src/lib/es2018.asyncgenerator.ts +++ b/packages/scope-manager/src/lib/es2018.asyncgenerator.ts @@ -3,9 +3,9 @@ // RUN THE FOLLOWING COMMAND FROM THE WORKSPACE ROOT TO REGENERATE: // npx nx generate-lib @typescript-eslint/scope-manager -import { ImplicitLibVariableOptions } from '../variable'; -import { es2018_asynciterable } from './es2018.asynciterable'; +import type { ImplicitLibVariableOptions } from '../variable'; import { TYPE } from './base-config'; +import { es2018_asynciterable } from './es2018.asynciterable'; export const es2018_asyncgenerator = { ...es2018_asynciterable, diff --git a/packages/scope-manager/src/lib/es2018.asynciterable.ts b/packages/scope-manager/src/lib/es2018.asynciterable.ts index ce4aebafb0d..5d4e373ef76 100644 --- a/packages/scope-manager/src/lib/es2018.asynciterable.ts +++ b/packages/scope-manager/src/lib/es2018.asynciterable.ts @@ -3,10 +3,10 @@ // RUN THE FOLLOWING COMMAND FROM THE WORKSPACE ROOT TO REGENERATE: // npx nx generate-lib @typescript-eslint/scope-manager -import { ImplicitLibVariableOptions } from '../variable'; -import { es2015_symbol } from './es2015.symbol'; -import { es2015_iterable } from './es2015.iterable'; +import type { ImplicitLibVariableOptions } from '../variable'; import { TYPE } from './base-config'; +import { es2015_iterable } from './es2015.iterable'; +import { es2015_symbol } from './es2015.symbol'; export const es2018_asynciterable = { ...es2015_symbol, diff --git a/packages/scope-manager/src/lib/es2018.full.ts b/packages/scope-manager/src/lib/es2018.full.ts index 8e0ab3621f2..802e30c6659 100644 --- a/packages/scope-manager/src/lib/es2018.full.ts +++ b/packages/scope-manager/src/lib/es2018.full.ts @@ -3,12 +3,12 @@ // RUN THE FOLLOWING COMMAND FROM THE WORKSPACE ROOT TO REGENERATE: // npx nx generate-lib @typescript-eslint/scope-manager -import { ImplicitLibVariableOptions } from '../variable'; -import { es2018 } from './es2018'; +import type { ImplicitLibVariableOptions } from '../variable'; import { dom } from './dom'; -import { webworker_importscripts } from './webworker.importscripts'; -import { scripthost } from './scripthost'; import { dom_iterable } from './dom.iterable'; +import { es2018 } from './es2018'; +import { scripthost } from './scripthost'; +import { webworker_importscripts } from './webworker.importscripts'; export const es2018_full = { ...es2018, diff --git a/packages/scope-manager/src/lib/es2018.intl.ts b/packages/scope-manager/src/lib/es2018.intl.ts index 8496761b2d2..9736c0ba48a 100644 --- a/packages/scope-manager/src/lib/es2018.intl.ts +++ b/packages/scope-manager/src/lib/es2018.intl.ts @@ -3,7 +3,7 @@ // RUN THE FOLLOWING COMMAND FROM THE WORKSPACE ROOT TO REGENERATE: // npx nx generate-lib @typescript-eslint/scope-manager -import { ImplicitLibVariableOptions } from '../variable'; +import type { ImplicitLibVariableOptions } from '../variable'; import { TYPE_VALUE } from './base-config'; export const es2018_intl = { diff --git a/packages/scope-manager/src/lib/es2018.promise.ts b/packages/scope-manager/src/lib/es2018.promise.ts index cc74f3b02b8..ac1e02d8a05 100644 --- a/packages/scope-manager/src/lib/es2018.promise.ts +++ b/packages/scope-manager/src/lib/es2018.promise.ts @@ -3,7 +3,7 @@ // RUN THE FOLLOWING COMMAND FROM THE WORKSPACE ROOT TO REGENERATE: // npx nx generate-lib @typescript-eslint/scope-manager -import { ImplicitLibVariableOptions } from '../variable'; +import type { ImplicitLibVariableOptions } from '../variable'; import { TYPE } from './base-config'; export const es2018_promise = { diff --git a/packages/scope-manager/src/lib/es2018.regexp.ts b/packages/scope-manager/src/lib/es2018.regexp.ts index 7c1ca120117..0fdf10f793a 100644 --- a/packages/scope-manager/src/lib/es2018.regexp.ts +++ b/packages/scope-manager/src/lib/es2018.regexp.ts @@ -3,7 +3,7 @@ // RUN THE FOLLOWING COMMAND FROM THE WORKSPACE ROOT TO REGENERATE: // npx nx generate-lib @typescript-eslint/scope-manager -import { ImplicitLibVariableOptions } from '../variable'; +import type { ImplicitLibVariableOptions } from '../variable'; import { TYPE } from './base-config'; export const es2018_regexp = { diff --git a/packages/scope-manager/src/lib/es2018.ts b/packages/scope-manager/src/lib/es2018.ts index a3b3fbe508c..d79390a3b87 100644 --- a/packages/scope-manager/src/lib/es2018.ts +++ b/packages/scope-manager/src/lib/es2018.ts @@ -3,13 +3,13 @@ // RUN THE FOLLOWING COMMAND FROM THE WORKSPACE ROOT TO REGENERATE: // npx nx generate-lib @typescript-eslint/scope-manager -import { ImplicitLibVariableOptions } from '../variable'; +import type { ImplicitLibVariableOptions } from '../variable'; import { es2017 } from './es2017'; -import { es2018_asynciterable } from './es2018.asynciterable'; import { es2018_asyncgenerator } from './es2018.asyncgenerator'; +import { es2018_asynciterable } from './es2018.asynciterable'; +import { es2018_intl } from './es2018.intl'; import { es2018_promise } from './es2018.promise'; import { es2018_regexp } from './es2018.regexp'; -import { es2018_intl } from './es2018.intl'; export const es2018 = { ...es2017, diff --git a/packages/scope-manager/src/lib/es2019.array.ts b/packages/scope-manager/src/lib/es2019.array.ts index 6d814131f52..b682bb04457 100644 --- a/packages/scope-manager/src/lib/es2019.array.ts +++ b/packages/scope-manager/src/lib/es2019.array.ts @@ -3,7 +3,7 @@ // RUN THE FOLLOWING COMMAND FROM THE WORKSPACE ROOT TO REGENERATE: // npx nx generate-lib @typescript-eslint/scope-manager -import { ImplicitLibVariableOptions } from '../variable'; +import type { ImplicitLibVariableOptions } from '../variable'; import { TYPE } from './base-config'; export const es2019_array = { diff --git a/packages/scope-manager/src/lib/es2019.full.ts b/packages/scope-manager/src/lib/es2019.full.ts index a97c713f5a0..8cee3178bc6 100644 --- a/packages/scope-manager/src/lib/es2019.full.ts +++ b/packages/scope-manager/src/lib/es2019.full.ts @@ -3,12 +3,12 @@ // RUN THE FOLLOWING COMMAND FROM THE WORKSPACE ROOT TO REGENERATE: // npx nx generate-lib @typescript-eslint/scope-manager -import { ImplicitLibVariableOptions } from '../variable'; -import { es2019 } from './es2019'; +import type { ImplicitLibVariableOptions } from '../variable'; import { dom } from './dom'; -import { webworker_importscripts } from './webworker.importscripts'; -import { scripthost } from './scripthost'; import { dom_iterable } from './dom.iterable'; +import { es2019 } from './es2019'; +import { scripthost } from './scripthost'; +import { webworker_importscripts } from './webworker.importscripts'; export const es2019_full = { ...es2019, diff --git a/packages/scope-manager/src/lib/es2019.intl.ts b/packages/scope-manager/src/lib/es2019.intl.ts index 8e44ef6d0cd..64b46f40ebb 100644 --- a/packages/scope-manager/src/lib/es2019.intl.ts +++ b/packages/scope-manager/src/lib/es2019.intl.ts @@ -3,7 +3,7 @@ // RUN THE FOLLOWING COMMAND FROM THE WORKSPACE ROOT TO REGENERATE: // npx nx generate-lib @typescript-eslint/scope-manager -import { ImplicitLibVariableOptions } from '../variable'; +import type { ImplicitLibVariableOptions } from '../variable'; import { TYPE_VALUE } from './base-config'; export const es2019_intl = { diff --git a/packages/scope-manager/src/lib/es2019.object.ts b/packages/scope-manager/src/lib/es2019.object.ts index 87f3bb33f45..f1f113ed54d 100644 --- a/packages/scope-manager/src/lib/es2019.object.ts +++ b/packages/scope-manager/src/lib/es2019.object.ts @@ -3,9 +3,9 @@ // RUN THE FOLLOWING COMMAND FROM THE WORKSPACE ROOT TO REGENERATE: // npx nx generate-lib @typescript-eslint/scope-manager -import { ImplicitLibVariableOptions } from '../variable'; -import { es2015_iterable } from './es2015.iterable'; +import type { ImplicitLibVariableOptions } from '../variable'; import { TYPE } from './base-config'; +import { es2015_iterable } from './es2015.iterable'; export const es2019_object = { ...es2015_iterable, diff --git a/packages/scope-manager/src/lib/es2019.string.ts b/packages/scope-manager/src/lib/es2019.string.ts index af1f1f8f2b5..eae2a44d376 100644 --- a/packages/scope-manager/src/lib/es2019.string.ts +++ b/packages/scope-manager/src/lib/es2019.string.ts @@ -3,7 +3,7 @@ // RUN THE FOLLOWING COMMAND FROM THE WORKSPACE ROOT TO REGENERATE: // npx nx generate-lib @typescript-eslint/scope-manager -import { ImplicitLibVariableOptions } from '../variable'; +import type { ImplicitLibVariableOptions } from '../variable'; import { TYPE } from './base-config'; export const es2019_string = { diff --git a/packages/scope-manager/src/lib/es2019.symbol.ts b/packages/scope-manager/src/lib/es2019.symbol.ts index 5c8a1fd2894..b39b41add7a 100644 --- a/packages/scope-manager/src/lib/es2019.symbol.ts +++ b/packages/scope-manager/src/lib/es2019.symbol.ts @@ -3,7 +3,7 @@ // RUN THE FOLLOWING COMMAND FROM THE WORKSPACE ROOT TO REGENERATE: // npx nx generate-lib @typescript-eslint/scope-manager -import { ImplicitLibVariableOptions } from '../variable'; +import type { ImplicitLibVariableOptions } from '../variable'; import { TYPE } from './base-config'; export const es2019_symbol = { diff --git a/packages/scope-manager/src/lib/es2019.ts b/packages/scope-manager/src/lib/es2019.ts index e41e53c1524..cd6d33c1f5d 100644 --- a/packages/scope-manager/src/lib/es2019.ts +++ b/packages/scope-manager/src/lib/es2019.ts @@ -3,13 +3,13 @@ // RUN THE FOLLOWING COMMAND FROM THE WORKSPACE ROOT TO REGENERATE: // npx nx generate-lib @typescript-eslint/scope-manager -import { ImplicitLibVariableOptions } from '../variable'; +import type { ImplicitLibVariableOptions } from '../variable'; import { es2018 } from './es2018'; import { es2019_array } from './es2019.array'; +import { es2019_intl } from './es2019.intl'; import { es2019_object } from './es2019.object'; import { es2019_string } from './es2019.string'; import { es2019_symbol } from './es2019.symbol'; -import { es2019_intl } from './es2019.intl'; export const es2019 = { ...es2018, diff --git a/packages/scope-manager/src/lib/es2020.bigint.ts b/packages/scope-manager/src/lib/es2020.bigint.ts index 3444dc701a2..52fbba1ca2e 100644 --- a/packages/scope-manager/src/lib/es2020.bigint.ts +++ b/packages/scope-manager/src/lib/es2020.bigint.ts @@ -3,9 +3,9 @@ // RUN THE FOLLOWING COMMAND FROM THE WORKSPACE ROOT TO REGENERATE: // npx nx generate-lib @typescript-eslint/scope-manager -import { ImplicitLibVariableOptions } from '../variable'; -import { es2020_intl } from './es2020.intl'; +import type { ImplicitLibVariableOptions } from '../variable'; import { TYPE, TYPE_VALUE } from './base-config'; +import { es2020_intl } from './es2020.intl'; export const es2020_bigint = { ...es2020_intl, diff --git a/packages/scope-manager/src/lib/es2020.date.ts b/packages/scope-manager/src/lib/es2020.date.ts index 1a5ed0d23f3..b4c3d319deb 100644 --- a/packages/scope-manager/src/lib/es2020.date.ts +++ b/packages/scope-manager/src/lib/es2020.date.ts @@ -3,9 +3,9 @@ // RUN THE FOLLOWING COMMAND FROM THE WORKSPACE ROOT TO REGENERATE: // npx nx generate-lib @typescript-eslint/scope-manager -import { ImplicitLibVariableOptions } from '../variable'; -import { es2020_intl } from './es2020.intl'; +import type { ImplicitLibVariableOptions } from '../variable'; import { TYPE } from './base-config'; +import { es2020_intl } from './es2020.intl'; export const es2020_date = { ...es2020_intl, diff --git a/packages/scope-manager/src/lib/es2020.full.ts b/packages/scope-manager/src/lib/es2020.full.ts index 6467ba7818d..1de20eaecc4 100644 --- a/packages/scope-manager/src/lib/es2020.full.ts +++ b/packages/scope-manager/src/lib/es2020.full.ts @@ -3,12 +3,12 @@ // RUN THE FOLLOWING COMMAND FROM THE WORKSPACE ROOT TO REGENERATE: // npx nx generate-lib @typescript-eslint/scope-manager -import { ImplicitLibVariableOptions } from '../variable'; -import { es2020 } from './es2020'; +import type { ImplicitLibVariableOptions } from '../variable'; import { dom } from './dom'; -import { webworker_importscripts } from './webworker.importscripts'; -import { scripthost } from './scripthost'; import { dom_iterable } from './dom.iterable'; +import { es2020 } from './es2020'; +import { scripthost } from './scripthost'; +import { webworker_importscripts } from './webworker.importscripts'; export const es2020_full = { ...es2020, diff --git a/packages/scope-manager/src/lib/es2020.intl.ts b/packages/scope-manager/src/lib/es2020.intl.ts index 6cf997c0ca3..2866dde791e 100644 --- a/packages/scope-manager/src/lib/es2020.intl.ts +++ b/packages/scope-manager/src/lib/es2020.intl.ts @@ -3,9 +3,9 @@ // RUN THE FOLLOWING COMMAND FROM THE WORKSPACE ROOT TO REGENERATE: // npx nx generate-lib @typescript-eslint/scope-manager -import { ImplicitLibVariableOptions } from '../variable'; -import { es2018_intl } from './es2018.intl'; +import type { ImplicitLibVariableOptions } from '../variable'; import { TYPE_VALUE } from './base-config'; +import { es2018_intl } from './es2018.intl'; export const es2020_intl = { ...es2018_intl, diff --git a/packages/scope-manager/src/lib/es2020.number.ts b/packages/scope-manager/src/lib/es2020.number.ts index 04ba01bc4bf..445b6073364 100644 --- a/packages/scope-manager/src/lib/es2020.number.ts +++ b/packages/scope-manager/src/lib/es2020.number.ts @@ -3,9 +3,9 @@ // RUN THE FOLLOWING COMMAND FROM THE WORKSPACE ROOT TO REGENERATE: // npx nx generate-lib @typescript-eslint/scope-manager -import { ImplicitLibVariableOptions } from '../variable'; -import { es2020_intl } from './es2020.intl'; +import type { ImplicitLibVariableOptions } from '../variable'; import { TYPE } from './base-config'; +import { es2020_intl } from './es2020.intl'; export const es2020_number = { ...es2020_intl, diff --git a/packages/scope-manager/src/lib/es2020.promise.ts b/packages/scope-manager/src/lib/es2020.promise.ts index c875a4c7b31..0352586806d 100644 --- a/packages/scope-manager/src/lib/es2020.promise.ts +++ b/packages/scope-manager/src/lib/es2020.promise.ts @@ -3,7 +3,7 @@ // RUN THE FOLLOWING COMMAND FROM THE WORKSPACE ROOT TO REGENERATE: // npx nx generate-lib @typescript-eslint/scope-manager -import { ImplicitLibVariableOptions } from '../variable'; +import type { ImplicitLibVariableOptions } from '../variable'; import { TYPE } from './base-config'; export const es2020_promise = { diff --git a/packages/scope-manager/src/lib/es2020.sharedmemory.ts b/packages/scope-manager/src/lib/es2020.sharedmemory.ts index e927965e621..180e291c0cc 100644 --- a/packages/scope-manager/src/lib/es2020.sharedmemory.ts +++ b/packages/scope-manager/src/lib/es2020.sharedmemory.ts @@ -3,7 +3,7 @@ // RUN THE FOLLOWING COMMAND FROM THE WORKSPACE ROOT TO REGENERATE: // npx nx generate-lib @typescript-eslint/scope-manager -import { ImplicitLibVariableOptions } from '../variable'; +import type { ImplicitLibVariableOptions } from '../variable'; import { TYPE } from './base-config'; export const es2020_sharedmemory = { diff --git a/packages/scope-manager/src/lib/es2020.string.ts b/packages/scope-manager/src/lib/es2020.string.ts index c33be91dd3f..ef0a81e1ca8 100644 --- a/packages/scope-manager/src/lib/es2020.string.ts +++ b/packages/scope-manager/src/lib/es2020.string.ts @@ -3,9 +3,9 @@ // RUN THE FOLLOWING COMMAND FROM THE WORKSPACE ROOT TO REGENERATE: // npx nx generate-lib @typescript-eslint/scope-manager -import { ImplicitLibVariableOptions } from '../variable'; -import { es2015_iterable } from './es2015.iterable'; +import type { ImplicitLibVariableOptions } from '../variable'; import { TYPE } from './base-config'; +import { es2015_iterable } from './es2015.iterable'; export const es2020_string = { ...es2015_iterable, diff --git a/packages/scope-manager/src/lib/es2020.symbol.wellknown.ts b/packages/scope-manager/src/lib/es2020.symbol.wellknown.ts index db8d79e9f44..1e104700032 100644 --- a/packages/scope-manager/src/lib/es2020.symbol.wellknown.ts +++ b/packages/scope-manager/src/lib/es2020.symbol.wellknown.ts @@ -3,10 +3,10 @@ // RUN THE FOLLOWING COMMAND FROM THE WORKSPACE ROOT TO REGENERATE: // npx nx generate-lib @typescript-eslint/scope-manager -import { ImplicitLibVariableOptions } from '../variable'; +import type { ImplicitLibVariableOptions } from '../variable'; +import { TYPE } from './base-config'; import { es2015_iterable } from './es2015.iterable'; import { es2015_symbol } from './es2015.symbol'; -import { TYPE } from './base-config'; export const es2020_symbol_wellknown = { ...es2015_iterable, diff --git a/packages/scope-manager/src/lib/es2020.ts b/packages/scope-manager/src/lib/es2020.ts index 3a89464f456..c6b1140596b 100644 --- a/packages/scope-manager/src/lib/es2020.ts +++ b/packages/scope-manager/src/lib/es2020.ts @@ -3,16 +3,16 @@ // RUN THE FOLLOWING COMMAND FROM THE WORKSPACE ROOT TO REGENERATE: // npx nx generate-lib @typescript-eslint/scope-manager -import { ImplicitLibVariableOptions } from '../variable'; +import type { ImplicitLibVariableOptions } from '../variable'; import { es2019 } from './es2019'; import { es2020_bigint } from './es2020.bigint'; import { es2020_date } from './es2020.date'; +import { es2020_intl } from './es2020.intl'; import { es2020_number } from './es2020.number'; import { es2020_promise } from './es2020.promise'; import { es2020_sharedmemory } from './es2020.sharedmemory'; import { es2020_string } from './es2020.string'; import { es2020_symbol_wellknown } from './es2020.symbol.wellknown'; -import { es2020_intl } from './es2020.intl'; export const es2020 = { ...es2019, diff --git a/packages/scope-manager/src/lib/es2021.full.ts b/packages/scope-manager/src/lib/es2021.full.ts index 2bf87c06e1a..e45a862ff2b 100644 --- a/packages/scope-manager/src/lib/es2021.full.ts +++ b/packages/scope-manager/src/lib/es2021.full.ts @@ -3,12 +3,12 @@ // RUN THE FOLLOWING COMMAND FROM THE WORKSPACE ROOT TO REGENERATE: // npx nx generate-lib @typescript-eslint/scope-manager -import { ImplicitLibVariableOptions } from '../variable'; -import { es2021 } from './es2021'; +import type { ImplicitLibVariableOptions } from '../variable'; import { dom } from './dom'; -import { webworker_importscripts } from './webworker.importscripts'; -import { scripthost } from './scripthost'; import { dom_iterable } from './dom.iterable'; +import { es2021 } from './es2021'; +import { scripthost } from './scripthost'; +import { webworker_importscripts } from './webworker.importscripts'; export const es2021_full = { ...es2021, diff --git a/packages/scope-manager/src/lib/es2021.intl.ts b/packages/scope-manager/src/lib/es2021.intl.ts index f73cbe394ab..e8cebf8ed07 100644 --- a/packages/scope-manager/src/lib/es2021.intl.ts +++ b/packages/scope-manager/src/lib/es2021.intl.ts @@ -3,7 +3,7 @@ // RUN THE FOLLOWING COMMAND FROM THE WORKSPACE ROOT TO REGENERATE: // npx nx generate-lib @typescript-eslint/scope-manager -import { ImplicitLibVariableOptions } from '../variable'; +import type { ImplicitLibVariableOptions } from '../variable'; import { TYPE_VALUE } from './base-config'; export const es2021_intl = { diff --git a/packages/scope-manager/src/lib/es2021.promise.ts b/packages/scope-manager/src/lib/es2021.promise.ts index 3607632e743..20d1f1b313c 100644 --- a/packages/scope-manager/src/lib/es2021.promise.ts +++ b/packages/scope-manager/src/lib/es2021.promise.ts @@ -3,8 +3,8 @@ // RUN THE FOLLOWING COMMAND FROM THE WORKSPACE ROOT TO REGENERATE: // npx nx generate-lib @typescript-eslint/scope-manager -import { ImplicitLibVariableOptions } from '../variable'; -import { TYPE_VALUE, TYPE } from './base-config'; +import type { ImplicitLibVariableOptions } from '../variable'; +import { TYPE, TYPE_VALUE } from './base-config'; export const es2021_promise = { AggregateError: TYPE_VALUE, diff --git a/packages/scope-manager/src/lib/es2021.string.ts b/packages/scope-manager/src/lib/es2021.string.ts index 28e9af00f37..8b7aa25c5a5 100644 --- a/packages/scope-manager/src/lib/es2021.string.ts +++ b/packages/scope-manager/src/lib/es2021.string.ts @@ -3,7 +3,7 @@ // RUN THE FOLLOWING COMMAND FROM THE WORKSPACE ROOT TO REGENERATE: // npx nx generate-lib @typescript-eslint/scope-manager -import { ImplicitLibVariableOptions } from '../variable'; +import type { ImplicitLibVariableOptions } from '../variable'; import { TYPE } from './base-config'; export const es2021_string = { diff --git a/packages/scope-manager/src/lib/es2021.ts b/packages/scope-manager/src/lib/es2021.ts index 43fd33f9abe..c54cfc31ccb 100644 --- a/packages/scope-manager/src/lib/es2021.ts +++ b/packages/scope-manager/src/lib/es2021.ts @@ -3,12 +3,12 @@ // RUN THE FOLLOWING COMMAND FROM THE WORKSPACE ROOT TO REGENERATE: // npx nx generate-lib @typescript-eslint/scope-manager -import { ImplicitLibVariableOptions } from '../variable'; +import type { ImplicitLibVariableOptions } from '../variable'; import { es2020 } from './es2020'; +import { es2021_intl } from './es2021.intl'; import { es2021_promise } from './es2021.promise'; import { es2021_string } from './es2021.string'; import { es2021_weakref } from './es2021.weakref'; -import { es2021_intl } from './es2021.intl'; export const es2021 = { ...es2020, diff --git a/packages/scope-manager/src/lib/es2021.weakref.ts b/packages/scope-manager/src/lib/es2021.weakref.ts index 4a7ee2ea44c..a65c90a8058 100644 --- a/packages/scope-manager/src/lib/es2021.weakref.ts +++ b/packages/scope-manager/src/lib/es2021.weakref.ts @@ -3,8 +3,8 @@ // RUN THE FOLLOWING COMMAND FROM THE WORKSPACE ROOT TO REGENERATE: // npx nx generate-lib @typescript-eslint/scope-manager -import { ImplicitLibVariableOptions } from '../variable'; -import { TYPE_VALUE, TYPE } from './base-config'; +import type { ImplicitLibVariableOptions } from '../variable'; +import { TYPE, TYPE_VALUE } from './base-config'; export const es2021_weakref = { WeakRef: TYPE_VALUE, diff --git a/packages/scope-manager/src/lib/es2022.array.ts b/packages/scope-manager/src/lib/es2022.array.ts index 95785becd3d..3927f26851e 100644 --- a/packages/scope-manager/src/lib/es2022.array.ts +++ b/packages/scope-manager/src/lib/es2022.array.ts @@ -3,7 +3,7 @@ // RUN THE FOLLOWING COMMAND FROM THE WORKSPACE ROOT TO REGENERATE: // npx nx generate-lib @typescript-eslint/scope-manager -import { ImplicitLibVariableOptions } from '../variable'; +import type { ImplicitLibVariableOptions } from '../variable'; import { TYPE } from './base-config'; export const es2022_array = { diff --git a/packages/scope-manager/src/lib/es2022.error.ts b/packages/scope-manager/src/lib/es2022.error.ts index f1e1bc2fa0f..282f66648bb 100644 --- a/packages/scope-manager/src/lib/es2022.error.ts +++ b/packages/scope-manager/src/lib/es2022.error.ts @@ -3,7 +3,7 @@ // RUN THE FOLLOWING COMMAND FROM THE WORKSPACE ROOT TO REGENERATE: // npx nx generate-lib @typescript-eslint/scope-manager -import { ImplicitLibVariableOptions } from '../variable'; +import type { ImplicitLibVariableOptions } from '../variable'; import { TYPE } from './base-config'; export const es2022_error = { diff --git a/packages/scope-manager/src/lib/es2022.full.ts b/packages/scope-manager/src/lib/es2022.full.ts index 3ef0dd62eca..1cf84cd17eb 100644 --- a/packages/scope-manager/src/lib/es2022.full.ts +++ b/packages/scope-manager/src/lib/es2022.full.ts @@ -3,12 +3,12 @@ // RUN THE FOLLOWING COMMAND FROM THE WORKSPACE ROOT TO REGENERATE: // npx nx generate-lib @typescript-eslint/scope-manager -import { ImplicitLibVariableOptions } from '../variable'; -import { es2022 } from './es2022'; +import type { ImplicitLibVariableOptions } from '../variable'; import { dom } from './dom'; -import { webworker_importscripts } from './webworker.importscripts'; -import { scripthost } from './scripthost'; import { dom_iterable } from './dom.iterable'; +import { es2022 } from './es2022'; +import { scripthost } from './scripthost'; +import { webworker_importscripts } from './webworker.importscripts'; export const es2022_full = { ...es2022, diff --git a/packages/scope-manager/src/lib/es2022.intl.ts b/packages/scope-manager/src/lib/es2022.intl.ts index f91ef8640a0..22c7fc5694d 100644 --- a/packages/scope-manager/src/lib/es2022.intl.ts +++ b/packages/scope-manager/src/lib/es2022.intl.ts @@ -3,7 +3,7 @@ // RUN THE FOLLOWING COMMAND FROM THE WORKSPACE ROOT TO REGENERATE: // npx nx generate-lib @typescript-eslint/scope-manager -import { ImplicitLibVariableOptions } from '../variable'; +import type { ImplicitLibVariableOptions } from '../variable'; import { TYPE_VALUE } from './base-config'; export const es2022_intl = { diff --git a/packages/scope-manager/src/lib/es2022.object.ts b/packages/scope-manager/src/lib/es2022.object.ts index 650a01c3835..ea209894d13 100644 --- a/packages/scope-manager/src/lib/es2022.object.ts +++ b/packages/scope-manager/src/lib/es2022.object.ts @@ -3,7 +3,7 @@ // RUN THE FOLLOWING COMMAND FROM THE WORKSPACE ROOT TO REGENERATE: // npx nx generate-lib @typescript-eslint/scope-manager -import { ImplicitLibVariableOptions } from '../variable'; +import type { ImplicitLibVariableOptions } from '../variable'; import { TYPE } from './base-config'; export const es2022_object = { diff --git a/packages/scope-manager/src/lib/es2022.sharedmemory.ts b/packages/scope-manager/src/lib/es2022.sharedmemory.ts index 8efb4b9d8c9..24d82d60912 100644 --- a/packages/scope-manager/src/lib/es2022.sharedmemory.ts +++ b/packages/scope-manager/src/lib/es2022.sharedmemory.ts @@ -3,7 +3,7 @@ // RUN THE FOLLOWING COMMAND FROM THE WORKSPACE ROOT TO REGENERATE: // npx nx generate-lib @typescript-eslint/scope-manager -import { ImplicitLibVariableOptions } from '../variable'; +import type { ImplicitLibVariableOptions } from '../variable'; import { TYPE } from './base-config'; export const es2022_sharedmemory = { diff --git a/packages/scope-manager/src/lib/es2022.string.ts b/packages/scope-manager/src/lib/es2022.string.ts index 3c4e1a766cd..8cd490c9bc5 100644 --- a/packages/scope-manager/src/lib/es2022.string.ts +++ b/packages/scope-manager/src/lib/es2022.string.ts @@ -3,7 +3,7 @@ // RUN THE FOLLOWING COMMAND FROM THE WORKSPACE ROOT TO REGENERATE: // npx nx generate-lib @typescript-eslint/scope-manager -import { ImplicitLibVariableOptions } from '../variable'; +import type { ImplicitLibVariableOptions } from '../variable'; import { TYPE } from './base-config'; export const es2022_string = { diff --git a/packages/scope-manager/src/lib/es2022.ts b/packages/scope-manager/src/lib/es2022.ts index 6f23b9dcd57..0956c0111d6 100644 --- a/packages/scope-manager/src/lib/es2022.ts +++ b/packages/scope-manager/src/lib/es2022.ts @@ -3,7 +3,7 @@ // RUN THE FOLLOWING COMMAND FROM THE WORKSPACE ROOT TO REGENERATE: // npx nx generate-lib @typescript-eslint/scope-manager -import { ImplicitLibVariableOptions } from '../variable'; +import type { ImplicitLibVariableOptions } from '../variable'; import { es2021 } from './es2021'; import { es2022_array } from './es2022.array'; import { es2022_error } from './es2022.error'; diff --git a/packages/scope-manager/src/lib/es5.ts b/packages/scope-manager/src/lib/es5.ts index 888faf61520..cef8eb253ce 100644 --- a/packages/scope-manager/src/lib/es5.ts +++ b/packages/scope-manager/src/lib/es5.ts @@ -3,7 +3,7 @@ // RUN THE FOLLOWING COMMAND FROM THE WORKSPACE ROOT TO REGENERATE: // npx nx generate-lib @typescript-eslint/scope-manager -import { ImplicitLibVariableOptions } from '../variable'; +import type { ImplicitLibVariableOptions } from '../variable'; import { TYPE, TYPE_VALUE } from './base-config'; export const es5 = { diff --git a/packages/scope-manager/src/lib/es6.ts b/packages/scope-manager/src/lib/es6.ts index 57c3eca6234..12bf80e84c9 100644 --- a/packages/scope-manager/src/lib/es6.ts +++ b/packages/scope-manager/src/lib/es6.ts @@ -3,12 +3,12 @@ // RUN THE FOLLOWING COMMAND FROM THE WORKSPACE ROOT TO REGENERATE: // npx nx generate-lib @typescript-eslint/scope-manager -import { ImplicitLibVariableOptions } from '../variable'; +import type { ImplicitLibVariableOptions } from '../variable'; import { es5 } from './es5'; -import { es2015_core } from './es2015.core'; import { es2015_collection } from './es2015.collection'; -import { es2015_iterable } from './es2015.iterable'; +import { es2015_core } from './es2015.core'; import { es2015_generator } from './es2015.generator'; +import { es2015_iterable } from './es2015.iterable'; import { es2015_promise } from './es2015.promise'; import { es2015_proxy } from './es2015.proxy'; import { es2015_reflect } from './es2015.reflect'; diff --git a/packages/scope-manager/src/lib/es7.ts b/packages/scope-manager/src/lib/es7.ts index dd0ae5bef60..e79a1dd39c7 100644 --- a/packages/scope-manager/src/lib/es7.ts +++ b/packages/scope-manager/src/lib/es7.ts @@ -3,7 +3,7 @@ // RUN THE FOLLOWING COMMAND FROM THE WORKSPACE ROOT TO REGENERATE: // npx nx generate-lib @typescript-eslint/scope-manager -import { ImplicitLibVariableOptions } from '../variable'; +import type { ImplicitLibVariableOptions } from '../variable'; import { es2015 } from './es2015'; import { es2016_array_include } from './es2016.array.include'; diff --git a/packages/scope-manager/src/lib/esnext.array.ts b/packages/scope-manager/src/lib/esnext.array.ts index 87709c583e4..e7d9824cf8c 100644 --- a/packages/scope-manager/src/lib/esnext.array.ts +++ b/packages/scope-manager/src/lib/esnext.array.ts @@ -3,7 +3,7 @@ // RUN THE FOLLOWING COMMAND FROM THE WORKSPACE ROOT TO REGENERATE: // npx nx generate-lib @typescript-eslint/scope-manager -import { ImplicitLibVariableOptions } from '../variable'; +import type { ImplicitLibVariableOptions } from '../variable'; import { TYPE } from './base-config'; export const esnext_array = { diff --git a/packages/scope-manager/src/lib/esnext.asynciterable.ts b/packages/scope-manager/src/lib/esnext.asynciterable.ts index 22c97a07040..2479b150904 100644 --- a/packages/scope-manager/src/lib/esnext.asynciterable.ts +++ b/packages/scope-manager/src/lib/esnext.asynciterable.ts @@ -3,10 +3,10 @@ // RUN THE FOLLOWING COMMAND FROM THE WORKSPACE ROOT TO REGENERATE: // npx nx generate-lib @typescript-eslint/scope-manager -import { ImplicitLibVariableOptions } from '../variable'; -import { es2015_symbol } from './es2015.symbol'; -import { es2015_iterable } from './es2015.iterable'; +import type { ImplicitLibVariableOptions } from '../variable'; import { TYPE } from './base-config'; +import { es2015_iterable } from './es2015.iterable'; +import { es2015_symbol } from './es2015.symbol'; export const esnext_asynciterable = { ...es2015_symbol, diff --git a/packages/scope-manager/src/lib/esnext.bigint.ts b/packages/scope-manager/src/lib/esnext.bigint.ts index 079bc59bf87..ccd2ae93293 100644 --- a/packages/scope-manager/src/lib/esnext.bigint.ts +++ b/packages/scope-manager/src/lib/esnext.bigint.ts @@ -3,9 +3,9 @@ // RUN THE FOLLOWING COMMAND FROM THE WORKSPACE ROOT TO REGENERATE: // npx nx generate-lib @typescript-eslint/scope-manager -import { ImplicitLibVariableOptions } from '../variable'; -import { es2020_intl } from './es2020.intl'; +import type { ImplicitLibVariableOptions } from '../variable'; import { TYPE, TYPE_VALUE } from './base-config'; +import { es2020_intl } from './es2020.intl'; export const esnext_bigint = { ...es2020_intl, diff --git a/packages/scope-manager/src/lib/esnext.full.ts b/packages/scope-manager/src/lib/esnext.full.ts index 5d7b43c2b66..2bae36c386e 100644 --- a/packages/scope-manager/src/lib/esnext.full.ts +++ b/packages/scope-manager/src/lib/esnext.full.ts @@ -3,12 +3,12 @@ // RUN THE FOLLOWING COMMAND FROM THE WORKSPACE ROOT TO REGENERATE: // npx nx generate-lib @typescript-eslint/scope-manager -import { ImplicitLibVariableOptions } from '../variable'; -import { esnext } from './esnext'; +import type { ImplicitLibVariableOptions } from '../variable'; import { dom } from './dom'; -import { webworker_importscripts } from './webworker.importscripts'; -import { scripthost } from './scripthost'; import { dom_iterable } from './dom.iterable'; +import { esnext } from './esnext'; +import { scripthost } from './scripthost'; +import { webworker_importscripts } from './webworker.importscripts'; export const esnext_full = { ...esnext, diff --git a/packages/scope-manager/src/lib/esnext.intl.ts b/packages/scope-manager/src/lib/esnext.intl.ts index 03cc1fb5997..35c7ef82ddb 100644 --- a/packages/scope-manager/src/lib/esnext.intl.ts +++ b/packages/scope-manager/src/lib/esnext.intl.ts @@ -3,7 +3,7 @@ // RUN THE FOLLOWING COMMAND FROM THE WORKSPACE ROOT TO REGENERATE: // npx nx generate-lib @typescript-eslint/scope-manager -import { ImplicitLibVariableOptions } from '../variable'; +import type { ImplicitLibVariableOptions } from '../variable'; import { TYPE_VALUE } from './base-config'; export const esnext_intl = { diff --git a/packages/scope-manager/src/lib/esnext.promise.ts b/packages/scope-manager/src/lib/esnext.promise.ts index 8042c77f8b4..08c9e142841 100644 --- a/packages/scope-manager/src/lib/esnext.promise.ts +++ b/packages/scope-manager/src/lib/esnext.promise.ts @@ -3,8 +3,8 @@ // RUN THE FOLLOWING COMMAND FROM THE WORKSPACE ROOT TO REGENERATE: // npx nx generate-lib @typescript-eslint/scope-manager -import { ImplicitLibVariableOptions } from '../variable'; -import { TYPE_VALUE, TYPE } from './base-config'; +import type { ImplicitLibVariableOptions } from '../variable'; +import { TYPE, TYPE_VALUE } from './base-config'; export const esnext_promise = { AggregateError: TYPE_VALUE, diff --git a/packages/scope-manager/src/lib/esnext.string.ts b/packages/scope-manager/src/lib/esnext.string.ts index 354c5d6dfea..d0bacb659a4 100644 --- a/packages/scope-manager/src/lib/esnext.string.ts +++ b/packages/scope-manager/src/lib/esnext.string.ts @@ -3,7 +3,7 @@ // RUN THE FOLLOWING COMMAND FROM THE WORKSPACE ROOT TO REGENERATE: // npx nx generate-lib @typescript-eslint/scope-manager -import { ImplicitLibVariableOptions } from '../variable'; +import type { ImplicitLibVariableOptions } from '../variable'; import { TYPE } from './base-config'; export const esnext_string = { diff --git a/packages/scope-manager/src/lib/esnext.symbol.ts b/packages/scope-manager/src/lib/esnext.symbol.ts index 49b2a8c9cd7..fb16e1cb55a 100644 --- a/packages/scope-manager/src/lib/esnext.symbol.ts +++ b/packages/scope-manager/src/lib/esnext.symbol.ts @@ -3,7 +3,7 @@ // RUN THE FOLLOWING COMMAND FROM THE WORKSPACE ROOT TO REGENERATE: // npx nx generate-lib @typescript-eslint/scope-manager -import { ImplicitLibVariableOptions } from '../variable'; +import type { ImplicitLibVariableOptions } from '../variable'; import { TYPE } from './base-config'; export const esnext_symbol = { diff --git a/packages/scope-manager/src/lib/esnext.ts b/packages/scope-manager/src/lib/esnext.ts index e6c59d96cf2..31ac2762267 100644 --- a/packages/scope-manager/src/lib/esnext.ts +++ b/packages/scope-manager/src/lib/esnext.ts @@ -3,7 +3,7 @@ // RUN THE FOLLOWING COMMAND FROM THE WORKSPACE ROOT TO REGENERATE: // npx nx generate-lib @typescript-eslint/scope-manager -import { ImplicitLibVariableOptions } from '../variable'; +import type { ImplicitLibVariableOptions } from '../variable'; import { es2022 } from './es2022'; import { esnext_intl } from './esnext.intl'; diff --git a/packages/scope-manager/src/lib/esnext.weakref.ts b/packages/scope-manager/src/lib/esnext.weakref.ts index aec8e3070bf..9a7df1c6d58 100644 --- a/packages/scope-manager/src/lib/esnext.weakref.ts +++ b/packages/scope-manager/src/lib/esnext.weakref.ts @@ -3,8 +3,8 @@ // RUN THE FOLLOWING COMMAND FROM THE WORKSPACE ROOT TO REGENERATE: // npx nx generate-lib @typescript-eslint/scope-manager -import { ImplicitLibVariableOptions } from '../variable'; -import { TYPE_VALUE, TYPE } from './base-config'; +import type { ImplicitLibVariableOptions } from '../variable'; +import { TYPE, TYPE_VALUE } from './base-config'; export const esnext_weakref = { WeakRef: TYPE_VALUE, diff --git a/packages/scope-manager/src/lib/index.ts b/packages/scope-manager/src/lib/index.ts index 06888a64238..dfee880fa16 100644 --- a/packages/scope-manager/src/lib/index.ts +++ b/packages/scope-manager/src/lib/index.ts @@ -3,26 +3,14 @@ // RUN THE FOLLOWING COMMAND FROM THE WORKSPACE ROOT TO REGENERATE: // npx nx generate-lib @typescript-eslint/scope-manager +import { dom } from './dom'; +import { dom_iterable } from './dom.iterable'; import { es5 } from './es5'; import { es6 } from './es6'; -import { es2015 } from './es2015'; import { es7 } from './es7'; -import { es2016 } from './es2016'; -import { es2017 } from './es2017'; -import { es2018 } from './es2018'; -import { es2019 } from './es2019'; -import { es2020 } from './es2020'; -import { es2021 } from './es2021'; -import { es2022 } from './es2022'; -import { esnext } from './esnext'; -import { dom } from './dom'; -import { dom_iterable } from './dom.iterable'; -import { webworker } from './webworker'; -import { webworker_importscripts } from './webworker.importscripts'; -import { webworker_iterable } from './webworker.iterable'; -import { scripthost } from './scripthost'; -import { es2015_core } from './es2015.core'; +import { es2015 } from './es2015'; import { es2015_collection } from './es2015.collection'; +import { es2015_core } from './es2015.core'; import { es2015_generator } from './es2015.generator'; import { es2015_iterable } from './es2015.iterable'; import { es2015_promise } from './es2015.promise'; @@ -30,57 +18,69 @@ import { es2015_proxy } from './es2015.proxy'; import { es2015_reflect } from './es2015.reflect'; import { es2015_symbol } from './es2015.symbol'; import { es2015_symbol_wellknown } from './es2015.symbol.wellknown'; +import { es2016 } from './es2016'; import { es2016_array_include } from './es2016.array.include'; +import { es2016_full } from './es2016.full'; +import { es2017 } from './es2017'; +import { es2017_full } from './es2017.full'; +import { es2017_intl } from './es2017.intl'; import { es2017_object } from './es2017.object'; import { es2017_sharedmemory } from './es2017.sharedmemory'; import { es2017_string } from './es2017.string'; -import { es2017_intl } from './es2017.intl'; import { es2017_typedarrays } from './es2017.typedarrays'; +import { es2018 } from './es2018'; import { es2018_asyncgenerator } from './es2018.asyncgenerator'; import { es2018_asynciterable } from './es2018.asynciterable'; +import { es2018_full } from './es2018.full'; import { es2018_intl } from './es2018.intl'; import { es2018_promise } from './es2018.promise'; import { es2018_regexp } from './es2018.regexp'; +import { es2019 } from './es2019'; import { es2019_array } from './es2019.array'; +import { es2019_full } from './es2019.full'; +import { es2019_intl } from './es2019.intl'; import { es2019_object } from './es2019.object'; import { es2019_string } from './es2019.string'; import { es2019_symbol } from './es2019.symbol'; -import { es2019_intl } from './es2019.intl'; +import { es2020 } from './es2020'; import { es2020_bigint } from './es2020.bigint'; import { es2020_date } from './es2020.date'; +import { es2020_full } from './es2020.full'; +import { es2020_intl } from './es2020.intl'; +import { es2020_number } from './es2020.number'; import { es2020_promise } from './es2020.promise'; import { es2020_sharedmemory } from './es2020.sharedmemory'; import { es2020_string } from './es2020.string'; import { es2020_symbol_wellknown } from './es2020.symbol.wellknown'; -import { es2020_intl } from './es2020.intl'; -import { es2020_number } from './es2020.number'; +import { es2021 } from './es2021'; +import { es2021_full } from './es2021.full'; +import { es2021_intl } from './es2021.intl'; import { es2021_promise } from './es2021.promise'; import { es2021_string } from './es2021.string'; import { es2021_weakref } from './es2021.weakref'; -import { es2021_intl } from './es2021.intl'; +import { es2022 } from './es2022'; import { es2022_array } from './es2022.array'; import { es2022_error } from './es2022.error'; +import { es2022_full } from './es2022.full'; import { es2022_intl } from './es2022.intl'; import { es2022_object } from './es2022.object'; import { es2022_sharedmemory } from './es2022.sharedmemory'; import { es2022_string } from './es2022.string'; +import { esnext } from './esnext'; import { esnext_array } from './esnext.array'; -import { esnext_symbol } from './esnext.symbol'; import { esnext_asynciterable } from './esnext.asynciterable'; -import { esnext_intl } from './esnext.intl'; import { esnext_bigint } from './esnext.bigint'; -import { esnext_string } from './esnext.string'; +import { esnext_full } from './esnext.full'; +import { esnext_intl } from './esnext.intl'; import { esnext_promise } from './esnext.promise'; +import { esnext_string } from './esnext.string'; +import { esnext_symbol } from './esnext.symbol'; import { esnext_weakref } from './esnext.weakref'; -import { es2016_full } from './es2016.full'; -import { es2017_full } from './es2017.full'; -import { es2018_full } from './es2018.full'; -import { es2019_full } from './es2019.full'; -import { es2020_full } from './es2020.full'; -import { es2021_full } from './es2021.full'; -import { es2022_full } from './es2022.full'; -import { esnext_full } from './esnext.full'; import { lib as libBase } from './lib'; +import { scripthost } from './scripthost'; +import { webworker } from './webworker'; +import { webworker_importscripts } from './webworker.importscripts'; +import { webworker_iterable } from './webworker.iterable'; const lib = { es5, diff --git a/packages/scope-manager/src/lib/lib.ts b/packages/scope-manager/src/lib/lib.ts index 68367da23d9..4ec72e9e80b 100644 --- a/packages/scope-manager/src/lib/lib.ts +++ b/packages/scope-manager/src/lib/lib.ts @@ -3,11 +3,11 @@ // RUN THE FOLLOWING COMMAND FROM THE WORKSPACE ROOT TO REGENERATE: // npx nx generate-lib @typescript-eslint/scope-manager -import { ImplicitLibVariableOptions } from '../variable'; -import { es5 } from './es5'; +import type { ImplicitLibVariableOptions } from '../variable'; import { dom } from './dom'; -import { webworker_importscripts } from './webworker.importscripts'; +import { es5 } from './es5'; import { scripthost } from './scripthost'; +import { webworker_importscripts } from './webworker.importscripts'; export const lib = { ...es5, diff --git a/packages/scope-manager/src/lib/scripthost.ts b/packages/scope-manager/src/lib/scripthost.ts index c143fc8ae59..cf802a3abad 100644 --- a/packages/scope-manager/src/lib/scripthost.ts +++ b/packages/scope-manager/src/lib/scripthost.ts @@ -3,8 +3,8 @@ // RUN THE FOLLOWING COMMAND FROM THE WORKSPACE ROOT TO REGENERATE: // npx nx generate-lib @typescript-eslint/scope-manager -import { ImplicitLibVariableOptions } from '../variable'; -import { TYPE_VALUE, TYPE } from './base-config'; +import type { ImplicitLibVariableOptions } from '../variable'; +import { TYPE, TYPE_VALUE } from './base-config'; export const scripthost = { ActiveXObject: TYPE_VALUE, diff --git a/packages/scope-manager/src/lib/webworker.importscripts.ts b/packages/scope-manager/src/lib/webworker.importscripts.ts index 4b3bb5f95c6..f7f1cb026bc 100644 --- a/packages/scope-manager/src/lib/webworker.importscripts.ts +++ b/packages/scope-manager/src/lib/webworker.importscripts.ts @@ -3,7 +3,7 @@ // RUN THE FOLLOWING COMMAND FROM THE WORKSPACE ROOT TO REGENERATE: // npx nx generate-lib @typescript-eslint/scope-manager -import { ImplicitLibVariableOptions } from '../variable'; +import type { ImplicitLibVariableOptions } from '../variable'; export const webworker_importscripts = {} as Record< string, diff --git a/packages/scope-manager/src/lib/webworker.iterable.ts b/packages/scope-manager/src/lib/webworker.iterable.ts index 80a04c759e4..e4b0fb8b940 100644 --- a/packages/scope-manager/src/lib/webworker.iterable.ts +++ b/packages/scope-manager/src/lib/webworker.iterable.ts @@ -3,7 +3,7 @@ // RUN THE FOLLOWING COMMAND FROM THE WORKSPACE ROOT TO REGENERATE: // npx nx generate-lib @typescript-eslint/scope-manager -import { ImplicitLibVariableOptions } from '../variable'; +import type { ImplicitLibVariableOptions } from '../variable'; import { TYPE } from './base-config'; export const webworker_iterable = { diff --git a/packages/scope-manager/src/lib/webworker.ts b/packages/scope-manager/src/lib/webworker.ts index 7f800409938..ccbb3efd3c4 100644 --- a/packages/scope-manager/src/lib/webworker.ts +++ b/packages/scope-manager/src/lib/webworker.ts @@ -3,7 +3,7 @@ // RUN THE FOLLOWING COMMAND FROM THE WORKSPACE ROOT TO REGENERATE: // npx nx generate-lib @typescript-eslint/scope-manager -import { ImplicitLibVariableOptions } from '../variable'; +import type { ImplicitLibVariableOptions } from '../variable'; import { TYPE, TYPE_VALUE } from './base-config'; export const webworker = { diff --git a/packages/scope-manager/src/referencer/Referencer.ts b/packages/scope-manager/src/referencer/Referencer.ts index a69209e86c6..93b0270ebfb 100644 --- a/packages/scope-manager/src/referencer/Referencer.ts +++ b/packages/scope-manager/src/referencer/Referencer.ts @@ -675,7 +675,7 @@ class Referencer extends Visitor { member.id.type === AST_NODE_TYPES.Literal && typeof member.id.value === 'string' ) { - const name = member.id as TSESTree.StringLiteral; + const name = member.id; this.currentScope().defineLiteralIdentifier( name, new TSEnumMemberDefinition(name, member), From d653607f257410a19d3d5aaf7d5838686964cd20 Mon Sep 17 00:00:00 2001 From: Sosuke Suzuki Date: Wed, 2 Nov 2022 19:50:02 +0900 Subject: [PATCH 07/20] feat: update to typescript 4.9.2-rc --- package.json | 4 ++-- .../src/parseSettings/warnAboutTSVersion.ts | 2 +- yarn.lock | 8 ++++---- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/package.json b/package.json index ca2f8a48a26..b3989f7bd46 100644 --- a/package.json +++ b/package.json @@ -104,10 +104,10 @@ "tmp": "^0.2.1", "ts-node": "^10.7.0", "tslint": "^6.1.3", - "typescript": ">=3.3.1 <4.8.3 || 4.9.1-beta" + "typescript": ">=3.3.1 <4.8.3 || 4.9.2-rc" }, "resolutions": { - "typescript": "~4.9.1-beta", + "typescript": "~4.9.2-rc", "@types/node": "^18.0.0", "//": "Pin jest to v29 across the repo", "@jest/create-cache-key-function": "^29", diff --git a/packages/typescript-estree/src/parseSettings/warnAboutTSVersion.ts b/packages/typescript-estree/src/parseSettings/warnAboutTSVersion.ts index b5dc97358e5..343e324307a 100644 --- a/packages/typescript-estree/src/parseSettings/warnAboutTSVersion.ts +++ b/packages/typescript-estree/src/parseSettings/warnAboutTSVersion.ts @@ -12,7 +12,7 @@ const SUPPORTED_TYPESCRIPT_VERSIONS = '>=3.3.1 <5.0.0'; * The semver package will ignore prerelease ranges, and we don't want to explicitly document every one * List them all separately here, so we can automatically create the full string */ -const SUPPORTED_PRERELEASE_RANGES: string[] = ['4.9.1-beta']; +const SUPPORTED_PRERELEASE_RANGES: string[] = ['4.9.2-rc']; const ACTIVE_TYPESCRIPT_VERSION = ts.version; const isRunningSupportedTypeScriptVersion = semver.satisfies( ACTIVE_TYPESCRIPT_VERSION, diff --git a/yarn.lock b/yarn.lock index 44197b74548..99774a63052 100644 --- a/yarn.lock +++ b/yarn.lock @@ -13622,10 +13622,10 @@ typedarray@^0.0.6: resolved "https://registry.yarnpkg.com/typedarray/-/typedarray-0.0.6.tgz#867ac74e3864187b1d3d47d996a78ec5c8830777" integrity sha1-hnrHTjhkGHsdPUfZlqeOxciDB3c= -typescript@*, "typescript@>=3.3.1 <4.8.3 || 4.9.1-beta", "typescript@^3 || ^4", typescript@next, typescript@~4.8.4, typescript@~4.9.1-beta: - version "4.9.1-beta" - resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.9.1-beta.tgz#b5fe1b26f2fe3aeb14790927b25372bebf351c67" - integrity sha512-D4c0t1+sMOS5Hy8DQsGFfEYUuKzolXhf+7e/N0Td5etBPflEYzVwWLBrbVgHpLpLC53OJQCtxk31+NWO2SBPaA== +typescript@*, "typescript@>=3.3.1 <4.8.3 || 4.9.2-rc", "typescript@^3 || ^4", typescript@next, typescript@~4.8.4, typescript@~4.9.2-rc: + version "4.9.2-rc" + resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.9.2-rc.tgz#3525dbeb8458a8c98ce7d60724e4a9380d7b46e7" + integrity sha512-Ly9UUxJBfiiFjfegI1gsW9FI8Xhw1cuwRMBJ4wdYg+UXZR4VnZvD1OnBDj/iQ2U+tWbWEjYqJ5xx1Cwr4Vsa4w== ua-parser-js@^0.7.30: version "0.7.31" From c7cb795582bb3c4e505f2141aede55b69792705d Mon Sep 17 00:00:00 2001 From: Sosuke Suzuki Date: Wed, 2 Nov 2022 19:53:22 +0900 Subject: [PATCH 08/20] chore: run patch-package --- ...{typescript+4.9.1-beta.patch => typescript+4.9.2-rc.patch} | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename patches/{typescript+4.9.1-beta.patch => typescript+4.9.2-rc.patch} (97%) diff --git a/patches/typescript+4.9.1-beta.patch b/patches/typescript+4.9.2-rc.patch similarity index 97% rename from patches/typescript+4.9.1-beta.patch rename to patches/typescript+4.9.2-rc.patch index 5e742894909..520a9fde936 100644 --- a/patches/typescript+4.9.1-beta.patch +++ b/patches/typescript+4.9.2-rc.patch @@ -1,5 +1,5 @@ diff --git a/node_modules/typescript/lib/typescript.d.ts b/node_modules/typescript/lib/typescript.d.ts -index 0e6b255..f0a588c 100644 +index 54e4c65..aa00912 100644 --- a/node_modules/typescript/lib/typescript.d.ts +++ b/node_modules/typescript/lib/typescript.d.ts @@ -428,8 +428,8 @@ declare namespace ts { @@ -40,7 +40,7 @@ index 0e6b255..f0a588c 100644 function canHaveDecorators(node: Node): node is HasDecorators; } declare namespace ts { -@@ -7951,7 +7963,7 @@ declare namespace ts { +@@ -7958,7 +7970,7 @@ declare namespace ts { * const decorators = ts.canHaveDecorators(node) ? ts.getDecorators(node) : undefined; * ``` */ From 35809e3273a36116e665c03e946be82e3b0b448c Mon Sep 17 00:00:00 2001 From: Sosuke Suzuki Date: Thu, 3 Nov 2022 01:47:45 +0900 Subject: [PATCH 09/20] chore: update `@types/node` --- package.json | 4 ++-- yarn.lock | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/package.json b/package.json index b3989f7bd46..ab6a13d82ad 100644 --- a/package.json +++ b/package.json @@ -67,7 +67,7 @@ "@types/lodash": "^4.14.182", "@types/marked": "^4.0.3", "@types/ncp": "^2.0.5", - "@types/node": "^18.0.0", + "@types/node": "^18.11.9", "@types/prettier": "^2.6.0", "@types/rimraf": "^3.0.2", "@types/semver": "^7.3.9", @@ -108,7 +108,7 @@ }, "resolutions": { "typescript": "~4.9.2-rc", - "@types/node": "^18.0.0", + "@types/node": "^18.11.9", "//": "Pin jest to v29 across the repo", "@jest/create-cache-key-function": "^29", "@jest/reporters": "^29", diff --git a/yarn.lock b/yarn.lock index 99774a63052..2f5881a3caf 100644 --- a/yarn.lock +++ b/yarn.lock @@ -4124,10 +4124,10 @@ dependencies: "@types/node" "*" -"@types/node@*", "@types/node@12.20.24", "@types/node@^17.0.5", "@types/node@^18.0.0": - version "18.8.3" - resolved "https://registry.yarnpkg.com/@types/node/-/node-18.8.3.tgz#ce750ab4017effa51aed6a7230651778d54e327c" - integrity sha512-0os9vz6BpGwxGe9LOhgP/ncvYN5Tx1fNcd2TM3rD/aCGBkysb+ZWpXEocG24h6ZzOi13+VB8HndAQFezsSOw1w== +"@types/node@*", "@types/node@12.20.24", "@types/node@^17.0.5", "@types/node@^18.11.9": + version "18.11.9" + resolved "https://registry.yarnpkg.com/@types/node/-/node-18.11.9.tgz#02d013de7058cea16d36168ef2fc653464cfbad4" + integrity sha512-CRpX21/kGdzjOpFsZSkcrXMGIBWMGNIHXXBVFSH+ggkftxg+XYP20TESbh+zFvFj3EQOl5byk0HTRn1IL6hbqg== "@types/normalize-package-data@^2.4.0": version "2.4.1" From 3b724d0b015dfca6ad67039e84b49919d9a870ae Mon Sep 17 00:00:00 2001 From: Sosuke Suzuki Date: Thu, 3 Nov 2022 17:04:16 +0900 Subject: [PATCH 10/20] feat(ast-spec): add `AccessorProperty` --- packages/ast-spec/src/ast-node-types.ts | 1 + .../ast-spec/src/element/AccessorProperty/spec.ts | 13 +++++++++++++ packages/ast-spec/src/element/spec.ts | 1 + packages/ast-spec/src/unions/ClassElement.ts | 2 ++ packages/ast-spec/src/unions/Node.ts | 2 ++ .../src/ts-estree/estree-to-ts-node-types.ts | 1 + 6 files changed, 20 insertions(+) create mode 100644 packages/ast-spec/src/element/AccessorProperty/spec.ts diff --git a/packages/ast-spec/src/ast-node-types.ts b/packages/ast-spec/src/ast-node-types.ts index ff90dd1ee18..0dde96c6527 100644 --- a/packages/ast-spec/src/ast-node-types.ts +++ b/packages/ast-spec/src/ast-node-types.ts @@ -1,4 +1,5 @@ export enum AST_NODE_TYPES { + AccessorProperty = 'AccessorProperty', ArrayExpression = 'ArrayExpression', ArrayPattern = 'ArrayPattern', ArrowFunctionExpression = 'ArrowFunctionExpression', diff --git a/packages/ast-spec/src/element/AccessorProperty/spec.ts b/packages/ast-spec/src/element/AccessorProperty/spec.ts new file mode 100644 index 00000000000..78e0a534443 --- /dev/null +++ b/packages/ast-spec/src/element/AccessorProperty/spec.ts @@ -0,0 +1,13 @@ +import type { AST_NODE_TYPES } from '../../ast-node-types'; +import type { BaseNode } from '../../base/BaseNode'; +import type { Decorator, PrivateIdentifier } from '../../special/spec'; +import type { Expression } from '../../unions/Expression'; + +export interface AccessorProperty extends BaseNode { + type: AST_NODE_TYPES.AccessorProperty; + key: Expression | PrivateIdentifier; + value: Expression | null; + computed: boolean; + static: boolean; + decorators: Decorator[]; +} diff --git a/packages/ast-spec/src/element/spec.ts b/packages/ast-spec/src/element/spec.ts index 77ed3f2f283..45c8374b659 100644 --- a/packages/ast-spec/src/element/spec.ts +++ b/packages/ast-spec/src/element/spec.ts @@ -1,3 +1,4 @@ +export * from './AccessorProperty/spec'; export * from './PropertyDefinition/spec'; export * from './MethodDefinition/spec'; export * from './Property/spec'; diff --git a/packages/ast-spec/src/unions/ClassElement.ts b/packages/ast-spec/src/unions/ClassElement.ts index 27d4ec4d752..459e62542d1 100644 --- a/packages/ast-spec/src/unions/ClassElement.ts +++ b/packages/ast-spec/src/unions/ClassElement.ts @@ -1,11 +1,13 @@ import type { MethodDefinition } from '../element/MethodDefinition/spec'; import type { PropertyDefinition } from '../element/PropertyDefinition/spec'; +import type { AccessorProperty } from '../element/spec'; import type { StaticBlock } from '../element/StaticBlock/spec'; import type { TSAbstractMethodDefinition } from '../element/TSAbstractMethodDefinition/spec'; import type { TSAbstractPropertyDefinition } from '../element/TSAbstractPropertyDefinition/spec'; import type { TSIndexSignature } from '../element/TSIndexSignature/spec'; export type ClassElement = + | AccessorProperty | MethodDefinition | PropertyDefinition | StaticBlock diff --git a/packages/ast-spec/src/unions/Node.ts b/packages/ast-spec/src/unions/Node.ts index 6505270427b..a774685013b 100644 --- a/packages/ast-spec/src/unions/Node.ts +++ b/packages/ast-spec/src/unions/Node.ts @@ -12,6 +12,7 @@ import type { TSModuleDeclaration } from '../declaration/TSModuleDeclaration/spe import type { TSNamespaceExportDeclaration } from '../declaration/TSNamespaceExportDeclaration/spec'; import type { TSTypeAliasDeclaration } from '../declaration/TSTypeAliasDeclaration/spec'; import type { VariableDeclaration } from '../declaration/VariableDeclaration/spec'; +import type { AccessorProperty } from '../element/AccessorProperty/spec'; import type { MethodDefinition } from '../element/MethodDefinition/spec'; import type { Property } from '../element/Property/spec'; import type { PropertyDefinition } from '../element/PropertyDefinition/spec'; @@ -169,6 +170,7 @@ import type { Literal } from './Literal'; */ export type Node = + | AccessorProperty | ArrayExpression | ArrayPattern | ArrowFunctionExpression diff --git a/packages/typescript-estree/src/ts-estree/estree-to-ts-node-types.ts b/packages/typescript-estree/src/ts-estree/estree-to-ts-node-types.ts index 3b80ab0a958..1e53f57e4e4 100644 --- a/packages/typescript-estree/src/ts-estree/estree-to-ts-node-types.ts +++ b/packages/typescript-estree/src/ts-estree/estree-to-ts-node-types.ts @@ -4,6 +4,7 @@ import type * as ts from 'typescript'; import type { TSNode } from './ts-nodes'; export interface EstreeToTsNodeTypes { + [AST_NODE_TYPES.AccessorProperty]: ts.PropertyDeclaration; [AST_NODE_TYPES.ArrayExpression]: ts.ArrayLiteralExpression; [AST_NODE_TYPES.ArrayPattern]: | ts.ArrayLiteralExpression From 6222f3cfb7cfa02f62209b64c81b09a4ae40dbc5 Mon Sep 17 00:00:00 2001 From: Sosuke Suzuki Date: Thu, 3 Nov 2022 18:15:43 +0900 Subject: [PATCH 11/20] chore(ast-spec): use base nodes for `PropertyDefinition` --- .../src/element/AccessorProperty/spec.ts | 24 ++++++++++++------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/packages/ast-spec/src/element/AccessorProperty/spec.ts b/packages/ast-spec/src/element/AccessorProperty/spec.ts index 78e0a534443..739481e9c23 100644 --- a/packages/ast-spec/src/element/AccessorProperty/spec.ts +++ b/packages/ast-spec/src/element/AccessorProperty/spec.ts @@ -1,13 +1,19 @@ import type { AST_NODE_TYPES } from '../../ast-node-types'; -import type { BaseNode } from '../../base/BaseNode'; -import type { Decorator, PrivateIdentifier } from '../../special/spec'; -import type { Expression } from '../../unions/Expression'; +import type { + PropertyDefinitionComputedNameBase, + PropertyDefinitionNonComputedNameBase, +} from '../../base/PropertyDefinitionBase'; -export interface AccessorProperty extends BaseNode { +export interface AccessorPropertyComputedName + extends PropertyDefinitionComputedNameBase { type: AST_NODE_TYPES.AccessorProperty; - key: Expression | PrivateIdentifier; - value: Expression | null; - computed: boolean; - static: boolean; - decorators: Decorator[]; } + +export interface AccessorPropertyNonComputedName + extends PropertyDefinitionNonComputedNameBase { + type: AST_NODE_TYPES.AccessorProperty; +} + +export type AccessorProperty = + | AccessorPropertyComputedName + | AccessorPropertyNonComputedName; From 3734248873bb973582104e9dd2b27c0a1609e9d8 Mon Sep 17 00:00:00 2001 From: Sosuke Suzuki Date: Thu, 3 Nov 2022 18:22:16 +0900 Subject: [PATCH 12/20] feat(typescript-estree): implement convert `AccessorProperty` --- packages/typescript-estree/src/convert.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/packages/typescript-estree/src/convert.ts b/packages/typescript-estree/src/convert.ts index 30c33050d42..7dbb6608c02 100644 --- a/packages/typescript-estree/src/convert.ts +++ b/packages/typescript-estree/src/convert.ts @@ -1167,11 +1167,16 @@ export class Converter { case SyntaxKind.PropertyDeclaration: { const isAbstract = hasModifier(SyntaxKind.AbstractKeyword, node); + const isAccessor = hasModifier(SyntaxKind.AccessorKeyword, node); const result = this.createNode< - TSESTree.TSAbstractPropertyDefinition | TSESTree.PropertyDefinition + | TSESTree.TSAbstractPropertyDefinition + | TSESTree.PropertyDefinition + | TSESTree.AccessorProperty >(node, { type: isAbstract ? AST_NODE_TYPES.TSAbstractPropertyDefinition + : isAccessor + ? AST_NODE_TYPES.AccessorProperty : AST_NODE_TYPES.PropertyDefinition, key: this.convertChild(node.name), value: isAbstract ? null : this.convertChild(node.initializer), From 7106081ab1cbb102eee9efce96bb1d174a79d285 Mon Sep 17 00:00:00 2001 From: Sosuke Suzuki Date: Fri, 4 Nov 2022 21:33:30 +0900 Subject: [PATCH 13/20] feat(visitor-keys): add `AccessorProperty` --- packages/visitor-keys/src/visitor-keys.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/packages/visitor-keys/src/visitor-keys.ts b/packages/visitor-keys/src/visitor-keys.ts index a1898e92246..8dff821a2ab 100644 --- a/packages/visitor-keys/src/visitor-keys.ts +++ b/packages/visitor-keys/src/visitor-keys.ts @@ -18,6 +18,8 @@ type AdditionalKeys = { const additionalKeys: AdditionalKeys = { // Stage 3 Import Assertions ImportAttribute: ['key', 'value'], + // Stage 3 Accessor Property + AccessorProperty: ['key', 'value', 'decorators'], // Additional Properties. ArrayPattern: ['decorators', 'elements', 'typeAnnotation'], From 8809d69b6580831cfb80458d9f1dbbb0bc9343d8 Mon Sep 17 00:00:00 2001 From: Sosuke Suzuki Date: Fri, 4 Nov 2022 21:41:24 +0900 Subject: [PATCH 14/20] test: add tests for auto accessors --- .../typescript/basics/auto-accessor-1.src.ts | 6 + .../typescript/basics/auto-accessor-2.src.ts | 16 + .../typescript/basics/auto-accessor-3.src.ts | 6 + .../typescript/basics/auto-accessor-4.src.ts | 6 + .../typescript/basics/auto-accessor-5.src.ts | 11 + .../semantic-diagnostics-enabled.test.ts.snap | 10 + .../basics/auto-accessor-1.src.ts.shot | 818 +++++++ .../basics/auto-accessor-2.src.ts.shot | 1925 +++++++++++++++++ .../basics/auto-accessor-3.src.ts.shot | 822 +++++++ .../basics/auto-accessor-4.src.ts.shot | 822 +++++++ .../basics/auto-accessor-5.src.ts.shot | 1532 +++++++++++++ 11 files changed, 5974 insertions(+) create mode 100644 packages/shared-fixtures/fixtures/typescript/basics/auto-accessor-1.src.ts create mode 100644 packages/shared-fixtures/fixtures/typescript/basics/auto-accessor-2.src.ts create mode 100644 packages/shared-fixtures/fixtures/typescript/basics/auto-accessor-3.src.ts create mode 100644 packages/shared-fixtures/fixtures/typescript/basics/auto-accessor-4.src.ts create mode 100644 packages/shared-fixtures/fixtures/typescript/basics/auto-accessor-5.src.ts create mode 100644 packages/typescript-estree/tests/snapshots/typescript/basics/auto-accessor-1.src.ts.shot create mode 100644 packages/typescript-estree/tests/snapshots/typescript/basics/auto-accessor-2.src.ts.shot create mode 100644 packages/typescript-estree/tests/snapshots/typescript/basics/auto-accessor-3.src.ts.shot create mode 100644 packages/typescript-estree/tests/snapshots/typescript/basics/auto-accessor-4.src.ts.shot create mode 100644 packages/typescript-estree/tests/snapshots/typescript/basics/auto-accessor-5.src.ts.shot diff --git a/packages/shared-fixtures/fixtures/typescript/basics/auto-accessor-1.src.ts b/packages/shared-fixtures/fixtures/typescript/basics/auto-accessor-1.src.ts new file mode 100644 index 00000000000..0a57edb16a3 --- /dev/null +++ b/packages/shared-fixtures/fixtures/typescript/basics/auto-accessor-1.src.ts @@ -0,0 +1,6 @@ +class C1 { + accessor a: any; + accessor b = 1; + static accessor c: any; + static accessor d = 2; +} diff --git a/packages/shared-fixtures/fixtures/typescript/basics/auto-accessor-2.src.ts b/packages/shared-fixtures/fixtures/typescript/basics/auto-accessor-2.src.ts new file mode 100644 index 00000000000..944a2faaecf --- /dev/null +++ b/packages/shared-fixtures/fixtures/typescript/basics/auto-accessor-2.src.ts @@ -0,0 +1,16 @@ +class C1 { + accessor #a: any; + accessor #b = 1; + static accessor #c: any; + static accessor #d = 2; + + constructor() { + this.#a = 3; + this.#b = 4; + } + + static { + this.#c = 5; + this.#d = 6; + } +} diff --git a/packages/shared-fixtures/fixtures/typescript/basics/auto-accessor-3.src.ts b/packages/shared-fixtures/fixtures/typescript/basics/auto-accessor-3.src.ts new file mode 100644 index 00000000000..0c61107fdbf --- /dev/null +++ b/packages/shared-fixtures/fixtures/typescript/basics/auto-accessor-3.src.ts @@ -0,0 +1,6 @@ +class C1 { + accessor "w": any; + accessor "x" = 1; + static accessor "y": any; + static accessor "z" = 2; +} diff --git a/packages/shared-fixtures/fixtures/typescript/basics/auto-accessor-4.src.ts b/packages/shared-fixtures/fixtures/typescript/basics/auto-accessor-4.src.ts new file mode 100644 index 00000000000..5f33194031b --- /dev/null +++ b/packages/shared-fixtures/fixtures/typescript/basics/auto-accessor-4.src.ts @@ -0,0 +1,6 @@ +class C1 { + accessor 0: any; + accessor 1 = 1; + static accessor 2: any; + static accessor 3 = 2; +} diff --git a/packages/shared-fixtures/fixtures/typescript/basics/auto-accessor-5.src.ts b/packages/shared-fixtures/fixtures/typescript/basics/auto-accessor-5.src.ts new file mode 100644 index 00000000000..8ab6c180543 --- /dev/null +++ b/packages/shared-fixtures/fixtures/typescript/basics/auto-accessor-5.src.ts @@ -0,0 +1,11 @@ +class C1 { + accessor ["w"]: any; + accessor ["x"] = 1; + static accessor ["y"]: any; + static accessor ["z"] = 2; +} + +declare var f: any; +class C2 { + accessor [f()] = 1; +} diff --git a/packages/typescript-estree/tests/lib/__snapshots__/semantic-diagnostics-enabled.test.ts.snap b/packages/typescript-estree/tests/lib/__snapshots__/semantic-diagnostics-enabled.test.ts.snap index 204da250a86..2fe1877e218 100644 --- a/packages/typescript-estree/tests/lib/__snapshots__/semantic-diagnostics-enabled.test.ts.snap +++ b/packages/typescript-estree/tests/lib/__snapshots__/semantic-diagnostics-enabled.test.ts.snap @@ -1733,6 +1733,16 @@ exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" e exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/basics/async-function-with-var-declaration.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; +exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/basics/auto-accessor-1.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; + +exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/basics/auto-accessor-2.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; + +exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/basics/auto-accessor-3.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; + +exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/basics/auto-accessor-4.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; + +exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/basics/auto-accessor-5.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; + exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/basics/await-without-async-function.src 1`] = ` TSError { "column": 14, diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/auto-accessor-1.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/auto-accessor-1.src.ts.shot new file mode 100644 index 00000000000..ec057cdc689 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/auto-accessor-1.src.ts.shot @@ -0,0 +1,818 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`typescript basics auto-accessor-1.src 1`] = ` +Object { + "body": Array [ + Object { + "body": Object { + "body": Array [ + Object { + "computed": false, + "declare": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 2, + }, + "start": Object { + "column": 11, + "line": 2, + }, + }, + "name": "a", + "range": Array [ + 22, + 23, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 18, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "override": false, + "range": Array [ + 13, + 29, + ], + "readonly": undefined, + "static": false, + "type": "AccessorProperty", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 2, + }, + "start": Object { + "column": 12, + "line": 2, + }, + }, + "range": Array [ + 23, + 28, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 2, + }, + "start": Object { + "column": 14, + "line": 2, + }, + }, + "range": Array [ + 25, + 28, + ], + "type": "TSAnyKeyword", + }, + }, + "value": null, + }, + Object { + "computed": false, + "declare": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 3, + }, + "start": Object { + "column": 11, + "line": 3, + }, + }, + "name": "b", + "range": Array [ + 41, + 42, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 17, + "line": 3, + }, + "start": Object { + "column": 2, + "line": 3, + }, + }, + "override": false, + "range": Array [ + 32, + 47, + ], + "readonly": undefined, + "static": false, + "type": "AccessorProperty", + "value": Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 3, + }, + "start": Object { + "column": 15, + "line": 3, + }, + }, + "range": Array [ + 45, + 46, + ], + "raw": "1", + "type": "Literal", + "value": 1, + }, + }, + Object { + "computed": false, + "declare": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 4, + }, + "start": Object { + "column": 18, + "line": 4, + }, + }, + "name": "c", + "range": Array [ + 66, + 67, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 25, + "line": 4, + }, + "start": Object { + "column": 2, + "line": 4, + }, + }, + "override": false, + "range": Array [ + 50, + 73, + ], + "readonly": undefined, + "static": true, + "type": "AccessorProperty", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 4, + }, + "start": Object { + "column": 19, + "line": 4, + }, + }, + "range": Array [ + 67, + 72, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 4, + }, + "start": Object { + "column": 21, + "line": 4, + }, + }, + "range": Array [ + 69, + 72, + ], + "type": "TSAnyKeyword", + }, + }, + "value": null, + }, + Object { + "computed": false, + "declare": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 5, + }, + "start": Object { + "column": 18, + "line": 5, + }, + }, + "name": "d", + "range": Array [ + 92, + 93, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 24, + "line": 5, + }, + "start": Object { + "column": 2, + "line": 5, + }, + }, + "override": false, + "range": Array [ + 76, + 98, + ], + "readonly": undefined, + "static": true, + "type": "AccessorProperty", + "value": Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 5, + }, + "start": Object { + "column": 22, + "line": 5, + }, + }, + "range": Array [ + 96, + 97, + ], + "raw": "2", + "type": "Literal", + "value": 2, + }, + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 6, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 100, + ], + "type": "ClassBody", + }, + "id": Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "name": "C1", + "range": Array [ + 6, + 8, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 6, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 100, + ], + "superClass": null, + "type": "ClassDeclaration", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 7, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 101, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 5, + ], + "type": "Keyword", + "value": "class", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 8, + ], + "type": "Identifier", + "value": "C1", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 10, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "range": Array [ + 13, + 21, + ], + "type": "Identifier", + "value": "accessor", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 2, + }, + "start": Object { + "column": 11, + "line": 2, + }, + }, + "range": Array [ + 22, + 23, + ], + "type": "Identifier", + "value": "a", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 2, + }, + "start": Object { + "column": 12, + "line": 2, + }, + }, + "range": Array [ + 23, + 24, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 2, + }, + "start": Object { + "column": 14, + "line": 2, + }, + }, + "range": Array [ + 25, + 28, + ], + "type": "Identifier", + "value": "any", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 2, + }, + "start": Object { + "column": 17, + "line": 2, + }, + }, + "range": Array [ + 28, + 29, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 3, + }, + "start": Object { + "column": 2, + "line": 3, + }, + }, + "range": Array [ + 32, + 40, + ], + "type": "Identifier", + "value": "accessor", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 3, + }, + "start": Object { + "column": 11, + "line": 3, + }, + }, + "range": Array [ + 41, + 42, + ], + "type": "Identifier", + "value": "b", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 3, + }, + "start": Object { + "column": 13, + "line": 3, + }, + }, + "range": Array [ + 43, + 44, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 3, + }, + "start": Object { + "column": 15, + "line": 3, + }, + }, + "range": Array [ + 45, + 46, + ], + "type": "Numeric", + "value": "1", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 3, + }, + "start": Object { + "column": 16, + "line": 3, + }, + }, + "range": Array [ + 46, + 47, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 4, + }, + "start": Object { + "column": 2, + "line": 4, + }, + }, + "range": Array [ + 50, + 56, + ], + "type": "Keyword", + "value": "static", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 4, + }, + "start": Object { + "column": 9, + "line": 4, + }, + }, + "range": Array [ + 57, + 65, + ], + "type": "Identifier", + "value": "accessor", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 4, + }, + "start": Object { + "column": 18, + "line": 4, + }, + }, + "range": Array [ + 66, + 67, + ], + "type": "Identifier", + "value": "c", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 4, + }, + "start": Object { + "column": 19, + "line": 4, + }, + }, + "range": Array [ + 67, + 68, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 4, + }, + "start": Object { + "column": 21, + "line": 4, + }, + }, + "range": Array [ + 69, + 72, + ], + "type": "Identifier", + "value": "any", + }, + Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 4, + }, + "start": Object { + "column": 24, + "line": 4, + }, + }, + "range": Array [ + 72, + 73, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 5, + }, + "start": Object { + "column": 2, + "line": 5, + }, + }, + "range": Array [ + 76, + 82, + ], + "type": "Keyword", + "value": "static", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 5, + }, + "start": Object { + "column": 9, + "line": 5, + }, + }, + "range": Array [ + 83, + 91, + ], + "type": "Identifier", + "value": "accessor", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 5, + }, + "start": Object { + "column": 18, + "line": 5, + }, + }, + "range": Array [ + 92, + 93, + ], + "type": "Identifier", + "value": "d", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 5, + }, + "start": Object { + "column": 20, + "line": 5, + }, + }, + "range": Array [ + 94, + 95, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 5, + }, + "start": Object { + "column": 22, + "line": 5, + }, + }, + "range": Array [ + 96, + 97, + ], + "type": "Numeric", + "value": "2", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 5, + }, + "start": Object { + "column": 23, + "line": 5, + }, + }, + "range": Array [ + 97, + 98, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 6, + }, + "start": Object { + "column": 0, + "line": 6, + }, + }, + "range": Array [ + 99, + 100, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/auto-accessor-2.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/auto-accessor-2.src.ts.shot new file mode 100644 index 00000000000..5823636706b --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/auto-accessor-2.src.ts.shot @@ -0,0 +1,1925 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`typescript basics auto-accessor-2.src 1`] = ` +Object { + "body": Array [ + Object { + "body": Object { + "body": Array [ + Object { + "computed": false, + "declare": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 2, + }, + "start": Object { + "column": 11, + "line": 2, + }, + }, + "name": "a", + "range": Array [ + 22, + 24, + ], + "type": "PrivateIdentifier", + }, + "loc": Object { + "end": Object { + "column": 19, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "override": false, + "range": Array [ + 13, + 30, + ], + "readonly": undefined, + "static": false, + "type": "AccessorProperty", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 2, + }, + "start": Object { + "column": 13, + "line": 2, + }, + }, + "range": Array [ + 24, + 29, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 2, + }, + "start": Object { + "column": 15, + "line": 2, + }, + }, + "range": Array [ + 26, + 29, + ], + "type": "TSAnyKeyword", + }, + }, + "value": null, + }, + Object { + "computed": false, + "declare": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 3, + }, + "start": Object { + "column": 11, + "line": 3, + }, + }, + "name": "b", + "range": Array [ + 42, + 44, + ], + "type": "PrivateIdentifier", + }, + "loc": Object { + "end": Object { + "column": 18, + "line": 3, + }, + "start": Object { + "column": 2, + "line": 3, + }, + }, + "override": false, + "range": Array [ + 33, + 49, + ], + "readonly": undefined, + "static": false, + "type": "AccessorProperty", + "value": Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 3, + }, + "start": Object { + "column": 16, + "line": 3, + }, + }, + "range": Array [ + 47, + 48, + ], + "raw": "1", + "type": "Literal", + "value": 1, + }, + }, + Object { + "computed": false, + "declare": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 4, + }, + "start": Object { + "column": 18, + "line": 4, + }, + }, + "name": "c", + "range": Array [ + 68, + 70, + ], + "type": "PrivateIdentifier", + }, + "loc": Object { + "end": Object { + "column": 26, + "line": 4, + }, + "start": Object { + "column": 2, + "line": 4, + }, + }, + "override": false, + "range": Array [ + 52, + 76, + ], + "readonly": undefined, + "static": true, + "type": "AccessorProperty", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 4, + }, + "start": Object { + "column": 20, + "line": 4, + }, + }, + "range": Array [ + 70, + 75, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 4, + }, + "start": Object { + "column": 22, + "line": 4, + }, + }, + "range": Array [ + 72, + 75, + ], + "type": "TSAnyKeyword", + }, + }, + "value": null, + }, + Object { + "computed": false, + "declare": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 5, + }, + "start": Object { + "column": 18, + "line": 5, + }, + }, + "name": "d", + "range": Array [ + 95, + 97, + ], + "type": "PrivateIdentifier", + }, + "loc": Object { + "end": Object { + "column": 25, + "line": 5, + }, + "start": Object { + "column": 2, + "line": 5, + }, + }, + "override": false, + "range": Array [ + 79, + 102, + ], + "readonly": undefined, + "static": true, + "type": "AccessorProperty", + "value": Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 5, + }, + "start": Object { + "column": 23, + "line": 5, + }, + }, + "range": Array [ + 100, + 101, + ], + "raw": "2", + "type": "Literal", + "value": 2, + }, + }, + Object { + "computed": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 7, + }, + "start": Object { + "column": 2, + "line": 7, + }, + }, + "name": "constructor", + "range": Array [ + 106, + 117, + ], + "type": "Identifier", + }, + "kind": "constructor", + "loc": Object { + "end": Object { + "column": 3, + "line": 10, + }, + "start": Object { + "column": 2, + "line": 7, + }, + }, + "override": false, + "range": Array [ + 106, + 159, + ], + "static": false, + "type": "MethodDefinition", + "value": Object { + "async": false, + "body": Object { + "body": Array [ + Object { + "expression": Object { + "left": Object { + "computed": false, + "loc": Object { + "end": Object { + "column": 11, + "line": 8, + }, + "start": Object { + "column": 4, + "line": 8, + }, + }, + "object": Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 8, + }, + "start": Object { + "column": 4, + "line": 8, + }, + }, + "range": Array [ + 126, + 130, + ], + "type": "ThisExpression", + }, + "optional": false, + "property": Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 8, + }, + "start": Object { + "column": 9, + "line": 8, + }, + }, + "name": "a", + "range": Array [ + 131, + 133, + ], + "type": "PrivateIdentifier", + }, + "range": Array [ + 126, + 133, + ], + "type": "MemberExpression", + }, + "loc": Object { + "end": Object { + "column": 15, + "line": 8, + }, + "start": Object { + "column": 4, + "line": 8, + }, + }, + "operator": "=", + "range": Array [ + 126, + 137, + ], + "right": Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 8, + }, + "start": Object { + "column": 14, + "line": 8, + }, + }, + "range": Array [ + 136, + 137, + ], + "raw": "3", + "type": "Literal", + "value": 3, + }, + "type": "AssignmentExpression", + }, + "loc": Object { + "end": Object { + "column": 16, + "line": 8, + }, + "start": Object { + "column": 4, + "line": 8, + }, + }, + "range": Array [ + 126, + 138, + ], + "type": "ExpressionStatement", + }, + Object { + "expression": Object { + "left": Object { + "computed": false, + "loc": Object { + "end": Object { + "column": 11, + "line": 9, + }, + "start": Object { + "column": 4, + "line": 9, + }, + }, + "object": Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 9, + }, + "start": Object { + "column": 4, + "line": 9, + }, + }, + "range": Array [ + 143, + 147, + ], + "type": "ThisExpression", + }, + "optional": false, + "property": Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 9, + }, + "start": Object { + "column": 9, + "line": 9, + }, + }, + "name": "b", + "range": Array [ + 148, + 150, + ], + "type": "PrivateIdentifier", + }, + "range": Array [ + 143, + 150, + ], + "type": "MemberExpression", + }, + "loc": Object { + "end": Object { + "column": 15, + "line": 9, + }, + "start": Object { + "column": 4, + "line": 9, + }, + }, + "operator": "=", + "range": Array [ + 143, + 154, + ], + "right": Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 9, + }, + "start": Object { + "column": 14, + "line": 9, + }, + }, + "range": Array [ + 153, + 154, + ], + "raw": "4", + "type": "Literal", + "value": 4, + }, + "type": "AssignmentExpression", + }, + "loc": Object { + "end": Object { + "column": 16, + "line": 9, + }, + "start": Object { + "column": 4, + "line": 9, + }, + }, + "range": Array [ + 143, + 155, + ], + "type": "ExpressionStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 3, + "line": 10, + }, + "start": Object { + "column": 16, + "line": 7, + }, + }, + "range": Array [ + 120, + 159, + ], + "type": "BlockStatement", + }, + "expression": false, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 3, + "line": 10, + }, + "start": Object { + "column": 13, + "line": 7, + }, + }, + "params": Array [], + "range": Array [ + 117, + 159, + ], + "type": "FunctionExpression", + }, + }, + Object { + "body": Array [ + Object { + "expression": Object { + "left": Object { + "computed": false, + "loc": Object { + "end": Object { + "column": 11, + "line": 13, + }, + "start": Object { + "column": 4, + "line": 13, + }, + }, + "object": Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 13, + }, + "start": Object { + "column": 4, + "line": 13, + }, + }, + "range": Array [ + 176, + 180, + ], + "type": "ThisExpression", + }, + "optional": false, + "property": Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 13, + }, + "start": Object { + "column": 9, + "line": 13, + }, + }, + "name": "c", + "range": Array [ + 181, + 183, + ], + "type": "PrivateIdentifier", + }, + "range": Array [ + 176, + 183, + ], + "type": "MemberExpression", + }, + "loc": Object { + "end": Object { + "column": 15, + "line": 13, + }, + "start": Object { + "column": 4, + "line": 13, + }, + }, + "operator": "=", + "range": Array [ + 176, + 187, + ], + "right": Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 13, + }, + "start": Object { + "column": 14, + "line": 13, + }, + }, + "range": Array [ + 186, + 187, + ], + "raw": "5", + "type": "Literal", + "value": 5, + }, + "type": "AssignmentExpression", + }, + "loc": Object { + "end": Object { + "column": 16, + "line": 13, + }, + "start": Object { + "column": 4, + "line": 13, + }, + }, + "range": Array [ + 176, + 188, + ], + "type": "ExpressionStatement", + }, + Object { + "expression": Object { + "left": Object { + "computed": false, + "loc": Object { + "end": Object { + "column": 11, + "line": 14, + }, + "start": Object { + "column": 4, + "line": 14, + }, + }, + "object": Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 14, + }, + "start": Object { + "column": 4, + "line": 14, + }, + }, + "range": Array [ + 193, + 197, + ], + "type": "ThisExpression", + }, + "optional": false, + "property": Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 14, + }, + "start": Object { + "column": 9, + "line": 14, + }, + }, + "name": "d", + "range": Array [ + 198, + 200, + ], + "type": "PrivateIdentifier", + }, + "range": Array [ + 193, + 200, + ], + "type": "MemberExpression", + }, + "loc": Object { + "end": Object { + "column": 15, + "line": 14, + }, + "start": Object { + "column": 4, + "line": 14, + }, + }, + "operator": "=", + "range": Array [ + 193, + 204, + ], + "right": Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 14, + }, + "start": Object { + "column": 14, + "line": 14, + }, + }, + "range": Array [ + 203, + 204, + ], + "raw": "6", + "type": "Literal", + "value": 6, + }, + "type": "AssignmentExpression", + }, + "loc": Object { + "end": Object { + "column": 16, + "line": 14, + }, + "start": Object { + "column": 4, + "line": 14, + }, + }, + "range": Array [ + 193, + 205, + ], + "type": "ExpressionStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 3, + "line": 15, + }, + "start": Object { + "column": 2, + "line": 12, + }, + }, + "range": Array [ + 163, + 209, + ], + "type": "StaticBlock", + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 16, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 211, + ], + "type": "ClassBody", + }, + "id": Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "name": "C1", + "range": Array [ + 6, + 8, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 16, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 211, + ], + "superClass": null, + "type": "ClassDeclaration", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 17, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 212, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 5, + ], + "type": "Keyword", + "value": "class", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 8, + ], + "type": "Identifier", + "value": "C1", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 10, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "range": Array [ + 13, + 21, + ], + "type": "Identifier", + "value": "accessor", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 2, + }, + "start": Object { + "column": 11, + "line": 2, + }, + }, + "range": Array [ + 22, + 24, + ], + "type": "Identifier", + "value": "#a", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 2, + }, + "start": Object { + "column": 13, + "line": 2, + }, + }, + "range": Array [ + 24, + 25, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 2, + }, + "start": Object { + "column": 15, + "line": 2, + }, + }, + "range": Array [ + 26, + 29, + ], + "type": "Identifier", + "value": "any", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 2, + }, + "start": Object { + "column": 18, + "line": 2, + }, + }, + "range": Array [ + 29, + 30, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 3, + }, + "start": Object { + "column": 2, + "line": 3, + }, + }, + "range": Array [ + 33, + 41, + ], + "type": "Identifier", + "value": "accessor", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 3, + }, + "start": Object { + "column": 11, + "line": 3, + }, + }, + "range": Array [ + 42, + 44, + ], + "type": "Identifier", + "value": "#b", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 3, + }, + "start": Object { + "column": 14, + "line": 3, + }, + }, + "range": Array [ + 45, + 46, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 3, + }, + "start": Object { + "column": 16, + "line": 3, + }, + }, + "range": Array [ + 47, + 48, + ], + "type": "Numeric", + "value": "1", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 3, + }, + "start": Object { + "column": 17, + "line": 3, + }, + }, + "range": Array [ + 48, + 49, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 4, + }, + "start": Object { + "column": 2, + "line": 4, + }, + }, + "range": Array [ + 52, + 58, + ], + "type": "Keyword", + "value": "static", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 4, + }, + "start": Object { + "column": 9, + "line": 4, + }, + }, + "range": Array [ + 59, + 67, + ], + "type": "Identifier", + "value": "accessor", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 4, + }, + "start": Object { + "column": 18, + "line": 4, + }, + }, + "range": Array [ + 68, + 70, + ], + "type": "Identifier", + "value": "#c", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 4, + }, + "start": Object { + "column": 20, + "line": 4, + }, + }, + "range": Array [ + 70, + 71, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 4, + }, + "start": Object { + "column": 22, + "line": 4, + }, + }, + "range": Array [ + 72, + 75, + ], + "type": "Identifier", + "value": "any", + }, + Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 4, + }, + "start": Object { + "column": 25, + "line": 4, + }, + }, + "range": Array [ + 75, + 76, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 5, + }, + "start": Object { + "column": 2, + "line": 5, + }, + }, + "range": Array [ + 79, + 85, + ], + "type": "Keyword", + "value": "static", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 5, + }, + "start": Object { + "column": 9, + "line": 5, + }, + }, + "range": Array [ + 86, + 94, + ], + "type": "Identifier", + "value": "accessor", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 5, + }, + "start": Object { + "column": 18, + "line": 5, + }, + }, + "range": Array [ + 95, + 97, + ], + "type": "Identifier", + "value": "#d", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 5, + }, + "start": Object { + "column": 21, + "line": 5, + }, + }, + "range": Array [ + 98, + 99, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 5, + }, + "start": Object { + "column": 23, + "line": 5, + }, + }, + "range": Array [ + 100, + 101, + ], + "type": "Numeric", + "value": "2", + }, + Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 5, + }, + "start": Object { + "column": 24, + "line": 5, + }, + }, + "range": Array [ + 101, + 102, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 7, + }, + "start": Object { + "column": 2, + "line": 7, + }, + }, + "range": Array [ + 106, + 117, + ], + "type": "Identifier", + "value": "constructor", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 7, + }, + "start": Object { + "column": 13, + "line": 7, + }, + }, + "range": Array [ + 117, + 118, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 7, + }, + "start": Object { + "column": 14, + "line": 7, + }, + }, + "range": Array [ + 118, + 119, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 7, + }, + "start": Object { + "column": 16, + "line": 7, + }, + }, + "range": Array [ + 120, + 121, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 8, + }, + "start": Object { + "column": 4, + "line": 8, + }, + }, + "range": Array [ + 126, + 130, + ], + "type": "Keyword", + "value": "this", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 8, + }, + "start": Object { + "column": 8, + "line": 8, + }, + }, + "range": Array [ + 130, + 131, + ], + "type": "Punctuator", + "value": ".", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 8, + }, + "start": Object { + "column": 9, + "line": 8, + }, + }, + "range": Array [ + 131, + 133, + ], + "type": "Identifier", + "value": "#a", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 8, + }, + "start": Object { + "column": 12, + "line": 8, + }, + }, + "range": Array [ + 134, + 135, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 8, + }, + "start": Object { + "column": 14, + "line": 8, + }, + }, + "range": Array [ + 136, + 137, + ], + "type": "Numeric", + "value": "3", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 8, + }, + "start": Object { + "column": 15, + "line": 8, + }, + }, + "range": Array [ + 137, + 138, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 9, + }, + "start": Object { + "column": 4, + "line": 9, + }, + }, + "range": Array [ + 143, + 147, + ], + "type": "Keyword", + "value": "this", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 9, + }, + "start": Object { + "column": 8, + "line": 9, + }, + }, + "range": Array [ + 147, + 148, + ], + "type": "Punctuator", + "value": ".", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 9, + }, + "start": Object { + "column": 9, + "line": 9, + }, + }, + "range": Array [ + 148, + 150, + ], + "type": "Identifier", + "value": "#b", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 9, + }, + "start": Object { + "column": 12, + "line": 9, + }, + }, + "range": Array [ + 151, + 152, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 9, + }, + "start": Object { + "column": 14, + "line": 9, + }, + }, + "range": Array [ + 153, + 154, + ], + "type": "Numeric", + "value": "4", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 9, + }, + "start": Object { + "column": 15, + "line": 9, + }, + }, + "range": Array [ + 154, + 155, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 10, + }, + "start": Object { + "column": 2, + "line": 10, + }, + }, + "range": Array [ + 158, + 159, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 12, + }, + "start": Object { + "column": 2, + "line": 12, + }, + }, + "range": Array [ + 163, + 169, + ], + "type": "Keyword", + "value": "static", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 12, + }, + "start": Object { + "column": 9, + "line": 12, + }, + }, + "range": Array [ + 170, + 171, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 13, + }, + "start": Object { + "column": 4, + "line": 13, + }, + }, + "range": Array [ + 176, + 180, + ], + "type": "Keyword", + "value": "this", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 13, + }, + "start": Object { + "column": 8, + "line": 13, + }, + }, + "range": Array [ + 180, + 181, + ], + "type": "Punctuator", + "value": ".", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 13, + }, + "start": Object { + "column": 9, + "line": 13, + }, + }, + "range": Array [ + 181, + 183, + ], + "type": "Identifier", + "value": "#c", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 13, + }, + "start": Object { + "column": 12, + "line": 13, + }, + }, + "range": Array [ + 184, + 185, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 13, + }, + "start": Object { + "column": 14, + "line": 13, + }, + }, + "range": Array [ + 186, + 187, + ], + "type": "Numeric", + "value": "5", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 13, + }, + "start": Object { + "column": 15, + "line": 13, + }, + }, + "range": Array [ + 187, + 188, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 14, + }, + "start": Object { + "column": 4, + "line": 14, + }, + }, + "range": Array [ + 193, + 197, + ], + "type": "Keyword", + "value": "this", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 14, + }, + "start": Object { + "column": 8, + "line": 14, + }, + }, + "range": Array [ + 197, + 198, + ], + "type": "Punctuator", + "value": ".", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 14, + }, + "start": Object { + "column": 9, + "line": 14, + }, + }, + "range": Array [ + 198, + 200, + ], + "type": "Identifier", + "value": "#d", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 14, + }, + "start": Object { + "column": 12, + "line": 14, + }, + }, + "range": Array [ + 201, + 202, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 14, + }, + "start": Object { + "column": 14, + "line": 14, + }, + }, + "range": Array [ + 203, + 204, + ], + "type": "Numeric", + "value": "6", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 14, + }, + "start": Object { + "column": 15, + "line": 14, + }, + }, + "range": Array [ + 204, + 205, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 15, + }, + "start": Object { + "column": 2, + "line": 15, + }, + }, + "range": Array [ + 208, + 209, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 16, + }, + "start": Object { + "column": 0, + "line": 16, + }, + }, + "range": Array [ + 210, + 211, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/auto-accessor-3.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/auto-accessor-3.src.ts.shot new file mode 100644 index 00000000000..5a322c1e66e --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/auto-accessor-3.src.ts.shot @@ -0,0 +1,822 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`typescript basics auto-accessor-3.src 1`] = ` +Object { + "body": Array [ + Object { + "body": Object { + "body": Array [ + Object { + "computed": false, + "declare": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 2, + }, + "start": Object { + "column": 11, + "line": 2, + }, + }, + "range": Array [ + 22, + 25, + ], + "raw": "\\"w\\"", + "type": "Literal", + "value": "w", + }, + "loc": Object { + "end": Object { + "column": 20, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "override": false, + "range": Array [ + 13, + 31, + ], + "readonly": undefined, + "static": false, + "type": "AccessorProperty", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 2, + }, + "start": Object { + "column": 14, + "line": 2, + }, + }, + "range": Array [ + 25, + 30, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 2, + }, + "start": Object { + "column": 16, + "line": 2, + }, + }, + "range": Array [ + 27, + 30, + ], + "type": "TSAnyKeyword", + }, + }, + "value": null, + }, + Object { + "computed": false, + "declare": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 3, + }, + "start": Object { + "column": 11, + "line": 3, + }, + }, + "range": Array [ + 43, + 46, + ], + "raw": "\\"x\\"", + "type": "Literal", + "value": "x", + }, + "loc": Object { + "end": Object { + "column": 19, + "line": 3, + }, + "start": Object { + "column": 2, + "line": 3, + }, + }, + "override": false, + "range": Array [ + 34, + 51, + ], + "readonly": undefined, + "static": false, + "type": "AccessorProperty", + "value": Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 3, + }, + "start": Object { + "column": 17, + "line": 3, + }, + }, + "range": Array [ + 49, + 50, + ], + "raw": "1", + "type": "Literal", + "value": 1, + }, + }, + Object { + "computed": false, + "declare": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 4, + }, + "start": Object { + "column": 18, + "line": 4, + }, + }, + "range": Array [ + 70, + 73, + ], + "raw": "\\"y\\"", + "type": "Literal", + "value": "y", + }, + "loc": Object { + "end": Object { + "column": 27, + "line": 4, + }, + "start": Object { + "column": 2, + "line": 4, + }, + }, + "override": false, + "range": Array [ + 54, + 79, + ], + "readonly": undefined, + "static": true, + "type": "AccessorProperty", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 4, + }, + "start": Object { + "column": 21, + "line": 4, + }, + }, + "range": Array [ + 73, + 78, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 4, + }, + "start": Object { + "column": 23, + "line": 4, + }, + }, + "range": Array [ + 75, + 78, + ], + "type": "TSAnyKeyword", + }, + }, + "value": null, + }, + Object { + "computed": false, + "declare": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 5, + }, + "start": Object { + "column": 18, + "line": 5, + }, + }, + "range": Array [ + 98, + 101, + ], + "raw": "\\"z\\"", + "type": "Literal", + "value": "z", + }, + "loc": Object { + "end": Object { + "column": 26, + "line": 5, + }, + "start": Object { + "column": 2, + "line": 5, + }, + }, + "override": false, + "range": Array [ + 82, + 106, + ], + "readonly": undefined, + "static": true, + "type": "AccessorProperty", + "value": Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 5, + }, + "start": Object { + "column": 24, + "line": 5, + }, + }, + "range": Array [ + 104, + 105, + ], + "raw": "2", + "type": "Literal", + "value": 2, + }, + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 6, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 108, + ], + "type": "ClassBody", + }, + "id": Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "name": "C1", + "range": Array [ + 6, + 8, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 6, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 108, + ], + "superClass": null, + "type": "ClassDeclaration", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 7, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 109, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 5, + ], + "type": "Keyword", + "value": "class", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 8, + ], + "type": "Identifier", + "value": "C1", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 10, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "range": Array [ + 13, + 21, + ], + "type": "Identifier", + "value": "accessor", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 2, + }, + "start": Object { + "column": 11, + "line": 2, + }, + }, + "range": Array [ + 22, + 25, + ], + "type": "String", + "value": "\\"w\\"", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 2, + }, + "start": Object { + "column": 14, + "line": 2, + }, + }, + "range": Array [ + 25, + 26, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 2, + }, + "start": Object { + "column": 16, + "line": 2, + }, + }, + "range": Array [ + 27, + 30, + ], + "type": "Identifier", + "value": "any", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 2, + }, + "start": Object { + "column": 19, + "line": 2, + }, + }, + "range": Array [ + 30, + 31, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 3, + }, + "start": Object { + "column": 2, + "line": 3, + }, + }, + "range": Array [ + 34, + 42, + ], + "type": "Identifier", + "value": "accessor", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 3, + }, + "start": Object { + "column": 11, + "line": 3, + }, + }, + "range": Array [ + 43, + 46, + ], + "type": "String", + "value": "\\"x\\"", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 3, + }, + "start": Object { + "column": 15, + "line": 3, + }, + }, + "range": Array [ + 47, + 48, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 3, + }, + "start": Object { + "column": 17, + "line": 3, + }, + }, + "range": Array [ + 49, + 50, + ], + "type": "Numeric", + "value": "1", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 3, + }, + "start": Object { + "column": 18, + "line": 3, + }, + }, + "range": Array [ + 50, + 51, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 4, + }, + "start": Object { + "column": 2, + "line": 4, + }, + }, + "range": Array [ + 54, + 60, + ], + "type": "Keyword", + "value": "static", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 4, + }, + "start": Object { + "column": 9, + "line": 4, + }, + }, + "range": Array [ + 61, + 69, + ], + "type": "Identifier", + "value": "accessor", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 4, + }, + "start": Object { + "column": 18, + "line": 4, + }, + }, + "range": Array [ + 70, + 73, + ], + "type": "String", + "value": "\\"y\\"", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 4, + }, + "start": Object { + "column": 21, + "line": 4, + }, + }, + "range": Array [ + 73, + 74, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 4, + }, + "start": Object { + "column": 23, + "line": 4, + }, + }, + "range": Array [ + 75, + 78, + ], + "type": "Identifier", + "value": "any", + }, + Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 4, + }, + "start": Object { + "column": 26, + "line": 4, + }, + }, + "range": Array [ + 78, + 79, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 5, + }, + "start": Object { + "column": 2, + "line": 5, + }, + }, + "range": Array [ + 82, + 88, + ], + "type": "Keyword", + "value": "static", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 5, + }, + "start": Object { + "column": 9, + "line": 5, + }, + }, + "range": Array [ + 89, + 97, + ], + "type": "Identifier", + "value": "accessor", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 5, + }, + "start": Object { + "column": 18, + "line": 5, + }, + }, + "range": Array [ + 98, + 101, + ], + "type": "String", + "value": "\\"z\\"", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 5, + }, + "start": Object { + "column": 22, + "line": 5, + }, + }, + "range": Array [ + 102, + 103, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 5, + }, + "start": Object { + "column": 24, + "line": 5, + }, + }, + "range": Array [ + 104, + 105, + ], + "type": "Numeric", + "value": "2", + }, + Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 5, + }, + "start": Object { + "column": 25, + "line": 5, + }, + }, + "range": Array [ + 105, + 106, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 6, + }, + "start": Object { + "column": 0, + "line": 6, + }, + }, + "range": Array [ + 107, + 108, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/auto-accessor-4.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/auto-accessor-4.src.ts.shot new file mode 100644 index 00000000000..ac54f24b8c0 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/auto-accessor-4.src.ts.shot @@ -0,0 +1,822 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`typescript basics auto-accessor-4.src 1`] = ` +Object { + "body": Array [ + Object { + "body": Object { + "body": Array [ + Object { + "computed": false, + "declare": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 2, + }, + "start": Object { + "column": 11, + "line": 2, + }, + }, + "range": Array [ + 22, + 23, + ], + "raw": "0", + "type": "Literal", + "value": 0, + }, + "loc": Object { + "end": Object { + "column": 18, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "override": false, + "range": Array [ + 13, + 29, + ], + "readonly": undefined, + "static": false, + "type": "AccessorProperty", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 2, + }, + "start": Object { + "column": 12, + "line": 2, + }, + }, + "range": Array [ + 23, + 28, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 2, + }, + "start": Object { + "column": 14, + "line": 2, + }, + }, + "range": Array [ + 25, + 28, + ], + "type": "TSAnyKeyword", + }, + }, + "value": null, + }, + Object { + "computed": false, + "declare": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 3, + }, + "start": Object { + "column": 11, + "line": 3, + }, + }, + "range": Array [ + 41, + 42, + ], + "raw": "1", + "type": "Literal", + "value": 1, + }, + "loc": Object { + "end": Object { + "column": 17, + "line": 3, + }, + "start": Object { + "column": 2, + "line": 3, + }, + }, + "override": false, + "range": Array [ + 32, + 47, + ], + "readonly": undefined, + "static": false, + "type": "AccessorProperty", + "value": Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 3, + }, + "start": Object { + "column": 15, + "line": 3, + }, + }, + "range": Array [ + 45, + 46, + ], + "raw": "1", + "type": "Literal", + "value": 1, + }, + }, + Object { + "computed": false, + "declare": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 4, + }, + "start": Object { + "column": 18, + "line": 4, + }, + }, + "range": Array [ + 66, + 67, + ], + "raw": "2", + "type": "Literal", + "value": 2, + }, + "loc": Object { + "end": Object { + "column": 25, + "line": 4, + }, + "start": Object { + "column": 2, + "line": 4, + }, + }, + "override": false, + "range": Array [ + 50, + 73, + ], + "readonly": undefined, + "static": true, + "type": "AccessorProperty", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 4, + }, + "start": Object { + "column": 19, + "line": 4, + }, + }, + "range": Array [ + 67, + 72, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 4, + }, + "start": Object { + "column": 21, + "line": 4, + }, + }, + "range": Array [ + 69, + 72, + ], + "type": "TSAnyKeyword", + }, + }, + "value": null, + }, + Object { + "computed": false, + "declare": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 5, + }, + "start": Object { + "column": 18, + "line": 5, + }, + }, + "range": Array [ + 92, + 93, + ], + "raw": "3", + "type": "Literal", + "value": 3, + }, + "loc": Object { + "end": Object { + "column": 24, + "line": 5, + }, + "start": Object { + "column": 2, + "line": 5, + }, + }, + "override": false, + "range": Array [ + 76, + 98, + ], + "readonly": undefined, + "static": true, + "type": "AccessorProperty", + "value": Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 5, + }, + "start": Object { + "column": 22, + "line": 5, + }, + }, + "range": Array [ + 96, + 97, + ], + "raw": "2", + "type": "Literal", + "value": 2, + }, + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 6, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 100, + ], + "type": "ClassBody", + }, + "id": Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "name": "C1", + "range": Array [ + 6, + 8, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 6, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 100, + ], + "superClass": null, + "type": "ClassDeclaration", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 7, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 101, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 5, + ], + "type": "Keyword", + "value": "class", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 8, + ], + "type": "Identifier", + "value": "C1", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 10, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "range": Array [ + 13, + 21, + ], + "type": "Identifier", + "value": "accessor", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 2, + }, + "start": Object { + "column": 11, + "line": 2, + }, + }, + "range": Array [ + 22, + 23, + ], + "type": "Numeric", + "value": "0", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 2, + }, + "start": Object { + "column": 12, + "line": 2, + }, + }, + "range": Array [ + 23, + 24, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 2, + }, + "start": Object { + "column": 14, + "line": 2, + }, + }, + "range": Array [ + 25, + 28, + ], + "type": "Identifier", + "value": "any", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 2, + }, + "start": Object { + "column": 17, + "line": 2, + }, + }, + "range": Array [ + 28, + 29, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 3, + }, + "start": Object { + "column": 2, + "line": 3, + }, + }, + "range": Array [ + 32, + 40, + ], + "type": "Identifier", + "value": "accessor", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 3, + }, + "start": Object { + "column": 11, + "line": 3, + }, + }, + "range": Array [ + 41, + 42, + ], + "type": "Numeric", + "value": "1", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 3, + }, + "start": Object { + "column": 13, + "line": 3, + }, + }, + "range": Array [ + 43, + 44, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 3, + }, + "start": Object { + "column": 15, + "line": 3, + }, + }, + "range": Array [ + 45, + 46, + ], + "type": "Numeric", + "value": "1", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 3, + }, + "start": Object { + "column": 16, + "line": 3, + }, + }, + "range": Array [ + 46, + 47, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 4, + }, + "start": Object { + "column": 2, + "line": 4, + }, + }, + "range": Array [ + 50, + 56, + ], + "type": "Keyword", + "value": "static", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 4, + }, + "start": Object { + "column": 9, + "line": 4, + }, + }, + "range": Array [ + 57, + 65, + ], + "type": "Identifier", + "value": "accessor", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 4, + }, + "start": Object { + "column": 18, + "line": 4, + }, + }, + "range": Array [ + 66, + 67, + ], + "type": "Numeric", + "value": "2", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 4, + }, + "start": Object { + "column": 19, + "line": 4, + }, + }, + "range": Array [ + 67, + 68, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 4, + }, + "start": Object { + "column": 21, + "line": 4, + }, + }, + "range": Array [ + 69, + 72, + ], + "type": "Identifier", + "value": "any", + }, + Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 4, + }, + "start": Object { + "column": 24, + "line": 4, + }, + }, + "range": Array [ + 72, + 73, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 5, + }, + "start": Object { + "column": 2, + "line": 5, + }, + }, + "range": Array [ + 76, + 82, + ], + "type": "Keyword", + "value": "static", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 5, + }, + "start": Object { + "column": 9, + "line": 5, + }, + }, + "range": Array [ + 83, + 91, + ], + "type": "Identifier", + "value": "accessor", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 5, + }, + "start": Object { + "column": 18, + "line": 5, + }, + }, + "range": Array [ + 92, + 93, + ], + "type": "Numeric", + "value": "3", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 5, + }, + "start": Object { + "column": 20, + "line": 5, + }, + }, + "range": Array [ + 94, + 95, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 5, + }, + "start": Object { + "column": 22, + "line": 5, + }, + }, + "range": Array [ + 96, + 97, + ], + "type": "Numeric", + "value": "2", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 5, + }, + "start": Object { + "column": 23, + "line": 5, + }, + }, + "range": Array [ + 97, + 98, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 6, + }, + "start": Object { + "column": 0, + "line": 6, + }, + }, + "range": Array [ + 99, + 100, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/auto-accessor-5.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/auto-accessor-5.src.ts.shot new file mode 100644 index 00000000000..374193a85a4 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/auto-accessor-5.src.ts.shot @@ -0,0 +1,1532 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`typescript basics auto-accessor-5.src 1`] = ` +Object { + "body": Array [ + Object { + "body": Object { + "body": Array [ + Object { + "computed": true, + "declare": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 2, + }, + "start": Object { + "column": 12, + "line": 2, + }, + }, + "range": Array [ + 23, + 26, + ], + "raw": "\\"w\\"", + "type": "Literal", + "value": "w", + }, + "loc": Object { + "end": Object { + "column": 22, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "override": false, + "range": Array [ + 13, + 33, + ], + "readonly": undefined, + "static": false, + "type": "AccessorProperty", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 2, + }, + "start": Object { + "column": 16, + "line": 2, + }, + }, + "range": Array [ + 27, + 32, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 2, + }, + "start": Object { + "column": 18, + "line": 2, + }, + }, + "range": Array [ + 29, + 32, + ], + "type": "TSAnyKeyword", + }, + }, + "value": null, + }, + Object { + "computed": true, + "declare": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 3, + }, + "start": Object { + "column": 12, + "line": 3, + }, + }, + "range": Array [ + 46, + 49, + ], + "raw": "\\"x\\"", + "type": "Literal", + "value": "x", + }, + "loc": Object { + "end": Object { + "column": 21, + "line": 3, + }, + "start": Object { + "column": 2, + "line": 3, + }, + }, + "override": false, + "range": Array [ + 36, + 55, + ], + "readonly": undefined, + "static": false, + "type": "AccessorProperty", + "value": Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 3, + }, + "start": Object { + "column": 19, + "line": 3, + }, + }, + "range": Array [ + 53, + 54, + ], + "raw": "1", + "type": "Literal", + "value": 1, + }, + }, + Object { + "computed": true, + "declare": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 4, + }, + "start": Object { + "column": 19, + "line": 4, + }, + }, + "range": Array [ + 75, + 78, + ], + "raw": "\\"y\\"", + "type": "Literal", + "value": "y", + }, + "loc": Object { + "end": Object { + "column": 29, + "line": 4, + }, + "start": Object { + "column": 2, + "line": 4, + }, + }, + "override": false, + "range": Array [ + 58, + 85, + ], + "readonly": undefined, + "static": true, + "type": "AccessorProperty", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 4, + }, + "start": Object { + "column": 23, + "line": 4, + }, + }, + "range": Array [ + 79, + 84, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 4, + }, + "start": Object { + "column": 25, + "line": 4, + }, + }, + "range": Array [ + 81, + 84, + ], + "type": "TSAnyKeyword", + }, + }, + "value": null, + }, + Object { + "computed": true, + "declare": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 5, + }, + "start": Object { + "column": 19, + "line": 5, + }, + }, + "range": Array [ + 105, + 108, + ], + "raw": "\\"z\\"", + "type": "Literal", + "value": "z", + }, + "loc": Object { + "end": Object { + "column": 28, + "line": 5, + }, + "start": Object { + "column": 2, + "line": 5, + }, + }, + "override": false, + "range": Array [ + 88, + 114, + ], + "readonly": undefined, + "static": true, + "type": "AccessorProperty", + "value": Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 5, + }, + "start": Object { + "column": 26, + "line": 5, + }, + }, + "range": Array [ + 112, + 113, + ], + "raw": "2", + "type": "Literal", + "value": 2, + }, + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 6, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 116, + ], + "type": "ClassBody", + }, + "id": Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "name": "C1", + "range": Array [ + 6, + 8, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 6, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 116, + ], + "superClass": null, + "type": "ClassDeclaration", + }, + Object { + "declarations": Array [ + Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 8, + }, + "start": Object { + "column": 12, + "line": 8, + }, + }, + "name": "f", + "range": Array [ + 130, + 136, + ], + "type": "Identifier", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 8, + }, + "start": Object { + "column": 13, + "line": 8, + }, + }, + "range": Array [ + 131, + 136, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 8, + }, + "start": Object { + "column": 15, + "line": 8, + }, + }, + "range": Array [ + 133, + 136, + ], + "type": "TSAnyKeyword", + }, + }, + }, + "init": null, + "loc": Object { + "end": Object { + "column": 18, + "line": 8, + }, + "start": Object { + "column": 12, + "line": 8, + }, + }, + "range": Array [ + 130, + 136, + ], + "type": "VariableDeclarator", + }, + ], + "declare": true, + "kind": "var", + "loc": Object { + "end": Object { + "column": 19, + "line": 8, + }, + "start": Object { + "column": 0, + "line": 8, + }, + }, + "range": Array [ + 118, + 137, + ], + "type": "VariableDeclaration", + }, + Object { + "body": Object { + "body": Array [ + Object { + "computed": true, + "declare": false, + "key": Object { + "arguments": Array [], + "callee": Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 10, + }, + "start": Object { + "column": 12, + "line": 10, + }, + }, + "name": "f", + "range": Array [ + 161, + 162, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 15, + "line": 10, + }, + "start": Object { + "column": 12, + "line": 10, + }, + }, + "optional": false, + "range": Array [ + 161, + 164, + ], + "type": "CallExpression", + }, + "loc": Object { + "end": Object { + "column": 21, + "line": 10, + }, + "start": Object { + "column": 2, + "line": 10, + }, + }, + "override": false, + "range": Array [ + 151, + 170, + ], + "readonly": undefined, + "static": false, + "type": "AccessorProperty", + "value": Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 10, + }, + "start": Object { + "column": 19, + "line": 10, + }, + }, + "range": Array [ + 168, + 169, + ], + "raw": "1", + "type": "Literal", + "value": 1, + }, + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 11, + }, + "start": Object { + "column": 9, + "line": 9, + }, + }, + "range": Array [ + 147, + 172, + ], + "type": "ClassBody", + }, + "id": Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 9, + }, + "start": Object { + "column": 6, + "line": 9, + }, + }, + "name": "C2", + "range": Array [ + 144, + 146, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 11, + }, + "start": Object { + "column": 0, + "line": 9, + }, + }, + "range": Array [ + 138, + 172, + ], + "superClass": null, + "type": "ClassDeclaration", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 12, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 173, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 5, + ], + "type": "Keyword", + "value": "class", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 8, + ], + "type": "Identifier", + "value": "C1", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 10, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "range": Array [ + 13, + 21, + ], + "type": "Identifier", + "value": "accessor", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 2, + }, + "start": Object { + "column": 11, + "line": 2, + }, + }, + "range": Array [ + 22, + 23, + ], + "type": "Punctuator", + "value": "[", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 2, + }, + "start": Object { + "column": 12, + "line": 2, + }, + }, + "range": Array [ + 23, + 26, + ], + "type": "String", + "value": "\\"w\\"", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 2, + }, + "start": Object { + "column": 15, + "line": 2, + }, + }, + "range": Array [ + 26, + 27, + ], + "type": "Punctuator", + "value": "]", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 2, + }, + "start": Object { + "column": 16, + "line": 2, + }, + }, + "range": Array [ + 27, + 28, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 2, + }, + "start": Object { + "column": 18, + "line": 2, + }, + }, + "range": Array [ + 29, + 32, + ], + "type": "Identifier", + "value": "any", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 2, + }, + "start": Object { + "column": 21, + "line": 2, + }, + }, + "range": Array [ + 32, + 33, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 3, + }, + "start": Object { + "column": 2, + "line": 3, + }, + }, + "range": Array [ + 36, + 44, + ], + "type": "Identifier", + "value": "accessor", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 3, + }, + "start": Object { + "column": 11, + "line": 3, + }, + }, + "range": Array [ + 45, + 46, + ], + "type": "Punctuator", + "value": "[", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 3, + }, + "start": Object { + "column": 12, + "line": 3, + }, + }, + "range": Array [ + 46, + 49, + ], + "type": "String", + "value": "\\"x\\"", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 3, + }, + "start": Object { + "column": 15, + "line": 3, + }, + }, + "range": Array [ + 49, + 50, + ], + "type": "Punctuator", + "value": "]", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 3, + }, + "start": Object { + "column": 17, + "line": 3, + }, + }, + "range": Array [ + 51, + 52, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 3, + }, + "start": Object { + "column": 19, + "line": 3, + }, + }, + "range": Array [ + 53, + 54, + ], + "type": "Numeric", + "value": "1", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 3, + }, + "start": Object { + "column": 20, + "line": 3, + }, + }, + "range": Array [ + 54, + 55, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 4, + }, + "start": Object { + "column": 2, + "line": 4, + }, + }, + "range": Array [ + 58, + 64, + ], + "type": "Keyword", + "value": "static", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 4, + }, + "start": Object { + "column": 9, + "line": 4, + }, + }, + "range": Array [ + 65, + 73, + ], + "type": "Identifier", + "value": "accessor", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 4, + }, + "start": Object { + "column": 18, + "line": 4, + }, + }, + "range": Array [ + 74, + 75, + ], + "type": "Punctuator", + "value": "[", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 4, + }, + "start": Object { + "column": 19, + "line": 4, + }, + }, + "range": Array [ + 75, + 78, + ], + "type": "String", + "value": "\\"y\\"", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 4, + }, + "start": Object { + "column": 22, + "line": 4, + }, + }, + "range": Array [ + 78, + 79, + ], + "type": "Punctuator", + "value": "]", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 4, + }, + "start": Object { + "column": 23, + "line": 4, + }, + }, + "range": Array [ + 79, + 80, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 4, + }, + "start": Object { + "column": 25, + "line": 4, + }, + }, + "range": Array [ + 81, + 84, + ], + "type": "Identifier", + "value": "any", + }, + Object { + "loc": Object { + "end": Object { + "column": 29, + "line": 4, + }, + "start": Object { + "column": 28, + "line": 4, + }, + }, + "range": Array [ + 84, + 85, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 5, + }, + "start": Object { + "column": 2, + "line": 5, + }, + }, + "range": Array [ + 88, + 94, + ], + "type": "Keyword", + "value": "static", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 5, + }, + "start": Object { + "column": 9, + "line": 5, + }, + }, + "range": Array [ + 95, + 103, + ], + "type": "Identifier", + "value": "accessor", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 5, + }, + "start": Object { + "column": 18, + "line": 5, + }, + }, + "range": Array [ + 104, + 105, + ], + "type": "Punctuator", + "value": "[", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 5, + }, + "start": Object { + "column": 19, + "line": 5, + }, + }, + "range": Array [ + 105, + 108, + ], + "type": "String", + "value": "\\"z\\"", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 5, + }, + "start": Object { + "column": 22, + "line": 5, + }, + }, + "range": Array [ + 108, + 109, + ], + "type": "Punctuator", + "value": "]", + }, + Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 5, + }, + "start": Object { + "column": 24, + "line": 5, + }, + }, + "range": Array [ + 110, + 111, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 5, + }, + "start": Object { + "column": 26, + "line": 5, + }, + }, + "range": Array [ + 112, + 113, + ], + "type": "Numeric", + "value": "2", + }, + Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 5, + }, + "start": Object { + "column": 27, + "line": 5, + }, + }, + "range": Array [ + 113, + 114, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 6, + }, + "start": Object { + "column": 0, + "line": 6, + }, + }, + "range": Array [ + 115, + 116, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 8, + }, + "start": Object { + "column": 0, + "line": 8, + }, + }, + "range": Array [ + 118, + 125, + ], + "type": "Identifier", + "value": "declare", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 8, + }, + "start": Object { + "column": 8, + "line": 8, + }, + }, + "range": Array [ + 126, + 129, + ], + "type": "Keyword", + "value": "var", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 8, + }, + "start": Object { + "column": 12, + "line": 8, + }, + }, + "range": Array [ + 130, + 131, + ], + "type": "Identifier", + "value": "f", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 8, + }, + "start": Object { + "column": 13, + "line": 8, + }, + }, + "range": Array [ + 131, + 132, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 8, + }, + "start": Object { + "column": 15, + "line": 8, + }, + }, + "range": Array [ + 133, + 136, + ], + "type": "Identifier", + "value": "any", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 8, + }, + "start": Object { + "column": 18, + "line": 8, + }, + }, + "range": Array [ + 136, + 137, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 9, + }, + "start": Object { + "column": 0, + "line": 9, + }, + }, + "range": Array [ + 138, + 143, + ], + "type": "Keyword", + "value": "class", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 9, + }, + "start": Object { + "column": 6, + "line": 9, + }, + }, + "range": Array [ + 144, + 146, + ], + "type": "Identifier", + "value": "C2", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 9, + }, + "start": Object { + "column": 9, + "line": 9, + }, + }, + "range": Array [ + 147, + 148, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 10, + }, + "start": Object { + "column": 2, + "line": 10, + }, + }, + "range": Array [ + 151, + 159, + ], + "type": "Identifier", + "value": "accessor", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 10, + }, + "start": Object { + "column": 11, + "line": 10, + }, + }, + "range": Array [ + 160, + 161, + ], + "type": "Punctuator", + "value": "[", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 10, + }, + "start": Object { + "column": 12, + "line": 10, + }, + }, + "range": Array [ + 161, + 162, + ], + "type": "Identifier", + "value": "f", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 10, + }, + "start": Object { + "column": 13, + "line": 10, + }, + }, + "range": Array [ + 162, + 163, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 10, + }, + "start": Object { + "column": 14, + "line": 10, + }, + }, + "range": Array [ + 163, + 164, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 10, + }, + "start": Object { + "column": 15, + "line": 10, + }, + }, + "range": Array [ + 164, + 165, + ], + "type": "Punctuator", + "value": "]", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 10, + }, + "start": Object { + "column": 17, + "line": 10, + }, + }, + "range": Array [ + 166, + 167, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 10, + }, + "start": Object { + "column": 19, + "line": 10, + }, + }, + "range": Array [ + 168, + 169, + ], + "type": "Numeric", + "value": "1", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 10, + }, + "start": Object { + "column": 20, + "line": 10, + }, + }, + "range": Array [ + 169, + 170, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 11, + }, + "start": Object { + "column": 0, + "line": 11, + }, + }, + "range": Array [ + 171, + 172, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; From ff3d58c5a7bab98e21620d27fdabfcdec3d0e02b Mon Sep 17 00:00:00 2001 From: Brad Zacher Date: Fri, 18 Nov 2022 13:07:28 +1030 Subject: [PATCH 15/20] add TSAbstractAccessorProperty and add ast-spec fixture tests --- .prettierignore | 2 + packages/ast-spec/src/ast-node-types.ts | 1 + .../fixtures/key-computed-complex/fixture.ts | 3 + .../snapshots/1-TSESTree-AST.shot | 82 + .../snapshots/2-TSESTree-Tokens.shot | 96 + .../snapshots/3-Babel-AST.shot | 80 + .../snapshots/4-Babel-Tokens.shot | 96 + .../snapshots/5-AST-Alignment-AST.shot | 88 + .../snapshots/6-AST-Alignment-Tokens.shot | 6 + .../fixtures/key-computed-number/fixture.ts | 3 + .../snapshots/1-TSESTree-AST.shot | 82 + .../snapshots/2-TSESTree-Tokens.shot | 116 + .../snapshots/3-Babel-AST.shot | 80 + .../snapshots/4-Babel-Tokens.shot | 116 + .../snapshots/5-AST-Alignment-AST.shot | 88 + .../snapshots/6-AST-Alignment-Tokens.shot | 6 + .../fixtures/key-computed-string/fixture.ts | 3 + .../snapshots/1-TSESTree-AST.shot | 82 + .../snapshots/2-TSESTree-Tokens.shot | 116 + .../snapshots/3-Babel-AST.shot | 80 + .../snapshots/4-Babel-Tokens.shot | 116 + .../snapshots/5-AST-Alignment-AST.shot | 88 + .../snapshots/6-AST-Alignment-Tokens.shot | 6 + .../fixtures/key-number/fixture.ts | 0 .../key-number/snapshots/1-TSESTree-AST.shot | 15 + .../snapshots/2-TSESTree-Tokens.shot | 3 + .../key-number/snapshots/3-Babel-AST.shot | 15 + .../key-number/snapshots/4-Babel-Tokens.shot | 3 + .../snapshots/5-AST-Alignment-AST.shot | 6 + .../snapshots/6-AST-Alignment-Tokens.shot | 6 + .../fixtures/key-private/fixture.ts | 3 + .../key-private/snapshots/1-TSESTree-AST.shot | 81 + .../snapshots/2-TSESTree-Tokens.shot | 96 + .../key-private/snapshots/3-Babel-AST.shot | 79 + .../key-private/snapshots/4-Babel-Tokens.shot | 96 + .../snapshots/5-AST-Alignment-AST.shot | 87 + .../snapshots/6-AST-Alignment-Tokens.shot | 103 + .../fixtures/key-string/fixture.ts | 3 + .../key-string/snapshots/1-TSESTree-AST.shot | 82 + .../snapshots/2-TSESTree-Tokens.shot | 96 + .../key-string/snapshots/3-Babel-AST.shot | 80 + .../key-string/snapshots/4-Babel-Tokens.shot | 96 + .../snapshots/5-AST-Alignment-AST.shot | 88 + .../snapshots/6-AST-Alignment-Tokens.shot | 6 + .../modifier-abstract-with-value/fixture.ts | 3 + .../snapshots/1-TSESTree-AST.shot | 90 + .../snapshots/2-TSESTree-Tokens.shot | 136 ++ .../fixtures/modifier-abstract/fixture.ts | 3 + .../snapshots/1-TSESTree-AST.shot | 90 + .../snapshots/2-TSESTree-Tokens.shot | 116 + .../fixtures/modifier-declare/fixture.ts | 3 + .../snapshots/1-TSESTree-AST.shot | 89 + .../snapshots/2-TSESTree-Tokens.shot | 106 + .../fixtures/modifier-override/fixture.ts | 3 + .../snapshots/1-TSESTree-AST.shot | 81 + .../snapshots/2-TSESTree-Tokens.shot | 106 + .../fixtures/modifier-private/fixture.ts | 3 + .../snapshots/1-TSESTree-AST.shot | 82 + .../snapshots/2-TSESTree-Tokens.shot | 106 + .../snapshots/3-Babel-AST.shot | 80 + .../snapshots/4-Babel-Tokens.shot | 106 + .../snapshots/5-AST-Alignment-AST.shot | 88 + .../snapshots/6-AST-Alignment-Tokens.shot | 112 + .../fixtures/modifier-protected/fixture.ts | 3 + .../snapshots/1-TSESTree-AST.shot | 82 + .../snapshots/2-TSESTree-Tokens.shot | 106 + .../snapshots/3-Babel-AST.shot | 80 + .../snapshots/4-Babel-Tokens.shot | 106 + .../snapshots/5-AST-Alignment-AST.shot | 88 + .../snapshots/6-AST-Alignment-Tokens.shot | 112 + .../fixtures/modifier-public/fixture.ts | 3 + .../snapshots/1-TSESTree-AST.shot | 82 + .../snapshots/2-TSESTree-Tokens.shot | 106 + .../snapshots/3-Babel-AST.shot | 80 + .../snapshots/4-Babel-Tokens.shot | 106 + .../snapshots/5-AST-Alignment-AST.shot | 88 + .../snapshots/6-AST-Alignment-Tokens.shot | 112 + .../fixtures/modifier-readonly/fixture.ts | 3 + .../snapshots/1-TSESTree-AST.shot | 82 + .../snapshots/2-TSESTree-Tokens.shot | 106 + .../snapshots/3-Babel-AST.shot | 80 + .../snapshots/4-Babel-Tokens.shot | 106 + .../snapshots/5-AST-Alignment-AST.shot | 88 + .../snapshots/6-AST-Alignment-Tokens.shot | 6 + .../fixtures/modifier-static/fixture.ts | 3 + .../snapshots/1-TSESTree-AST.shot | 81 + .../snapshots/2-TSESTree-Tokens.shot | 106 + .../snapshots/3-Babel-AST.shot | 79 + .../snapshots/4-Babel-Tokens.shot | 106 + .../snapshots/5-AST-Alignment-AST.shot | 87 + .../snapshots/6-AST-Alignment-Tokens.shot | 6 + .../no-annotation-no-value/fixture.ts | 3 + .../snapshots/1-TSESTree-AST.shot | 71 + .../snapshots/2-TSESTree-Tokens.shot | 76 + .../snapshots/3-Babel-AST.shot | 69 + .../snapshots/4-Babel-Tokens.shot | 76 + .../snapshots/5-AST-Alignment-AST.shot | 77 + .../snapshots/6-AST-Alignment-Tokens.shot | 6 + .../no-annotation-with-value/fixture.ts | 3 + .../snapshots/1-TSESTree-AST.shot | 81 + .../snapshots/2-TSESTree-Tokens.shot | 96 + .../snapshots/3-Babel-AST.shot | 79 + .../snapshots/4-Babel-Tokens.shot | 96 + .../snapshots/5-AST-Alignment-AST.shot | 87 + .../snapshots/6-AST-Alignment-Tokens.shot | 6 + .../with-annotation-no-value/fixture.ts | 3 + .../snapshots/1-TSESTree-AST.shot | 89 + .../snapshots/2-TSESTree-Tokens.shot | 96 + .../with-annotation-with-value/fixture.ts | 3 + .../snapshots/1-TSESTree-AST.shot | 99 + .../snapshots/2-TSESTree-Tokens.shot | 116 + .../TSAbstractAccessorProperty/spec.ts | 22 + packages/ast-spec/src/element/spec.ts | 1 + packages/ast-spec/src/unions/ClassElement.ts | 4 +- packages/ast-spec/src/unions/Node.ts | 2 + .../tests/fixtures-with-differences-ast.shot | 12 + .../fixtures-with-differences-tokens.shot | 4 + packages/ast-spec/tests/util/parsers/babel.ts | 1 + .../typescript/basics/auto-accessor-1.src.ts | 6 - .../typescript/basics/auto-accessor-2.src.ts | 16 - .../typescript/basics/auto-accessor-3.src.ts | 6 - .../typescript/basics/auto-accessor-4.src.ts | 6 - .../typescript/basics/auto-accessor-5.src.ts | 11 - packages/typescript-estree/src/convert.ts | 23 +- .../src/parseSettings/warnAboutTSVersion.ts | 2 +- .../src/ts-estree/estree-to-ts-node-types.ts | 1 + .../basics/auto-accessor-1.src.ts.shot | 818 ------- .../basics/auto-accessor-2.src.ts.shot | 1925 ----------------- .../basics/auto-accessor-3.src.ts.shot | 822 ------- .../basics/auto-accessor-4.src.ts.shot | 822 ------- .../basics/auto-accessor-5.src.ts.shot | 1532 ------------- 131 files changed, 7273 insertions(+), 5971 deletions(-) create mode 100644 packages/ast-spec/src/element/AccessorProperty/fixtures/key-computed-complex/fixture.ts create mode 100644 packages/ast-spec/src/element/AccessorProperty/fixtures/key-computed-complex/snapshots/1-TSESTree-AST.shot create mode 100644 packages/ast-spec/src/element/AccessorProperty/fixtures/key-computed-complex/snapshots/2-TSESTree-Tokens.shot create mode 100644 packages/ast-spec/src/element/AccessorProperty/fixtures/key-computed-complex/snapshots/3-Babel-AST.shot create mode 100644 packages/ast-spec/src/element/AccessorProperty/fixtures/key-computed-complex/snapshots/4-Babel-Tokens.shot create mode 100644 packages/ast-spec/src/element/AccessorProperty/fixtures/key-computed-complex/snapshots/5-AST-Alignment-AST.shot create mode 100644 packages/ast-spec/src/element/AccessorProperty/fixtures/key-computed-complex/snapshots/6-AST-Alignment-Tokens.shot create mode 100644 packages/ast-spec/src/element/AccessorProperty/fixtures/key-computed-number/fixture.ts create mode 100644 packages/ast-spec/src/element/AccessorProperty/fixtures/key-computed-number/snapshots/1-TSESTree-AST.shot create mode 100644 packages/ast-spec/src/element/AccessorProperty/fixtures/key-computed-number/snapshots/2-TSESTree-Tokens.shot create mode 100644 packages/ast-spec/src/element/AccessorProperty/fixtures/key-computed-number/snapshots/3-Babel-AST.shot create mode 100644 packages/ast-spec/src/element/AccessorProperty/fixtures/key-computed-number/snapshots/4-Babel-Tokens.shot create mode 100644 packages/ast-spec/src/element/AccessorProperty/fixtures/key-computed-number/snapshots/5-AST-Alignment-AST.shot create mode 100644 packages/ast-spec/src/element/AccessorProperty/fixtures/key-computed-number/snapshots/6-AST-Alignment-Tokens.shot create mode 100644 packages/ast-spec/src/element/AccessorProperty/fixtures/key-computed-string/fixture.ts create mode 100644 packages/ast-spec/src/element/AccessorProperty/fixtures/key-computed-string/snapshots/1-TSESTree-AST.shot create mode 100644 packages/ast-spec/src/element/AccessorProperty/fixtures/key-computed-string/snapshots/2-TSESTree-Tokens.shot create mode 100644 packages/ast-spec/src/element/AccessorProperty/fixtures/key-computed-string/snapshots/3-Babel-AST.shot create mode 100644 packages/ast-spec/src/element/AccessorProperty/fixtures/key-computed-string/snapshots/4-Babel-Tokens.shot create mode 100644 packages/ast-spec/src/element/AccessorProperty/fixtures/key-computed-string/snapshots/5-AST-Alignment-AST.shot create mode 100644 packages/ast-spec/src/element/AccessorProperty/fixtures/key-computed-string/snapshots/6-AST-Alignment-Tokens.shot create mode 100644 packages/ast-spec/src/element/AccessorProperty/fixtures/key-number/fixture.ts create mode 100644 packages/ast-spec/src/element/AccessorProperty/fixtures/key-number/snapshots/1-TSESTree-AST.shot create mode 100644 packages/ast-spec/src/element/AccessorProperty/fixtures/key-number/snapshots/2-TSESTree-Tokens.shot create mode 100644 packages/ast-spec/src/element/AccessorProperty/fixtures/key-number/snapshots/3-Babel-AST.shot create mode 100644 packages/ast-spec/src/element/AccessorProperty/fixtures/key-number/snapshots/4-Babel-Tokens.shot create mode 100644 packages/ast-spec/src/element/AccessorProperty/fixtures/key-number/snapshots/5-AST-Alignment-AST.shot create mode 100644 packages/ast-spec/src/element/AccessorProperty/fixtures/key-number/snapshots/6-AST-Alignment-Tokens.shot create mode 100644 packages/ast-spec/src/element/AccessorProperty/fixtures/key-private/fixture.ts create mode 100644 packages/ast-spec/src/element/AccessorProperty/fixtures/key-private/snapshots/1-TSESTree-AST.shot create mode 100644 packages/ast-spec/src/element/AccessorProperty/fixtures/key-private/snapshots/2-TSESTree-Tokens.shot create mode 100644 packages/ast-spec/src/element/AccessorProperty/fixtures/key-private/snapshots/3-Babel-AST.shot create mode 100644 packages/ast-spec/src/element/AccessorProperty/fixtures/key-private/snapshots/4-Babel-Tokens.shot create mode 100644 packages/ast-spec/src/element/AccessorProperty/fixtures/key-private/snapshots/5-AST-Alignment-AST.shot create mode 100644 packages/ast-spec/src/element/AccessorProperty/fixtures/key-private/snapshots/6-AST-Alignment-Tokens.shot create mode 100644 packages/ast-spec/src/element/AccessorProperty/fixtures/key-string/fixture.ts create mode 100644 packages/ast-spec/src/element/AccessorProperty/fixtures/key-string/snapshots/1-TSESTree-AST.shot create mode 100644 packages/ast-spec/src/element/AccessorProperty/fixtures/key-string/snapshots/2-TSESTree-Tokens.shot create mode 100644 packages/ast-spec/src/element/AccessorProperty/fixtures/key-string/snapshots/3-Babel-AST.shot create mode 100644 packages/ast-spec/src/element/AccessorProperty/fixtures/key-string/snapshots/4-Babel-Tokens.shot create mode 100644 packages/ast-spec/src/element/AccessorProperty/fixtures/key-string/snapshots/5-AST-Alignment-AST.shot create mode 100644 packages/ast-spec/src/element/AccessorProperty/fixtures/key-string/snapshots/6-AST-Alignment-Tokens.shot create mode 100644 packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-abstract-with-value/fixture.ts create mode 100644 packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-abstract-with-value/snapshots/1-TSESTree-AST.shot create mode 100644 packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-abstract-with-value/snapshots/2-TSESTree-Tokens.shot create mode 100644 packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-abstract/fixture.ts create mode 100644 packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-abstract/snapshots/1-TSESTree-AST.shot create mode 100644 packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-abstract/snapshots/2-TSESTree-Tokens.shot create mode 100644 packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-declare/fixture.ts create mode 100644 packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-declare/snapshots/1-TSESTree-AST.shot create mode 100644 packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-declare/snapshots/2-TSESTree-Tokens.shot create mode 100644 packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-override/fixture.ts create mode 100644 packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-override/snapshots/1-TSESTree-AST.shot create mode 100644 packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-override/snapshots/2-TSESTree-Tokens.shot create mode 100644 packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-private/fixture.ts create mode 100644 packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-private/snapshots/1-TSESTree-AST.shot create mode 100644 packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-private/snapshots/2-TSESTree-Tokens.shot create mode 100644 packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-private/snapshots/3-Babel-AST.shot create mode 100644 packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-private/snapshots/4-Babel-Tokens.shot create mode 100644 packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-private/snapshots/5-AST-Alignment-AST.shot create mode 100644 packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-private/snapshots/6-AST-Alignment-Tokens.shot create mode 100644 packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-protected/fixture.ts create mode 100644 packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-protected/snapshots/1-TSESTree-AST.shot create mode 100644 packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-protected/snapshots/2-TSESTree-Tokens.shot create mode 100644 packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-protected/snapshots/3-Babel-AST.shot create mode 100644 packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-protected/snapshots/4-Babel-Tokens.shot create mode 100644 packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-protected/snapshots/5-AST-Alignment-AST.shot create mode 100644 packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-protected/snapshots/6-AST-Alignment-Tokens.shot create mode 100644 packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-public/fixture.ts create mode 100644 packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-public/snapshots/1-TSESTree-AST.shot create mode 100644 packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-public/snapshots/2-TSESTree-Tokens.shot create mode 100644 packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-public/snapshots/3-Babel-AST.shot create mode 100644 packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-public/snapshots/4-Babel-Tokens.shot create mode 100644 packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-public/snapshots/5-AST-Alignment-AST.shot create mode 100644 packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-public/snapshots/6-AST-Alignment-Tokens.shot create mode 100644 packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-readonly/fixture.ts create mode 100644 packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-readonly/snapshots/1-TSESTree-AST.shot create mode 100644 packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-readonly/snapshots/2-TSESTree-Tokens.shot create mode 100644 packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-readonly/snapshots/3-Babel-AST.shot create mode 100644 packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-readonly/snapshots/4-Babel-Tokens.shot create mode 100644 packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-readonly/snapshots/5-AST-Alignment-AST.shot create mode 100644 packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-readonly/snapshots/6-AST-Alignment-Tokens.shot create mode 100644 packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-static/fixture.ts create mode 100644 packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-static/snapshots/1-TSESTree-AST.shot create mode 100644 packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-static/snapshots/2-TSESTree-Tokens.shot create mode 100644 packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-static/snapshots/3-Babel-AST.shot create mode 100644 packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-static/snapshots/4-Babel-Tokens.shot create mode 100644 packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-static/snapshots/5-AST-Alignment-AST.shot create mode 100644 packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-static/snapshots/6-AST-Alignment-Tokens.shot create mode 100644 packages/ast-spec/src/element/AccessorProperty/fixtures/no-annotation-no-value/fixture.ts create mode 100644 packages/ast-spec/src/element/AccessorProperty/fixtures/no-annotation-no-value/snapshots/1-TSESTree-AST.shot create mode 100644 packages/ast-spec/src/element/AccessorProperty/fixtures/no-annotation-no-value/snapshots/2-TSESTree-Tokens.shot create mode 100644 packages/ast-spec/src/element/AccessorProperty/fixtures/no-annotation-no-value/snapshots/3-Babel-AST.shot create mode 100644 packages/ast-spec/src/element/AccessorProperty/fixtures/no-annotation-no-value/snapshots/4-Babel-Tokens.shot create mode 100644 packages/ast-spec/src/element/AccessorProperty/fixtures/no-annotation-no-value/snapshots/5-AST-Alignment-AST.shot create mode 100644 packages/ast-spec/src/element/AccessorProperty/fixtures/no-annotation-no-value/snapshots/6-AST-Alignment-Tokens.shot create mode 100644 packages/ast-spec/src/element/AccessorProperty/fixtures/no-annotation-with-value/fixture.ts create mode 100644 packages/ast-spec/src/element/AccessorProperty/fixtures/no-annotation-with-value/snapshots/1-TSESTree-AST.shot create mode 100644 packages/ast-spec/src/element/AccessorProperty/fixtures/no-annotation-with-value/snapshots/2-TSESTree-Tokens.shot create mode 100644 packages/ast-spec/src/element/AccessorProperty/fixtures/no-annotation-with-value/snapshots/3-Babel-AST.shot create mode 100644 packages/ast-spec/src/element/AccessorProperty/fixtures/no-annotation-with-value/snapshots/4-Babel-Tokens.shot create mode 100644 packages/ast-spec/src/element/AccessorProperty/fixtures/no-annotation-with-value/snapshots/5-AST-Alignment-AST.shot create mode 100644 packages/ast-spec/src/element/AccessorProperty/fixtures/no-annotation-with-value/snapshots/6-AST-Alignment-Tokens.shot create mode 100644 packages/ast-spec/src/element/AccessorProperty/fixtures/with-annotation-no-value/fixture.ts create mode 100644 packages/ast-spec/src/element/AccessorProperty/fixtures/with-annotation-no-value/snapshots/1-TSESTree-AST.shot create mode 100644 packages/ast-spec/src/element/AccessorProperty/fixtures/with-annotation-no-value/snapshots/2-TSESTree-Tokens.shot create mode 100644 packages/ast-spec/src/element/AccessorProperty/fixtures/with-annotation-with-value/fixture.ts create mode 100644 packages/ast-spec/src/element/AccessorProperty/fixtures/with-annotation-with-value/snapshots/1-TSESTree-AST.shot create mode 100644 packages/ast-spec/src/element/AccessorProperty/fixtures/with-annotation-with-value/snapshots/2-TSESTree-Tokens.shot create mode 100644 packages/ast-spec/src/element/TSAbstractAccessorProperty/spec.ts delete mode 100644 packages/shared-fixtures/fixtures/typescript/basics/auto-accessor-1.src.ts delete mode 100644 packages/shared-fixtures/fixtures/typescript/basics/auto-accessor-2.src.ts delete mode 100644 packages/shared-fixtures/fixtures/typescript/basics/auto-accessor-3.src.ts delete mode 100644 packages/shared-fixtures/fixtures/typescript/basics/auto-accessor-4.src.ts delete mode 100644 packages/shared-fixtures/fixtures/typescript/basics/auto-accessor-5.src.ts delete mode 100644 packages/typescript-estree/tests/snapshots/typescript/basics/auto-accessor-1.src.ts.shot delete mode 100644 packages/typescript-estree/tests/snapshots/typescript/basics/auto-accessor-2.src.ts.shot delete mode 100644 packages/typescript-estree/tests/snapshots/typescript/basics/auto-accessor-3.src.ts.shot delete mode 100644 packages/typescript-estree/tests/snapshots/typescript/basics/auto-accessor-4.src.ts.shot delete mode 100644 packages/typescript-estree/tests/snapshots/typescript/basics/auto-accessor-5.src.ts.shot diff --git a/.prettierignore b/.prettierignore index 88af276a1b2..c241812228c 100644 --- a/.prettierignore +++ b/.prettierignore @@ -14,6 +14,8 @@ packages/ast-spec/src/*/*/fixtures/_error_/*/fixture.ts # prettier doesn't yet support satisfies packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/ +# prettier doesn't yet support auto-accessors +packages/ast-spec/src/element/AccessorProperty/fixtures # Ignore CHANGELOG.md files to avoid issues with automated release job CHANGELOG.md diff --git a/packages/ast-spec/src/ast-node-types.ts b/packages/ast-spec/src/ast-node-types.ts index ad93a407b00..7a637489eb0 100644 --- a/packages/ast-spec/src/ast-node-types.ts +++ b/packages/ast-spec/src/ast-node-types.ts @@ -91,6 +91,7 @@ export enum AST_NODE_TYPES { /** * TS-prefixed nodes */ + TSAbstractAccessorProperty = 'TSAbstractAccessorProperty', TSAbstractKeyword = 'TSAbstractKeyword', TSAbstractMethodDefinition = 'TSAbstractMethodDefinition', TSAbstractPropertyDefinition = 'TSAbstractPropertyDefinition', diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/key-computed-complex/fixture.ts b/packages/ast-spec/src/element/AccessorProperty/fixtures/key-computed-complex/fixture.ts new file mode 100644 index 00000000000..5dc28758b4e --- /dev/null +++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/key-computed-complex/fixture.ts @@ -0,0 +1,3 @@ +class Foo { + accessor 1 = 2; +} diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/key-computed-complex/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/key-computed-complex/snapshots/1-TSESTree-AST.shot new file mode 100644 index 00000000000..00745c8a8d3 --- /dev/null +++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/key-computed-complex/snapshots/1-TSESTree-AST.shot @@ -0,0 +1,82 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures element AccessorProperty key-computed-complex TSESTree - AST 1`] = ` +Program { + type: "Program", + body: Array [ + ClassDeclaration { + type: "ClassDeclaration", + body: ClassBody { + type: "ClassBody", + body: Array [ + AccessorProperty { + type: "AccessorProperty", + computed: false, + declare: false, + key: Literal { + type: "Literal", + raw: "1", + value: 1, + + range: [23, 24], + loc: { + start: { column: 11, line: 2 }, + end: { column: 12, line: 2 }, + }, + }, + override: false, + static: false, + value: Literal { + type: "Literal", + raw: "2", + value: 2, + + range: [27, 28], + loc: { + start: { column: 15, line: 2 }, + end: { column: 16, line: 2 }, + }, + }, + + range: [14, 29], + loc: { + start: { column: 2, line: 2 }, + end: { column: 17, line: 2 }, + }, + }, + ], + + range: [10, 31], + loc: { + start: { column: 10, line: 1 }, + end: { column: 1, line: 3 }, + }, + }, + id: Identifier { + type: "Identifier", + name: "Foo", + + range: [6, 9], + loc: { + start: { column: 6, line: 1 }, + end: { column: 9, line: 1 }, + }, + }, + superClass: null, + + range: [0, 31], + loc: { + start: { column: 0, line: 1 }, + end: { column: 1, line: 3 }, + }, + }, + ], + sourceType: "script", + + range: [0, 32], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 4 }, + }, +} +`; diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/key-computed-complex/snapshots/2-TSESTree-Tokens.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/key-computed-complex/snapshots/2-TSESTree-Tokens.shot new file mode 100644 index 00000000000..97c056640e7 --- /dev/null +++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/key-computed-complex/snapshots/2-TSESTree-Tokens.shot @@ -0,0 +1,96 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures element AccessorProperty key-computed-complex TSESTree - Tokens 1`] = ` +Array [ + Keyword { + type: "Keyword", + value: "class", + + 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 }, + }, + }, + Identifier { + type: "Identifier", + value: "accessor", + + range: [14, 22], + loc: { + start: { column: 2, line: 2 }, + end: { column: 10, line: 2 }, + }, + }, + Numeric { + type: "Numeric", + value: "1", + + range: [23, 24], + loc: { + start: { column: 11, line: 2 }, + end: { column: 12, line: 2 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "=", + + range: [25, 26], + loc: { + start: { column: 13, line: 2 }, + end: { column: 14, line: 2 }, + }, + }, + Numeric { + type: "Numeric", + value: "2", + + range: [27, 28], + loc: { + start: { column: 15, line: 2 }, + end: { column: 16, line: 2 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ";", + + range: [28, 29], + loc: { + start: { column: 16, line: 2 }, + end: { column: 17, line: 2 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "}", + + range: [30, 31], + loc: { + start: { column: 0, line: 3 }, + end: { column: 1, line: 3 }, + }, + }, +] +`; diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/key-computed-complex/snapshots/3-Babel-AST.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/key-computed-complex/snapshots/3-Babel-AST.shot new file mode 100644 index 00000000000..e52653f4094 --- /dev/null +++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/key-computed-complex/snapshots/3-Babel-AST.shot @@ -0,0 +1,80 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures element AccessorProperty key-computed-complex Babel - AST 1`] = ` +Program { + type: "Program", + body: Array [ + ClassDeclaration { + type: "ClassDeclaration", + body: ClassBody { + type: "ClassBody", + body: Array [ + ClassAccessorProperty { + type: "ClassAccessorProperty", + computed: false, + key: Literal { + type: "Literal", + raw: "1", + value: 1, + + range: [23, 24], + loc: { + start: { column: 11, line: 2 }, + end: { column: 12, line: 2 }, + }, + }, + static: false, + value: Literal { + type: "Literal", + raw: "2", + value: 2, + + range: [27, 28], + loc: { + start: { column: 15, line: 2 }, + end: { column: 16, line: 2 }, + }, + }, + + range: [14, 29], + loc: { + start: { column: 2, line: 2 }, + end: { column: 17, line: 2 }, + }, + }, + ], + + range: [10, 31], + loc: { + start: { column: 10, line: 1 }, + end: { column: 1, line: 3 }, + }, + }, + id: Identifier { + type: "Identifier", + name: "Foo", + + range: [6, 9], + loc: { + start: { column: 6, line: 1 }, + end: { column: 9, line: 1 }, + }, + }, + superClass: null, + + range: [0, 31], + loc: { + start: { column: 0, line: 1 }, + end: { column: 1, line: 3 }, + }, + }, + ], + sourceType: "script", + + range: [0, 32], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 4 }, + }, +} +`; diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/key-computed-complex/snapshots/4-Babel-Tokens.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/key-computed-complex/snapshots/4-Babel-Tokens.shot new file mode 100644 index 00000000000..651eb331471 --- /dev/null +++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/key-computed-complex/snapshots/4-Babel-Tokens.shot @@ -0,0 +1,96 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures element AccessorProperty key-computed-complex Babel - Tokens 1`] = ` +Array [ + Keyword { + type: "Keyword", + value: "class", + + 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 }, + }, + }, + Identifier { + type: "Identifier", + value: "accessor", + + range: [14, 22], + loc: { + start: { column: 2, line: 2 }, + end: { column: 10, line: 2 }, + }, + }, + Numeric { + type: "Numeric", + value: "1", + + range: [23, 24], + loc: { + start: { column: 11, line: 2 }, + end: { column: 12, line: 2 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "=", + + range: [25, 26], + loc: { + start: { column: 13, line: 2 }, + end: { column: 14, line: 2 }, + }, + }, + Numeric { + type: "Numeric", + value: "2", + + range: [27, 28], + loc: { + start: { column: 15, line: 2 }, + end: { column: 16, line: 2 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ";", + + range: [28, 29], + loc: { + start: { column: 16, line: 2 }, + end: { column: 17, line: 2 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "}", + + range: [30, 31], + loc: { + start: { column: 0, line: 3 }, + end: { column: 1, line: 3 }, + }, + }, +] +`; diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/key-computed-complex/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/key-computed-complex/snapshots/5-AST-Alignment-AST.shot new file mode 100644 index 00000000000..b6b30dd18c6 --- /dev/null +++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/key-computed-complex/snapshots/5-AST-Alignment-AST.shot @@ -0,0 +1,88 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures element AccessorProperty key-computed-complex AST Alignment - AST 1`] = ` +"Snapshot Diff: +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + ClassDeclaration { + type: 'ClassDeclaration', + body: ClassBody { + type: 'ClassBody', + body: Array [ +- AccessorProperty { +- type: 'AccessorProperty', ++ ClassAccessorProperty { ++ type: 'ClassAccessorProperty', + computed: false, +- declare: false, + key: Literal { + type: 'Literal', + raw: '1', + value: 1, + + range: [23, 24], + loc: { + start: { column: 11, line: 2 }, + end: { column: 12, line: 2 }, + }, + }, +- override: false, + static: false, + value: Literal { + type: 'Literal', + raw: '2', + value: 2, + + range: [27, 28], + loc: { + start: { column: 15, line: 2 }, + end: { column: 16, line: 2 }, + }, + }, + + range: [14, 29], + loc: { + start: { column: 2, line: 2 }, + end: { column: 17, line: 2 }, + }, + }, + ], + + range: [10, 31], + loc: { + start: { column: 10, line: 1 }, + end: { column: 1, line: 3 }, + }, + }, + id: Identifier { + type: 'Identifier', + name: 'Foo', + + range: [6, 9], + loc: { + start: { column: 6, line: 1 }, + end: { column: 9, line: 1 }, + }, + }, + superClass: null, + + range: [0, 31], + loc: { + start: { column: 0, line: 1 }, + end: { column: 1, line: 3 }, + }, + }, + ], + sourceType: 'script', + + range: [0, 32], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 4 }, + }, + }" +`; diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/key-computed-complex/snapshots/6-AST-Alignment-Tokens.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/key-computed-complex/snapshots/6-AST-Alignment-Tokens.shot new file mode 100644 index 00000000000..8375156efe1 --- /dev/null +++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/key-computed-complex/snapshots/6-AST-Alignment-Tokens.shot @@ -0,0 +1,6 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures element AccessorProperty key-computed-complex AST Alignment - Token 1`] = ` +"Snapshot Diff: +Compared values have no visual difference." +`; diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/key-computed-number/fixture.ts b/packages/ast-spec/src/element/AccessorProperty/fixtures/key-computed-number/fixture.ts new file mode 100644 index 00000000000..e6eb4123594 --- /dev/null +++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/key-computed-number/fixture.ts @@ -0,0 +1,3 @@ +class Foo { + accessor [1] = 2; +} diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/key-computed-number/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/key-computed-number/snapshots/1-TSESTree-AST.shot new file mode 100644 index 00000000000..abb1554d8a2 --- /dev/null +++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/key-computed-number/snapshots/1-TSESTree-AST.shot @@ -0,0 +1,82 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures element AccessorProperty key-computed-number TSESTree - AST 1`] = ` +Program { + type: "Program", + body: Array [ + ClassDeclaration { + type: "ClassDeclaration", + body: ClassBody { + type: "ClassBody", + body: Array [ + AccessorProperty { + type: "AccessorProperty", + computed: true, + declare: false, + key: Literal { + type: "Literal", + raw: "1", + value: 1, + + range: [24, 25], + loc: { + start: { column: 12, line: 2 }, + end: { column: 13, line: 2 }, + }, + }, + override: false, + static: false, + value: Literal { + type: "Literal", + raw: "2", + value: 2, + + range: [29, 30], + loc: { + start: { column: 17, line: 2 }, + end: { column: 18, line: 2 }, + }, + }, + + range: [14, 31], + loc: { + start: { column: 2, line: 2 }, + end: { column: 19, line: 2 }, + }, + }, + ], + + range: [10, 33], + loc: { + start: { column: 10, line: 1 }, + end: { column: 1, line: 3 }, + }, + }, + id: Identifier { + type: "Identifier", + name: "Foo", + + range: [6, 9], + loc: { + start: { column: 6, line: 1 }, + end: { column: 9, line: 1 }, + }, + }, + superClass: null, + + range: [0, 33], + loc: { + start: { column: 0, line: 1 }, + end: { column: 1, line: 3 }, + }, + }, + ], + sourceType: "script", + + range: [0, 34], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 4 }, + }, +} +`; diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/key-computed-number/snapshots/2-TSESTree-Tokens.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/key-computed-number/snapshots/2-TSESTree-Tokens.shot new file mode 100644 index 00000000000..d12fe10489e --- /dev/null +++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/key-computed-number/snapshots/2-TSESTree-Tokens.shot @@ -0,0 +1,116 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures element AccessorProperty key-computed-number TSESTree - Tokens 1`] = ` +Array [ + Keyword { + type: "Keyword", + value: "class", + + 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 }, + }, + }, + Identifier { + type: "Identifier", + value: "accessor", + + range: [14, 22], + loc: { + start: { column: 2, line: 2 }, + end: { column: 10, line: 2 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "[", + + range: [23, 24], + loc: { + start: { column: 11, line: 2 }, + end: { column: 12, line: 2 }, + }, + }, + Numeric { + type: "Numeric", + value: "1", + + range: [24, 25], + loc: { + start: { column: 12, line: 2 }, + end: { column: 13, line: 2 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "]", + + range: [25, 26], + loc: { + start: { column: 13, line: 2 }, + end: { column: 14, line: 2 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "=", + + range: [27, 28], + loc: { + start: { column: 15, line: 2 }, + end: { column: 16, line: 2 }, + }, + }, + Numeric { + type: "Numeric", + value: "2", + + range: [29, 30], + loc: { + start: { column: 17, line: 2 }, + end: { column: 18, line: 2 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ";", + + range: [30, 31], + loc: { + start: { column: 18, line: 2 }, + end: { column: 19, line: 2 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "}", + + range: [32, 33], + loc: { + start: { column: 0, line: 3 }, + end: { column: 1, line: 3 }, + }, + }, +] +`; diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/key-computed-number/snapshots/3-Babel-AST.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/key-computed-number/snapshots/3-Babel-AST.shot new file mode 100644 index 00000000000..69de24d530d --- /dev/null +++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/key-computed-number/snapshots/3-Babel-AST.shot @@ -0,0 +1,80 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures element AccessorProperty key-computed-number Babel - AST 1`] = ` +Program { + type: "Program", + body: Array [ + ClassDeclaration { + type: "ClassDeclaration", + body: ClassBody { + type: "ClassBody", + body: Array [ + ClassAccessorProperty { + type: "ClassAccessorProperty", + computed: true, + key: Literal { + type: "Literal", + raw: "1", + value: 1, + + range: [24, 25], + loc: { + start: { column: 12, line: 2 }, + end: { column: 13, line: 2 }, + }, + }, + static: false, + value: Literal { + type: "Literal", + raw: "2", + value: 2, + + range: [29, 30], + loc: { + start: { column: 17, line: 2 }, + end: { column: 18, line: 2 }, + }, + }, + + range: [14, 31], + loc: { + start: { column: 2, line: 2 }, + end: { column: 19, line: 2 }, + }, + }, + ], + + range: [10, 33], + loc: { + start: { column: 10, line: 1 }, + end: { column: 1, line: 3 }, + }, + }, + id: Identifier { + type: "Identifier", + name: "Foo", + + range: [6, 9], + loc: { + start: { column: 6, line: 1 }, + end: { column: 9, line: 1 }, + }, + }, + superClass: null, + + range: [0, 33], + loc: { + start: { column: 0, line: 1 }, + end: { column: 1, line: 3 }, + }, + }, + ], + sourceType: "script", + + range: [0, 34], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 4 }, + }, +} +`; diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/key-computed-number/snapshots/4-Babel-Tokens.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/key-computed-number/snapshots/4-Babel-Tokens.shot new file mode 100644 index 00000000000..e2dd78f3f2f --- /dev/null +++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/key-computed-number/snapshots/4-Babel-Tokens.shot @@ -0,0 +1,116 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures element AccessorProperty key-computed-number Babel - Tokens 1`] = ` +Array [ + Keyword { + type: "Keyword", + value: "class", + + 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 }, + }, + }, + Identifier { + type: "Identifier", + value: "accessor", + + range: [14, 22], + loc: { + start: { column: 2, line: 2 }, + end: { column: 10, line: 2 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "[", + + range: [23, 24], + loc: { + start: { column: 11, line: 2 }, + end: { column: 12, line: 2 }, + }, + }, + Numeric { + type: "Numeric", + value: "1", + + range: [24, 25], + loc: { + start: { column: 12, line: 2 }, + end: { column: 13, line: 2 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "]", + + range: [25, 26], + loc: { + start: { column: 13, line: 2 }, + end: { column: 14, line: 2 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "=", + + range: [27, 28], + loc: { + start: { column: 15, line: 2 }, + end: { column: 16, line: 2 }, + }, + }, + Numeric { + type: "Numeric", + value: "2", + + range: [29, 30], + loc: { + start: { column: 17, line: 2 }, + end: { column: 18, line: 2 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ";", + + range: [30, 31], + loc: { + start: { column: 18, line: 2 }, + end: { column: 19, line: 2 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "}", + + range: [32, 33], + loc: { + start: { column: 0, line: 3 }, + end: { column: 1, line: 3 }, + }, + }, +] +`; diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/key-computed-number/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/key-computed-number/snapshots/5-AST-Alignment-AST.shot new file mode 100644 index 00000000000..bd3b115af80 --- /dev/null +++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/key-computed-number/snapshots/5-AST-Alignment-AST.shot @@ -0,0 +1,88 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures element AccessorProperty key-computed-number AST Alignment - AST 1`] = ` +"Snapshot Diff: +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + ClassDeclaration { + type: 'ClassDeclaration', + body: ClassBody { + type: 'ClassBody', + body: Array [ +- AccessorProperty { +- type: 'AccessorProperty', ++ ClassAccessorProperty { ++ type: 'ClassAccessorProperty', + computed: true, +- declare: false, + key: Literal { + type: 'Literal', + raw: '1', + value: 1, + + range: [24, 25], + loc: { + start: { column: 12, line: 2 }, + end: { column: 13, line: 2 }, + }, + }, +- override: false, + static: false, + value: Literal { + type: 'Literal', + raw: '2', + value: 2, + + range: [29, 30], + loc: { + start: { column: 17, line: 2 }, + end: { column: 18, line: 2 }, + }, + }, + + range: [14, 31], + loc: { + start: { column: 2, line: 2 }, + end: { column: 19, line: 2 }, + }, + }, + ], + + range: [10, 33], + loc: { + start: { column: 10, line: 1 }, + end: { column: 1, line: 3 }, + }, + }, + id: Identifier { + type: 'Identifier', + name: 'Foo', + + range: [6, 9], + loc: { + start: { column: 6, line: 1 }, + end: { column: 9, line: 1 }, + }, + }, + superClass: null, + + range: [0, 33], + loc: { + start: { column: 0, line: 1 }, + end: { column: 1, line: 3 }, + }, + }, + ], + sourceType: 'script', + + range: [0, 34], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 4 }, + }, + }" +`; diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/key-computed-number/snapshots/6-AST-Alignment-Tokens.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/key-computed-number/snapshots/6-AST-Alignment-Tokens.shot new file mode 100644 index 00000000000..2243b91ca2e --- /dev/null +++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/key-computed-number/snapshots/6-AST-Alignment-Tokens.shot @@ -0,0 +1,6 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures element AccessorProperty key-computed-number AST Alignment - Token 1`] = ` +"Snapshot Diff: +Compared values have no visual difference." +`; diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/key-computed-string/fixture.ts b/packages/ast-spec/src/element/AccessorProperty/fixtures/key-computed-string/fixture.ts new file mode 100644 index 00000000000..feb7a8c14ce --- /dev/null +++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/key-computed-string/fixture.ts @@ -0,0 +1,3 @@ +class Foo { + accessor ['prop'] = 'value'; +} diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/key-computed-string/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/key-computed-string/snapshots/1-TSESTree-AST.shot new file mode 100644 index 00000000000..24de40f9aae --- /dev/null +++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/key-computed-string/snapshots/1-TSESTree-AST.shot @@ -0,0 +1,82 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures element AccessorProperty key-computed-string TSESTree - AST 1`] = ` +Program { + type: "Program", + body: Array [ + ClassDeclaration { + type: "ClassDeclaration", + body: ClassBody { + type: "ClassBody", + body: Array [ + AccessorProperty { + type: "AccessorProperty", + computed: true, + declare: false, + key: Literal { + type: "Literal", + raw: "'prop'", + value: "prop", + + range: [24, 30], + loc: { + start: { column: 12, line: 2 }, + end: { column: 18, line: 2 }, + }, + }, + override: false, + static: false, + value: Literal { + type: "Literal", + raw: "'value'", + value: "value", + + range: [34, 41], + loc: { + start: { column: 22, line: 2 }, + end: { column: 29, line: 2 }, + }, + }, + + range: [14, 42], + loc: { + start: { column: 2, line: 2 }, + end: { column: 30, line: 2 }, + }, + }, + ], + + range: [10, 44], + loc: { + start: { column: 10, line: 1 }, + end: { column: 1, line: 3 }, + }, + }, + id: Identifier { + type: "Identifier", + name: "Foo", + + range: [6, 9], + loc: { + start: { column: 6, line: 1 }, + end: { column: 9, line: 1 }, + }, + }, + superClass: null, + + range: [0, 44], + loc: { + start: { column: 0, line: 1 }, + end: { column: 1, line: 3 }, + }, + }, + ], + sourceType: "script", + + range: [0, 45], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 4 }, + }, +} +`; diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/key-computed-string/snapshots/2-TSESTree-Tokens.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/key-computed-string/snapshots/2-TSESTree-Tokens.shot new file mode 100644 index 00000000000..9b1fd979379 --- /dev/null +++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/key-computed-string/snapshots/2-TSESTree-Tokens.shot @@ -0,0 +1,116 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures element AccessorProperty key-computed-string TSESTree - Tokens 1`] = ` +Array [ + Keyword { + type: "Keyword", + value: "class", + + 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 }, + }, + }, + Identifier { + type: "Identifier", + value: "accessor", + + range: [14, 22], + loc: { + start: { column: 2, line: 2 }, + end: { column: 10, line: 2 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "[", + + range: [23, 24], + loc: { + start: { column: 11, line: 2 }, + end: { column: 12, line: 2 }, + }, + }, + String { + type: "String", + value: "'prop'", + + range: [24, 30], + loc: { + start: { column: 12, line: 2 }, + end: { column: 18, line: 2 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "]", + + range: [30, 31], + loc: { + start: { column: 18, line: 2 }, + end: { column: 19, line: 2 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "=", + + range: [32, 33], + loc: { + start: { column: 20, line: 2 }, + end: { column: 21, line: 2 }, + }, + }, + String { + type: "String", + value: "'value'", + + range: [34, 41], + loc: { + start: { column: 22, line: 2 }, + end: { column: 29, line: 2 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ";", + + range: [41, 42], + loc: { + start: { column: 29, line: 2 }, + end: { column: 30, line: 2 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "}", + + range: [43, 44], + loc: { + start: { column: 0, line: 3 }, + end: { column: 1, line: 3 }, + }, + }, +] +`; diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/key-computed-string/snapshots/3-Babel-AST.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/key-computed-string/snapshots/3-Babel-AST.shot new file mode 100644 index 00000000000..d8b18a55910 --- /dev/null +++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/key-computed-string/snapshots/3-Babel-AST.shot @@ -0,0 +1,80 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures element AccessorProperty key-computed-string Babel - AST 1`] = ` +Program { + type: "Program", + body: Array [ + ClassDeclaration { + type: "ClassDeclaration", + body: ClassBody { + type: "ClassBody", + body: Array [ + ClassAccessorProperty { + type: "ClassAccessorProperty", + computed: true, + key: Literal { + type: "Literal", + raw: "'prop'", + value: "prop", + + range: [24, 30], + loc: { + start: { column: 12, line: 2 }, + end: { column: 18, line: 2 }, + }, + }, + static: false, + value: Literal { + type: "Literal", + raw: "'value'", + value: "value", + + range: [34, 41], + loc: { + start: { column: 22, line: 2 }, + end: { column: 29, line: 2 }, + }, + }, + + range: [14, 42], + loc: { + start: { column: 2, line: 2 }, + end: { column: 30, line: 2 }, + }, + }, + ], + + range: [10, 44], + loc: { + start: { column: 10, line: 1 }, + end: { column: 1, line: 3 }, + }, + }, + id: Identifier { + type: "Identifier", + name: "Foo", + + range: [6, 9], + loc: { + start: { column: 6, line: 1 }, + end: { column: 9, line: 1 }, + }, + }, + superClass: null, + + range: [0, 44], + loc: { + start: { column: 0, line: 1 }, + end: { column: 1, line: 3 }, + }, + }, + ], + sourceType: "script", + + range: [0, 45], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 4 }, + }, +} +`; diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/key-computed-string/snapshots/4-Babel-Tokens.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/key-computed-string/snapshots/4-Babel-Tokens.shot new file mode 100644 index 00000000000..29da5db3884 --- /dev/null +++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/key-computed-string/snapshots/4-Babel-Tokens.shot @@ -0,0 +1,116 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures element AccessorProperty key-computed-string Babel - Tokens 1`] = ` +Array [ + Keyword { + type: "Keyword", + value: "class", + + 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 }, + }, + }, + Identifier { + type: "Identifier", + value: "accessor", + + range: [14, 22], + loc: { + start: { column: 2, line: 2 }, + end: { column: 10, line: 2 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "[", + + range: [23, 24], + loc: { + start: { column: 11, line: 2 }, + end: { column: 12, line: 2 }, + }, + }, + String { + type: "String", + value: "'prop'", + + range: [24, 30], + loc: { + start: { column: 12, line: 2 }, + end: { column: 18, line: 2 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "]", + + range: [30, 31], + loc: { + start: { column: 18, line: 2 }, + end: { column: 19, line: 2 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "=", + + range: [32, 33], + loc: { + start: { column: 20, line: 2 }, + end: { column: 21, line: 2 }, + }, + }, + String { + type: "String", + value: "'value'", + + range: [34, 41], + loc: { + start: { column: 22, line: 2 }, + end: { column: 29, line: 2 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ";", + + range: [41, 42], + loc: { + start: { column: 29, line: 2 }, + end: { column: 30, line: 2 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "}", + + range: [43, 44], + loc: { + start: { column: 0, line: 3 }, + end: { column: 1, line: 3 }, + }, + }, +] +`; diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/key-computed-string/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/key-computed-string/snapshots/5-AST-Alignment-AST.shot new file mode 100644 index 00000000000..3ca8eaf26ea --- /dev/null +++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/key-computed-string/snapshots/5-AST-Alignment-AST.shot @@ -0,0 +1,88 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures element AccessorProperty key-computed-string AST Alignment - AST 1`] = ` +"Snapshot Diff: +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + ClassDeclaration { + type: 'ClassDeclaration', + body: ClassBody { + type: 'ClassBody', + body: Array [ +- AccessorProperty { +- type: 'AccessorProperty', ++ ClassAccessorProperty { ++ type: 'ClassAccessorProperty', + computed: true, +- declare: false, + key: Literal { + type: 'Literal', + raw: '\\\\'prop\\\\'', + value: 'prop', + + range: [24, 30], + loc: { + start: { column: 12, line: 2 }, + end: { column: 18, line: 2 }, + }, + }, +- override: false, + static: false, + value: Literal { + type: 'Literal', + raw: '\\\\'value\\\\'', + value: 'value', + + range: [34, 41], + loc: { + start: { column: 22, line: 2 }, + end: { column: 29, line: 2 }, + }, + }, + + range: [14, 42], + loc: { + start: { column: 2, line: 2 }, + end: { column: 30, line: 2 }, + }, + }, + ], + + range: [10, 44], + loc: { + start: { column: 10, line: 1 }, + end: { column: 1, line: 3 }, + }, + }, + id: Identifier { + type: 'Identifier', + name: 'Foo', + + range: [6, 9], + loc: { + start: { column: 6, line: 1 }, + end: { column: 9, line: 1 }, + }, + }, + superClass: null, + + range: [0, 44], + loc: { + start: { column: 0, line: 1 }, + end: { column: 1, line: 3 }, + }, + }, + ], + sourceType: 'script', + + range: [0, 45], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 4 }, + }, + }" +`; diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/key-computed-string/snapshots/6-AST-Alignment-Tokens.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/key-computed-string/snapshots/6-AST-Alignment-Tokens.shot new file mode 100644 index 00000000000..628cbb97adb --- /dev/null +++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/key-computed-string/snapshots/6-AST-Alignment-Tokens.shot @@ -0,0 +1,6 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures element AccessorProperty key-computed-string AST Alignment - Token 1`] = ` +"Snapshot Diff: +Compared values have no visual difference." +`; diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/key-number/fixture.ts b/packages/ast-spec/src/element/AccessorProperty/fixtures/key-number/fixture.ts new file mode 100644 index 00000000000..e69de29bb2d diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/key-number/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/key-number/snapshots/1-TSESTree-AST.shot new file mode 100644 index 00000000000..40d09186f6d --- /dev/null +++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/key-number/snapshots/1-TSESTree-AST.shot @@ -0,0 +1,15 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures element AccessorProperty key-number TSESTree - AST 1`] = ` +Program { + type: "Program", + body: Array [], + sourceType: "script", + + range: [0, 0], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 1 }, + }, +} +`; diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/key-number/snapshots/2-TSESTree-Tokens.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/key-number/snapshots/2-TSESTree-Tokens.shot new file mode 100644 index 00000000000..ea5732d8dee --- /dev/null +++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/key-number/snapshots/2-TSESTree-Tokens.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures element AccessorProperty key-number TSESTree - Tokens 1`] = `Array []`; diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/key-number/snapshots/3-Babel-AST.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/key-number/snapshots/3-Babel-AST.shot new file mode 100644 index 00000000000..c3c65ccd7f8 --- /dev/null +++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/key-number/snapshots/3-Babel-AST.shot @@ -0,0 +1,15 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures element AccessorProperty key-number Babel - AST 1`] = ` +Program { + type: "Program", + body: Array [], + sourceType: "script", + + range: [0, 0], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 1 }, + }, +} +`; diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/key-number/snapshots/4-Babel-Tokens.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/key-number/snapshots/4-Babel-Tokens.shot new file mode 100644 index 00000000000..75ca02a990c --- /dev/null +++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/key-number/snapshots/4-Babel-Tokens.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures element AccessorProperty key-number Babel - Tokens 1`] = `Array []`; diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/key-number/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/key-number/snapshots/5-AST-Alignment-AST.shot new file mode 100644 index 00000000000..55fd7a3d475 --- /dev/null +++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/key-number/snapshots/5-AST-Alignment-AST.shot @@ -0,0 +1,6 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures element AccessorProperty key-number AST Alignment - AST 1`] = ` +"Snapshot Diff: +Compared values have no visual difference." +`; diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/key-number/snapshots/6-AST-Alignment-Tokens.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/key-number/snapshots/6-AST-Alignment-Tokens.shot new file mode 100644 index 00000000000..0ee5b89aab4 --- /dev/null +++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/key-number/snapshots/6-AST-Alignment-Tokens.shot @@ -0,0 +1,6 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures element AccessorProperty key-number AST Alignment - Token 1`] = ` +"Snapshot Diff: +Compared values have no visual difference." +`; diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/key-private/fixture.ts b/packages/ast-spec/src/element/AccessorProperty/fixtures/key-private/fixture.ts new file mode 100644 index 00000000000..255b0794a5e --- /dev/null +++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/key-private/fixture.ts @@ -0,0 +1,3 @@ +class Foo { + accessor #foo = 2; +} diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/key-private/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/key-private/snapshots/1-TSESTree-AST.shot new file mode 100644 index 00000000000..e30dd5e502f --- /dev/null +++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/key-private/snapshots/1-TSESTree-AST.shot @@ -0,0 +1,81 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures element AccessorProperty key-private TSESTree - AST 1`] = ` +Program { + type: "Program", + body: Array [ + ClassDeclaration { + type: "ClassDeclaration", + body: ClassBody { + type: "ClassBody", + body: Array [ + AccessorProperty { + type: "AccessorProperty", + computed: false, + declare: false, + key: PrivateIdentifier { + type: "PrivateIdentifier", + name: "foo", + + range: [23, 27], + loc: { + start: { column: 11, line: 2 }, + end: { column: 15, line: 2 }, + }, + }, + override: false, + static: false, + value: Literal { + type: "Literal", + raw: "2", + value: 2, + + range: [30, 31], + loc: { + start: { column: 18, line: 2 }, + end: { column: 19, line: 2 }, + }, + }, + + range: [14, 32], + loc: { + start: { column: 2, line: 2 }, + end: { column: 20, line: 2 }, + }, + }, + ], + + range: [10, 34], + loc: { + start: { column: 10, line: 1 }, + end: { column: 1, line: 3 }, + }, + }, + id: Identifier { + type: "Identifier", + name: "Foo", + + range: [6, 9], + loc: { + start: { column: 6, line: 1 }, + end: { column: 9, line: 1 }, + }, + }, + superClass: null, + + range: [0, 34], + loc: { + start: { column: 0, line: 1 }, + end: { column: 1, line: 3 }, + }, + }, + ], + sourceType: "script", + + range: [0, 35], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 4 }, + }, +} +`; diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/key-private/snapshots/2-TSESTree-Tokens.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/key-private/snapshots/2-TSESTree-Tokens.shot new file mode 100644 index 00000000000..1a3c3d84ed7 --- /dev/null +++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/key-private/snapshots/2-TSESTree-Tokens.shot @@ -0,0 +1,96 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures element AccessorProperty key-private TSESTree - Tokens 1`] = ` +Array [ + Keyword { + type: "Keyword", + value: "class", + + 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 }, + }, + }, + Identifier { + type: "Identifier", + value: "accessor", + + range: [14, 22], + loc: { + start: { column: 2, line: 2 }, + end: { column: 10, line: 2 }, + }, + }, + Identifier { + type: "Identifier", + value: "#foo", + + range: [23, 27], + loc: { + start: { column: 11, line: 2 }, + end: { column: 15, line: 2 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "=", + + range: [28, 29], + loc: { + start: { column: 16, line: 2 }, + end: { column: 17, line: 2 }, + }, + }, + Numeric { + type: "Numeric", + value: "2", + + range: [30, 31], + loc: { + start: { column: 18, line: 2 }, + end: { column: 19, line: 2 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ";", + + range: [31, 32], + loc: { + start: { column: 19, line: 2 }, + end: { column: 20, line: 2 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "}", + + range: [33, 34], + loc: { + start: { column: 0, line: 3 }, + end: { column: 1, line: 3 }, + }, + }, +] +`; diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/key-private/snapshots/3-Babel-AST.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/key-private/snapshots/3-Babel-AST.shot new file mode 100644 index 00000000000..e687dfd0d9a --- /dev/null +++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/key-private/snapshots/3-Babel-AST.shot @@ -0,0 +1,79 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures element AccessorProperty key-private Babel - AST 1`] = ` +Program { + type: "Program", + body: Array [ + ClassDeclaration { + type: "ClassDeclaration", + body: ClassBody { + type: "ClassBody", + body: Array [ + ClassAccessorProperty { + type: "ClassAccessorProperty", + computed: false, + key: PrivateIdentifier { + type: "PrivateIdentifier", + name: "foo", + + range: [23, 27], + loc: { + start: { column: 11, line: 2 }, + end: { column: 15, line: 2 }, + }, + }, + static: false, + value: Literal { + type: "Literal", + raw: "2", + value: 2, + + range: [30, 31], + loc: { + start: { column: 18, line: 2 }, + end: { column: 19, line: 2 }, + }, + }, + + range: [14, 32], + loc: { + start: { column: 2, line: 2 }, + end: { column: 20, line: 2 }, + }, + }, + ], + + range: [10, 34], + loc: { + start: { column: 10, line: 1 }, + end: { column: 1, line: 3 }, + }, + }, + id: Identifier { + type: "Identifier", + name: "Foo", + + range: [6, 9], + loc: { + start: { column: 6, line: 1 }, + end: { column: 9, line: 1 }, + }, + }, + superClass: null, + + range: [0, 34], + loc: { + start: { column: 0, line: 1 }, + end: { column: 1, line: 3 }, + }, + }, + ], + sourceType: "script", + + range: [0, 35], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 4 }, + }, +} +`; diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/key-private/snapshots/4-Babel-Tokens.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/key-private/snapshots/4-Babel-Tokens.shot new file mode 100644 index 00000000000..52963d76a15 --- /dev/null +++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/key-private/snapshots/4-Babel-Tokens.shot @@ -0,0 +1,96 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures element AccessorProperty key-private Babel - Tokens 1`] = ` +Array [ + Keyword { + type: "Keyword", + value: "class", + + 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 }, + }, + }, + Identifier { + type: "Identifier", + value: "accessor", + + range: [14, 22], + loc: { + start: { column: 2, line: 2 }, + end: { column: 10, line: 2 }, + }, + }, + PrivateIdentifier { + type: "PrivateIdentifier", + value: "foo", + + range: [23, 27], + loc: { + start: { column: 11, line: 2 }, + end: { column: 15, line: 2 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "=", + + range: [28, 29], + loc: { + start: { column: 16, line: 2 }, + end: { column: 17, line: 2 }, + }, + }, + Numeric { + type: "Numeric", + value: "2", + + range: [30, 31], + loc: { + start: { column: 18, line: 2 }, + end: { column: 19, line: 2 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ";", + + range: [31, 32], + loc: { + start: { column: 19, line: 2 }, + end: { column: 20, line: 2 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "}", + + range: [33, 34], + loc: { + start: { column: 0, line: 3 }, + end: { column: 1, line: 3 }, + }, + }, +] +`; diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/key-private/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/key-private/snapshots/5-AST-Alignment-AST.shot new file mode 100644 index 00000000000..100c519c06c --- /dev/null +++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/key-private/snapshots/5-AST-Alignment-AST.shot @@ -0,0 +1,87 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures element AccessorProperty key-private AST Alignment - AST 1`] = ` +"Snapshot Diff: +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + ClassDeclaration { + type: 'ClassDeclaration', + body: ClassBody { + type: 'ClassBody', + body: Array [ +- AccessorProperty { +- type: 'AccessorProperty', ++ ClassAccessorProperty { ++ type: 'ClassAccessorProperty', + computed: false, +- declare: false, + key: PrivateIdentifier { + type: 'PrivateIdentifier', + name: 'foo', + + range: [23, 27], + loc: { + start: { column: 11, line: 2 }, + end: { column: 15, line: 2 }, + }, + }, +- override: false, + static: false, + value: Literal { + type: 'Literal', + raw: '2', + value: 2, + + range: [30, 31], + loc: { + start: { column: 18, line: 2 }, + end: { column: 19, line: 2 }, + }, + }, + + range: [14, 32], + loc: { + start: { column: 2, line: 2 }, + end: { column: 20, line: 2 }, + }, + }, + ], + + range: [10, 34], + loc: { + start: { column: 10, line: 1 }, + end: { column: 1, line: 3 }, + }, + }, + id: Identifier { + type: 'Identifier', + name: 'Foo', + + range: [6, 9], + loc: { + start: { column: 6, line: 1 }, + end: { column: 9, line: 1 }, + }, + }, + superClass: null, + + range: [0, 34], + loc: { + start: { column: 0, line: 1 }, + end: { column: 1, line: 3 }, + }, + }, + ], + sourceType: 'script', + + range: [0, 35], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 4 }, + }, + }" +`; diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/key-private/snapshots/6-AST-Alignment-Tokens.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/key-private/snapshots/6-AST-Alignment-Tokens.shot new file mode 100644 index 00000000000..11bd633e049 --- /dev/null +++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/key-private/snapshots/6-AST-Alignment-Tokens.shot @@ -0,0 +1,103 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures element AccessorProperty key-private AST Alignment - Token 1`] = ` +"Snapshot Diff: +- TSESTree ++ Babel + + Array [ + Keyword { + type: 'Keyword', + value: 'class', + + 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 }, + }, + }, + Identifier { + type: 'Identifier', + value: 'accessor', + + range: [14, 22], + loc: { + start: { column: 2, line: 2 }, + end: { column: 10, line: 2 }, + }, + }, +- Identifier { +- type: 'Identifier', +- value: '#foo', ++ PrivateIdentifier { ++ type: 'PrivateIdentifier', ++ value: 'foo', + + range: [23, 27], + loc: { + start: { column: 11, line: 2 }, + end: { column: 15, line: 2 }, + }, + }, + Punctuator { + type: 'Punctuator', + value: '=', + + range: [28, 29], + loc: { + start: { column: 16, line: 2 }, + end: { column: 17, line: 2 }, + }, + }, + Numeric { + type: 'Numeric', + value: '2', + + range: [30, 31], + loc: { + start: { column: 18, line: 2 }, + end: { column: 19, line: 2 }, + }, + }, + Punctuator { + type: 'Punctuator', + value: ';', + + range: [31, 32], + loc: { + start: { column: 19, line: 2 }, + end: { column: 20, line: 2 }, + }, + }, + Punctuator { + type: 'Punctuator', + value: '}', + + range: [33, 34], + loc: { + start: { column: 0, line: 3 }, + end: { column: 1, line: 3 }, + }, + }, + ]" +`; diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/key-string/fixture.ts b/packages/ast-spec/src/element/AccessorProperty/fixtures/key-string/fixture.ts new file mode 100644 index 00000000000..808470d5b6a --- /dev/null +++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/key-string/fixture.ts @@ -0,0 +1,3 @@ +class Foo { + accessor 'prop' = 'value'; +} diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/key-string/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/key-string/snapshots/1-TSESTree-AST.shot new file mode 100644 index 00000000000..06a3b3705ed --- /dev/null +++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/key-string/snapshots/1-TSESTree-AST.shot @@ -0,0 +1,82 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures element AccessorProperty key-string TSESTree - AST 1`] = ` +Program { + type: "Program", + body: Array [ + ClassDeclaration { + type: "ClassDeclaration", + body: ClassBody { + type: "ClassBody", + body: Array [ + AccessorProperty { + type: "AccessorProperty", + computed: false, + declare: false, + key: Literal { + type: "Literal", + raw: "'prop'", + value: "prop", + + range: [23, 29], + loc: { + start: { column: 11, line: 2 }, + end: { column: 17, line: 2 }, + }, + }, + override: false, + static: false, + value: Literal { + type: "Literal", + raw: "'value'", + value: "value", + + range: [32, 39], + loc: { + start: { column: 20, line: 2 }, + end: { column: 27, line: 2 }, + }, + }, + + range: [14, 40], + loc: { + start: { column: 2, line: 2 }, + end: { column: 28, line: 2 }, + }, + }, + ], + + range: [10, 42], + loc: { + start: { column: 10, line: 1 }, + end: { column: 1, line: 3 }, + }, + }, + id: Identifier { + type: "Identifier", + name: "Foo", + + range: [6, 9], + loc: { + start: { column: 6, line: 1 }, + end: { column: 9, line: 1 }, + }, + }, + superClass: null, + + range: [0, 42], + loc: { + start: { column: 0, line: 1 }, + end: { column: 1, line: 3 }, + }, + }, + ], + sourceType: "script", + + range: [0, 43], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 4 }, + }, +} +`; diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/key-string/snapshots/2-TSESTree-Tokens.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/key-string/snapshots/2-TSESTree-Tokens.shot new file mode 100644 index 00000000000..0fe6262dd93 --- /dev/null +++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/key-string/snapshots/2-TSESTree-Tokens.shot @@ -0,0 +1,96 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures element AccessorProperty key-string TSESTree - Tokens 1`] = ` +Array [ + Keyword { + type: "Keyword", + value: "class", + + 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 }, + }, + }, + Identifier { + type: "Identifier", + value: "accessor", + + range: [14, 22], + loc: { + start: { column: 2, line: 2 }, + end: { column: 10, line: 2 }, + }, + }, + String { + type: "String", + value: "'prop'", + + range: [23, 29], + loc: { + start: { column: 11, line: 2 }, + end: { column: 17, line: 2 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "=", + + range: [30, 31], + loc: { + start: { column: 18, line: 2 }, + end: { column: 19, line: 2 }, + }, + }, + String { + type: "String", + value: "'value'", + + range: [32, 39], + loc: { + start: { column: 20, line: 2 }, + end: { column: 27, line: 2 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ";", + + range: [39, 40], + loc: { + start: { column: 27, line: 2 }, + end: { column: 28, line: 2 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "}", + + range: [41, 42], + loc: { + start: { column: 0, line: 3 }, + end: { column: 1, line: 3 }, + }, + }, +] +`; diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/key-string/snapshots/3-Babel-AST.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/key-string/snapshots/3-Babel-AST.shot new file mode 100644 index 00000000000..9af9236878c --- /dev/null +++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/key-string/snapshots/3-Babel-AST.shot @@ -0,0 +1,80 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures element AccessorProperty key-string Babel - AST 1`] = ` +Program { + type: "Program", + body: Array [ + ClassDeclaration { + type: "ClassDeclaration", + body: ClassBody { + type: "ClassBody", + body: Array [ + ClassAccessorProperty { + type: "ClassAccessorProperty", + computed: false, + key: Literal { + type: "Literal", + raw: "'prop'", + value: "prop", + + range: [23, 29], + loc: { + start: { column: 11, line: 2 }, + end: { column: 17, line: 2 }, + }, + }, + static: false, + value: Literal { + type: "Literal", + raw: "'value'", + value: "value", + + range: [32, 39], + loc: { + start: { column: 20, line: 2 }, + end: { column: 27, line: 2 }, + }, + }, + + range: [14, 40], + loc: { + start: { column: 2, line: 2 }, + end: { column: 28, line: 2 }, + }, + }, + ], + + range: [10, 42], + loc: { + start: { column: 10, line: 1 }, + end: { column: 1, line: 3 }, + }, + }, + id: Identifier { + type: "Identifier", + name: "Foo", + + range: [6, 9], + loc: { + start: { column: 6, line: 1 }, + end: { column: 9, line: 1 }, + }, + }, + superClass: null, + + range: [0, 42], + loc: { + start: { column: 0, line: 1 }, + end: { column: 1, line: 3 }, + }, + }, + ], + sourceType: "script", + + range: [0, 43], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 4 }, + }, +} +`; diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/key-string/snapshots/4-Babel-Tokens.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/key-string/snapshots/4-Babel-Tokens.shot new file mode 100644 index 00000000000..110b7cb9949 --- /dev/null +++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/key-string/snapshots/4-Babel-Tokens.shot @@ -0,0 +1,96 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures element AccessorProperty key-string Babel - Tokens 1`] = ` +Array [ + Keyword { + type: "Keyword", + value: "class", + + 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 }, + }, + }, + Identifier { + type: "Identifier", + value: "accessor", + + range: [14, 22], + loc: { + start: { column: 2, line: 2 }, + end: { column: 10, line: 2 }, + }, + }, + String { + type: "String", + value: "'prop'", + + range: [23, 29], + loc: { + start: { column: 11, line: 2 }, + end: { column: 17, line: 2 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "=", + + range: [30, 31], + loc: { + start: { column: 18, line: 2 }, + end: { column: 19, line: 2 }, + }, + }, + String { + type: "String", + value: "'value'", + + range: [32, 39], + loc: { + start: { column: 20, line: 2 }, + end: { column: 27, line: 2 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ";", + + range: [39, 40], + loc: { + start: { column: 27, line: 2 }, + end: { column: 28, line: 2 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "}", + + range: [41, 42], + loc: { + start: { column: 0, line: 3 }, + end: { column: 1, line: 3 }, + }, + }, +] +`; diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/key-string/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/key-string/snapshots/5-AST-Alignment-AST.shot new file mode 100644 index 00000000000..f831283bcb4 --- /dev/null +++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/key-string/snapshots/5-AST-Alignment-AST.shot @@ -0,0 +1,88 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures element AccessorProperty key-string AST Alignment - AST 1`] = ` +"Snapshot Diff: +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + ClassDeclaration { + type: 'ClassDeclaration', + body: ClassBody { + type: 'ClassBody', + body: Array [ +- AccessorProperty { +- type: 'AccessorProperty', ++ ClassAccessorProperty { ++ type: 'ClassAccessorProperty', + computed: false, +- declare: false, + key: Literal { + type: 'Literal', + raw: '\\\\'prop\\\\'', + value: 'prop', + + range: [23, 29], + loc: { + start: { column: 11, line: 2 }, + end: { column: 17, line: 2 }, + }, + }, +- override: false, + static: false, + value: Literal { + type: 'Literal', + raw: '\\\\'value\\\\'', + value: 'value', + + range: [32, 39], + loc: { + start: { column: 20, line: 2 }, + end: { column: 27, line: 2 }, + }, + }, + + range: [14, 40], + loc: { + start: { column: 2, line: 2 }, + end: { column: 28, line: 2 }, + }, + }, + ], + + range: [10, 42], + loc: { + start: { column: 10, line: 1 }, + end: { column: 1, line: 3 }, + }, + }, + id: Identifier { + type: 'Identifier', + name: 'Foo', + + range: [6, 9], + loc: { + start: { column: 6, line: 1 }, + end: { column: 9, line: 1 }, + }, + }, + superClass: null, + + range: [0, 42], + loc: { + start: { column: 0, line: 1 }, + end: { column: 1, line: 3 }, + }, + }, + ], + sourceType: 'script', + + range: [0, 43], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 4 }, + }, + }" +`; diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/key-string/snapshots/6-AST-Alignment-Tokens.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/key-string/snapshots/6-AST-Alignment-Tokens.shot new file mode 100644 index 00000000000..af1e8eed8c6 --- /dev/null +++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/key-string/snapshots/6-AST-Alignment-Tokens.shot @@ -0,0 +1,6 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures element AccessorProperty key-string AST Alignment - Token 1`] = ` +"Snapshot Diff: +Compared values have no visual difference." +`; diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-abstract-with-value/fixture.ts b/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-abstract-with-value/fixture.ts new file mode 100644 index 00000000000..26b6ab5a4e0 --- /dev/null +++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-abstract-with-value/fixture.ts @@ -0,0 +1,3 @@ +abstract class Foo { + abstract accessor foo: number = 1; +} diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-abstract-with-value/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-abstract-with-value/snapshots/1-TSESTree-AST.shot new file mode 100644 index 00000000000..1c8247fb96d --- /dev/null +++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-abstract-with-value/snapshots/1-TSESTree-AST.shot @@ -0,0 +1,90 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures element AccessorProperty modifier-abstract-with-value TSESTree - AST 1`] = ` +Program { + type: "Program", + body: Array [ + ClassDeclaration { + type: "ClassDeclaration", + abstract: true, + body: ClassBody { + type: "ClassBody", + body: Array [ + TSAbstractAccessorProperty { + type: "TSAbstractAccessorProperty", + computed: false, + declare: false, + key: Identifier { + type: "Identifier", + name: "foo", + + range: [41, 44], + loc: { + start: { column: 20, line: 2 }, + end: { column: 23, line: 2 }, + }, + }, + override: false, + static: false, + typeAnnotation: TSTypeAnnotation { + type: "TSTypeAnnotation", + typeAnnotation: TSNumberKeyword { + type: "TSNumberKeyword", + + range: [46, 52], + loc: { + start: { column: 25, line: 2 }, + end: { column: 31, line: 2 }, + }, + }, + + range: [44, 52], + loc: { + start: { column: 23, line: 2 }, + end: { column: 31, line: 2 }, + }, + }, + value: null, + + range: [23, 57], + loc: { + start: { column: 2, line: 2 }, + end: { column: 36, line: 2 }, + }, + }, + ], + + range: [19, 59], + loc: { + start: { column: 19, line: 1 }, + end: { column: 1, line: 3 }, + }, + }, + id: Identifier { + type: "Identifier", + name: "Foo", + + range: [15, 18], + loc: { + start: { column: 15, line: 1 }, + end: { column: 18, line: 1 }, + }, + }, + superClass: null, + + range: [0, 59], + loc: { + start: { column: 0, line: 1 }, + end: { column: 1, line: 3 }, + }, + }, + ], + sourceType: "script", + + range: [0, 60], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 4 }, + }, +} +`; diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-abstract-with-value/snapshots/2-TSESTree-Tokens.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-abstract-with-value/snapshots/2-TSESTree-Tokens.shot new file mode 100644 index 00000000000..b993bfecdea --- /dev/null +++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-abstract-with-value/snapshots/2-TSESTree-Tokens.shot @@ -0,0 +1,136 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures element AccessorProperty modifier-abstract-with-value TSESTree - Tokens 1`] = ` +Array [ + Identifier { + type: "Identifier", + value: "abstract", + + range: [0, 8], + loc: { + start: { column: 0, line: 1 }, + end: { column: 8, line: 1 }, + }, + }, + Keyword { + type: "Keyword", + value: "class", + + range: [9, 14], + loc: { + start: { column: 9, line: 1 }, + end: { column: 14, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "Foo", + + 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 }, + }, + }, + Identifier { + type: "Identifier", + value: "abstract", + + range: [23, 31], + loc: { + start: { column: 2, line: 2 }, + end: { column: 10, line: 2 }, + }, + }, + Identifier { + type: "Identifier", + value: "accessor", + + range: [32, 40], + loc: { + start: { column: 11, line: 2 }, + end: { column: 19, line: 2 }, + }, + }, + Identifier { + type: "Identifier", + value: "foo", + + range: [41, 44], + loc: { + start: { column: 20, line: 2 }, + end: { column: 23, line: 2 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ":", + + range: [44, 45], + loc: { + start: { column: 23, line: 2 }, + end: { column: 24, line: 2 }, + }, + }, + Identifier { + type: "Identifier", + value: "number", + + range: [46, 52], + loc: { + start: { column: 25, line: 2 }, + end: { column: 31, line: 2 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "=", + + range: [53, 54], + loc: { + start: { column: 32, line: 2 }, + end: { column: 33, line: 2 }, + }, + }, + Numeric { + type: "Numeric", + value: "1", + + range: [55, 56], + loc: { + start: { column: 34, line: 2 }, + end: { column: 35, line: 2 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ";", + + range: [56, 57], + loc: { + start: { column: 35, line: 2 }, + end: { column: 36, line: 2 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "}", + + range: [58, 59], + loc: { + start: { column: 0, line: 3 }, + end: { column: 1, line: 3 }, + }, + }, +] +`; diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-abstract/fixture.ts b/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-abstract/fixture.ts new file mode 100644 index 00000000000..61608bfc72d --- /dev/null +++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-abstract/fixture.ts @@ -0,0 +1,3 @@ +abstract class Foo { + abstract accessor foo: number; +} diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-abstract/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-abstract/snapshots/1-TSESTree-AST.shot new file mode 100644 index 00000000000..420e13ca4bf --- /dev/null +++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-abstract/snapshots/1-TSESTree-AST.shot @@ -0,0 +1,90 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures element AccessorProperty modifier-abstract TSESTree - AST 1`] = ` +Program { + type: "Program", + body: Array [ + ClassDeclaration { + type: "ClassDeclaration", + abstract: true, + body: ClassBody { + type: "ClassBody", + body: Array [ + TSAbstractAccessorProperty { + type: "TSAbstractAccessorProperty", + computed: false, + declare: false, + key: Identifier { + type: "Identifier", + name: "foo", + + range: [41, 44], + loc: { + start: { column: 20, line: 2 }, + end: { column: 23, line: 2 }, + }, + }, + override: false, + static: false, + typeAnnotation: TSTypeAnnotation { + type: "TSTypeAnnotation", + typeAnnotation: TSNumberKeyword { + type: "TSNumberKeyword", + + range: [46, 52], + loc: { + start: { column: 25, line: 2 }, + end: { column: 31, line: 2 }, + }, + }, + + range: [44, 52], + loc: { + start: { column: 23, line: 2 }, + end: { column: 31, line: 2 }, + }, + }, + value: null, + + range: [23, 53], + loc: { + start: { column: 2, line: 2 }, + end: { column: 32, line: 2 }, + }, + }, + ], + + range: [19, 55], + loc: { + start: { column: 19, line: 1 }, + end: { column: 1, line: 3 }, + }, + }, + id: Identifier { + type: "Identifier", + name: "Foo", + + range: [15, 18], + loc: { + start: { column: 15, line: 1 }, + end: { column: 18, line: 1 }, + }, + }, + superClass: null, + + range: [0, 55], + loc: { + start: { column: 0, line: 1 }, + end: { column: 1, line: 3 }, + }, + }, + ], + sourceType: "script", + + range: [0, 56], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 4 }, + }, +} +`; diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-abstract/snapshots/2-TSESTree-Tokens.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-abstract/snapshots/2-TSESTree-Tokens.shot new file mode 100644 index 00000000000..732caf89fce --- /dev/null +++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-abstract/snapshots/2-TSESTree-Tokens.shot @@ -0,0 +1,116 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures element AccessorProperty modifier-abstract TSESTree - Tokens 1`] = ` +Array [ + Identifier { + type: "Identifier", + value: "abstract", + + range: [0, 8], + loc: { + start: { column: 0, line: 1 }, + end: { column: 8, line: 1 }, + }, + }, + Keyword { + type: "Keyword", + value: "class", + + range: [9, 14], + loc: { + start: { column: 9, line: 1 }, + end: { column: 14, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "Foo", + + 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 }, + }, + }, + Identifier { + type: "Identifier", + value: "abstract", + + range: [23, 31], + loc: { + start: { column: 2, line: 2 }, + end: { column: 10, line: 2 }, + }, + }, + Identifier { + type: "Identifier", + value: "accessor", + + range: [32, 40], + loc: { + start: { column: 11, line: 2 }, + end: { column: 19, line: 2 }, + }, + }, + Identifier { + type: "Identifier", + value: "foo", + + range: [41, 44], + loc: { + start: { column: 20, line: 2 }, + end: { column: 23, line: 2 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ":", + + range: [44, 45], + loc: { + start: { column: 23, line: 2 }, + end: { column: 24, line: 2 }, + }, + }, + Identifier { + type: "Identifier", + value: "number", + + range: [46, 52], + loc: { + start: { column: 25, line: 2 }, + end: { column: 31, line: 2 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ";", + + range: [52, 53], + loc: { + start: { column: 31, line: 2 }, + end: { column: 32, line: 2 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "}", + + range: [54, 55], + loc: { + start: { column: 0, line: 3 }, + end: { column: 1, line: 3 }, + }, + }, +] +`; diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-declare/fixture.ts b/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-declare/fixture.ts new file mode 100644 index 00000000000..2a4248c0bf8 --- /dev/null +++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-declare/fixture.ts @@ -0,0 +1,3 @@ +class Foo { + declare accessor foo: number; +} diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-declare/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-declare/snapshots/1-TSESTree-AST.shot new file mode 100644 index 00000000000..0b61be5984a --- /dev/null +++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-declare/snapshots/1-TSESTree-AST.shot @@ -0,0 +1,89 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures element AccessorProperty modifier-declare TSESTree - AST 1`] = ` +Program { + type: "Program", + body: Array [ + ClassDeclaration { + type: "ClassDeclaration", + body: ClassBody { + type: "ClassBody", + body: Array [ + AccessorProperty { + type: "AccessorProperty", + computed: false, + declare: true, + key: Identifier { + type: "Identifier", + name: "foo", + + range: [31, 34], + loc: { + start: { column: 19, line: 2 }, + end: { column: 22, line: 2 }, + }, + }, + override: false, + static: false, + typeAnnotation: TSTypeAnnotation { + type: "TSTypeAnnotation", + typeAnnotation: TSNumberKeyword { + type: "TSNumberKeyword", + + range: [36, 42], + loc: { + start: { column: 24, line: 2 }, + end: { column: 30, line: 2 }, + }, + }, + + range: [34, 42], + loc: { + start: { column: 22, line: 2 }, + end: { column: 30, line: 2 }, + }, + }, + value: null, + + range: [14, 43], + loc: { + start: { column: 2, line: 2 }, + end: { column: 31, line: 2 }, + }, + }, + ], + + range: [10, 45], + loc: { + start: { column: 10, line: 1 }, + end: { column: 1, line: 3 }, + }, + }, + id: Identifier { + type: "Identifier", + name: "Foo", + + range: [6, 9], + loc: { + start: { column: 6, line: 1 }, + end: { column: 9, line: 1 }, + }, + }, + superClass: null, + + range: [0, 45], + loc: { + start: { column: 0, line: 1 }, + end: { column: 1, line: 3 }, + }, + }, + ], + sourceType: "script", + + range: [0, 46], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 4 }, + }, +} +`; diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-declare/snapshots/2-TSESTree-Tokens.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-declare/snapshots/2-TSESTree-Tokens.shot new file mode 100644 index 00000000000..c9f1a1a1da8 --- /dev/null +++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-declare/snapshots/2-TSESTree-Tokens.shot @@ -0,0 +1,106 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures element AccessorProperty modifier-declare TSESTree - Tokens 1`] = ` +Array [ + Keyword { + type: "Keyword", + value: "class", + + 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 }, + }, + }, + Identifier { + type: "Identifier", + value: "declare", + + range: [14, 21], + loc: { + start: { column: 2, line: 2 }, + end: { column: 9, line: 2 }, + }, + }, + Identifier { + type: "Identifier", + value: "accessor", + + range: [22, 30], + loc: { + start: { column: 10, line: 2 }, + end: { column: 18, line: 2 }, + }, + }, + Identifier { + type: "Identifier", + value: "foo", + + range: [31, 34], + loc: { + start: { column: 19, line: 2 }, + end: { column: 22, line: 2 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ":", + + range: [34, 35], + loc: { + start: { column: 22, line: 2 }, + end: { column: 23, line: 2 }, + }, + }, + Identifier { + type: "Identifier", + value: "number", + + range: [36, 42], + loc: { + start: { column: 24, line: 2 }, + end: { column: 30, line: 2 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ";", + + range: [42, 43], + loc: { + start: { column: 30, line: 2 }, + end: { column: 31, line: 2 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "}", + + range: [44, 45], + loc: { + start: { column: 0, line: 3 }, + end: { column: 1, line: 3 }, + }, + }, +] +`; diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-override/fixture.ts b/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-override/fixture.ts new file mode 100644 index 00000000000..4db186874ab --- /dev/null +++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-override/fixture.ts @@ -0,0 +1,3 @@ +class Foo { + override accessor foo = 1; +} diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-override/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-override/snapshots/1-TSESTree-AST.shot new file mode 100644 index 00000000000..01f0402a3e4 --- /dev/null +++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-override/snapshots/1-TSESTree-AST.shot @@ -0,0 +1,81 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures element AccessorProperty modifier-override TSESTree - AST 1`] = ` +Program { + type: "Program", + body: Array [ + ClassDeclaration { + type: "ClassDeclaration", + body: ClassBody { + type: "ClassBody", + body: Array [ + AccessorProperty { + type: "AccessorProperty", + computed: false, + declare: false, + key: Identifier { + type: "Identifier", + name: "foo", + + range: [32, 35], + loc: { + start: { column: 20, line: 2 }, + end: { column: 23, line: 2 }, + }, + }, + override: true, + static: false, + value: Literal { + type: "Literal", + raw: "1", + value: 1, + + range: [38, 39], + loc: { + start: { column: 26, line: 2 }, + end: { column: 27, line: 2 }, + }, + }, + + range: [14, 40], + loc: { + start: { column: 2, line: 2 }, + end: { column: 28, line: 2 }, + }, + }, + ], + + range: [10, 42], + loc: { + start: { column: 10, line: 1 }, + end: { column: 1, line: 3 }, + }, + }, + id: Identifier { + type: "Identifier", + name: "Foo", + + range: [6, 9], + loc: { + start: { column: 6, line: 1 }, + end: { column: 9, line: 1 }, + }, + }, + superClass: null, + + range: [0, 42], + loc: { + start: { column: 0, line: 1 }, + end: { column: 1, line: 3 }, + }, + }, + ], + sourceType: "script", + + range: [0, 43], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 4 }, + }, +} +`; diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-override/snapshots/2-TSESTree-Tokens.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-override/snapshots/2-TSESTree-Tokens.shot new file mode 100644 index 00000000000..46fce83728c --- /dev/null +++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-override/snapshots/2-TSESTree-Tokens.shot @@ -0,0 +1,106 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures element AccessorProperty modifier-override TSESTree - Tokens 1`] = ` +Array [ + Keyword { + type: "Keyword", + value: "class", + + 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 }, + }, + }, + Identifier { + type: "Identifier", + value: "override", + + range: [14, 22], + loc: { + start: { column: 2, line: 2 }, + end: { column: 10, line: 2 }, + }, + }, + Identifier { + type: "Identifier", + value: "accessor", + + range: [23, 31], + loc: { + start: { column: 11, line: 2 }, + end: { column: 19, line: 2 }, + }, + }, + Identifier { + type: "Identifier", + value: "foo", + + range: [32, 35], + loc: { + start: { column: 20, line: 2 }, + end: { column: 23, line: 2 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "=", + + range: [36, 37], + loc: { + start: { column: 24, line: 2 }, + end: { column: 25, line: 2 }, + }, + }, + Numeric { + type: "Numeric", + value: "1", + + range: [38, 39], + loc: { + start: { column: 26, line: 2 }, + end: { column: 27, line: 2 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ";", + + range: [39, 40], + loc: { + start: { column: 27, line: 2 }, + end: { column: 28, line: 2 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "}", + + range: [41, 42], + loc: { + start: { column: 0, line: 3 }, + end: { column: 1, line: 3 }, + }, + }, +] +`; diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-private/fixture.ts b/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-private/fixture.ts new file mode 100644 index 00000000000..ceacabc649f --- /dev/null +++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-private/fixture.ts @@ -0,0 +1,3 @@ +class Foo { + private accessor foo = 2; +} diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-private/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-private/snapshots/1-TSESTree-AST.shot new file mode 100644 index 00000000000..0f0fa0f2a10 --- /dev/null +++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-private/snapshots/1-TSESTree-AST.shot @@ -0,0 +1,82 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures element AccessorProperty modifier-private TSESTree - AST 1`] = ` +Program { + type: "Program", + body: Array [ + ClassDeclaration { + type: "ClassDeclaration", + body: ClassBody { + type: "ClassBody", + body: Array [ + AccessorProperty { + type: "AccessorProperty", + accessibility: "private", + computed: false, + declare: false, + key: Identifier { + type: "Identifier", + name: "foo", + + range: [31, 34], + loc: { + start: { column: 19, line: 2 }, + end: { column: 22, line: 2 }, + }, + }, + override: false, + static: false, + value: Literal { + type: "Literal", + raw: "2", + value: 2, + + range: [37, 38], + loc: { + start: { column: 25, line: 2 }, + end: { column: 26, line: 2 }, + }, + }, + + range: [14, 39], + loc: { + start: { column: 2, line: 2 }, + end: { column: 27, line: 2 }, + }, + }, + ], + + range: [10, 41], + loc: { + start: { column: 10, line: 1 }, + end: { column: 1, line: 3 }, + }, + }, + id: Identifier { + type: "Identifier", + name: "Foo", + + range: [6, 9], + loc: { + start: { column: 6, line: 1 }, + end: { column: 9, line: 1 }, + }, + }, + superClass: null, + + range: [0, 41], + loc: { + start: { column: 0, line: 1 }, + end: { column: 1, line: 3 }, + }, + }, + ], + sourceType: "script", + + range: [0, 42], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 4 }, + }, +} +`; diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-private/snapshots/2-TSESTree-Tokens.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-private/snapshots/2-TSESTree-Tokens.shot new file mode 100644 index 00000000000..17510235b46 --- /dev/null +++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-private/snapshots/2-TSESTree-Tokens.shot @@ -0,0 +1,106 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures element AccessorProperty modifier-private TSESTree - Tokens 1`] = ` +Array [ + Keyword { + type: "Keyword", + value: "class", + + 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 }, + }, + }, + Keyword { + type: "Keyword", + value: "private", + + range: [14, 21], + loc: { + start: { column: 2, line: 2 }, + end: { column: 9, line: 2 }, + }, + }, + Identifier { + type: "Identifier", + value: "accessor", + + range: [22, 30], + loc: { + start: { column: 10, line: 2 }, + end: { column: 18, line: 2 }, + }, + }, + Identifier { + type: "Identifier", + value: "foo", + + range: [31, 34], + loc: { + start: { column: 19, line: 2 }, + end: { column: 22, line: 2 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "=", + + range: [35, 36], + loc: { + start: { column: 23, line: 2 }, + end: { column: 24, line: 2 }, + }, + }, + Numeric { + type: "Numeric", + value: "2", + + range: [37, 38], + loc: { + start: { column: 25, line: 2 }, + end: { column: 26, line: 2 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ";", + + range: [38, 39], + loc: { + start: { column: 26, line: 2 }, + end: { column: 27, line: 2 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "}", + + range: [40, 41], + loc: { + start: { column: 0, line: 3 }, + end: { column: 1, line: 3 }, + }, + }, +] +`; diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-private/snapshots/3-Babel-AST.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-private/snapshots/3-Babel-AST.shot new file mode 100644 index 00000000000..b11a056920d --- /dev/null +++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-private/snapshots/3-Babel-AST.shot @@ -0,0 +1,80 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures element AccessorProperty modifier-private Babel - AST 1`] = ` +Program { + type: "Program", + body: Array [ + ClassDeclaration { + type: "ClassDeclaration", + body: ClassBody { + type: "ClassBody", + body: Array [ + ClassAccessorProperty { + type: "ClassAccessorProperty", + accessibility: "private", + computed: false, + key: Identifier { + type: "Identifier", + name: "foo", + + range: [31, 34], + loc: { + start: { column: 19, line: 2 }, + end: { column: 22, line: 2 }, + }, + }, + static: false, + value: Literal { + type: "Literal", + raw: "2", + value: 2, + + range: [37, 38], + loc: { + start: { column: 25, line: 2 }, + end: { column: 26, line: 2 }, + }, + }, + + range: [14, 39], + loc: { + start: { column: 2, line: 2 }, + end: { column: 27, line: 2 }, + }, + }, + ], + + range: [10, 41], + loc: { + start: { column: 10, line: 1 }, + end: { column: 1, line: 3 }, + }, + }, + id: Identifier { + type: "Identifier", + name: "Foo", + + range: [6, 9], + loc: { + start: { column: 6, line: 1 }, + end: { column: 9, line: 1 }, + }, + }, + superClass: null, + + range: [0, 41], + loc: { + start: { column: 0, line: 1 }, + end: { column: 1, line: 3 }, + }, + }, + ], + sourceType: "script", + + range: [0, 42], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 4 }, + }, +} +`; diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-private/snapshots/4-Babel-Tokens.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-private/snapshots/4-Babel-Tokens.shot new file mode 100644 index 00000000000..75520e7741d --- /dev/null +++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-private/snapshots/4-Babel-Tokens.shot @@ -0,0 +1,106 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures element AccessorProperty modifier-private Babel - Tokens 1`] = ` +Array [ + Keyword { + type: "Keyword", + value: "class", + + 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 }, + }, + }, + Identifier { + type: "Identifier", + value: "private", + + range: [14, 21], + loc: { + start: { column: 2, line: 2 }, + end: { column: 9, line: 2 }, + }, + }, + Identifier { + type: "Identifier", + value: "accessor", + + range: [22, 30], + loc: { + start: { column: 10, line: 2 }, + end: { column: 18, line: 2 }, + }, + }, + Identifier { + type: "Identifier", + value: "foo", + + range: [31, 34], + loc: { + start: { column: 19, line: 2 }, + end: { column: 22, line: 2 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "=", + + range: [35, 36], + loc: { + start: { column: 23, line: 2 }, + end: { column: 24, line: 2 }, + }, + }, + Numeric { + type: "Numeric", + value: "2", + + range: [37, 38], + loc: { + start: { column: 25, line: 2 }, + end: { column: 26, line: 2 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ";", + + range: [38, 39], + loc: { + start: { column: 26, line: 2 }, + end: { column: 27, line: 2 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "}", + + range: [40, 41], + loc: { + start: { column: 0, line: 3 }, + end: { column: 1, line: 3 }, + }, + }, +] +`; diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-private/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-private/snapshots/5-AST-Alignment-AST.shot new file mode 100644 index 00000000000..fd302779cf1 --- /dev/null +++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-private/snapshots/5-AST-Alignment-AST.shot @@ -0,0 +1,88 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures element AccessorProperty modifier-private AST Alignment - AST 1`] = ` +"Snapshot Diff: +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + ClassDeclaration { + type: 'ClassDeclaration', + body: ClassBody { + type: 'ClassBody', + body: Array [ +- AccessorProperty { +- type: 'AccessorProperty', ++ ClassAccessorProperty { ++ type: 'ClassAccessorProperty', + accessibility: 'private', + computed: false, +- declare: false, + key: Identifier { + type: 'Identifier', + name: 'foo', + + range: [31, 34], + loc: { + start: { column: 19, line: 2 }, + end: { column: 22, line: 2 }, + }, + }, +- override: false, + static: false, + value: Literal { + type: 'Literal', + raw: '2', + value: 2, + + range: [37, 38], + loc: { + start: { column: 25, line: 2 }, + end: { column: 26, line: 2 }, + }, + }, + + range: [14, 39], + loc: { + start: { column: 2, line: 2 }, + end: { column: 27, line: 2 }, + }, + }, + ], + + range: [10, 41], + loc: { + start: { column: 10, line: 1 }, + end: { column: 1, line: 3 }, + }, + }, + id: Identifier { + type: 'Identifier', + name: 'Foo', + + range: [6, 9], + loc: { + start: { column: 6, line: 1 }, + end: { column: 9, line: 1 }, + }, + }, + superClass: null, + + range: [0, 41], + loc: { + start: { column: 0, line: 1 }, + end: { column: 1, line: 3 }, + }, + }, + ], + sourceType: 'script', + + range: [0, 42], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 4 }, + }, + }" +`; diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-private/snapshots/6-AST-Alignment-Tokens.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-private/snapshots/6-AST-Alignment-Tokens.shot new file mode 100644 index 00000000000..35301570665 --- /dev/null +++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-private/snapshots/6-AST-Alignment-Tokens.shot @@ -0,0 +1,112 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures element AccessorProperty modifier-private AST Alignment - Token 1`] = ` +"Snapshot Diff: +- TSESTree ++ Babel + + Array [ + Keyword { + type: 'Keyword', + value: 'class', + + 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 }, + }, + }, +- Keyword { +- type: 'Keyword', ++ Identifier { ++ type: 'Identifier', + value: 'private', + + range: [14, 21], + loc: { + start: { column: 2, line: 2 }, + end: { column: 9, line: 2 }, + }, + }, + Identifier { + type: 'Identifier', + value: 'accessor', + + range: [22, 30], + loc: { + start: { column: 10, line: 2 }, + end: { column: 18, line: 2 }, + }, + }, + Identifier { + type: 'Identifier', + value: 'foo', + + range: [31, 34], + loc: { + start: { column: 19, line: 2 }, + end: { column: 22, line: 2 }, + }, + }, + Punctuator { + type: 'Punctuator', + value: '=', + + range: [35, 36], + loc: { + start: { column: 23, line: 2 }, + end: { column: 24, line: 2 }, + }, + }, + Numeric { + type: 'Numeric', + value: '2', + + range: [37, 38], + loc: { + start: { column: 25, line: 2 }, + end: { column: 26, line: 2 }, + }, + }, + Punctuator { + type: 'Punctuator', + value: ';', + + range: [38, 39], + loc: { + start: { column: 26, line: 2 }, + end: { column: 27, line: 2 }, + }, + }, + Punctuator { + type: 'Punctuator', + value: '}', + + range: [40, 41], + loc: { + start: { column: 0, line: 3 }, + end: { column: 1, line: 3 }, + }, + }, + ]" +`; diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-protected/fixture.ts b/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-protected/fixture.ts new file mode 100644 index 00000000000..dac8cd734c5 --- /dev/null +++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-protected/fixture.ts @@ -0,0 +1,3 @@ +class Foo { + protected accessor foo = 2; +} diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-protected/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-protected/snapshots/1-TSESTree-AST.shot new file mode 100644 index 00000000000..d862c8f8648 --- /dev/null +++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-protected/snapshots/1-TSESTree-AST.shot @@ -0,0 +1,82 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures element AccessorProperty modifier-protected TSESTree - AST 1`] = ` +Program { + type: "Program", + body: Array [ + ClassDeclaration { + type: "ClassDeclaration", + body: ClassBody { + type: "ClassBody", + body: Array [ + AccessorProperty { + type: "AccessorProperty", + accessibility: "protected", + computed: false, + declare: false, + key: Identifier { + type: "Identifier", + name: "foo", + + range: [33, 36], + loc: { + start: { column: 21, line: 2 }, + end: { column: 24, line: 2 }, + }, + }, + override: false, + static: false, + value: Literal { + type: "Literal", + raw: "2", + value: 2, + + range: [39, 40], + loc: { + start: { column: 27, line: 2 }, + end: { column: 28, line: 2 }, + }, + }, + + range: [14, 41], + loc: { + start: { column: 2, line: 2 }, + end: { column: 29, line: 2 }, + }, + }, + ], + + range: [10, 43], + loc: { + start: { column: 10, line: 1 }, + end: { column: 1, line: 3 }, + }, + }, + id: Identifier { + type: "Identifier", + name: "Foo", + + range: [6, 9], + loc: { + start: { column: 6, line: 1 }, + end: { column: 9, line: 1 }, + }, + }, + superClass: null, + + range: [0, 43], + loc: { + start: { column: 0, line: 1 }, + end: { column: 1, line: 3 }, + }, + }, + ], + sourceType: "script", + + range: [0, 44], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 4 }, + }, +} +`; diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-protected/snapshots/2-TSESTree-Tokens.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-protected/snapshots/2-TSESTree-Tokens.shot new file mode 100644 index 00000000000..88ab4ac1f40 --- /dev/null +++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-protected/snapshots/2-TSESTree-Tokens.shot @@ -0,0 +1,106 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures element AccessorProperty modifier-protected TSESTree - Tokens 1`] = ` +Array [ + Keyword { + type: "Keyword", + value: "class", + + 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 }, + }, + }, + Keyword { + type: "Keyword", + value: "protected", + + range: [14, 23], + loc: { + start: { column: 2, line: 2 }, + end: { column: 11, line: 2 }, + }, + }, + Identifier { + type: "Identifier", + value: "accessor", + + range: [24, 32], + loc: { + start: { column: 12, line: 2 }, + end: { column: 20, line: 2 }, + }, + }, + Identifier { + type: "Identifier", + value: "foo", + + range: [33, 36], + loc: { + start: { column: 21, line: 2 }, + end: { column: 24, line: 2 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "=", + + range: [37, 38], + loc: { + start: { column: 25, line: 2 }, + end: { column: 26, line: 2 }, + }, + }, + Numeric { + type: "Numeric", + value: "2", + + range: [39, 40], + loc: { + start: { column: 27, line: 2 }, + end: { column: 28, line: 2 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ";", + + range: [40, 41], + loc: { + start: { column: 28, line: 2 }, + end: { column: 29, line: 2 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "}", + + range: [42, 43], + loc: { + start: { column: 0, line: 3 }, + end: { column: 1, line: 3 }, + }, + }, +] +`; diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-protected/snapshots/3-Babel-AST.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-protected/snapshots/3-Babel-AST.shot new file mode 100644 index 00000000000..dbabfaa6a93 --- /dev/null +++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-protected/snapshots/3-Babel-AST.shot @@ -0,0 +1,80 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures element AccessorProperty modifier-protected Babel - AST 1`] = ` +Program { + type: "Program", + body: Array [ + ClassDeclaration { + type: "ClassDeclaration", + body: ClassBody { + type: "ClassBody", + body: Array [ + ClassAccessorProperty { + type: "ClassAccessorProperty", + accessibility: "protected", + computed: false, + key: Identifier { + type: "Identifier", + name: "foo", + + range: [33, 36], + loc: { + start: { column: 21, line: 2 }, + end: { column: 24, line: 2 }, + }, + }, + static: false, + value: Literal { + type: "Literal", + raw: "2", + value: 2, + + range: [39, 40], + loc: { + start: { column: 27, line: 2 }, + end: { column: 28, line: 2 }, + }, + }, + + range: [14, 41], + loc: { + start: { column: 2, line: 2 }, + end: { column: 29, line: 2 }, + }, + }, + ], + + range: [10, 43], + loc: { + start: { column: 10, line: 1 }, + end: { column: 1, line: 3 }, + }, + }, + id: Identifier { + type: "Identifier", + name: "Foo", + + range: [6, 9], + loc: { + start: { column: 6, line: 1 }, + end: { column: 9, line: 1 }, + }, + }, + superClass: null, + + range: [0, 43], + loc: { + start: { column: 0, line: 1 }, + end: { column: 1, line: 3 }, + }, + }, + ], + sourceType: "script", + + range: [0, 44], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 4 }, + }, +} +`; diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-protected/snapshots/4-Babel-Tokens.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-protected/snapshots/4-Babel-Tokens.shot new file mode 100644 index 00000000000..c730984ef44 --- /dev/null +++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-protected/snapshots/4-Babel-Tokens.shot @@ -0,0 +1,106 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures element AccessorProperty modifier-protected Babel - Tokens 1`] = ` +Array [ + Keyword { + type: "Keyword", + value: "class", + + 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 }, + }, + }, + Identifier { + type: "Identifier", + value: "protected", + + range: [14, 23], + loc: { + start: { column: 2, line: 2 }, + end: { column: 11, line: 2 }, + }, + }, + Identifier { + type: "Identifier", + value: "accessor", + + range: [24, 32], + loc: { + start: { column: 12, line: 2 }, + end: { column: 20, line: 2 }, + }, + }, + Identifier { + type: "Identifier", + value: "foo", + + range: [33, 36], + loc: { + start: { column: 21, line: 2 }, + end: { column: 24, line: 2 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "=", + + range: [37, 38], + loc: { + start: { column: 25, line: 2 }, + end: { column: 26, line: 2 }, + }, + }, + Numeric { + type: "Numeric", + value: "2", + + range: [39, 40], + loc: { + start: { column: 27, line: 2 }, + end: { column: 28, line: 2 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ";", + + range: [40, 41], + loc: { + start: { column: 28, line: 2 }, + end: { column: 29, line: 2 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "}", + + range: [42, 43], + loc: { + start: { column: 0, line: 3 }, + end: { column: 1, line: 3 }, + }, + }, +] +`; diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-protected/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-protected/snapshots/5-AST-Alignment-AST.shot new file mode 100644 index 00000000000..c26ec2b5985 --- /dev/null +++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-protected/snapshots/5-AST-Alignment-AST.shot @@ -0,0 +1,88 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures element AccessorProperty modifier-protected AST Alignment - AST 1`] = ` +"Snapshot Diff: +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + ClassDeclaration { + type: 'ClassDeclaration', + body: ClassBody { + type: 'ClassBody', + body: Array [ +- AccessorProperty { +- type: 'AccessorProperty', ++ ClassAccessorProperty { ++ type: 'ClassAccessorProperty', + accessibility: 'protected', + computed: false, +- declare: false, + key: Identifier { + type: 'Identifier', + name: 'foo', + + range: [33, 36], + loc: { + start: { column: 21, line: 2 }, + end: { column: 24, line: 2 }, + }, + }, +- override: false, + static: false, + value: Literal { + type: 'Literal', + raw: '2', + value: 2, + + range: [39, 40], + loc: { + start: { column: 27, line: 2 }, + end: { column: 28, line: 2 }, + }, + }, + + range: [14, 41], + loc: { + start: { column: 2, line: 2 }, + end: { column: 29, line: 2 }, + }, + }, + ], + + range: [10, 43], + loc: { + start: { column: 10, line: 1 }, + end: { column: 1, line: 3 }, + }, + }, + id: Identifier { + type: 'Identifier', + name: 'Foo', + + range: [6, 9], + loc: { + start: { column: 6, line: 1 }, + end: { column: 9, line: 1 }, + }, + }, + superClass: null, + + range: [0, 43], + loc: { + start: { column: 0, line: 1 }, + end: { column: 1, line: 3 }, + }, + }, + ], + sourceType: 'script', + + range: [0, 44], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 4 }, + }, + }" +`; diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-protected/snapshots/6-AST-Alignment-Tokens.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-protected/snapshots/6-AST-Alignment-Tokens.shot new file mode 100644 index 00000000000..cbbcda53541 --- /dev/null +++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-protected/snapshots/6-AST-Alignment-Tokens.shot @@ -0,0 +1,112 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures element AccessorProperty modifier-protected AST Alignment - Token 1`] = ` +"Snapshot Diff: +- TSESTree ++ Babel + + Array [ + Keyword { + type: 'Keyword', + value: 'class', + + 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 }, + }, + }, +- Keyword { +- type: 'Keyword', ++ Identifier { ++ type: 'Identifier', + value: 'protected', + + range: [14, 23], + loc: { + start: { column: 2, line: 2 }, + end: { column: 11, line: 2 }, + }, + }, + Identifier { + type: 'Identifier', + value: 'accessor', + + range: [24, 32], + loc: { + start: { column: 12, line: 2 }, + end: { column: 20, line: 2 }, + }, + }, + Identifier { + type: 'Identifier', + value: 'foo', + + range: [33, 36], + loc: { + start: { column: 21, line: 2 }, + end: { column: 24, line: 2 }, + }, + }, + Punctuator { + type: 'Punctuator', + value: '=', + + range: [37, 38], + loc: { + start: { column: 25, line: 2 }, + end: { column: 26, line: 2 }, + }, + }, + Numeric { + type: 'Numeric', + value: '2', + + range: [39, 40], + loc: { + start: { column: 27, line: 2 }, + end: { column: 28, line: 2 }, + }, + }, + Punctuator { + type: 'Punctuator', + value: ';', + + range: [40, 41], + loc: { + start: { column: 28, line: 2 }, + end: { column: 29, line: 2 }, + }, + }, + Punctuator { + type: 'Punctuator', + value: '}', + + range: [42, 43], + loc: { + start: { column: 0, line: 3 }, + end: { column: 1, line: 3 }, + }, + }, + ]" +`; diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-public/fixture.ts b/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-public/fixture.ts new file mode 100644 index 00000000000..bbcbc59c710 --- /dev/null +++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-public/fixture.ts @@ -0,0 +1,3 @@ +class Foo { + public accessor foo = 2; +} diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-public/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-public/snapshots/1-TSESTree-AST.shot new file mode 100644 index 00000000000..6a1c4d1b7ec --- /dev/null +++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-public/snapshots/1-TSESTree-AST.shot @@ -0,0 +1,82 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures element AccessorProperty modifier-public TSESTree - AST 1`] = ` +Program { + type: "Program", + body: Array [ + ClassDeclaration { + type: "ClassDeclaration", + body: ClassBody { + type: "ClassBody", + body: Array [ + AccessorProperty { + type: "AccessorProperty", + accessibility: "public", + computed: false, + declare: false, + key: Identifier { + type: "Identifier", + name: "foo", + + range: [30, 33], + loc: { + start: { column: 18, line: 2 }, + end: { column: 21, line: 2 }, + }, + }, + override: false, + static: false, + value: Literal { + type: "Literal", + raw: "2", + value: 2, + + range: [36, 37], + loc: { + start: { column: 24, line: 2 }, + end: { column: 25, line: 2 }, + }, + }, + + range: [14, 38], + loc: { + start: { column: 2, line: 2 }, + end: { column: 26, line: 2 }, + }, + }, + ], + + range: [10, 40], + loc: { + start: { column: 10, line: 1 }, + end: { column: 1, line: 3 }, + }, + }, + id: Identifier { + type: "Identifier", + name: "Foo", + + range: [6, 9], + loc: { + start: { column: 6, line: 1 }, + end: { column: 9, line: 1 }, + }, + }, + superClass: null, + + range: [0, 40], + loc: { + start: { column: 0, line: 1 }, + end: { column: 1, line: 3 }, + }, + }, + ], + sourceType: "script", + + range: [0, 41], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 4 }, + }, +} +`; diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-public/snapshots/2-TSESTree-Tokens.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-public/snapshots/2-TSESTree-Tokens.shot new file mode 100644 index 00000000000..31de17a79dd --- /dev/null +++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-public/snapshots/2-TSESTree-Tokens.shot @@ -0,0 +1,106 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures element AccessorProperty modifier-public TSESTree - Tokens 1`] = ` +Array [ + Keyword { + type: "Keyword", + value: "class", + + 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 }, + }, + }, + Keyword { + type: "Keyword", + value: "public", + + range: [14, 20], + loc: { + start: { column: 2, line: 2 }, + end: { column: 8, line: 2 }, + }, + }, + Identifier { + type: "Identifier", + value: "accessor", + + range: [21, 29], + loc: { + start: { column: 9, line: 2 }, + end: { column: 17, line: 2 }, + }, + }, + Identifier { + type: "Identifier", + value: "foo", + + range: [30, 33], + loc: { + start: { column: 18, line: 2 }, + end: { column: 21, line: 2 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "=", + + range: [34, 35], + loc: { + start: { column: 22, line: 2 }, + end: { column: 23, line: 2 }, + }, + }, + Numeric { + type: "Numeric", + value: "2", + + range: [36, 37], + loc: { + start: { column: 24, line: 2 }, + end: { column: 25, line: 2 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ";", + + range: [37, 38], + loc: { + start: { column: 25, line: 2 }, + end: { column: 26, line: 2 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "}", + + range: [39, 40], + loc: { + start: { column: 0, line: 3 }, + end: { column: 1, line: 3 }, + }, + }, +] +`; diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-public/snapshots/3-Babel-AST.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-public/snapshots/3-Babel-AST.shot new file mode 100644 index 00000000000..ed50b70a5c7 --- /dev/null +++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-public/snapshots/3-Babel-AST.shot @@ -0,0 +1,80 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures element AccessorProperty modifier-public Babel - AST 1`] = ` +Program { + type: "Program", + body: Array [ + ClassDeclaration { + type: "ClassDeclaration", + body: ClassBody { + type: "ClassBody", + body: Array [ + ClassAccessorProperty { + type: "ClassAccessorProperty", + accessibility: "public", + computed: false, + key: Identifier { + type: "Identifier", + name: "foo", + + range: [30, 33], + loc: { + start: { column: 18, line: 2 }, + end: { column: 21, line: 2 }, + }, + }, + static: false, + value: Literal { + type: "Literal", + raw: "2", + value: 2, + + range: [36, 37], + loc: { + start: { column: 24, line: 2 }, + end: { column: 25, line: 2 }, + }, + }, + + range: [14, 38], + loc: { + start: { column: 2, line: 2 }, + end: { column: 26, line: 2 }, + }, + }, + ], + + range: [10, 40], + loc: { + start: { column: 10, line: 1 }, + end: { column: 1, line: 3 }, + }, + }, + id: Identifier { + type: "Identifier", + name: "Foo", + + range: [6, 9], + loc: { + start: { column: 6, line: 1 }, + end: { column: 9, line: 1 }, + }, + }, + superClass: null, + + range: [0, 40], + loc: { + start: { column: 0, line: 1 }, + end: { column: 1, line: 3 }, + }, + }, + ], + sourceType: "script", + + range: [0, 41], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 4 }, + }, +} +`; diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-public/snapshots/4-Babel-Tokens.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-public/snapshots/4-Babel-Tokens.shot new file mode 100644 index 00000000000..e0257ccc735 --- /dev/null +++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-public/snapshots/4-Babel-Tokens.shot @@ -0,0 +1,106 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures element AccessorProperty modifier-public Babel - Tokens 1`] = ` +Array [ + Keyword { + type: "Keyword", + value: "class", + + 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 }, + }, + }, + Identifier { + type: "Identifier", + value: "public", + + range: [14, 20], + loc: { + start: { column: 2, line: 2 }, + end: { column: 8, line: 2 }, + }, + }, + Identifier { + type: "Identifier", + value: "accessor", + + range: [21, 29], + loc: { + start: { column: 9, line: 2 }, + end: { column: 17, line: 2 }, + }, + }, + Identifier { + type: "Identifier", + value: "foo", + + range: [30, 33], + loc: { + start: { column: 18, line: 2 }, + end: { column: 21, line: 2 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "=", + + range: [34, 35], + loc: { + start: { column: 22, line: 2 }, + end: { column: 23, line: 2 }, + }, + }, + Numeric { + type: "Numeric", + value: "2", + + range: [36, 37], + loc: { + start: { column: 24, line: 2 }, + end: { column: 25, line: 2 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ";", + + range: [37, 38], + loc: { + start: { column: 25, line: 2 }, + end: { column: 26, line: 2 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "}", + + range: [39, 40], + loc: { + start: { column: 0, line: 3 }, + end: { column: 1, line: 3 }, + }, + }, +] +`; diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-public/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-public/snapshots/5-AST-Alignment-AST.shot new file mode 100644 index 00000000000..9eb4ac8ef9b --- /dev/null +++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-public/snapshots/5-AST-Alignment-AST.shot @@ -0,0 +1,88 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures element AccessorProperty modifier-public AST Alignment - AST 1`] = ` +"Snapshot Diff: +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + ClassDeclaration { + type: 'ClassDeclaration', + body: ClassBody { + type: 'ClassBody', + body: Array [ +- AccessorProperty { +- type: 'AccessorProperty', ++ ClassAccessorProperty { ++ type: 'ClassAccessorProperty', + accessibility: 'public', + computed: false, +- declare: false, + key: Identifier { + type: 'Identifier', + name: 'foo', + + range: [30, 33], + loc: { + start: { column: 18, line: 2 }, + end: { column: 21, line: 2 }, + }, + }, +- override: false, + static: false, + value: Literal { + type: 'Literal', + raw: '2', + value: 2, + + range: [36, 37], + loc: { + start: { column: 24, line: 2 }, + end: { column: 25, line: 2 }, + }, + }, + + range: [14, 38], + loc: { + start: { column: 2, line: 2 }, + end: { column: 26, line: 2 }, + }, + }, + ], + + range: [10, 40], + loc: { + start: { column: 10, line: 1 }, + end: { column: 1, line: 3 }, + }, + }, + id: Identifier { + type: 'Identifier', + name: 'Foo', + + range: [6, 9], + loc: { + start: { column: 6, line: 1 }, + end: { column: 9, line: 1 }, + }, + }, + superClass: null, + + range: [0, 40], + loc: { + start: { column: 0, line: 1 }, + end: { column: 1, line: 3 }, + }, + }, + ], + sourceType: 'script', + + range: [0, 41], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 4 }, + }, + }" +`; diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-public/snapshots/6-AST-Alignment-Tokens.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-public/snapshots/6-AST-Alignment-Tokens.shot new file mode 100644 index 00000000000..7228be97ad2 --- /dev/null +++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-public/snapshots/6-AST-Alignment-Tokens.shot @@ -0,0 +1,112 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures element AccessorProperty modifier-public AST Alignment - Token 1`] = ` +"Snapshot Diff: +- TSESTree ++ Babel + + Array [ + Keyword { + type: 'Keyword', + value: 'class', + + 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 }, + }, + }, +- Keyword { +- type: 'Keyword', ++ Identifier { ++ type: 'Identifier', + value: 'public', + + range: [14, 20], + loc: { + start: { column: 2, line: 2 }, + end: { column: 8, line: 2 }, + }, + }, + Identifier { + type: 'Identifier', + value: 'accessor', + + range: [21, 29], + loc: { + start: { column: 9, line: 2 }, + end: { column: 17, line: 2 }, + }, + }, + Identifier { + type: 'Identifier', + value: 'foo', + + range: [30, 33], + loc: { + start: { column: 18, line: 2 }, + end: { column: 21, line: 2 }, + }, + }, + Punctuator { + type: 'Punctuator', + value: '=', + + range: [34, 35], + loc: { + start: { column: 22, line: 2 }, + end: { column: 23, line: 2 }, + }, + }, + Numeric { + type: 'Numeric', + value: '2', + + range: [36, 37], + loc: { + start: { column: 24, line: 2 }, + end: { column: 25, line: 2 }, + }, + }, + Punctuator { + type: 'Punctuator', + value: ';', + + range: [37, 38], + loc: { + start: { column: 25, line: 2 }, + end: { column: 26, line: 2 }, + }, + }, + Punctuator { + type: 'Punctuator', + value: '}', + + range: [39, 40], + loc: { + start: { column: 0, line: 3 }, + end: { column: 1, line: 3 }, + }, + }, + ]" +`; diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-readonly/fixture.ts b/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-readonly/fixture.ts new file mode 100644 index 00000000000..532df27a9ee --- /dev/null +++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-readonly/fixture.ts @@ -0,0 +1,3 @@ +class Foo { + readonly accessor foo = 2; +} diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-readonly/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-readonly/snapshots/1-TSESTree-AST.shot new file mode 100644 index 00000000000..41928f7e572 --- /dev/null +++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-readonly/snapshots/1-TSESTree-AST.shot @@ -0,0 +1,82 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures element AccessorProperty modifier-readonly TSESTree - AST 1`] = ` +Program { + type: "Program", + body: Array [ + ClassDeclaration { + type: "ClassDeclaration", + body: ClassBody { + type: "ClassBody", + body: Array [ + AccessorProperty { + type: "AccessorProperty", + computed: false, + declare: false, + key: Identifier { + type: "Identifier", + name: "foo", + + range: [32, 35], + loc: { + start: { column: 20, line: 2 }, + end: { column: 23, line: 2 }, + }, + }, + override: false, + readonly: true, + static: false, + value: Literal { + type: "Literal", + raw: "2", + value: 2, + + range: [38, 39], + loc: { + start: { column: 26, line: 2 }, + end: { column: 27, line: 2 }, + }, + }, + + range: [14, 40], + loc: { + start: { column: 2, line: 2 }, + end: { column: 28, line: 2 }, + }, + }, + ], + + range: [10, 42], + loc: { + start: { column: 10, line: 1 }, + end: { column: 1, line: 3 }, + }, + }, + id: Identifier { + type: "Identifier", + name: "Foo", + + range: [6, 9], + loc: { + start: { column: 6, line: 1 }, + end: { column: 9, line: 1 }, + }, + }, + superClass: null, + + range: [0, 42], + loc: { + start: { column: 0, line: 1 }, + end: { column: 1, line: 3 }, + }, + }, + ], + sourceType: "script", + + range: [0, 43], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 4 }, + }, +} +`; diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-readonly/snapshots/2-TSESTree-Tokens.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-readonly/snapshots/2-TSESTree-Tokens.shot new file mode 100644 index 00000000000..802229ba8ae --- /dev/null +++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-readonly/snapshots/2-TSESTree-Tokens.shot @@ -0,0 +1,106 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures element AccessorProperty modifier-readonly TSESTree - Tokens 1`] = ` +Array [ + Keyword { + type: "Keyword", + value: "class", + + 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 }, + }, + }, + Identifier { + type: "Identifier", + value: "readonly", + + range: [14, 22], + loc: { + start: { column: 2, line: 2 }, + end: { column: 10, line: 2 }, + }, + }, + Identifier { + type: "Identifier", + value: "accessor", + + range: [23, 31], + loc: { + start: { column: 11, line: 2 }, + end: { column: 19, line: 2 }, + }, + }, + Identifier { + type: "Identifier", + value: "foo", + + range: [32, 35], + loc: { + start: { column: 20, line: 2 }, + end: { column: 23, line: 2 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "=", + + range: [36, 37], + loc: { + start: { column: 24, line: 2 }, + end: { column: 25, line: 2 }, + }, + }, + Numeric { + type: "Numeric", + value: "2", + + range: [38, 39], + loc: { + start: { column: 26, line: 2 }, + end: { column: 27, line: 2 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ";", + + range: [39, 40], + loc: { + start: { column: 27, line: 2 }, + end: { column: 28, line: 2 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "}", + + range: [41, 42], + loc: { + start: { column: 0, line: 3 }, + end: { column: 1, line: 3 }, + }, + }, +] +`; diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-readonly/snapshots/3-Babel-AST.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-readonly/snapshots/3-Babel-AST.shot new file mode 100644 index 00000000000..369cfde552a --- /dev/null +++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-readonly/snapshots/3-Babel-AST.shot @@ -0,0 +1,80 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures element AccessorProperty modifier-readonly Babel - AST 1`] = ` +Program { + type: "Program", + body: Array [ + ClassDeclaration { + type: "ClassDeclaration", + body: ClassBody { + type: "ClassBody", + body: Array [ + ClassAccessorProperty { + type: "ClassAccessorProperty", + computed: false, + key: Identifier { + type: "Identifier", + name: "foo", + + range: [32, 35], + loc: { + start: { column: 20, line: 2 }, + end: { column: 23, line: 2 }, + }, + }, + readonly: true, + static: false, + value: Literal { + type: "Literal", + raw: "2", + value: 2, + + range: [38, 39], + loc: { + start: { column: 26, line: 2 }, + end: { column: 27, line: 2 }, + }, + }, + + range: [14, 40], + loc: { + start: { column: 2, line: 2 }, + end: { column: 28, line: 2 }, + }, + }, + ], + + range: [10, 42], + loc: { + start: { column: 10, line: 1 }, + end: { column: 1, line: 3 }, + }, + }, + id: Identifier { + type: "Identifier", + name: "Foo", + + range: [6, 9], + loc: { + start: { column: 6, line: 1 }, + end: { column: 9, line: 1 }, + }, + }, + superClass: null, + + range: [0, 42], + loc: { + start: { column: 0, line: 1 }, + end: { column: 1, line: 3 }, + }, + }, + ], + sourceType: "script", + + range: [0, 43], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 4 }, + }, +} +`; diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-readonly/snapshots/4-Babel-Tokens.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-readonly/snapshots/4-Babel-Tokens.shot new file mode 100644 index 00000000000..673f38fe66c --- /dev/null +++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-readonly/snapshots/4-Babel-Tokens.shot @@ -0,0 +1,106 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures element AccessorProperty modifier-readonly Babel - Tokens 1`] = ` +Array [ + Keyword { + type: "Keyword", + value: "class", + + 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 }, + }, + }, + Identifier { + type: "Identifier", + value: "readonly", + + range: [14, 22], + loc: { + start: { column: 2, line: 2 }, + end: { column: 10, line: 2 }, + }, + }, + Identifier { + type: "Identifier", + value: "accessor", + + range: [23, 31], + loc: { + start: { column: 11, line: 2 }, + end: { column: 19, line: 2 }, + }, + }, + Identifier { + type: "Identifier", + value: "foo", + + range: [32, 35], + loc: { + start: { column: 20, line: 2 }, + end: { column: 23, line: 2 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "=", + + range: [36, 37], + loc: { + start: { column: 24, line: 2 }, + end: { column: 25, line: 2 }, + }, + }, + Numeric { + type: "Numeric", + value: "2", + + range: [38, 39], + loc: { + start: { column: 26, line: 2 }, + end: { column: 27, line: 2 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ";", + + range: [39, 40], + loc: { + start: { column: 27, line: 2 }, + end: { column: 28, line: 2 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "}", + + range: [41, 42], + loc: { + start: { column: 0, line: 3 }, + end: { column: 1, line: 3 }, + }, + }, +] +`; diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-readonly/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-readonly/snapshots/5-AST-Alignment-AST.shot new file mode 100644 index 00000000000..7f48bba2e58 --- /dev/null +++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-readonly/snapshots/5-AST-Alignment-AST.shot @@ -0,0 +1,88 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures element AccessorProperty modifier-readonly AST Alignment - AST 1`] = ` +"Snapshot Diff: +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + ClassDeclaration { + type: 'ClassDeclaration', + body: ClassBody { + type: 'ClassBody', + body: Array [ +- AccessorProperty { +- type: 'AccessorProperty', ++ ClassAccessorProperty { ++ type: 'ClassAccessorProperty', + computed: false, +- declare: false, + key: Identifier { + type: 'Identifier', + name: 'foo', + + range: [32, 35], + loc: { + start: { column: 20, line: 2 }, + end: { column: 23, line: 2 }, + }, + }, +- override: false, + readonly: true, + static: false, + value: Literal { + type: 'Literal', + raw: '2', + value: 2, + + range: [38, 39], + loc: { + start: { column: 26, line: 2 }, + end: { column: 27, line: 2 }, + }, + }, + + range: [14, 40], + loc: { + start: { column: 2, line: 2 }, + end: { column: 28, line: 2 }, + }, + }, + ], + + range: [10, 42], + loc: { + start: { column: 10, line: 1 }, + end: { column: 1, line: 3 }, + }, + }, + id: Identifier { + type: 'Identifier', + name: 'Foo', + + range: [6, 9], + loc: { + start: { column: 6, line: 1 }, + end: { column: 9, line: 1 }, + }, + }, + superClass: null, + + range: [0, 42], + loc: { + start: { column: 0, line: 1 }, + end: { column: 1, line: 3 }, + }, + }, + ], + sourceType: 'script', + + range: [0, 43], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 4 }, + }, + }" +`; diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-readonly/snapshots/6-AST-Alignment-Tokens.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-readonly/snapshots/6-AST-Alignment-Tokens.shot new file mode 100644 index 00000000000..ba78cbeda59 --- /dev/null +++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-readonly/snapshots/6-AST-Alignment-Tokens.shot @@ -0,0 +1,6 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures element AccessorProperty modifier-readonly AST Alignment - Token 1`] = ` +"Snapshot Diff: +Compared values have no visual difference." +`; diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-static/fixture.ts b/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-static/fixture.ts new file mode 100644 index 00000000000..0c8cd7ca6a4 --- /dev/null +++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-static/fixture.ts @@ -0,0 +1,3 @@ +class Foo { + static accessor foo = 2; +} diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-static/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-static/snapshots/1-TSESTree-AST.shot new file mode 100644 index 00000000000..6733de847c8 --- /dev/null +++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-static/snapshots/1-TSESTree-AST.shot @@ -0,0 +1,81 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures element AccessorProperty modifier-static TSESTree - AST 1`] = ` +Program { + type: "Program", + body: Array [ + ClassDeclaration { + type: "ClassDeclaration", + body: ClassBody { + type: "ClassBody", + body: Array [ + AccessorProperty { + type: "AccessorProperty", + computed: false, + declare: false, + key: Identifier { + type: "Identifier", + name: "foo", + + range: [30, 33], + loc: { + start: { column: 18, line: 2 }, + end: { column: 21, line: 2 }, + }, + }, + override: false, + static: true, + value: Literal { + type: "Literal", + raw: "2", + value: 2, + + range: [36, 37], + loc: { + start: { column: 24, line: 2 }, + end: { column: 25, line: 2 }, + }, + }, + + range: [14, 38], + loc: { + start: { column: 2, line: 2 }, + end: { column: 26, line: 2 }, + }, + }, + ], + + range: [10, 40], + loc: { + start: { column: 10, line: 1 }, + end: { column: 1, line: 3 }, + }, + }, + id: Identifier { + type: "Identifier", + name: "Foo", + + range: [6, 9], + loc: { + start: { column: 6, line: 1 }, + end: { column: 9, line: 1 }, + }, + }, + superClass: null, + + range: [0, 40], + loc: { + start: { column: 0, line: 1 }, + end: { column: 1, line: 3 }, + }, + }, + ], + sourceType: "script", + + range: [0, 41], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 4 }, + }, +} +`; diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-static/snapshots/2-TSESTree-Tokens.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-static/snapshots/2-TSESTree-Tokens.shot new file mode 100644 index 00000000000..245c071ee55 --- /dev/null +++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-static/snapshots/2-TSESTree-Tokens.shot @@ -0,0 +1,106 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures element AccessorProperty modifier-static TSESTree - Tokens 1`] = ` +Array [ + Keyword { + type: "Keyword", + value: "class", + + 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 }, + }, + }, + Keyword { + type: "Keyword", + value: "static", + + range: [14, 20], + loc: { + start: { column: 2, line: 2 }, + end: { column: 8, line: 2 }, + }, + }, + Identifier { + type: "Identifier", + value: "accessor", + + range: [21, 29], + loc: { + start: { column: 9, line: 2 }, + end: { column: 17, line: 2 }, + }, + }, + Identifier { + type: "Identifier", + value: "foo", + + range: [30, 33], + loc: { + start: { column: 18, line: 2 }, + end: { column: 21, line: 2 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "=", + + range: [34, 35], + loc: { + start: { column: 22, line: 2 }, + end: { column: 23, line: 2 }, + }, + }, + Numeric { + type: "Numeric", + value: "2", + + range: [36, 37], + loc: { + start: { column: 24, line: 2 }, + end: { column: 25, line: 2 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ";", + + range: [37, 38], + loc: { + start: { column: 25, line: 2 }, + end: { column: 26, line: 2 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "}", + + range: [39, 40], + loc: { + start: { column: 0, line: 3 }, + end: { column: 1, line: 3 }, + }, + }, +] +`; diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-static/snapshots/3-Babel-AST.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-static/snapshots/3-Babel-AST.shot new file mode 100644 index 00000000000..917914d80fb --- /dev/null +++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-static/snapshots/3-Babel-AST.shot @@ -0,0 +1,79 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures element AccessorProperty modifier-static Babel - AST 1`] = ` +Program { + type: "Program", + body: Array [ + ClassDeclaration { + type: "ClassDeclaration", + body: ClassBody { + type: "ClassBody", + body: Array [ + ClassAccessorProperty { + type: "ClassAccessorProperty", + computed: false, + key: Identifier { + type: "Identifier", + name: "foo", + + range: [30, 33], + loc: { + start: { column: 18, line: 2 }, + end: { column: 21, line: 2 }, + }, + }, + static: true, + value: Literal { + type: "Literal", + raw: "2", + value: 2, + + range: [36, 37], + loc: { + start: { column: 24, line: 2 }, + end: { column: 25, line: 2 }, + }, + }, + + range: [14, 38], + loc: { + start: { column: 2, line: 2 }, + end: { column: 26, line: 2 }, + }, + }, + ], + + range: [10, 40], + loc: { + start: { column: 10, line: 1 }, + end: { column: 1, line: 3 }, + }, + }, + id: Identifier { + type: "Identifier", + name: "Foo", + + range: [6, 9], + loc: { + start: { column: 6, line: 1 }, + end: { column: 9, line: 1 }, + }, + }, + superClass: null, + + range: [0, 40], + loc: { + start: { column: 0, line: 1 }, + end: { column: 1, line: 3 }, + }, + }, + ], + sourceType: "script", + + range: [0, 41], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 4 }, + }, +} +`; diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-static/snapshots/4-Babel-Tokens.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-static/snapshots/4-Babel-Tokens.shot new file mode 100644 index 00000000000..64b2cf04408 --- /dev/null +++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-static/snapshots/4-Babel-Tokens.shot @@ -0,0 +1,106 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures element AccessorProperty modifier-static Babel - Tokens 1`] = ` +Array [ + Keyword { + type: "Keyword", + value: "class", + + 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 }, + }, + }, + Keyword { + type: "Keyword", + value: "static", + + range: [14, 20], + loc: { + start: { column: 2, line: 2 }, + end: { column: 8, line: 2 }, + }, + }, + Identifier { + type: "Identifier", + value: "accessor", + + range: [21, 29], + loc: { + start: { column: 9, line: 2 }, + end: { column: 17, line: 2 }, + }, + }, + Identifier { + type: "Identifier", + value: "foo", + + range: [30, 33], + loc: { + start: { column: 18, line: 2 }, + end: { column: 21, line: 2 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "=", + + range: [34, 35], + loc: { + start: { column: 22, line: 2 }, + end: { column: 23, line: 2 }, + }, + }, + Numeric { + type: "Numeric", + value: "2", + + range: [36, 37], + loc: { + start: { column: 24, line: 2 }, + end: { column: 25, line: 2 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ";", + + range: [37, 38], + loc: { + start: { column: 25, line: 2 }, + end: { column: 26, line: 2 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "}", + + range: [39, 40], + loc: { + start: { column: 0, line: 3 }, + end: { column: 1, line: 3 }, + }, + }, +] +`; diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-static/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-static/snapshots/5-AST-Alignment-AST.shot new file mode 100644 index 00000000000..c5c6c8589ee --- /dev/null +++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-static/snapshots/5-AST-Alignment-AST.shot @@ -0,0 +1,87 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures element AccessorProperty modifier-static AST Alignment - AST 1`] = ` +"Snapshot Diff: +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + ClassDeclaration { + type: 'ClassDeclaration', + body: ClassBody { + type: 'ClassBody', + body: Array [ +- AccessorProperty { +- type: 'AccessorProperty', ++ ClassAccessorProperty { ++ type: 'ClassAccessorProperty', + computed: false, +- declare: false, + key: Identifier { + type: 'Identifier', + name: 'foo', + + range: [30, 33], + loc: { + start: { column: 18, line: 2 }, + end: { column: 21, line: 2 }, + }, + }, +- override: false, + static: true, + value: Literal { + type: 'Literal', + raw: '2', + value: 2, + + range: [36, 37], + loc: { + start: { column: 24, line: 2 }, + end: { column: 25, line: 2 }, + }, + }, + + range: [14, 38], + loc: { + start: { column: 2, line: 2 }, + end: { column: 26, line: 2 }, + }, + }, + ], + + range: [10, 40], + loc: { + start: { column: 10, line: 1 }, + end: { column: 1, line: 3 }, + }, + }, + id: Identifier { + type: 'Identifier', + name: 'Foo', + + range: [6, 9], + loc: { + start: { column: 6, line: 1 }, + end: { column: 9, line: 1 }, + }, + }, + superClass: null, + + range: [0, 40], + loc: { + start: { column: 0, line: 1 }, + end: { column: 1, line: 3 }, + }, + }, + ], + sourceType: 'script', + + range: [0, 41], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 4 }, + }, + }" +`; diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-static/snapshots/6-AST-Alignment-Tokens.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-static/snapshots/6-AST-Alignment-Tokens.shot new file mode 100644 index 00000000000..72680d23ee5 --- /dev/null +++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-static/snapshots/6-AST-Alignment-Tokens.shot @@ -0,0 +1,6 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures element AccessorProperty modifier-static AST Alignment - Token 1`] = ` +"Snapshot Diff: +Compared values have no visual difference." +`; diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/no-annotation-no-value/fixture.ts b/packages/ast-spec/src/element/AccessorProperty/fixtures/no-annotation-no-value/fixture.ts new file mode 100644 index 00000000000..18afaa86480 --- /dev/null +++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/no-annotation-no-value/fixture.ts @@ -0,0 +1,3 @@ +class Foo { + accessor prop; +} diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/no-annotation-no-value/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/no-annotation-no-value/snapshots/1-TSESTree-AST.shot new file mode 100644 index 00000000000..a5341fd2f70 --- /dev/null +++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/no-annotation-no-value/snapshots/1-TSESTree-AST.shot @@ -0,0 +1,71 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures element AccessorProperty no-annotation-no-value TSESTree - AST 1`] = ` +Program { + type: "Program", + body: Array [ + ClassDeclaration { + type: "ClassDeclaration", + body: ClassBody { + type: "ClassBody", + body: Array [ + AccessorProperty { + type: "AccessorProperty", + computed: false, + declare: false, + key: Identifier { + type: "Identifier", + name: "prop", + + range: [23, 27], + loc: { + start: { column: 11, line: 2 }, + end: { column: 15, line: 2 }, + }, + }, + override: false, + static: false, + value: null, + + range: [14, 28], + loc: { + start: { column: 2, line: 2 }, + end: { column: 16, line: 2 }, + }, + }, + ], + + range: [10, 30], + loc: { + start: { column: 10, line: 1 }, + end: { column: 1, line: 3 }, + }, + }, + id: Identifier { + type: "Identifier", + name: "Foo", + + range: [6, 9], + loc: { + start: { column: 6, line: 1 }, + end: { column: 9, line: 1 }, + }, + }, + superClass: null, + + range: [0, 30], + loc: { + start: { column: 0, line: 1 }, + end: { column: 1, line: 3 }, + }, + }, + ], + sourceType: "script", + + range: [0, 31], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 4 }, + }, +} +`; diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/no-annotation-no-value/snapshots/2-TSESTree-Tokens.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/no-annotation-no-value/snapshots/2-TSESTree-Tokens.shot new file mode 100644 index 00000000000..b28c76ee39c --- /dev/null +++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/no-annotation-no-value/snapshots/2-TSESTree-Tokens.shot @@ -0,0 +1,76 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures element AccessorProperty no-annotation-no-value TSESTree - Tokens 1`] = ` +Array [ + Keyword { + type: "Keyword", + value: "class", + + 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 }, + }, + }, + Identifier { + type: "Identifier", + value: "accessor", + + range: [14, 22], + loc: { + start: { column: 2, line: 2 }, + end: { column: 10, line: 2 }, + }, + }, + Identifier { + type: "Identifier", + value: "prop", + + range: [23, 27], + loc: { + start: { column: 11, line: 2 }, + end: { column: 15, line: 2 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ";", + + range: [27, 28], + loc: { + start: { column: 15, line: 2 }, + end: { column: 16, line: 2 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "}", + + range: [29, 30], + loc: { + start: { column: 0, line: 3 }, + end: { column: 1, line: 3 }, + }, + }, +] +`; diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/no-annotation-no-value/snapshots/3-Babel-AST.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/no-annotation-no-value/snapshots/3-Babel-AST.shot new file mode 100644 index 00000000000..7cf14ad2c92 --- /dev/null +++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/no-annotation-no-value/snapshots/3-Babel-AST.shot @@ -0,0 +1,69 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures element AccessorProperty no-annotation-no-value Babel - AST 1`] = ` +Program { + type: "Program", + body: Array [ + ClassDeclaration { + type: "ClassDeclaration", + body: ClassBody { + type: "ClassBody", + body: Array [ + ClassAccessorProperty { + type: "ClassAccessorProperty", + computed: false, + key: Identifier { + type: "Identifier", + name: "prop", + + range: [23, 27], + loc: { + start: { column: 11, line: 2 }, + end: { column: 15, line: 2 }, + }, + }, + static: false, + value: null, + + range: [14, 28], + loc: { + start: { column: 2, line: 2 }, + end: { column: 16, line: 2 }, + }, + }, + ], + + range: [10, 30], + loc: { + start: { column: 10, line: 1 }, + end: { column: 1, line: 3 }, + }, + }, + id: Identifier { + type: "Identifier", + name: "Foo", + + range: [6, 9], + loc: { + start: { column: 6, line: 1 }, + end: { column: 9, line: 1 }, + }, + }, + superClass: null, + + range: [0, 30], + loc: { + start: { column: 0, line: 1 }, + end: { column: 1, line: 3 }, + }, + }, + ], + sourceType: "script", + + range: [0, 31], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 4 }, + }, +} +`; diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/no-annotation-no-value/snapshots/4-Babel-Tokens.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/no-annotation-no-value/snapshots/4-Babel-Tokens.shot new file mode 100644 index 00000000000..46747c3659a --- /dev/null +++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/no-annotation-no-value/snapshots/4-Babel-Tokens.shot @@ -0,0 +1,76 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures element AccessorProperty no-annotation-no-value Babel - Tokens 1`] = ` +Array [ + Keyword { + type: "Keyword", + value: "class", + + 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 }, + }, + }, + Identifier { + type: "Identifier", + value: "accessor", + + range: [14, 22], + loc: { + start: { column: 2, line: 2 }, + end: { column: 10, line: 2 }, + }, + }, + Identifier { + type: "Identifier", + value: "prop", + + range: [23, 27], + loc: { + start: { column: 11, line: 2 }, + end: { column: 15, line: 2 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ";", + + range: [27, 28], + loc: { + start: { column: 15, line: 2 }, + end: { column: 16, line: 2 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "}", + + range: [29, 30], + loc: { + start: { column: 0, line: 3 }, + end: { column: 1, line: 3 }, + }, + }, +] +`; diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/no-annotation-no-value/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/no-annotation-no-value/snapshots/5-AST-Alignment-AST.shot new file mode 100644 index 00000000000..b08e790e91d --- /dev/null +++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/no-annotation-no-value/snapshots/5-AST-Alignment-AST.shot @@ -0,0 +1,77 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures element AccessorProperty no-annotation-no-value AST Alignment - AST 1`] = ` +"Snapshot Diff: +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + ClassDeclaration { + type: 'ClassDeclaration', + body: ClassBody { + type: 'ClassBody', + body: Array [ +- AccessorProperty { +- type: 'AccessorProperty', ++ ClassAccessorProperty { ++ type: 'ClassAccessorProperty', + computed: false, +- declare: false, + key: Identifier { + type: 'Identifier', + name: 'prop', + + range: [23, 27], + loc: { + start: { column: 11, line: 2 }, + end: { column: 15, line: 2 }, + }, + }, +- override: false, + static: false, + value: null, + + range: [14, 28], + loc: { + start: { column: 2, line: 2 }, + end: { column: 16, line: 2 }, + }, + }, + ], + + range: [10, 30], + loc: { + start: { column: 10, line: 1 }, + end: { column: 1, line: 3 }, + }, + }, + id: Identifier { + type: 'Identifier', + name: 'Foo', + + range: [6, 9], + loc: { + start: { column: 6, line: 1 }, + end: { column: 9, line: 1 }, + }, + }, + superClass: null, + + range: [0, 30], + loc: { + start: { column: 0, line: 1 }, + end: { column: 1, line: 3 }, + }, + }, + ], + sourceType: 'script', + + range: [0, 31], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 4 }, + }, + }" +`; diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/no-annotation-no-value/snapshots/6-AST-Alignment-Tokens.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/no-annotation-no-value/snapshots/6-AST-Alignment-Tokens.shot new file mode 100644 index 00000000000..3a66da8c8d9 --- /dev/null +++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/no-annotation-no-value/snapshots/6-AST-Alignment-Tokens.shot @@ -0,0 +1,6 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures element AccessorProperty no-annotation-no-value AST Alignment - Token 1`] = ` +"Snapshot Diff: +Compared values have no visual difference." +`; diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/no-annotation-with-value/fixture.ts b/packages/ast-spec/src/element/AccessorProperty/fixtures/no-annotation-with-value/fixture.ts new file mode 100644 index 00000000000..4ac51cccf92 --- /dev/null +++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/no-annotation-with-value/fixture.ts @@ -0,0 +1,3 @@ +class Foo { + accessor prop = 'str'; +} diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/no-annotation-with-value/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/no-annotation-with-value/snapshots/1-TSESTree-AST.shot new file mode 100644 index 00000000000..0cc63f22486 --- /dev/null +++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/no-annotation-with-value/snapshots/1-TSESTree-AST.shot @@ -0,0 +1,81 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures element AccessorProperty no-annotation-with-value TSESTree - AST 1`] = ` +Program { + type: "Program", + body: Array [ + ClassDeclaration { + type: "ClassDeclaration", + body: ClassBody { + type: "ClassBody", + body: Array [ + AccessorProperty { + type: "AccessorProperty", + computed: false, + declare: false, + key: Identifier { + type: "Identifier", + name: "prop", + + range: [23, 27], + loc: { + start: { column: 11, line: 2 }, + end: { column: 15, line: 2 }, + }, + }, + override: false, + static: false, + value: Literal { + type: "Literal", + raw: "'str'", + value: "str", + + range: [30, 35], + loc: { + start: { column: 18, line: 2 }, + end: { column: 23, line: 2 }, + }, + }, + + range: [14, 36], + loc: { + start: { column: 2, line: 2 }, + end: { column: 24, line: 2 }, + }, + }, + ], + + range: [10, 38], + loc: { + start: { column: 10, line: 1 }, + end: { column: 1, line: 3 }, + }, + }, + id: Identifier { + type: "Identifier", + name: "Foo", + + range: [6, 9], + loc: { + start: { column: 6, line: 1 }, + end: { column: 9, line: 1 }, + }, + }, + superClass: null, + + range: [0, 38], + loc: { + start: { column: 0, line: 1 }, + end: { column: 1, line: 3 }, + }, + }, + ], + sourceType: "script", + + range: [0, 39], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 4 }, + }, +} +`; diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/no-annotation-with-value/snapshots/2-TSESTree-Tokens.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/no-annotation-with-value/snapshots/2-TSESTree-Tokens.shot new file mode 100644 index 00000000000..e98ce8a1ccf --- /dev/null +++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/no-annotation-with-value/snapshots/2-TSESTree-Tokens.shot @@ -0,0 +1,96 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures element AccessorProperty no-annotation-with-value TSESTree - Tokens 1`] = ` +Array [ + Keyword { + type: "Keyword", + value: "class", + + 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 }, + }, + }, + Identifier { + type: "Identifier", + value: "accessor", + + range: [14, 22], + loc: { + start: { column: 2, line: 2 }, + end: { column: 10, line: 2 }, + }, + }, + Identifier { + type: "Identifier", + value: "prop", + + range: [23, 27], + loc: { + start: { column: 11, line: 2 }, + end: { column: 15, line: 2 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "=", + + range: [28, 29], + loc: { + start: { column: 16, line: 2 }, + end: { column: 17, line: 2 }, + }, + }, + String { + type: "String", + value: "'str'", + + range: [30, 35], + loc: { + start: { column: 18, line: 2 }, + end: { column: 23, line: 2 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ";", + + range: [35, 36], + loc: { + start: { column: 23, line: 2 }, + end: { column: 24, line: 2 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "}", + + range: [37, 38], + loc: { + start: { column: 0, line: 3 }, + end: { column: 1, line: 3 }, + }, + }, +] +`; diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/no-annotation-with-value/snapshots/3-Babel-AST.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/no-annotation-with-value/snapshots/3-Babel-AST.shot new file mode 100644 index 00000000000..7c1c8d024f9 --- /dev/null +++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/no-annotation-with-value/snapshots/3-Babel-AST.shot @@ -0,0 +1,79 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures element AccessorProperty no-annotation-with-value Babel - AST 1`] = ` +Program { + type: "Program", + body: Array [ + ClassDeclaration { + type: "ClassDeclaration", + body: ClassBody { + type: "ClassBody", + body: Array [ + ClassAccessorProperty { + type: "ClassAccessorProperty", + computed: false, + key: Identifier { + type: "Identifier", + name: "prop", + + range: [23, 27], + loc: { + start: { column: 11, line: 2 }, + end: { column: 15, line: 2 }, + }, + }, + static: false, + value: Literal { + type: "Literal", + raw: "'str'", + value: "str", + + range: [30, 35], + loc: { + start: { column: 18, line: 2 }, + end: { column: 23, line: 2 }, + }, + }, + + range: [14, 36], + loc: { + start: { column: 2, line: 2 }, + end: { column: 24, line: 2 }, + }, + }, + ], + + range: [10, 38], + loc: { + start: { column: 10, line: 1 }, + end: { column: 1, line: 3 }, + }, + }, + id: Identifier { + type: "Identifier", + name: "Foo", + + range: [6, 9], + loc: { + start: { column: 6, line: 1 }, + end: { column: 9, line: 1 }, + }, + }, + superClass: null, + + range: [0, 38], + loc: { + start: { column: 0, line: 1 }, + end: { column: 1, line: 3 }, + }, + }, + ], + sourceType: "script", + + range: [0, 39], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 4 }, + }, +} +`; diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/no-annotation-with-value/snapshots/4-Babel-Tokens.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/no-annotation-with-value/snapshots/4-Babel-Tokens.shot new file mode 100644 index 00000000000..fbe3b7015a8 --- /dev/null +++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/no-annotation-with-value/snapshots/4-Babel-Tokens.shot @@ -0,0 +1,96 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures element AccessorProperty no-annotation-with-value Babel - Tokens 1`] = ` +Array [ + Keyword { + type: "Keyword", + value: "class", + + 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 }, + }, + }, + Identifier { + type: "Identifier", + value: "accessor", + + range: [14, 22], + loc: { + start: { column: 2, line: 2 }, + end: { column: 10, line: 2 }, + }, + }, + Identifier { + type: "Identifier", + value: "prop", + + range: [23, 27], + loc: { + start: { column: 11, line: 2 }, + end: { column: 15, line: 2 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "=", + + range: [28, 29], + loc: { + start: { column: 16, line: 2 }, + end: { column: 17, line: 2 }, + }, + }, + String { + type: "String", + value: "'str'", + + range: [30, 35], + loc: { + start: { column: 18, line: 2 }, + end: { column: 23, line: 2 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ";", + + range: [35, 36], + loc: { + start: { column: 23, line: 2 }, + end: { column: 24, line: 2 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "}", + + range: [37, 38], + loc: { + start: { column: 0, line: 3 }, + end: { column: 1, line: 3 }, + }, + }, +] +`; diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/no-annotation-with-value/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/no-annotation-with-value/snapshots/5-AST-Alignment-AST.shot new file mode 100644 index 00000000000..2d4b943581c --- /dev/null +++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/no-annotation-with-value/snapshots/5-AST-Alignment-AST.shot @@ -0,0 +1,87 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures element AccessorProperty no-annotation-with-value AST Alignment - AST 1`] = ` +"Snapshot Diff: +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + ClassDeclaration { + type: 'ClassDeclaration', + body: ClassBody { + type: 'ClassBody', + body: Array [ +- AccessorProperty { +- type: 'AccessorProperty', ++ ClassAccessorProperty { ++ type: 'ClassAccessorProperty', + computed: false, +- declare: false, + key: Identifier { + type: 'Identifier', + name: 'prop', + + range: [23, 27], + loc: { + start: { column: 11, line: 2 }, + end: { column: 15, line: 2 }, + }, + }, +- override: false, + static: false, + value: Literal { + type: 'Literal', + raw: '\\\\'str\\\\'', + value: 'str', + + range: [30, 35], + loc: { + start: { column: 18, line: 2 }, + end: { column: 23, line: 2 }, + }, + }, + + range: [14, 36], + loc: { + start: { column: 2, line: 2 }, + end: { column: 24, line: 2 }, + }, + }, + ], + + range: [10, 38], + loc: { + start: { column: 10, line: 1 }, + end: { column: 1, line: 3 }, + }, + }, + id: Identifier { + type: 'Identifier', + name: 'Foo', + + range: [6, 9], + loc: { + start: { column: 6, line: 1 }, + end: { column: 9, line: 1 }, + }, + }, + superClass: null, + + range: [0, 38], + loc: { + start: { column: 0, line: 1 }, + end: { column: 1, line: 3 }, + }, + }, + ], + sourceType: 'script', + + range: [0, 39], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 4 }, + }, + }" +`; diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/no-annotation-with-value/snapshots/6-AST-Alignment-Tokens.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/no-annotation-with-value/snapshots/6-AST-Alignment-Tokens.shot new file mode 100644 index 00000000000..01d2c94e685 --- /dev/null +++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/no-annotation-with-value/snapshots/6-AST-Alignment-Tokens.shot @@ -0,0 +1,6 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures element AccessorProperty no-annotation-with-value AST Alignment - Token 1`] = ` +"Snapshot Diff: +Compared values have no visual difference." +`; diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/with-annotation-no-value/fixture.ts b/packages/ast-spec/src/element/AccessorProperty/fixtures/with-annotation-no-value/fixture.ts new file mode 100644 index 00000000000..1ec3f55869e --- /dev/null +++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/with-annotation-no-value/fixture.ts @@ -0,0 +1,3 @@ +class Foo { + accessor prop: string; +} diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/with-annotation-no-value/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/with-annotation-no-value/snapshots/1-TSESTree-AST.shot new file mode 100644 index 00000000000..be65f1b2fcd --- /dev/null +++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/with-annotation-no-value/snapshots/1-TSESTree-AST.shot @@ -0,0 +1,89 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures element AccessorProperty with-annotation-no-value TSESTree - AST 1`] = ` +Program { + type: "Program", + body: Array [ + ClassDeclaration { + type: "ClassDeclaration", + body: ClassBody { + type: "ClassBody", + body: Array [ + AccessorProperty { + type: "AccessorProperty", + computed: false, + declare: false, + key: Identifier { + type: "Identifier", + name: "prop", + + range: [23, 27], + loc: { + start: { column: 11, line: 2 }, + end: { column: 15, line: 2 }, + }, + }, + override: false, + static: false, + typeAnnotation: TSTypeAnnotation { + type: "TSTypeAnnotation", + typeAnnotation: TSStringKeyword { + type: "TSStringKeyword", + + range: [29, 35], + loc: { + start: { column: 17, line: 2 }, + end: { column: 23, line: 2 }, + }, + }, + + range: [27, 35], + loc: { + start: { column: 15, line: 2 }, + end: { column: 23, line: 2 }, + }, + }, + value: null, + + range: [14, 36], + loc: { + start: { column: 2, line: 2 }, + end: { column: 24, line: 2 }, + }, + }, + ], + + range: [10, 38], + loc: { + start: { column: 10, line: 1 }, + end: { column: 1, line: 3 }, + }, + }, + id: Identifier { + type: "Identifier", + name: "Foo", + + range: [6, 9], + loc: { + start: { column: 6, line: 1 }, + end: { column: 9, line: 1 }, + }, + }, + superClass: null, + + range: [0, 38], + loc: { + start: { column: 0, line: 1 }, + end: { column: 1, line: 3 }, + }, + }, + ], + sourceType: "script", + + range: [0, 39], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 4 }, + }, +} +`; diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/with-annotation-no-value/snapshots/2-TSESTree-Tokens.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/with-annotation-no-value/snapshots/2-TSESTree-Tokens.shot new file mode 100644 index 00000000000..3787e2a78f8 --- /dev/null +++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/with-annotation-no-value/snapshots/2-TSESTree-Tokens.shot @@ -0,0 +1,96 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures element AccessorProperty with-annotation-no-value TSESTree - Tokens 1`] = ` +Array [ + Keyword { + type: "Keyword", + value: "class", + + 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 }, + }, + }, + Identifier { + type: "Identifier", + value: "accessor", + + range: [14, 22], + loc: { + start: { column: 2, line: 2 }, + end: { column: 10, line: 2 }, + }, + }, + Identifier { + type: "Identifier", + value: "prop", + + range: [23, 27], + loc: { + start: { column: 11, line: 2 }, + end: { column: 15, line: 2 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ":", + + range: [27, 28], + loc: { + start: { column: 15, line: 2 }, + end: { column: 16, line: 2 }, + }, + }, + Identifier { + type: "Identifier", + value: "string", + + range: [29, 35], + loc: { + start: { column: 17, line: 2 }, + end: { column: 23, line: 2 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ";", + + range: [35, 36], + loc: { + start: { column: 23, line: 2 }, + end: { column: 24, line: 2 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "}", + + range: [37, 38], + loc: { + start: { column: 0, line: 3 }, + end: { column: 1, line: 3 }, + }, + }, +] +`; diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/with-annotation-with-value/fixture.ts b/packages/ast-spec/src/element/AccessorProperty/fixtures/with-annotation-with-value/fixture.ts new file mode 100644 index 00000000000..0fde6c3138c --- /dev/null +++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/with-annotation-with-value/fixture.ts @@ -0,0 +1,3 @@ +class Foo { + accessor prop: string = 'str'; +} diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/with-annotation-with-value/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/with-annotation-with-value/snapshots/1-TSESTree-AST.shot new file mode 100644 index 00000000000..9e9448b46f1 --- /dev/null +++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/with-annotation-with-value/snapshots/1-TSESTree-AST.shot @@ -0,0 +1,99 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures element AccessorProperty with-annotation-with-value TSESTree - AST 1`] = ` +Program { + type: "Program", + body: Array [ + ClassDeclaration { + type: "ClassDeclaration", + body: ClassBody { + type: "ClassBody", + body: Array [ + AccessorProperty { + type: "AccessorProperty", + computed: false, + declare: false, + key: Identifier { + type: "Identifier", + name: "prop", + + range: [23, 27], + loc: { + start: { column: 11, line: 2 }, + end: { column: 15, line: 2 }, + }, + }, + override: false, + static: false, + typeAnnotation: TSTypeAnnotation { + type: "TSTypeAnnotation", + typeAnnotation: TSStringKeyword { + type: "TSStringKeyword", + + range: [29, 35], + loc: { + start: { column: 17, line: 2 }, + end: { column: 23, line: 2 }, + }, + }, + + range: [27, 35], + loc: { + start: { column: 15, line: 2 }, + end: { column: 23, line: 2 }, + }, + }, + value: Literal { + type: "Literal", + raw: "'str'", + value: "str", + + range: [38, 43], + loc: { + start: { column: 26, line: 2 }, + end: { column: 31, line: 2 }, + }, + }, + + range: [14, 44], + loc: { + start: { column: 2, line: 2 }, + end: { column: 32, line: 2 }, + }, + }, + ], + + range: [10, 46], + loc: { + start: { column: 10, line: 1 }, + end: { column: 1, line: 3 }, + }, + }, + id: Identifier { + type: "Identifier", + name: "Foo", + + range: [6, 9], + loc: { + start: { column: 6, line: 1 }, + end: { column: 9, line: 1 }, + }, + }, + superClass: null, + + range: [0, 46], + loc: { + start: { column: 0, line: 1 }, + end: { column: 1, line: 3 }, + }, + }, + ], + sourceType: "script", + + range: [0, 47], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 4 }, + }, +} +`; diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/with-annotation-with-value/snapshots/2-TSESTree-Tokens.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/with-annotation-with-value/snapshots/2-TSESTree-Tokens.shot new file mode 100644 index 00000000000..2ee9140971c --- /dev/null +++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/with-annotation-with-value/snapshots/2-TSESTree-Tokens.shot @@ -0,0 +1,116 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures element AccessorProperty with-annotation-with-value TSESTree - Tokens 1`] = ` +Array [ + Keyword { + type: "Keyword", + value: "class", + + 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 }, + }, + }, + Identifier { + type: "Identifier", + value: "accessor", + + range: [14, 22], + loc: { + start: { column: 2, line: 2 }, + end: { column: 10, line: 2 }, + }, + }, + Identifier { + type: "Identifier", + value: "prop", + + range: [23, 27], + loc: { + start: { column: 11, line: 2 }, + end: { column: 15, line: 2 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ":", + + range: [27, 28], + loc: { + start: { column: 15, line: 2 }, + end: { column: 16, line: 2 }, + }, + }, + Identifier { + type: "Identifier", + value: "string", + + range: [29, 35], + loc: { + start: { column: 17, line: 2 }, + end: { column: 23, line: 2 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "=", + + range: [36, 37], + loc: { + start: { column: 24, line: 2 }, + end: { column: 25, line: 2 }, + }, + }, + String { + type: "String", + value: "'str'", + + range: [38, 43], + loc: { + start: { column: 26, line: 2 }, + end: { column: 31, line: 2 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ";", + + range: [43, 44], + loc: { + start: { column: 31, line: 2 }, + end: { column: 32, line: 2 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "}", + + range: [45, 46], + loc: { + start: { column: 0, line: 3 }, + end: { column: 1, line: 3 }, + }, + }, +] +`; diff --git a/packages/ast-spec/src/element/TSAbstractAccessorProperty/spec.ts b/packages/ast-spec/src/element/TSAbstractAccessorProperty/spec.ts new file mode 100644 index 00000000000..6ca44e44183 --- /dev/null +++ b/packages/ast-spec/src/element/TSAbstractAccessorProperty/spec.ts @@ -0,0 +1,22 @@ +import type { AST_NODE_TYPES } from '../../ast-node-types'; +import type { + PropertyDefinitionComputedNameBase, + PropertyDefinitionNonComputedNameBase, +} from '../../base/PropertyDefinitionBase'; + +export interface TSAbstractAccessorPropertyComputedName + extends PropertyDefinitionComputedNameBase { + type: AST_NODE_TYPES.TSAbstractAccessorProperty; + value: null; +} + +export interface TSAbstractAccessorPropertyNonComputedName + // this does not extend ClassPropertyDefinitionNonComputedNameBase because abstract private names are not allowed + extends PropertyDefinitionNonComputedNameBase { + type: AST_NODE_TYPES.TSAbstractAccessorProperty; + value: null; +} + +export type TSAbstractAccessorProperty = + | TSAbstractAccessorPropertyComputedName + | TSAbstractAccessorPropertyNonComputedName; diff --git a/packages/ast-spec/src/element/spec.ts b/packages/ast-spec/src/element/spec.ts index 45c8374b659..eeecc41028c 100644 --- a/packages/ast-spec/src/element/spec.ts +++ b/packages/ast-spec/src/element/spec.ts @@ -4,6 +4,7 @@ export * from './MethodDefinition/spec'; export * from './Property/spec'; export * from './SpreadElement/spec'; export * from './StaticBlock/spec'; +export * from './TSAbstractAccessorProperty/spec'; export * from './TSAbstractPropertyDefinition/spec'; export * from './TSAbstractMethodDefinition/spec'; export * from './TSCallSignatureDeclaration/spec'; diff --git a/packages/ast-spec/src/unions/ClassElement.ts b/packages/ast-spec/src/unions/ClassElement.ts index 459e62542d1..21fba7babcf 100644 --- a/packages/ast-spec/src/unions/ClassElement.ts +++ b/packages/ast-spec/src/unions/ClassElement.ts @@ -1,7 +1,8 @@ +import type { AccessorProperty } from '../element/AccessorProperty/spec'; import type { MethodDefinition } from '../element/MethodDefinition/spec'; import type { PropertyDefinition } from '../element/PropertyDefinition/spec'; -import type { AccessorProperty } from '../element/spec'; import type { StaticBlock } from '../element/StaticBlock/spec'; +import type { TSAbstractAccessorProperty } from '../element/TSAbstractAccessorProperty/spec'; import type { TSAbstractMethodDefinition } from '../element/TSAbstractMethodDefinition/spec'; import type { TSAbstractPropertyDefinition } from '../element/TSAbstractPropertyDefinition/spec'; import type { TSIndexSignature } from '../element/TSIndexSignature/spec'; @@ -11,6 +12,7 @@ export type ClassElement = | MethodDefinition | PropertyDefinition | StaticBlock + | TSAbstractAccessorProperty | TSAbstractMethodDefinition | TSAbstractPropertyDefinition | TSIndexSignature; diff --git a/packages/ast-spec/src/unions/Node.ts b/packages/ast-spec/src/unions/Node.ts index cc08b8842d8..b0952e0e186 100644 --- a/packages/ast-spec/src/unions/Node.ts +++ b/packages/ast-spec/src/unions/Node.ts @@ -18,6 +18,7 @@ import type { Property } from '../element/Property/spec'; import type { PropertyDefinition } from '../element/PropertyDefinition/spec'; import type { SpreadElement } from '../element/SpreadElement/spec'; import type { StaticBlock } from '../element/StaticBlock/spec'; +import type { TSAbstractAccessorProperty } from '../element/TSAbstractAccessorProperty/spec'; import type { TSAbstractMethodDefinition } from '../element/TSAbstractMethodDefinition/spec'; import type { TSAbstractPropertyDefinition } from '../element/TSAbstractPropertyDefinition/spec'; import type { TSCallSignatureDeclaration } from '../element/TSCallSignatureDeclaration/spec'; @@ -253,6 +254,7 @@ export type Node = | ThisExpression | ThrowStatement | TryStatement + | TSAbstractAccessorProperty | TSAbstractKeyword | TSAbstractMethodDefinition | TSAbstractPropertyDefinition diff --git a/packages/ast-spec/tests/fixtures-with-differences-ast.shot b/packages/ast-spec/tests/fixtures-with-differences-ast.shot index beff8134d6e..bc403cfd80f 100644 --- a/packages/ast-spec/tests/fixtures-with-differences-ast.shot +++ b/packages/ast-spec/tests/fixtures-with-differences-ast.shot @@ -24,6 +24,18 @@ Set { "declaration/TSInterfaceDeclaration/fixtures/type-param-one/fixture.ts", "declaration/TSTypeAliasDeclaration/fixtures/type-param-many/fixture.ts", "declaration/TSTypeAliasDeclaration/fixtures/type-param-one/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", + "element/AccessorProperty/fixtures/key-private/fixture.ts", + "element/AccessorProperty/fixtures/key-string/fixture.ts", + "element/AccessorProperty/fixtures/modifier-private/fixture.ts", + "element/AccessorProperty/fixtures/modifier-protected/fixture.ts", + "element/AccessorProperty/fixtures/modifier-public/fixture.ts", + "element/AccessorProperty/fixtures/modifier-readonly/fixture.ts", + "element/AccessorProperty/fixtures/modifier-static/fixture.ts", + "element/AccessorProperty/fixtures/no-annotation-no-value/fixture.ts", + "element/AccessorProperty/fixtures/no-annotation-with-value/fixture.ts", "expression/TSSatisfiesExpression/fixtures/arrow-func-with-parentheses/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 ee92fc9b050..c9796a38459 100644 --- a/packages/ast-spec/tests/fixtures-with-differences-tokens.shot +++ b/packages/ast-spec/tests/fixtures-with-differences-tokens.shot @@ -22,5 +22,9 @@ Set { "declaration/VariableDeclaration/fixtures/let-with-value/fixture.ts", "declaration/VariableDeclaration/fixtures/let-without-value/fixture.ts", "declaration/VariableDeclaration/fixtures/multiple-declarations/fixture.ts", + "element/AccessorProperty/fixtures/key-private/fixture.ts", + "element/AccessorProperty/fixtures/modifier-private/fixture.ts", + "element/AccessorProperty/fixtures/modifier-protected/fixture.ts", + "element/AccessorProperty/fixtures/modifier-public/fixture.ts", } `; diff --git a/packages/ast-spec/tests/util/parsers/babel.ts b/packages/ast-spec/tests/util/parsers/babel.ts index e0d4268bbcc..5e874be85af 100644 --- a/packages/ast-spec/tests/util/parsers/babel.ts +++ b/packages/ast-spec/tests/util/parsers/babel.ts @@ -5,6 +5,7 @@ import type { Fixture, ParserResponse } from './parser-types'; import { ParserResponseType } from './parser-types'; const PLUGINS: ParserPlugin[] = [ + 'decoratorAutoAccessors', // TODO - enable classFeatures instead of classProperties when we support it // 'classFeatures', 'classProperties', diff --git a/packages/shared-fixtures/fixtures/typescript/basics/auto-accessor-1.src.ts b/packages/shared-fixtures/fixtures/typescript/basics/auto-accessor-1.src.ts deleted file mode 100644 index 0a57edb16a3..00000000000 --- a/packages/shared-fixtures/fixtures/typescript/basics/auto-accessor-1.src.ts +++ /dev/null @@ -1,6 +0,0 @@ -class C1 { - accessor a: any; - accessor b = 1; - static accessor c: any; - static accessor d = 2; -} diff --git a/packages/shared-fixtures/fixtures/typescript/basics/auto-accessor-2.src.ts b/packages/shared-fixtures/fixtures/typescript/basics/auto-accessor-2.src.ts deleted file mode 100644 index 944a2faaecf..00000000000 --- a/packages/shared-fixtures/fixtures/typescript/basics/auto-accessor-2.src.ts +++ /dev/null @@ -1,16 +0,0 @@ -class C1 { - accessor #a: any; - accessor #b = 1; - static accessor #c: any; - static accessor #d = 2; - - constructor() { - this.#a = 3; - this.#b = 4; - } - - static { - this.#c = 5; - this.#d = 6; - } -} diff --git a/packages/shared-fixtures/fixtures/typescript/basics/auto-accessor-3.src.ts b/packages/shared-fixtures/fixtures/typescript/basics/auto-accessor-3.src.ts deleted file mode 100644 index 0c61107fdbf..00000000000 --- a/packages/shared-fixtures/fixtures/typescript/basics/auto-accessor-3.src.ts +++ /dev/null @@ -1,6 +0,0 @@ -class C1 { - accessor "w": any; - accessor "x" = 1; - static accessor "y": any; - static accessor "z" = 2; -} diff --git a/packages/shared-fixtures/fixtures/typescript/basics/auto-accessor-4.src.ts b/packages/shared-fixtures/fixtures/typescript/basics/auto-accessor-4.src.ts deleted file mode 100644 index 5f33194031b..00000000000 --- a/packages/shared-fixtures/fixtures/typescript/basics/auto-accessor-4.src.ts +++ /dev/null @@ -1,6 +0,0 @@ -class C1 { - accessor 0: any; - accessor 1 = 1; - static accessor 2: any; - static accessor 3 = 2; -} diff --git a/packages/shared-fixtures/fixtures/typescript/basics/auto-accessor-5.src.ts b/packages/shared-fixtures/fixtures/typescript/basics/auto-accessor-5.src.ts deleted file mode 100644 index 8ab6c180543..00000000000 --- a/packages/shared-fixtures/fixtures/typescript/basics/auto-accessor-5.src.ts +++ /dev/null @@ -1,11 +0,0 @@ -class C1 { - accessor ["w"]: any; - accessor ["x"] = 1; - static accessor ["y"]: any; - static accessor ["z"] = 2; -} - -declare var f: any; -class C2 { - accessor [f()] = 1; -} diff --git a/packages/typescript-estree/src/convert.ts b/packages/typescript-estree/src/convert.ts index 30b49c13264..b21a42614da 100644 --- a/packages/typescript-estree/src/convert.ts +++ b/packages/typescript-estree/src/convert.ts @@ -1168,16 +1168,29 @@ export class Converter { case SyntaxKind.PropertyDeclaration: { const isAbstract = hasModifier(SyntaxKind.AbstractKeyword, node); const isAccessor = hasModifier(SyntaxKind.AccessorKeyword, node); + + // eslint-disable-next-line @typescript-eslint/explicit-function-return-type -- TODO - add ignore IIFE option + const type = (() => { + if (isAccessor) { + if (isAbstract) { + return AST_NODE_TYPES.TSAbstractAccessorProperty; + } + return AST_NODE_TYPES.AccessorProperty; + } + + if (isAbstract) { + return AST_NODE_TYPES.TSAbstractPropertyDefinition; + } + return AST_NODE_TYPES.PropertyDefinition; + })(); + const result = this.createNode< + | TSESTree.TSAbstractAccessorProperty | TSESTree.TSAbstractPropertyDefinition | TSESTree.PropertyDefinition | TSESTree.AccessorProperty >(node, { - type: isAbstract - ? AST_NODE_TYPES.TSAbstractPropertyDefinition - : isAccessor - ? AST_NODE_TYPES.AccessorProperty - : AST_NODE_TYPES.PropertyDefinition, + type, key: this.convertChild(node.name), value: isAbstract ? null : this.convertChild(node.initializer), computed: isComputedProperty(node.name), diff --git a/packages/typescript-estree/src/parseSettings/warnAboutTSVersion.ts b/packages/typescript-estree/src/parseSettings/warnAboutTSVersion.ts index 343e324307a..ad9a74157d6 100644 --- a/packages/typescript-estree/src/parseSettings/warnAboutTSVersion.ts +++ b/packages/typescript-estree/src/parseSettings/warnAboutTSVersion.ts @@ -12,7 +12,7 @@ const SUPPORTED_TYPESCRIPT_VERSIONS = '>=3.3.1 <5.0.0'; * The semver package will ignore prerelease ranges, and we don't want to explicitly document every one * List them all separately here, so we can automatically create the full string */ -const SUPPORTED_PRERELEASE_RANGES: string[] = ['4.9.2-rc']; +const SUPPORTED_PRERELEASE_RANGES: string[] = []; const ACTIVE_TYPESCRIPT_VERSION = ts.version; const isRunningSupportedTypeScriptVersion = semver.satisfies( ACTIVE_TYPESCRIPT_VERSION, diff --git a/packages/typescript-estree/src/ts-estree/estree-to-ts-node-types.ts b/packages/typescript-estree/src/ts-estree/estree-to-ts-node-types.ts index 41697caf29a..c080a83559b 100644 --- a/packages/typescript-estree/src/ts-estree/estree-to-ts-node-types.ts +++ b/packages/typescript-estree/src/ts-estree/estree-to-ts-node-types.ts @@ -157,6 +157,7 @@ export interface EstreeToTsNodeTypes { | ts.Identifier; [AST_NODE_TYPES.ThrowStatement]: ts.ThrowStatement; [AST_NODE_TYPES.TryStatement]: ts.TryStatement; + [AST_NODE_TYPES.TSAbstractAccessorProperty]: ts.PropertyDeclaration; [AST_NODE_TYPES.TSAbstractPropertyDefinition]: ts.PropertyDeclaration; [AST_NODE_TYPES.TSAbstractMethodDefinition]: | ts.GetAccessorDeclaration diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/auto-accessor-1.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/auto-accessor-1.src.ts.shot deleted file mode 100644 index ec057cdc689..00000000000 --- a/packages/typescript-estree/tests/snapshots/typescript/basics/auto-accessor-1.src.ts.shot +++ /dev/null @@ -1,818 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`typescript basics auto-accessor-1.src 1`] = ` -Object { - "body": Array [ - Object { - "body": Object { - "body": Array [ - Object { - "computed": false, - "declare": false, - "key": Object { - "loc": Object { - "end": Object { - "column": 12, - "line": 2, - }, - "start": Object { - "column": 11, - "line": 2, - }, - }, - "name": "a", - "range": Array [ - 22, - 23, - ], - "type": "Identifier", - }, - "loc": Object { - "end": Object { - "column": 18, - "line": 2, - }, - "start": Object { - "column": 2, - "line": 2, - }, - }, - "override": false, - "range": Array [ - 13, - 29, - ], - "readonly": undefined, - "static": false, - "type": "AccessorProperty", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 17, - "line": 2, - }, - "start": Object { - "column": 12, - "line": 2, - }, - }, - "range": Array [ - 23, - 28, - ], - "type": "TSTypeAnnotation", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 17, - "line": 2, - }, - "start": Object { - "column": 14, - "line": 2, - }, - }, - "range": Array [ - 25, - 28, - ], - "type": "TSAnyKeyword", - }, - }, - "value": null, - }, - Object { - "computed": false, - "declare": false, - "key": Object { - "loc": Object { - "end": Object { - "column": 12, - "line": 3, - }, - "start": Object { - "column": 11, - "line": 3, - }, - }, - "name": "b", - "range": Array [ - 41, - 42, - ], - "type": "Identifier", - }, - "loc": Object { - "end": Object { - "column": 17, - "line": 3, - }, - "start": Object { - "column": 2, - "line": 3, - }, - }, - "override": false, - "range": Array [ - 32, - 47, - ], - "readonly": undefined, - "static": false, - "type": "AccessorProperty", - "value": Object { - "loc": Object { - "end": Object { - "column": 16, - "line": 3, - }, - "start": Object { - "column": 15, - "line": 3, - }, - }, - "range": Array [ - 45, - 46, - ], - "raw": "1", - "type": "Literal", - "value": 1, - }, - }, - Object { - "computed": false, - "declare": false, - "key": Object { - "loc": Object { - "end": Object { - "column": 19, - "line": 4, - }, - "start": Object { - "column": 18, - "line": 4, - }, - }, - "name": "c", - "range": Array [ - 66, - 67, - ], - "type": "Identifier", - }, - "loc": Object { - "end": Object { - "column": 25, - "line": 4, - }, - "start": Object { - "column": 2, - "line": 4, - }, - }, - "override": false, - "range": Array [ - 50, - 73, - ], - "readonly": undefined, - "static": true, - "type": "AccessorProperty", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 24, - "line": 4, - }, - "start": Object { - "column": 19, - "line": 4, - }, - }, - "range": Array [ - 67, - 72, - ], - "type": "TSTypeAnnotation", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 24, - "line": 4, - }, - "start": Object { - "column": 21, - "line": 4, - }, - }, - "range": Array [ - 69, - 72, - ], - "type": "TSAnyKeyword", - }, - }, - "value": null, - }, - Object { - "computed": false, - "declare": false, - "key": Object { - "loc": Object { - "end": Object { - "column": 19, - "line": 5, - }, - "start": Object { - "column": 18, - "line": 5, - }, - }, - "name": "d", - "range": Array [ - 92, - 93, - ], - "type": "Identifier", - }, - "loc": Object { - "end": Object { - "column": 24, - "line": 5, - }, - "start": Object { - "column": 2, - "line": 5, - }, - }, - "override": false, - "range": Array [ - 76, - 98, - ], - "readonly": undefined, - "static": true, - "type": "AccessorProperty", - "value": Object { - "loc": Object { - "end": Object { - "column": 23, - "line": 5, - }, - "start": Object { - "column": 22, - "line": 5, - }, - }, - "range": Array [ - 96, - 97, - ], - "raw": "2", - "type": "Literal", - "value": 2, - }, - }, - ], - "loc": Object { - "end": Object { - "column": 1, - "line": 6, - }, - "start": Object { - "column": 9, - "line": 1, - }, - }, - "range": Array [ - 9, - 100, - ], - "type": "ClassBody", - }, - "id": Object { - "loc": Object { - "end": Object { - "column": 8, - "line": 1, - }, - "start": Object { - "column": 6, - "line": 1, - }, - }, - "name": "C1", - "range": Array [ - 6, - 8, - ], - "type": "Identifier", - }, - "loc": Object { - "end": Object { - "column": 1, - "line": 6, - }, - "start": Object { - "column": 0, - "line": 1, - }, - }, - "range": Array [ - 0, - 100, - ], - "superClass": null, - "type": "ClassDeclaration", - }, - ], - "comments": Array [], - "loc": Object { - "end": Object { - "column": 0, - "line": 7, - }, - "start": Object { - "column": 0, - "line": 1, - }, - }, - "range": Array [ - 0, - 101, - ], - "sourceType": "script", - "tokens": Array [ - Object { - "loc": Object { - "end": Object { - "column": 5, - "line": 1, - }, - "start": Object { - "column": 0, - "line": 1, - }, - }, - "range": Array [ - 0, - 5, - ], - "type": "Keyword", - "value": "class", - }, - Object { - "loc": Object { - "end": Object { - "column": 8, - "line": 1, - }, - "start": Object { - "column": 6, - "line": 1, - }, - }, - "range": Array [ - 6, - 8, - ], - "type": "Identifier", - "value": "C1", - }, - Object { - "loc": Object { - "end": Object { - "column": 10, - "line": 1, - }, - "start": Object { - "column": 9, - "line": 1, - }, - }, - "range": Array [ - 9, - 10, - ], - "type": "Punctuator", - "value": "{", - }, - Object { - "loc": Object { - "end": Object { - "column": 10, - "line": 2, - }, - "start": Object { - "column": 2, - "line": 2, - }, - }, - "range": Array [ - 13, - 21, - ], - "type": "Identifier", - "value": "accessor", - }, - Object { - "loc": Object { - "end": Object { - "column": 12, - "line": 2, - }, - "start": Object { - "column": 11, - "line": 2, - }, - }, - "range": Array [ - 22, - 23, - ], - "type": "Identifier", - "value": "a", - }, - Object { - "loc": Object { - "end": Object { - "column": 13, - "line": 2, - }, - "start": Object { - "column": 12, - "line": 2, - }, - }, - "range": Array [ - 23, - 24, - ], - "type": "Punctuator", - "value": ":", - }, - Object { - "loc": Object { - "end": Object { - "column": 17, - "line": 2, - }, - "start": Object { - "column": 14, - "line": 2, - }, - }, - "range": Array [ - 25, - 28, - ], - "type": "Identifier", - "value": "any", - }, - Object { - "loc": Object { - "end": Object { - "column": 18, - "line": 2, - }, - "start": Object { - "column": 17, - "line": 2, - }, - }, - "range": Array [ - 28, - 29, - ], - "type": "Punctuator", - "value": ";", - }, - Object { - "loc": Object { - "end": Object { - "column": 10, - "line": 3, - }, - "start": Object { - "column": 2, - "line": 3, - }, - }, - "range": Array [ - 32, - 40, - ], - "type": "Identifier", - "value": "accessor", - }, - Object { - "loc": Object { - "end": Object { - "column": 12, - "line": 3, - }, - "start": Object { - "column": 11, - "line": 3, - }, - }, - "range": Array [ - 41, - 42, - ], - "type": "Identifier", - "value": "b", - }, - Object { - "loc": Object { - "end": Object { - "column": 14, - "line": 3, - }, - "start": Object { - "column": 13, - "line": 3, - }, - }, - "range": Array [ - 43, - 44, - ], - "type": "Punctuator", - "value": "=", - }, - Object { - "loc": Object { - "end": Object { - "column": 16, - "line": 3, - }, - "start": Object { - "column": 15, - "line": 3, - }, - }, - "range": Array [ - 45, - 46, - ], - "type": "Numeric", - "value": "1", - }, - Object { - "loc": Object { - "end": Object { - "column": 17, - "line": 3, - }, - "start": Object { - "column": 16, - "line": 3, - }, - }, - "range": Array [ - 46, - 47, - ], - "type": "Punctuator", - "value": ";", - }, - Object { - "loc": Object { - "end": Object { - "column": 8, - "line": 4, - }, - "start": Object { - "column": 2, - "line": 4, - }, - }, - "range": Array [ - 50, - 56, - ], - "type": "Keyword", - "value": "static", - }, - Object { - "loc": Object { - "end": Object { - "column": 17, - "line": 4, - }, - "start": Object { - "column": 9, - "line": 4, - }, - }, - "range": Array [ - 57, - 65, - ], - "type": "Identifier", - "value": "accessor", - }, - Object { - "loc": Object { - "end": Object { - "column": 19, - "line": 4, - }, - "start": Object { - "column": 18, - "line": 4, - }, - }, - "range": Array [ - 66, - 67, - ], - "type": "Identifier", - "value": "c", - }, - Object { - "loc": Object { - "end": Object { - "column": 20, - "line": 4, - }, - "start": Object { - "column": 19, - "line": 4, - }, - }, - "range": Array [ - 67, - 68, - ], - "type": "Punctuator", - "value": ":", - }, - Object { - "loc": Object { - "end": Object { - "column": 24, - "line": 4, - }, - "start": Object { - "column": 21, - "line": 4, - }, - }, - "range": Array [ - 69, - 72, - ], - "type": "Identifier", - "value": "any", - }, - Object { - "loc": Object { - "end": Object { - "column": 25, - "line": 4, - }, - "start": Object { - "column": 24, - "line": 4, - }, - }, - "range": Array [ - 72, - 73, - ], - "type": "Punctuator", - "value": ";", - }, - Object { - "loc": Object { - "end": Object { - "column": 8, - "line": 5, - }, - "start": Object { - "column": 2, - "line": 5, - }, - }, - "range": Array [ - 76, - 82, - ], - "type": "Keyword", - "value": "static", - }, - Object { - "loc": Object { - "end": Object { - "column": 17, - "line": 5, - }, - "start": Object { - "column": 9, - "line": 5, - }, - }, - "range": Array [ - 83, - 91, - ], - "type": "Identifier", - "value": "accessor", - }, - Object { - "loc": Object { - "end": Object { - "column": 19, - "line": 5, - }, - "start": Object { - "column": 18, - "line": 5, - }, - }, - "range": Array [ - 92, - 93, - ], - "type": "Identifier", - "value": "d", - }, - Object { - "loc": Object { - "end": Object { - "column": 21, - "line": 5, - }, - "start": Object { - "column": 20, - "line": 5, - }, - }, - "range": Array [ - 94, - 95, - ], - "type": "Punctuator", - "value": "=", - }, - Object { - "loc": Object { - "end": Object { - "column": 23, - "line": 5, - }, - "start": Object { - "column": 22, - "line": 5, - }, - }, - "range": Array [ - 96, - 97, - ], - "type": "Numeric", - "value": "2", - }, - Object { - "loc": Object { - "end": Object { - "column": 24, - "line": 5, - }, - "start": Object { - "column": 23, - "line": 5, - }, - }, - "range": Array [ - 97, - 98, - ], - "type": "Punctuator", - "value": ";", - }, - Object { - "loc": Object { - "end": Object { - "column": 1, - "line": 6, - }, - "start": Object { - "column": 0, - "line": 6, - }, - }, - "range": Array [ - 99, - 100, - ], - "type": "Punctuator", - "value": "}", - }, - ], - "type": "Program", -} -`; diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/auto-accessor-2.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/auto-accessor-2.src.ts.shot deleted file mode 100644 index 5823636706b..00000000000 --- a/packages/typescript-estree/tests/snapshots/typescript/basics/auto-accessor-2.src.ts.shot +++ /dev/null @@ -1,1925 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`typescript basics auto-accessor-2.src 1`] = ` -Object { - "body": Array [ - Object { - "body": Object { - "body": Array [ - Object { - "computed": false, - "declare": false, - "key": Object { - "loc": Object { - "end": Object { - "column": 13, - "line": 2, - }, - "start": Object { - "column": 11, - "line": 2, - }, - }, - "name": "a", - "range": Array [ - 22, - 24, - ], - "type": "PrivateIdentifier", - }, - "loc": Object { - "end": Object { - "column": 19, - "line": 2, - }, - "start": Object { - "column": 2, - "line": 2, - }, - }, - "override": false, - "range": Array [ - 13, - 30, - ], - "readonly": undefined, - "static": false, - "type": "AccessorProperty", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 18, - "line": 2, - }, - "start": Object { - "column": 13, - "line": 2, - }, - }, - "range": Array [ - 24, - 29, - ], - "type": "TSTypeAnnotation", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 18, - "line": 2, - }, - "start": Object { - "column": 15, - "line": 2, - }, - }, - "range": Array [ - 26, - 29, - ], - "type": "TSAnyKeyword", - }, - }, - "value": null, - }, - Object { - "computed": false, - "declare": false, - "key": Object { - "loc": Object { - "end": Object { - "column": 13, - "line": 3, - }, - "start": Object { - "column": 11, - "line": 3, - }, - }, - "name": "b", - "range": Array [ - 42, - 44, - ], - "type": "PrivateIdentifier", - }, - "loc": Object { - "end": Object { - "column": 18, - "line": 3, - }, - "start": Object { - "column": 2, - "line": 3, - }, - }, - "override": false, - "range": Array [ - 33, - 49, - ], - "readonly": undefined, - "static": false, - "type": "AccessorProperty", - "value": Object { - "loc": Object { - "end": Object { - "column": 17, - "line": 3, - }, - "start": Object { - "column": 16, - "line": 3, - }, - }, - "range": Array [ - 47, - 48, - ], - "raw": "1", - "type": "Literal", - "value": 1, - }, - }, - Object { - "computed": false, - "declare": false, - "key": Object { - "loc": Object { - "end": Object { - "column": 20, - "line": 4, - }, - "start": Object { - "column": 18, - "line": 4, - }, - }, - "name": "c", - "range": Array [ - 68, - 70, - ], - "type": "PrivateIdentifier", - }, - "loc": Object { - "end": Object { - "column": 26, - "line": 4, - }, - "start": Object { - "column": 2, - "line": 4, - }, - }, - "override": false, - "range": Array [ - 52, - 76, - ], - "readonly": undefined, - "static": true, - "type": "AccessorProperty", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 25, - "line": 4, - }, - "start": Object { - "column": 20, - "line": 4, - }, - }, - "range": Array [ - 70, - 75, - ], - "type": "TSTypeAnnotation", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 25, - "line": 4, - }, - "start": Object { - "column": 22, - "line": 4, - }, - }, - "range": Array [ - 72, - 75, - ], - "type": "TSAnyKeyword", - }, - }, - "value": null, - }, - Object { - "computed": false, - "declare": false, - "key": Object { - "loc": Object { - "end": Object { - "column": 20, - "line": 5, - }, - "start": Object { - "column": 18, - "line": 5, - }, - }, - "name": "d", - "range": Array [ - 95, - 97, - ], - "type": "PrivateIdentifier", - }, - "loc": Object { - "end": Object { - "column": 25, - "line": 5, - }, - "start": Object { - "column": 2, - "line": 5, - }, - }, - "override": false, - "range": Array [ - 79, - 102, - ], - "readonly": undefined, - "static": true, - "type": "AccessorProperty", - "value": Object { - "loc": Object { - "end": Object { - "column": 24, - "line": 5, - }, - "start": Object { - "column": 23, - "line": 5, - }, - }, - "range": Array [ - 100, - 101, - ], - "raw": "2", - "type": "Literal", - "value": 2, - }, - }, - Object { - "computed": false, - "key": Object { - "loc": Object { - "end": Object { - "column": 13, - "line": 7, - }, - "start": Object { - "column": 2, - "line": 7, - }, - }, - "name": "constructor", - "range": Array [ - 106, - 117, - ], - "type": "Identifier", - }, - "kind": "constructor", - "loc": Object { - "end": Object { - "column": 3, - "line": 10, - }, - "start": Object { - "column": 2, - "line": 7, - }, - }, - "override": false, - "range": Array [ - 106, - 159, - ], - "static": false, - "type": "MethodDefinition", - "value": Object { - "async": false, - "body": Object { - "body": Array [ - Object { - "expression": Object { - "left": Object { - "computed": false, - "loc": Object { - "end": Object { - "column": 11, - "line": 8, - }, - "start": Object { - "column": 4, - "line": 8, - }, - }, - "object": Object { - "loc": Object { - "end": Object { - "column": 8, - "line": 8, - }, - "start": Object { - "column": 4, - "line": 8, - }, - }, - "range": Array [ - 126, - 130, - ], - "type": "ThisExpression", - }, - "optional": false, - "property": Object { - "loc": Object { - "end": Object { - "column": 11, - "line": 8, - }, - "start": Object { - "column": 9, - "line": 8, - }, - }, - "name": "a", - "range": Array [ - 131, - 133, - ], - "type": "PrivateIdentifier", - }, - "range": Array [ - 126, - 133, - ], - "type": "MemberExpression", - }, - "loc": Object { - "end": Object { - "column": 15, - "line": 8, - }, - "start": Object { - "column": 4, - "line": 8, - }, - }, - "operator": "=", - "range": Array [ - 126, - 137, - ], - "right": Object { - "loc": Object { - "end": Object { - "column": 15, - "line": 8, - }, - "start": Object { - "column": 14, - "line": 8, - }, - }, - "range": Array [ - 136, - 137, - ], - "raw": "3", - "type": "Literal", - "value": 3, - }, - "type": "AssignmentExpression", - }, - "loc": Object { - "end": Object { - "column": 16, - "line": 8, - }, - "start": Object { - "column": 4, - "line": 8, - }, - }, - "range": Array [ - 126, - 138, - ], - "type": "ExpressionStatement", - }, - Object { - "expression": Object { - "left": Object { - "computed": false, - "loc": Object { - "end": Object { - "column": 11, - "line": 9, - }, - "start": Object { - "column": 4, - "line": 9, - }, - }, - "object": Object { - "loc": Object { - "end": Object { - "column": 8, - "line": 9, - }, - "start": Object { - "column": 4, - "line": 9, - }, - }, - "range": Array [ - 143, - 147, - ], - "type": "ThisExpression", - }, - "optional": false, - "property": Object { - "loc": Object { - "end": Object { - "column": 11, - "line": 9, - }, - "start": Object { - "column": 9, - "line": 9, - }, - }, - "name": "b", - "range": Array [ - 148, - 150, - ], - "type": "PrivateIdentifier", - }, - "range": Array [ - 143, - 150, - ], - "type": "MemberExpression", - }, - "loc": Object { - "end": Object { - "column": 15, - "line": 9, - }, - "start": Object { - "column": 4, - "line": 9, - }, - }, - "operator": "=", - "range": Array [ - 143, - 154, - ], - "right": Object { - "loc": Object { - "end": Object { - "column": 15, - "line": 9, - }, - "start": Object { - "column": 14, - "line": 9, - }, - }, - "range": Array [ - 153, - 154, - ], - "raw": "4", - "type": "Literal", - "value": 4, - }, - "type": "AssignmentExpression", - }, - "loc": Object { - "end": Object { - "column": 16, - "line": 9, - }, - "start": Object { - "column": 4, - "line": 9, - }, - }, - "range": Array [ - 143, - 155, - ], - "type": "ExpressionStatement", - }, - ], - "loc": Object { - "end": Object { - "column": 3, - "line": 10, - }, - "start": Object { - "column": 16, - "line": 7, - }, - }, - "range": Array [ - 120, - 159, - ], - "type": "BlockStatement", - }, - "expression": false, - "generator": false, - "id": null, - "loc": Object { - "end": Object { - "column": 3, - "line": 10, - }, - "start": Object { - "column": 13, - "line": 7, - }, - }, - "params": Array [], - "range": Array [ - 117, - 159, - ], - "type": "FunctionExpression", - }, - }, - Object { - "body": Array [ - Object { - "expression": Object { - "left": Object { - "computed": false, - "loc": Object { - "end": Object { - "column": 11, - "line": 13, - }, - "start": Object { - "column": 4, - "line": 13, - }, - }, - "object": Object { - "loc": Object { - "end": Object { - "column": 8, - "line": 13, - }, - "start": Object { - "column": 4, - "line": 13, - }, - }, - "range": Array [ - 176, - 180, - ], - "type": "ThisExpression", - }, - "optional": false, - "property": Object { - "loc": Object { - "end": Object { - "column": 11, - "line": 13, - }, - "start": Object { - "column": 9, - "line": 13, - }, - }, - "name": "c", - "range": Array [ - 181, - 183, - ], - "type": "PrivateIdentifier", - }, - "range": Array [ - 176, - 183, - ], - "type": "MemberExpression", - }, - "loc": Object { - "end": Object { - "column": 15, - "line": 13, - }, - "start": Object { - "column": 4, - "line": 13, - }, - }, - "operator": "=", - "range": Array [ - 176, - 187, - ], - "right": Object { - "loc": Object { - "end": Object { - "column": 15, - "line": 13, - }, - "start": Object { - "column": 14, - "line": 13, - }, - }, - "range": Array [ - 186, - 187, - ], - "raw": "5", - "type": "Literal", - "value": 5, - }, - "type": "AssignmentExpression", - }, - "loc": Object { - "end": Object { - "column": 16, - "line": 13, - }, - "start": Object { - "column": 4, - "line": 13, - }, - }, - "range": Array [ - 176, - 188, - ], - "type": "ExpressionStatement", - }, - Object { - "expression": Object { - "left": Object { - "computed": false, - "loc": Object { - "end": Object { - "column": 11, - "line": 14, - }, - "start": Object { - "column": 4, - "line": 14, - }, - }, - "object": Object { - "loc": Object { - "end": Object { - "column": 8, - "line": 14, - }, - "start": Object { - "column": 4, - "line": 14, - }, - }, - "range": Array [ - 193, - 197, - ], - "type": "ThisExpression", - }, - "optional": false, - "property": Object { - "loc": Object { - "end": Object { - "column": 11, - "line": 14, - }, - "start": Object { - "column": 9, - "line": 14, - }, - }, - "name": "d", - "range": Array [ - 198, - 200, - ], - "type": "PrivateIdentifier", - }, - "range": Array [ - 193, - 200, - ], - "type": "MemberExpression", - }, - "loc": Object { - "end": Object { - "column": 15, - "line": 14, - }, - "start": Object { - "column": 4, - "line": 14, - }, - }, - "operator": "=", - "range": Array [ - 193, - 204, - ], - "right": Object { - "loc": Object { - "end": Object { - "column": 15, - "line": 14, - }, - "start": Object { - "column": 14, - "line": 14, - }, - }, - "range": Array [ - 203, - 204, - ], - "raw": "6", - "type": "Literal", - "value": 6, - }, - "type": "AssignmentExpression", - }, - "loc": Object { - "end": Object { - "column": 16, - "line": 14, - }, - "start": Object { - "column": 4, - "line": 14, - }, - }, - "range": Array [ - 193, - 205, - ], - "type": "ExpressionStatement", - }, - ], - "loc": Object { - "end": Object { - "column": 3, - "line": 15, - }, - "start": Object { - "column": 2, - "line": 12, - }, - }, - "range": Array [ - 163, - 209, - ], - "type": "StaticBlock", - }, - ], - "loc": Object { - "end": Object { - "column": 1, - "line": 16, - }, - "start": Object { - "column": 9, - "line": 1, - }, - }, - "range": Array [ - 9, - 211, - ], - "type": "ClassBody", - }, - "id": Object { - "loc": Object { - "end": Object { - "column": 8, - "line": 1, - }, - "start": Object { - "column": 6, - "line": 1, - }, - }, - "name": "C1", - "range": Array [ - 6, - 8, - ], - "type": "Identifier", - }, - "loc": Object { - "end": Object { - "column": 1, - "line": 16, - }, - "start": Object { - "column": 0, - "line": 1, - }, - }, - "range": Array [ - 0, - 211, - ], - "superClass": null, - "type": "ClassDeclaration", - }, - ], - "comments": Array [], - "loc": Object { - "end": Object { - "column": 0, - "line": 17, - }, - "start": Object { - "column": 0, - "line": 1, - }, - }, - "range": Array [ - 0, - 212, - ], - "sourceType": "script", - "tokens": Array [ - Object { - "loc": Object { - "end": Object { - "column": 5, - "line": 1, - }, - "start": Object { - "column": 0, - "line": 1, - }, - }, - "range": Array [ - 0, - 5, - ], - "type": "Keyword", - "value": "class", - }, - Object { - "loc": Object { - "end": Object { - "column": 8, - "line": 1, - }, - "start": Object { - "column": 6, - "line": 1, - }, - }, - "range": Array [ - 6, - 8, - ], - "type": "Identifier", - "value": "C1", - }, - Object { - "loc": Object { - "end": Object { - "column": 10, - "line": 1, - }, - "start": Object { - "column": 9, - "line": 1, - }, - }, - "range": Array [ - 9, - 10, - ], - "type": "Punctuator", - "value": "{", - }, - Object { - "loc": Object { - "end": Object { - "column": 10, - "line": 2, - }, - "start": Object { - "column": 2, - "line": 2, - }, - }, - "range": Array [ - 13, - 21, - ], - "type": "Identifier", - "value": "accessor", - }, - Object { - "loc": Object { - "end": Object { - "column": 13, - "line": 2, - }, - "start": Object { - "column": 11, - "line": 2, - }, - }, - "range": Array [ - 22, - 24, - ], - "type": "Identifier", - "value": "#a", - }, - Object { - "loc": Object { - "end": Object { - "column": 14, - "line": 2, - }, - "start": Object { - "column": 13, - "line": 2, - }, - }, - "range": Array [ - 24, - 25, - ], - "type": "Punctuator", - "value": ":", - }, - Object { - "loc": Object { - "end": Object { - "column": 18, - "line": 2, - }, - "start": Object { - "column": 15, - "line": 2, - }, - }, - "range": Array [ - 26, - 29, - ], - "type": "Identifier", - "value": "any", - }, - Object { - "loc": Object { - "end": Object { - "column": 19, - "line": 2, - }, - "start": Object { - "column": 18, - "line": 2, - }, - }, - "range": Array [ - 29, - 30, - ], - "type": "Punctuator", - "value": ";", - }, - Object { - "loc": Object { - "end": Object { - "column": 10, - "line": 3, - }, - "start": Object { - "column": 2, - "line": 3, - }, - }, - "range": Array [ - 33, - 41, - ], - "type": "Identifier", - "value": "accessor", - }, - Object { - "loc": Object { - "end": Object { - "column": 13, - "line": 3, - }, - "start": Object { - "column": 11, - "line": 3, - }, - }, - "range": Array [ - 42, - 44, - ], - "type": "Identifier", - "value": "#b", - }, - Object { - "loc": Object { - "end": Object { - "column": 15, - "line": 3, - }, - "start": Object { - "column": 14, - "line": 3, - }, - }, - "range": Array [ - 45, - 46, - ], - "type": "Punctuator", - "value": "=", - }, - Object { - "loc": Object { - "end": Object { - "column": 17, - "line": 3, - }, - "start": Object { - "column": 16, - "line": 3, - }, - }, - "range": Array [ - 47, - 48, - ], - "type": "Numeric", - "value": "1", - }, - Object { - "loc": Object { - "end": Object { - "column": 18, - "line": 3, - }, - "start": Object { - "column": 17, - "line": 3, - }, - }, - "range": Array [ - 48, - 49, - ], - "type": "Punctuator", - "value": ";", - }, - Object { - "loc": Object { - "end": Object { - "column": 8, - "line": 4, - }, - "start": Object { - "column": 2, - "line": 4, - }, - }, - "range": Array [ - 52, - 58, - ], - "type": "Keyword", - "value": "static", - }, - Object { - "loc": Object { - "end": Object { - "column": 17, - "line": 4, - }, - "start": Object { - "column": 9, - "line": 4, - }, - }, - "range": Array [ - 59, - 67, - ], - "type": "Identifier", - "value": "accessor", - }, - Object { - "loc": Object { - "end": Object { - "column": 20, - "line": 4, - }, - "start": Object { - "column": 18, - "line": 4, - }, - }, - "range": Array [ - 68, - 70, - ], - "type": "Identifier", - "value": "#c", - }, - Object { - "loc": Object { - "end": Object { - "column": 21, - "line": 4, - }, - "start": Object { - "column": 20, - "line": 4, - }, - }, - "range": Array [ - 70, - 71, - ], - "type": "Punctuator", - "value": ":", - }, - Object { - "loc": Object { - "end": Object { - "column": 25, - "line": 4, - }, - "start": Object { - "column": 22, - "line": 4, - }, - }, - "range": Array [ - 72, - 75, - ], - "type": "Identifier", - "value": "any", - }, - Object { - "loc": Object { - "end": Object { - "column": 26, - "line": 4, - }, - "start": Object { - "column": 25, - "line": 4, - }, - }, - "range": Array [ - 75, - 76, - ], - "type": "Punctuator", - "value": ";", - }, - Object { - "loc": Object { - "end": Object { - "column": 8, - "line": 5, - }, - "start": Object { - "column": 2, - "line": 5, - }, - }, - "range": Array [ - 79, - 85, - ], - "type": "Keyword", - "value": "static", - }, - Object { - "loc": Object { - "end": Object { - "column": 17, - "line": 5, - }, - "start": Object { - "column": 9, - "line": 5, - }, - }, - "range": Array [ - 86, - 94, - ], - "type": "Identifier", - "value": "accessor", - }, - Object { - "loc": Object { - "end": Object { - "column": 20, - "line": 5, - }, - "start": Object { - "column": 18, - "line": 5, - }, - }, - "range": Array [ - 95, - 97, - ], - "type": "Identifier", - "value": "#d", - }, - Object { - "loc": Object { - "end": Object { - "column": 22, - "line": 5, - }, - "start": Object { - "column": 21, - "line": 5, - }, - }, - "range": Array [ - 98, - 99, - ], - "type": "Punctuator", - "value": "=", - }, - Object { - "loc": Object { - "end": Object { - "column": 24, - "line": 5, - }, - "start": Object { - "column": 23, - "line": 5, - }, - }, - "range": Array [ - 100, - 101, - ], - "type": "Numeric", - "value": "2", - }, - Object { - "loc": Object { - "end": Object { - "column": 25, - "line": 5, - }, - "start": Object { - "column": 24, - "line": 5, - }, - }, - "range": Array [ - 101, - 102, - ], - "type": "Punctuator", - "value": ";", - }, - Object { - "loc": Object { - "end": Object { - "column": 13, - "line": 7, - }, - "start": Object { - "column": 2, - "line": 7, - }, - }, - "range": Array [ - 106, - 117, - ], - "type": "Identifier", - "value": "constructor", - }, - Object { - "loc": Object { - "end": Object { - "column": 14, - "line": 7, - }, - "start": Object { - "column": 13, - "line": 7, - }, - }, - "range": Array [ - 117, - 118, - ], - "type": "Punctuator", - "value": "(", - }, - Object { - "loc": Object { - "end": Object { - "column": 15, - "line": 7, - }, - "start": Object { - "column": 14, - "line": 7, - }, - }, - "range": Array [ - 118, - 119, - ], - "type": "Punctuator", - "value": ")", - }, - Object { - "loc": Object { - "end": Object { - "column": 17, - "line": 7, - }, - "start": Object { - "column": 16, - "line": 7, - }, - }, - "range": Array [ - 120, - 121, - ], - "type": "Punctuator", - "value": "{", - }, - Object { - "loc": Object { - "end": Object { - "column": 8, - "line": 8, - }, - "start": Object { - "column": 4, - "line": 8, - }, - }, - "range": Array [ - 126, - 130, - ], - "type": "Keyword", - "value": "this", - }, - Object { - "loc": Object { - "end": Object { - "column": 9, - "line": 8, - }, - "start": Object { - "column": 8, - "line": 8, - }, - }, - "range": Array [ - 130, - 131, - ], - "type": "Punctuator", - "value": ".", - }, - Object { - "loc": Object { - "end": Object { - "column": 11, - "line": 8, - }, - "start": Object { - "column": 9, - "line": 8, - }, - }, - "range": Array [ - 131, - 133, - ], - "type": "Identifier", - "value": "#a", - }, - Object { - "loc": Object { - "end": Object { - "column": 13, - "line": 8, - }, - "start": Object { - "column": 12, - "line": 8, - }, - }, - "range": Array [ - 134, - 135, - ], - "type": "Punctuator", - "value": "=", - }, - Object { - "loc": Object { - "end": Object { - "column": 15, - "line": 8, - }, - "start": Object { - "column": 14, - "line": 8, - }, - }, - "range": Array [ - 136, - 137, - ], - "type": "Numeric", - "value": "3", - }, - Object { - "loc": Object { - "end": Object { - "column": 16, - "line": 8, - }, - "start": Object { - "column": 15, - "line": 8, - }, - }, - "range": Array [ - 137, - 138, - ], - "type": "Punctuator", - "value": ";", - }, - Object { - "loc": Object { - "end": Object { - "column": 8, - "line": 9, - }, - "start": Object { - "column": 4, - "line": 9, - }, - }, - "range": Array [ - 143, - 147, - ], - "type": "Keyword", - "value": "this", - }, - Object { - "loc": Object { - "end": Object { - "column": 9, - "line": 9, - }, - "start": Object { - "column": 8, - "line": 9, - }, - }, - "range": Array [ - 147, - 148, - ], - "type": "Punctuator", - "value": ".", - }, - Object { - "loc": Object { - "end": Object { - "column": 11, - "line": 9, - }, - "start": Object { - "column": 9, - "line": 9, - }, - }, - "range": Array [ - 148, - 150, - ], - "type": "Identifier", - "value": "#b", - }, - Object { - "loc": Object { - "end": Object { - "column": 13, - "line": 9, - }, - "start": Object { - "column": 12, - "line": 9, - }, - }, - "range": Array [ - 151, - 152, - ], - "type": "Punctuator", - "value": "=", - }, - Object { - "loc": Object { - "end": Object { - "column": 15, - "line": 9, - }, - "start": Object { - "column": 14, - "line": 9, - }, - }, - "range": Array [ - 153, - 154, - ], - "type": "Numeric", - "value": "4", - }, - Object { - "loc": Object { - "end": Object { - "column": 16, - "line": 9, - }, - "start": Object { - "column": 15, - "line": 9, - }, - }, - "range": Array [ - 154, - 155, - ], - "type": "Punctuator", - "value": ";", - }, - Object { - "loc": Object { - "end": Object { - "column": 3, - "line": 10, - }, - "start": Object { - "column": 2, - "line": 10, - }, - }, - "range": Array [ - 158, - 159, - ], - "type": "Punctuator", - "value": "}", - }, - Object { - "loc": Object { - "end": Object { - "column": 8, - "line": 12, - }, - "start": Object { - "column": 2, - "line": 12, - }, - }, - "range": Array [ - 163, - 169, - ], - "type": "Keyword", - "value": "static", - }, - Object { - "loc": Object { - "end": Object { - "column": 10, - "line": 12, - }, - "start": Object { - "column": 9, - "line": 12, - }, - }, - "range": Array [ - 170, - 171, - ], - "type": "Punctuator", - "value": "{", - }, - Object { - "loc": Object { - "end": Object { - "column": 8, - "line": 13, - }, - "start": Object { - "column": 4, - "line": 13, - }, - }, - "range": Array [ - 176, - 180, - ], - "type": "Keyword", - "value": "this", - }, - Object { - "loc": Object { - "end": Object { - "column": 9, - "line": 13, - }, - "start": Object { - "column": 8, - "line": 13, - }, - }, - "range": Array [ - 180, - 181, - ], - "type": "Punctuator", - "value": ".", - }, - Object { - "loc": Object { - "end": Object { - "column": 11, - "line": 13, - }, - "start": Object { - "column": 9, - "line": 13, - }, - }, - "range": Array [ - 181, - 183, - ], - "type": "Identifier", - "value": "#c", - }, - Object { - "loc": Object { - "end": Object { - "column": 13, - "line": 13, - }, - "start": Object { - "column": 12, - "line": 13, - }, - }, - "range": Array [ - 184, - 185, - ], - "type": "Punctuator", - "value": "=", - }, - Object { - "loc": Object { - "end": Object { - "column": 15, - "line": 13, - }, - "start": Object { - "column": 14, - "line": 13, - }, - }, - "range": Array [ - 186, - 187, - ], - "type": "Numeric", - "value": "5", - }, - Object { - "loc": Object { - "end": Object { - "column": 16, - "line": 13, - }, - "start": Object { - "column": 15, - "line": 13, - }, - }, - "range": Array [ - 187, - 188, - ], - "type": "Punctuator", - "value": ";", - }, - Object { - "loc": Object { - "end": Object { - "column": 8, - "line": 14, - }, - "start": Object { - "column": 4, - "line": 14, - }, - }, - "range": Array [ - 193, - 197, - ], - "type": "Keyword", - "value": "this", - }, - Object { - "loc": Object { - "end": Object { - "column": 9, - "line": 14, - }, - "start": Object { - "column": 8, - "line": 14, - }, - }, - "range": Array [ - 197, - 198, - ], - "type": "Punctuator", - "value": ".", - }, - Object { - "loc": Object { - "end": Object { - "column": 11, - "line": 14, - }, - "start": Object { - "column": 9, - "line": 14, - }, - }, - "range": Array [ - 198, - 200, - ], - "type": "Identifier", - "value": "#d", - }, - Object { - "loc": Object { - "end": Object { - "column": 13, - "line": 14, - }, - "start": Object { - "column": 12, - "line": 14, - }, - }, - "range": Array [ - 201, - 202, - ], - "type": "Punctuator", - "value": "=", - }, - Object { - "loc": Object { - "end": Object { - "column": 15, - "line": 14, - }, - "start": Object { - "column": 14, - "line": 14, - }, - }, - "range": Array [ - 203, - 204, - ], - "type": "Numeric", - "value": "6", - }, - Object { - "loc": Object { - "end": Object { - "column": 16, - "line": 14, - }, - "start": Object { - "column": 15, - "line": 14, - }, - }, - "range": Array [ - 204, - 205, - ], - "type": "Punctuator", - "value": ";", - }, - Object { - "loc": Object { - "end": Object { - "column": 3, - "line": 15, - }, - "start": Object { - "column": 2, - "line": 15, - }, - }, - "range": Array [ - 208, - 209, - ], - "type": "Punctuator", - "value": "}", - }, - Object { - "loc": Object { - "end": Object { - "column": 1, - "line": 16, - }, - "start": Object { - "column": 0, - "line": 16, - }, - }, - "range": Array [ - 210, - 211, - ], - "type": "Punctuator", - "value": "}", - }, - ], - "type": "Program", -} -`; diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/auto-accessor-3.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/auto-accessor-3.src.ts.shot deleted file mode 100644 index 5a322c1e66e..00000000000 --- a/packages/typescript-estree/tests/snapshots/typescript/basics/auto-accessor-3.src.ts.shot +++ /dev/null @@ -1,822 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`typescript basics auto-accessor-3.src 1`] = ` -Object { - "body": Array [ - Object { - "body": Object { - "body": Array [ - Object { - "computed": false, - "declare": false, - "key": Object { - "loc": Object { - "end": Object { - "column": 14, - "line": 2, - }, - "start": Object { - "column": 11, - "line": 2, - }, - }, - "range": Array [ - 22, - 25, - ], - "raw": "\\"w\\"", - "type": "Literal", - "value": "w", - }, - "loc": Object { - "end": Object { - "column": 20, - "line": 2, - }, - "start": Object { - "column": 2, - "line": 2, - }, - }, - "override": false, - "range": Array [ - 13, - 31, - ], - "readonly": undefined, - "static": false, - "type": "AccessorProperty", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 19, - "line": 2, - }, - "start": Object { - "column": 14, - "line": 2, - }, - }, - "range": Array [ - 25, - 30, - ], - "type": "TSTypeAnnotation", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 19, - "line": 2, - }, - "start": Object { - "column": 16, - "line": 2, - }, - }, - "range": Array [ - 27, - 30, - ], - "type": "TSAnyKeyword", - }, - }, - "value": null, - }, - Object { - "computed": false, - "declare": false, - "key": Object { - "loc": Object { - "end": Object { - "column": 14, - "line": 3, - }, - "start": Object { - "column": 11, - "line": 3, - }, - }, - "range": Array [ - 43, - 46, - ], - "raw": "\\"x\\"", - "type": "Literal", - "value": "x", - }, - "loc": Object { - "end": Object { - "column": 19, - "line": 3, - }, - "start": Object { - "column": 2, - "line": 3, - }, - }, - "override": false, - "range": Array [ - 34, - 51, - ], - "readonly": undefined, - "static": false, - "type": "AccessorProperty", - "value": Object { - "loc": Object { - "end": Object { - "column": 18, - "line": 3, - }, - "start": Object { - "column": 17, - "line": 3, - }, - }, - "range": Array [ - 49, - 50, - ], - "raw": "1", - "type": "Literal", - "value": 1, - }, - }, - Object { - "computed": false, - "declare": false, - "key": Object { - "loc": Object { - "end": Object { - "column": 21, - "line": 4, - }, - "start": Object { - "column": 18, - "line": 4, - }, - }, - "range": Array [ - 70, - 73, - ], - "raw": "\\"y\\"", - "type": "Literal", - "value": "y", - }, - "loc": Object { - "end": Object { - "column": 27, - "line": 4, - }, - "start": Object { - "column": 2, - "line": 4, - }, - }, - "override": false, - "range": Array [ - 54, - 79, - ], - "readonly": undefined, - "static": true, - "type": "AccessorProperty", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 26, - "line": 4, - }, - "start": Object { - "column": 21, - "line": 4, - }, - }, - "range": Array [ - 73, - 78, - ], - "type": "TSTypeAnnotation", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 26, - "line": 4, - }, - "start": Object { - "column": 23, - "line": 4, - }, - }, - "range": Array [ - 75, - 78, - ], - "type": "TSAnyKeyword", - }, - }, - "value": null, - }, - Object { - "computed": false, - "declare": false, - "key": Object { - "loc": Object { - "end": Object { - "column": 21, - "line": 5, - }, - "start": Object { - "column": 18, - "line": 5, - }, - }, - "range": Array [ - 98, - 101, - ], - "raw": "\\"z\\"", - "type": "Literal", - "value": "z", - }, - "loc": Object { - "end": Object { - "column": 26, - "line": 5, - }, - "start": Object { - "column": 2, - "line": 5, - }, - }, - "override": false, - "range": Array [ - 82, - 106, - ], - "readonly": undefined, - "static": true, - "type": "AccessorProperty", - "value": Object { - "loc": Object { - "end": Object { - "column": 25, - "line": 5, - }, - "start": Object { - "column": 24, - "line": 5, - }, - }, - "range": Array [ - 104, - 105, - ], - "raw": "2", - "type": "Literal", - "value": 2, - }, - }, - ], - "loc": Object { - "end": Object { - "column": 1, - "line": 6, - }, - "start": Object { - "column": 9, - "line": 1, - }, - }, - "range": Array [ - 9, - 108, - ], - "type": "ClassBody", - }, - "id": Object { - "loc": Object { - "end": Object { - "column": 8, - "line": 1, - }, - "start": Object { - "column": 6, - "line": 1, - }, - }, - "name": "C1", - "range": Array [ - 6, - 8, - ], - "type": "Identifier", - }, - "loc": Object { - "end": Object { - "column": 1, - "line": 6, - }, - "start": Object { - "column": 0, - "line": 1, - }, - }, - "range": Array [ - 0, - 108, - ], - "superClass": null, - "type": "ClassDeclaration", - }, - ], - "comments": Array [], - "loc": Object { - "end": Object { - "column": 0, - "line": 7, - }, - "start": Object { - "column": 0, - "line": 1, - }, - }, - "range": Array [ - 0, - 109, - ], - "sourceType": "script", - "tokens": Array [ - Object { - "loc": Object { - "end": Object { - "column": 5, - "line": 1, - }, - "start": Object { - "column": 0, - "line": 1, - }, - }, - "range": Array [ - 0, - 5, - ], - "type": "Keyword", - "value": "class", - }, - Object { - "loc": Object { - "end": Object { - "column": 8, - "line": 1, - }, - "start": Object { - "column": 6, - "line": 1, - }, - }, - "range": Array [ - 6, - 8, - ], - "type": "Identifier", - "value": "C1", - }, - Object { - "loc": Object { - "end": Object { - "column": 10, - "line": 1, - }, - "start": Object { - "column": 9, - "line": 1, - }, - }, - "range": Array [ - 9, - 10, - ], - "type": "Punctuator", - "value": "{", - }, - Object { - "loc": Object { - "end": Object { - "column": 10, - "line": 2, - }, - "start": Object { - "column": 2, - "line": 2, - }, - }, - "range": Array [ - 13, - 21, - ], - "type": "Identifier", - "value": "accessor", - }, - Object { - "loc": Object { - "end": Object { - "column": 14, - "line": 2, - }, - "start": Object { - "column": 11, - "line": 2, - }, - }, - "range": Array [ - 22, - 25, - ], - "type": "String", - "value": "\\"w\\"", - }, - Object { - "loc": Object { - "end": Object { - "column": 15, - "line": 2, - }, - "start": Object { - "column": 14, - "line": 2, - }, - }, - "range": Array [ - 25, - 26, - ], - "type": "Punctuator", - "value": ":", - }, - Object { - "loc": Object { - "end": Object { - "column": 19, - "line": 2, - }, - "start": Object { - "column": 16, - "line": 2, - }, - }, - "range": Array [ - 27, - 30, - ], - "type": "Identifier", - "value": "any", - }, - Object { - "loc": Object { - "end": Object { - "column": 20, - "line": 2, - }, - "start": Object { - "column": 19, - "line": 2, - }, - }, - "range": Array [ - 30, - 31, - ], - "type": "Punctuator", - "value": ";", - }, - Object { - "loc": Object { - "end": Object { - "column": 10, - "line": 3, - }, - "start": Object { - "column": 2, - "line": 3, - }, - }, - "range": Array [ - 34, - 42, - ], - "type": "Identifier", - "value": "accessor", - }, - Object { - "loc": Object { - "end": Object { - "column": 14, - "line": 3, - }, - "start": Object { - "column": 11, - "line": 3, - }, - }, - "range": Array [ - 43, - 46, - ], - "type": "String", - "value": "\\"x\\"", - }, - Object { - "loc": Object { - "end": Object { - "column": 16, - "line": 3, - }, - "start": Object { - "column": 15, - "line": 3, - }, - }, - "range": Array [ - 47, - 48, - ], - "type": "Punctuator", - "value": "=", - }, - Object { - "loc": Object { - "end": Object { - "column": 18, - "line": 3, - }, - "start": Object { - "column": 17, - "line": 3, - }, - }, - "range": Array [ - 49, - 50, - ], - "type": "Numeric", - "value": "1", - }, - Object { - "loc": Object { - "end": Object { - "column": 19, - "line": 3, - }, - "start": Object { - "column": 18, - "line": 3, - }, - }, - "range": Array [ - 50, - 51, - ], - "type": "Punctuator", - "value": ";", - }, - Object { - "loc": Object { - "end": Object { - "column": 8, - "line": 4, - }, - "start": Object { - "column": 2, - "line": 4, - }, - }, - "range": Array [ - 54, - 60, - ], - "type": "Keyword", - "value": "static", - }, - Object { - "loc": Object { - "end": Object { - "column": 17, - "line": 4, - }, - "start": Object { - "column": 9, - "line": 4, - }, - }, - "range": Array [ - 61, - 69, - ], - "type": "Identifier", - "value": "accessor", - }, - Object { - "loc": Object { - "end": Object { - "column": 21, - "line": 4, - }, - "start": Object { - "column": 18, - "line": 4, - }, - }, - "range": Array [ - 70, - 73, - ], - "type": "String", - "value": "\\"y\\"", - }, - Object { - "loc": Object { - "end": Object { - "column": 22, - "line": 4, - }, - "start": Object { - "column": 21, - "line": 4, - }, - }, - "range": Array [ - 73, - 74, - ], - "type": "Punctuator", - "value": ":", - }, - Object { - "loc": Object { - "end": Object { - "column": 26, - "line": 4, - }, - "start": Object { - "column": 23, - "line": 4, - }, - }, - "range": Array [ - 75, - 78, - ], - "type": "Identifier", - "value": "any", - }, - Object { - "loc": Object { - "end": Object { - "column": 27, - "line": 4, - }, - "start": Object { - "column": 26, - "line": 4, - }, - }, - "range": Array [ - 78, - 79, - ], - "type": "Punctuator", - "value": ";", - }, - Object { - "loc": Object { - "end": Object { - "column": 8, - "line": 5, - }, - "start": Object { - "column": 2, - "line": 5, - }, - }, - "range": Array [ - 82, - 88, - ], - "type": "Keyword", - "value": "static", - }, - Object { - "loc": Object { - "end": Object { - "column": 17, - "line": 5, - }, - "start": Object { - "column": 9, - "line": 5, - }, - }, - "range": Array [ - 89, - 97, - ], - "type": "Identifier", - "value": "accessor", - }, - Object { - "loc": Object { - "end": Object { - "column": 21, - "line": 5, - }, - "start": Object { - "column": 18, - "line": 5, - }, - }, - "range": Array [ - 98, - 101, - ], - "type": "String", - "value": "\\"z\\"", - }, - Object { - "loc": Object { - "end": Object { - "column": 23, - "line": 5, - }, - "start": Object { - "column": 22, - "line": 5, - }, - }, - "range": Array [ - 102, - 103, - ], - "type": "Punctuator", - "value": "=", - }, - Object { - "loc": Object { - "end": Object { - "column": 25, - "line": 5, - }, - "start": Object { - "column": 24, - "line": 5, - }, - }, - "range": Array [ - 104, - 105, - ], - "type": "Numeric", - "value": "2", - }, - Object { - "loc": Object { - "end": Object { - "column": 26, - "line": 5, - }, - "start": Object { - "column": 25, - "line": 5, - }, - }, - "range": Array [ - 105, - 106, - ], - "type": "Punctuator", - "value": ";", - }, - Object { - "loc": Object { - "end": Object { - "column": 1, - "line": 6, - }, - "start": Object { - "column": 0, - "line": 6, - }, - }, - "range": Array [ - 107, - 108, - ], - "type": "Punctuator", - "value": "}", - }, - ], - "type": "Program", -} -`; diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/auto-accessor-4.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/auto-accessor-4.src.ts.shot deleted file mode 100644 index ac54f24b8c0..00000000000 --- a/packages/typescript-estree/tests/snapshots/typescript/basics/auto-accessor-4.src.ts.shot +++ /dev/null @@ -1,822 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`typescript basics auto-accessor-4.src 1`] = ` -Object { - "body": Array [ - Object { - "body": Object { - "body": Array [ - Object { - "computed": false, - "declare": false, - "key": Object { - "loc": Object { - "end": Object { - "column": 12, - "line": 2, - }, - "start": Object { - "column": 11, - "line": 2, - }, - }, - "range": Array [ - 22, - 23, - ], - "raw": "0", - "type": "Literal", - "value": 0, - }, - "loc": Object { - "end": Object { - "column": 18, - "line": 2, - }, - "start": Object { - "column": 2, - "line": 2, - }, - }, - "override": false, - "range": Array [ - 13, - 29, - ], - "readonly": undefined, - "static": false, - "type": "AccessorProperty", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 17, - "line": 2, - }, - "start": Object { - "column": 12, - "line": 2, - }, - }, - "range": Array [ - 23, - 28, - ], - "type": "TSTypeAnnotation", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 17, - "line": 2, - }, - "start": Object { - "column": 14, - "line": 2, - }, - }, - "range": Array [ - 25, - 28, - ], - "type": "TSAnyKeyword", - }, - }, - "value": null, - }, - Object { - "computed": false, - "declare": false, - "key": Object { - "loc": Object { - "end": Object { - "column": 12, - "line": 3, - }, - "start": Object { - "column": 11, - "line": 3, - }, - }, - "range": Array [ - 41, - 42, - ], - "raw": "1", - "type": "Literal", - "value": 1, - }, - "loc": Object { - "end": Object { - "column": 17, - "line": 3, - }, - "start": Object { - "column": 2, - "line": 3, - }, - }, - "override": false, - "range": Array [ - 32, - 47, - ], - "readonly": undefined, - "static": false, - "type": "AccessorProperty", - "value": Object { - "loc": Object { - "end": Object { - "column": 16, - "line": 3, - }, - "start": Object { - "column": 15, - "line": 3, - }, - }, - "range": Array [ - 45, - 46, - ], - "raw": "1", - "type": "Literal", - "value": 1, - }, - }, - Object { - "computed": false, - "declare": false, - "key": Object { - "loc": Object { - "end": Object { - "column": 19, - "line": 4, - }, - "start": Object { - "column": 18, - "line": 4, - }, - }, - "range": Array [ - 66, - 67, - ], - "raw": "2", - "type": "Literal", - "value": 2, - }, - "loc": Object { - "end": Object { - "column": 25, - "line": 4, - }, - "start": Object { - "column": 2, - "line": 4, - }, - }, - "override": false, - "range": Array [ - 50, - 73, - ], - "readonly": undefined, - "static": true, - "type": "AccessorProperty", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 24, - "line": 4, - }, - "start": Object { - "column": 19, - "line": 4, - }, - }, - "range": Array [ - 67, - 72, - ], - "type": "TSTypeAnnotation", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 24, - "line": 4, - }, - "start": Object { - "column": 21, - "line": 4, - }, - }, - "range": Array [ - 69, - 72, - ], - "type": "TSAnyKeyword", - }, - }, - "value": null, - }, - Object { - "computed": false, - "declare": false, - "key": Object { - "loc": Object { - "end": Object { - "column": 19, - "line": 5, - }, - "start": Object { - "column": 18, - "line": 5, - }, - }, - "range": Array [ - 92, - 93, - ], - "raw": "3", - "type": "Literal", - "value": 3, - }, - "loc": Object { - "end": Object { - "column": 24, - "line": 5, - }, - "start": Object { - "column": 2, - "line": 5, - }, - }, - "override": false, - "range": Array [ - 76, - 98, - ], - "readonly": undefined, - "static": true, - "type": "AccessorProperty", - "value": Object { - "loc": Object { - "end": Object { - "column": 23, - "line": 5, - }, - "start": Object { - "column": 22, - "line": 5, - }, - }, - "range": Array [ - 96, - 97, - ], - "raw": "2", - "type": "Literal", - "value": 2, - }, - }, - ], - "loc": Object { - "end": Object { - "column": 1, - "line": 6, - }, - "start": Object { - "column": 9, - "line": 1, - }, - }, - "range": Array [ - 9, - 100, - ], - "type": "ClassBody", - }, - "id": Object { - "loc": Object { - "end": Object { - "column": 8, - "line": 1, - }, - "start": Object { - "column": 6, - "line": 1, - }, - }, - "name": "C1", - "range": Array [ - 6, - 8, - ], - "type": "Identifier", - }, - "loc": Object { - "end": Object { - "column": 1, - "line": 6, - }, - "start": Object { - "column": 0, - "line": 1, - }, - }, - "range": Array [ - 0, - 100, - ], - "superClass": null, - "type": "ClassDeclaration", - }, - ], - "comments": Array [], - "loc": Object { - "end": Object { - "column": 0, - "line": 7, - }, - "start": Object { - "column": 0, - "line": 1, - }, - }, - "range": Array [ - 0, - 101, - ], - "sourceType": "script", - "tokens": Array [ - Object { - "loc": Object { - "end": Object { - "column": 5, - "line": 1, - }, - "start": Object { - "column": 0, - "line": 1, - }, - }, - "range": Array [ - 0, - 5, - ], - "type": "Keyword", - "value": "class", - }, - Object { - "loc": Object { - "end": Object { - "column": 8, - "line": 1, - }, - "start": Object { - "column": 6, - "line": 1, - }, - }, - "range": Array [ - 6, - 8, - ], - "type": "Identifier", - "value": "C1", - }, - Object { - "loc": Object { - "end": Object { - "column": 10, - "line": 1, - }, - "start": Object { - "column": 9, - "line": 1, - }, - }, - "range": Array [ - 9, - 10, - ], - "type": "Punctuator", - "value": "{", - }, - Object { - "loc": Object { - "end": Object { - "column": 10, - "line": 2, - }, - "start": Object { - "column": 2, - "line": 2, - }, - }, - "range": Array [ - 13, - 21, - ], - "type": "Identifier", - "value": "accessor", - }, - Object { - "loc": Object { - "end": Object { - "column": 12, - "line": 2, - }, - "start": Object { - "column": 11, - "line": 2, - }, - }, - "range": Array [ - 22, - 23, - ], - "type": "Numeric", - "value": "0", - }, - Object { - "loc": Object { - "end": Object { - "column": 13, - "line": 2, - }, - "start": Object { - "column": 12, - "line": 2, - }, - }, - "range": Array [ - 23, - 24, - ], - "type": "Punctuator", - "value": ":", - }, - Object { - "loc": Object { - "end": Object { - "column": 17, - "line": 2, - }, - "start": Object { - "column": 14, - "line": 2, - }, - }, - "range": Array [ - 25, - 28, - ], - "type": "Identifier", - "value": "any", - }, - Object { - "loc": Object { - "end": Object { - "column": 18, - "line": 2, - }, - "start": Object { - "column": 17, - "line": 2, - }, - }, - "range": Array [ - 28, - 29, - ], - "type": "Punctuator", - "value": ";", - }, - Object { - "loc": Object { - "end": Object { - "column": 10, - "line": 3, - }, - "start": Object { - "column": 2, - "line": 3, - }, - }, - "range": Array [ - 32, - 40, - ], - "type": "Identifier", - "value": "accessor", - }, - Object { - "loc": Object { - "end": Object { - "column": 12, - "line": 3, - }, - "start": Object { - "column": 11, - "line": 3, - }, - }, - "range": Array [ - 41, - 42, - ], - "type": "Numeric", - "value": "1", - }, - Object { - "loc": Object { - "end": Object { - "column": 14, - "line": 3, - }, - "start": Object { - "column": 13, - "line": 3, - }, - }, - "range": Array [ - 43, - 44, - ], - "type": "Punctuator", - "value": "=", - }, - Object { - "loc": Object { - "end": Object { - "column": 16, - "line": 3, - }, - "start": Object { - "column": 15, - "line": 3, - }, - }, - "range": Array [ - 45, - 46, - ], - "type": "Numeric", - "value": "1", - }, - Object { - "loc": Object { - "end": Object { - "column": 17, - "line": 3, - }, - "start": Object { - "column": 16, - "line": 3, - }, - }, - "range": Array [ - 46, - 47, - ], - "type": "Punctuator", - "value": ";", - }, - Object { - "loc": Object { - "end": Object { - "column": 8, - "line": 4, - }, - "start": Object { - "column": 2, - "line": 4, - }, - }, - "range": Array [ - 50, - 56, - ], - "type": "Keyword", - "value": "static", - }, - Object { - "loc": Object { - "end": Object { - "column": 17, - "line": 4, - }, - "start": Object { - "column": 9, - "line": 4, - }, - }, - "range": Array [ - 57, - 65, - ], - "type": "Identifier", - "value": "accessor", - }, - Object { - "loc": Object { - "end": Object { - "column": 19, - "line": 4, - }, - "start": Object { - "column": 18, - "line": 4, - }, - }, - "range": Array [ - 66, - 67, - ], - "type": "Numeric", - "value": "2", - }, - Object { - "loc": Object { - "end": Object { - "column": 20, - "line": 4, - }, - "start": Object { - "column": 19, - "line": 4, - }, - }, - "range": Array [ - 67, - 68, - ], - "type": "Punctuator", - "value": ":", - }, - Object { - "loc": Object { - "end": Object { - "column": 24, - "line": 4, - }, - "start": Object { - "column": 21, - "line": 4, - }, - }, - "range": Array [ - 69, - 72, - ], - "type": "Identifier", - "value": "any", - }, - Object { - "loc": Object { - "end": Object { - "column": 25, - "line": 4, - }, - "start": Object { - "column": 24, - "line": 4, - }, - }, - "range": Array [ - 72, - 73, - ], - "type": "Punctuator", - "value": ";", - }, - Object { - "loc": Object { - "end": Object { - "column": 8, - "line": 5, - }, - "start": Object { - "column": 2, - "line": 5, - }, - }, - "range": Array [ - 76, - 82, - ], - "type": "Keyword", - "value": "static", - }, - Object { - "loc": Object { - "end": Object { - "column": 17, - "line": 5, - }, - "start": Object { - "column": 9, - "line": 5, - }, - }, - "range": Array [ - 83, - 91, - ], - "type": "Identifier", - "value": "accessor", - }, - Object { - "loc": Object { - "end": Object { - "column": 19, - "line": 5, - }, - "start": Object { - "column": 18, - "line": 5, - }, - }, - "range": Array [ - 92, - 93, - ], - "type": "Numeric", - "value": "3", - }, - Object { - "loc": Object { - "end": Object { - "column": 21, - "line": 5, - }, - "start": Object { - "column": 20, - "line": 5, - }, - }, - "range": Array [ - 94, - 95, - ], - "type": "Punctuator", - "value": "=", - }, - Object { - "loc": Object { - "end": Object { - "column": 23, - "line": 5, - }, - "start": Object { - "column": 22, - "line": 5, - }, - }, - "range": Array [ - 96, - 97, - ], - "type": "Numeric", - "value": "2", - }, - Object { - "loc": Object { - "end": Object { - "column": 24, - "line": 5, - }, - "start": Object { - "column": 23, - "line": 5, - }, - }, - "range": Array [ - 97, - 98, - ], - "type": "Punctuator", - "value": ";", - }, - Object { - "loc": Object { - "end": Object { - "column": 1, - "line": 6, - }, - "start": Object { - "column": 0, - "line": 6, - }, - }, - "range": Array [ - 99, - 100, - ], - "type": "Punctuator", - "value": "}", - }, - ], - "type": "Program", -} -`; diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/auto-accessor-5.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/auto-accessor-5.src.ts.shot deleted file mode 100644 index 374193a85a4..00000000000 --- a/packages/typescript-estree/tests/snapshots/typescript/basics/auto-accessor-5.src.ts.shot +++ /dev/null @@ -1,1532 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`typescript basics auto-accessor-5.src 1`] = ` -Object { - "body": Array [ - Object { - "body": Object { - "body": Array [ - Object { - "computed": true, - "declare": false, - "key": Object { - "loc": Object { - "end": Object { - "column": 15, - "line": 2, - }, - "start": Object { - "column": 12, - "line": 2, - }, - }, - "range": Array [ - 23, - 26, - ], - "raw": "\\"w\\"", - "type": "Literal", - "value": "w", - }, - "loc": Object { - "end": Object { - "column": 22, - "line": 2, - }, - "start": Object { - "column": 2, - "line": 2, - }, - }, - "override": false, - "range": Array [ - 13, - 33, - ], - "readonly": undefined, - "static": false, - "type": "AccessorProperty", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 21, - "line": 2, - }, - "start": Object { - "column": 16, - "line": 2, - }, - }, - "range": Array [ - 27, - 32, - ], - "type": "TSTypeAnnotation", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 21, - "line": 2, - }, - "start": Object { - "column": 18, - "line": 2, - }, - }, - "range": Array [ - 29, - 32, - ], - "type": "TSAnyKeyword", - }, - }, - "value": null, - }, - Object { - "computed": true, - "declare": false, - "key": Object { - "loc": Object { - "end": Object { - "column": 15, - "line": 3, - }, - "start": Object { - "column": 12, - "line": 3, - }, - }, - "range": Array [ - 46, - 49, - ], - "raw": "\\"x\\"", - "type": "Literal", - "value": "x", - }, - "loc": Object { - "end": Object { - "column": 21, - "line": 3, - }, - "start": Object { - "column": 2, - "line": 3, - }, - }, - "override": false, - "range": Array [ - 36, - 55, - ], - "readonly": undefined, - "static": false, - "type": "AccessorProperty", - "value": Object { - "loc": Object { - "end": Object { - "column": 20, - "line": 3, - }, - "start": Object { - "column": 19, - "line": 3, - }, - }, - "range": Array [ - 53, - 54, - ], - "raw": "1", - "type": "Literal", - "value": 1, - }, - }, - Object { - "computed": true, - "declare": false, - "key": Object { - "loc": Object { - "end": Object { - "column": 22, - "line": 4, - }, - "start": Object { - "column": 19, - "line": 4, - }, - }, - "range": Array [ - 75, - 78, - ], - "raw": "\\"y\\"", - "type": "Literal", - "value": "y", - }, - "loc": Object { - "end": Object { - "column": 29, - "line": 4, - }, - "start": Object { - "column": 2, - "line": 4, - }, - }, - "override": false, - "range": Array [ - 58, - 85, - ], - "readonly": undefined, - "static": true, - "type": "AccessorProperty", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 28, - "line": 4, - }, - "start": Object { - "column": 23, - "line": 4, - }, - }, - "range": Array [ - 79, - 84, - ], - "type": "TSTypeAnnotation", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 28, - "line": 4, - }, - "start": Object { - "column": 25, - "line": 4, - }, - }, - "range": Array [ - 81, - 84, - ], - "type": "TSAnyKeyword", - }, - }, - "value": null, - }, - Object { - "computed": true, - "declare": false, - "key": Object { - "loc": Object { - "end": Object { - "column": 22, - "line": 5, - }, - "start": Object { - "column": 19, - "line": 5, - }, - }, - "range": Array [ - 105, - 108, - ], - "raw": "\\"z\\"", - "type": "Literal", - "value": "z", - }, - "loc": Object { - "end": Object { - "column": 28, - "line": 5, - }, - "start": Object { - "column": 2, - "line": 5, - }, - }, - "override": false, - "range": Array [ - 88, - 114, - ], - "readonly": undefined, - "static": true, - "type": "AccessorProperty", - "value": Object { - "loc": Object { - "end": Object { - "column": 27, - "line": 5, - }, - "start": Object { - "column": 26, - "line": 5, - }, - }, - "range": Array [ - 112, - 113, - ], - "raw": "2", - "type": "Literal", - "value": 2, - }, - }, - ], - "loc": Object { - "end": Object { - "column": 1, - "line": 6, - }, - "start": Object { - "column": 9, - "line": 1, - }, - }, - "range": Array [ - 9, - 116, - ], - "type": "ClassBody", - }, - "id": Object { - "loc": Object { - "end": Object { - "column": 8, - "line": 1, - }, - "start": Object { - "column": 6, - "line": 1, - }, - }, - "name": "C1", - "range": Array [ - 6, - 8, - ], - "type": "Identifier", - }, - "loc": Object { - "end": Object { - "column": 1, - "line": 6, - }, - "start": Object { - "column": 0, - "line": 1, - }, - }, - "range": Array [ - 0, - 116, - ], - "superClass": null, - "type": "ClassDeclaration", - }, - Object { - "declarations": Array [ - Object { - "id": Object { - "loc": Object { - "end": Object { - "column": 18, - "line": 8, - }, - "start": Object { - "column": 12, - "line": 8, - }, - }, - "name": "f", - "range": Array [ - 130, - 136, - ], - "type": "Identifier", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 18, - "line": 8, - }, - "start": Object { - "column": 13, - "line": 8, - }, - }, - "range": Array [ - 131, - 136, - ], - "type": "TSTypeAnnotation", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 18, - "line": 8, - }, - "start": Object { - "column": 15, - "line": 8, - }, - }, - "range": Array [ - 133, - 136, - ], - "type": "TSAnyKeyword", - }, - }, - }, - "init": null, - "loc": Object { - "end": Object { - "column": 18, - "line": 8, - }, - "start": Object { - "column": 12, - "line": 8, - }, - }, - "range": Array [ - 130, - 136, - ], - "type": "VariableDeclarator", - }, - ], - "declare": true, - "kind": "var", - "loc": Object { - "end": Object { - "column": 19, - "line": 8, - }, - "start": Object { - "column": 0, - "line": 8, - }, - }, - "range": Array [ - 118, - 137, - ], - "type": "VariableDeclaration", - }, - Object { - "body": Object { - "body": Array [ - Object { - "computed": true, - "declare": false, - "key": Object { - "arguments": Array [], - "callee": Object { - "loc": Object { - "end": Object { - "column": 13, - "line": 10, - }, - "start": Object { - "column": 12, - "line": 10, - }, - }, - "name": "f", - "range": Array [ - 161, - 162, - ], - "type": "Identifier", - }, - "loc": Object { - "end": Object { - "column": 15, - "line": 10, - }, - "start": Object { - "column": 12, - "line": 10, - }, - }, - "optional": false, - "range": Array [ - 161, - 164, - ], - "type": "CallExpression", - }, - "loc": Object { - "end": Object { - "column": 21, - "line": 10, - }, - "start": Object { - "column": 2, - "line": 10, - }, - }, - "override": false, - "range": Array [ - 151, - 170, - ], - "readonly": undefined, - "static": false, - "type": "AccessorProperty", - "value": Object { - "loc": Object { - "end": Object { - "column": 20, - "line": 10, - }, - "start": Object { - "column": 19, - "line": 10, - }, - }, - "range": Array [ - 168, - 169, - ], - "raw": "1", - "type": "Literal", - "value": 1, - }, - }, - ], - "loc": Object { - "end": Object { - "column": 1, - "line": 11, - }, - "start": Object { - "column": 9, - "line": 9, - }, - }, - "range": Array [ - 147, - 172, - ], - "type": "ClassBody", - }, - "id": Object { - "loc": Object { - "end": Object { - "column": 8, - "line": 9, - }, - "start": Object { - "column": 6, - "line": 9, - }, - }, - "name": "C2", - "range": Array [ - 144, - 146, - ], - "type": "Identifier", - }, - "loc": Object { - "end": Object { - "column": 1, - "line": 11, - }, - "start": Object { - "column": 0, - "line": 9, - }, - }, - "range": Array [ - 138, - 172, - ], - "superClass": null, - "type": "ClassDeclaration", - }, - ], - "comments": Array [], - "loc": Object { - "end": Object { - "column": 0, - "line": 12, - }, - "start": Object { - "column": 0, - "line": 1, - }, - }, - "range": Array [ - 0, - 173, - ], - "sourceType": "script", - "tokens": Array [ - Object { - "loc": Object { - "end": Object { - "column": 5, - "line": 1, - }, - "start": Object { - "column": 0, - "line": 1, - }, - }, - "range": Array [ - 0, - 5, - ], - "type": "Keyword", - "value": "class", - }, - Object { - "loc": Object { - "end": Object { - "column": 8, - "line": 1, - }, - "start": Object { - "column": 6, - "line": 1, - }, - }, - "range": Array [ - 6, - 8, - ], - "type": "Identifier", - "value": "C1", - }, - Object { - "loc": Object { - "end": Object { - "column": 10, - "line": 1, - }, - "start": Object { - "column": 9, - "line": 1, - }, - }, - "range": Array [ - 9, - 10, - ], - "type": "Punctuator", - "value": "{", - }, - Object { - "loc": Object { - "end": Object { - "column": 10, - "line": 2, - }, - "start": Object { - "column": 2, - "line": 2, - }, - }, - "range": Array [ - 13, - 21, - ], - "type": "Identifier", - "value": "accessor", - }, - Object { - "loc": Object { - "end": Object { - "column": 12, - "line": 2, - }, - "start": Object { - "column": 11, - "line": 2, - }, - }, - "range": Array [ - 22, - 23, - ], - "type": "Punctuator", - "value": "[", - }, - Object { - "loc": Object { - "end": Object { - "column": 15, - "line": 2, - }, - "start": Object { - "column": 12, - "line": 2, - }, - }, - "range": Array [ - 23, - 26, - ], - "type": "String", - "value": "\\"w\\"", - }, - Object { - "loc": Object { - "end": Object { - "column": 16, - "line": 2, - }, - "start": Object { - "column": 15, - "line": 2, - }, - }, - "range": Array [ - 26, - 27, - ], - "type": "Punctuator", - "value": "]", - }, - Object { - "loc": Object { - "end": Object { - "column": 17, - "line": 2, - }, - "start": Object { - "column": 16, - "line": 2, - }, - }, - "range": Array [ - 27, - 28, - ], - "type": "Punctuator", - "value": ":", - }, - Object { - "loc": Object { - "end": Object { - "column": 21, - "line": 2, - }, - "start": Object { - "column": 18, - "line": 2, - }, - }, - "range": Array [ - 29, - 32, - ], - "type": "Identifier", - "value": "any", - }, - Object { - "loc": Object { - "end": Object { - "column": 22, - "line": 2, - }, - "start": Object { - "column": 21, - "line": 2, - }, - }, - "range": Array [ - 32, - 33, - ], - "type": "Punctuator", - "value": ";", - }, - Object { - "loc": Object { - "end": Object { - "column": 10, - "line": 3, - }, - "start": Object { - "column": 2, - "line": 3, - }, - }, - "range": Array [ - 36, - 44, - ], - "type": "Identifier", - "value": "accessor", - }, - Object { - "loc": Object { - "end": Object { - "column": 12, - "line": 3, - }, - "start": Object { - "column": 11, - "line": 3, - }, - }, - "range": Array [ - 45, - 46, - ], - "type": "Punctuator", - "value": "[", - }, - Object { - "loc": Object { - "end": Object { - "column": 15, - "line": 3, - }, - "start": Object { - "column": 12, - "line": 3, - }, - }, - "range": Array [ - 46, - 49, - ], - "type": "String", - "value": "\\"x\\"", - }, - Object { - "loc": Object { - "end": Object { - "column": 16, - "line": 3, - }, - "start": Object { - "column": 15, - "line": 3, - }, - }, - "range": Array [ - 49, - 50, - ], - "type": "Punctuator", - "value": "]", - }, - Object { - "loc": Object { - "end": Object { - "column": 18, - "line": 3, - }, - "start": Object { - "column": 17, - "line": 3, - }, - }, - "range": Array [ - 51, - 52, - ], - "type": "Punctuator", - "value": "=", - }, - Object { - "loc": Object { - "end": Object { - "column": 20, - "line": 3, - }, - "start": Object { - "column": 19, - "line": 3, - }, - }, - "range": Array [ - 53, - 54, - ], - "type": "Numeric", - "value": "1", - }, - Object { - "loc": Object { - "end": Object { - "column": 21, - "line": 3, - }, - "start": Object { - "column": 20, - "line": 3, - }, - }, - "range": Array [ - 54, - 55, - ], - "type": "Punctuator", - "value": ";", - }, - Object { - "loc": Object { - "end": Object { - "column": 8, - "line": 4, - }, - "start": Object { - "column": 2, - "line": 4, - }, - }, - "range": Array [ - 58, - 64, - ], - "type": "Keyword", - "value": "static", - }, - Object { - "loc": Object { - "end": Object { - "column": 17, - "line": 4, - }, - "start": Object { - "column": 9, - "line": 4, - }, - }, - "range": Array [ - 65, - 73, - ], - "type": "Identifier", - "value": "accessor", - }, - Object { - "loc": Object { - "end": Object { - "column": 19, - "line": 4, - }, - "start": Object { - "column": 18, - "line": 4, - }, - }, - "range": Array [ - 74, - 75, - ], - "type": "Punctuator", - "value": "[", - }, - Object { - "loc": Object { - "end": Object { - "column": 22, - "line": 4, - }, - "start": Object { - "column": 19, - "line": 4, - }, - }, - "range": Array [ - 75, - 78, - ], - "type": "String", - "value": "\\"y\\"", - }, - Object { - "loc": Object { - "end": Object { - "column": 23, - "line": 4, - }, - "start": Object { - "column": 22, - "line": 4, - }, - }, - "range": Array [ - 78, - 79, - ], - "type": "Punctuator", - "value": "]", - }, - Object { - "loc": Object { - "end": Object { - "column": 24, - "line": 4, - }, - "start": Object { - "column": 23, - "line": 4, - }, - }, - "range": Array [ - 79, - 80, - ], - "type": "Punctuator", - "value": ":", - }, - Object { - "loc": Object { - "end": Object { - "column": 28, - "line": 4, - }, - "start": Object { - "column": 25, - "line": 4, - }, - }, - "range": Array [ - 81, - 84, - ], - "type": "Identifier", - "value": "any", - }, - Object { - "loc": Object { - "end": Object { - "column": 29, - "line": 4, - }, - "start": Object { - "column": 28, - "line": 4, - }, - }, - "range": Array [ - 84, - 85, - ], - "type": "Punctuator", - "value": ";", - }, - Object { - "loc": Object { - "end": Object { - "column": 8, - "line": 5, - }, - "start": Object { - "column": 2, - "line": 5, - }, - }, - "range": Array [ - 88, - 94, - ], - "type": "Keyword", - "value": "static", - }, - Object { - "loc": Object { - "end": Object { - "column": 17, - "line": 5, - }, - "start": Object { - "column": 9, - "line": 5, - }, - }, - "range": Array [ - 95, - 103, - ], - "type": "Identifier", - "value": "accessor", - }, - Object { - "loc": Object { - "end": Object { - "column": 19, - "line": 5, - }, - "start": Object { - "column": 18, - "line": 5, - }, - }, - "range": Array [ - 104, - 105, - ], - "type": "Punctuator", - "value": "[", - }, - Object { - "loc": Object { - "end": Object { - "column": 22, - "line": 5, - }, - "start": Object { - "column": 19, - "line": 5, - }, - }, - "range": Array [ - 105, - 108, - ], - "type": "String", - "value": "\\"z\\"", - }, - Object { - "loc": Object { - "end": Object { - "column": 23, - "line": 5, - }, - "start": Object { - "column": 22, - "line": 5, - }, - }, - "range": Array [ - 108, - 109, - ], - "type": "Punctuator", - "value": "]", - }, - Object { - "loc": Object { - "end": Object { - "column": 25, - "line": 5, - }, - "start": Object { - "column": 24, - "line": 5, - }, - }, - "range": Array [ - 110, - 111, - ], - "type": "Punctuator", - "value": "=", - }, - Object { - "loc": Object { - "end": Object { - "column": 27, - "line": 5, - }, - "start": Object { - "column": 26, - "line": 5, - }, - }, - "range": Array [ - 112, - 113, - ], - "type": "Numeric", - "value": "2", - }, - Object { - "loc": Object { - "end": Object { - "column": 28, - "line": 5, - }, - "start": Object { - "column": 27, - "line": 5, - }, - }, - "range": Array [ - 113, - 114, - ], - "type": "Punctuator", - "value": ";", - }, - Object { - "loc": Object { - "end": Object { - "column": 1, - "line": 6, - }, - "start": Object { - "column": 0, - "line": 6, - }, - }, - "range": Array [ - 115, - 116, - ], - "type": "Punctuator", - "value": "}", - }, - Object { - "loc": Object { - "end": Object { - "column": 7, - "line": 8, - }, - "start": Object { - "column": 0, - "line": 8, - }, - }, - "range": Array [ - 118, - 125, - ], - "type": "Identifier", - "value": "declare", - }, - Object { - "loc": Object { - "end": Object { - "column": 11, - "line": 8, - }, - "start": Object { - "column": 8, - "line": 8, - }, - }, - "range": Array [ - 126, - 129, - ], - "type": "Keyword", - "value": "var", - }, - Object { - "loc": Object { - "end": Object { - "column": 13, - "line": 8, - }, - "start": Object { - "column": 12, - "line": 8, - }, - }, - "range": Array [ - 130, - 131, - ], - "type": "Identifier", - "value": "f", - }, - Object { - "loc": Object { - "end": Object { - "column": 14, - "line": 8, - }, - "start": Object { - "column": 13, - "line": 8, - }, - }, - "range": Array [ - 131, - 132, - ], - "type": "Punctuator", - "value": ":", - }, - Object { - "loc": Object { - "end": Object { - "column": 18, - "line": 8, - }, - "start": Object { - "column": 15, - "line": 8, - }, - }, - "range": Array [ - 133, - 136, - ], - "type": "Identifier", - "value": "any", - }, - Object { - "loc": Object { - "end": Object { - "column": 19, - "line": 8, - }, - "start": Object { - "column": 18, - "line": 8, - }, - }, - "range": Array [ - 136, - 137, - ], - "type": "Punctuator", - "value": ";", - }, - Object { - "loc": Object { - "end": Object { - "column": 5, - "line": 9, - }, - "start": Object { - "column": 0, - "line": 9, - }, - }, - "range": Array [ - 138, - 143, - ], - "type": "Keyword", - "value": "class", - }, - Object { - "loc": Object { - "end": Object { - "column": 8, - "line": 9, - }, - "start": Object { - "column": 6, - "line": 9, - }, - }, - "range": Array [ - 144, - 146, - ], - "type": "Identifier", - "value": "C2", - }, - Object { - "loc": Object { - "end": Object { - "column": 10, - "line": 9, - }, - "start": Object { - "column": 9, - "line": 9, - }, - }, - "range": Array [ - 147, - 148, - ], - "type": "Punctuator", - "value": "{", - }, - Object { - "loc": Object { - "end": Object { - "column": 10, - "line": 10, - }, - "start": Object { - "column": 2, - "line": 10, - }, - }, - "range": Array [ - 151, - 159, - ], - "type": "Identifier", - "value": "accessor", - }, - Object { - "loc": Object { - "end": Object { - "column": 12, - "line": 10, - }, - "start": Object { - "column": 11, - "line": 10, - }, - }, - "range": Array [ - 160, - 161, - ], - "type": "Punctuator", - "value": "[", - }, - Object { - "loc": Object { - "end": Object { - "column": 13, - "line": 10, - }, - "start": Object { - "column": 12, - "line": 10, - }, - }, - "range": Array [ - 161, - 162, - ], - "type": "Identifier", - "value": "f", - }, - Object { - "loc": Object { - "end": Object { - "column": 14, - "line": 10, - }, - "start": Object { - "column": 13, - "line": 10, - }, - }, - "range": Array [ - 162, - 163, - ], - "type": "Punctuator", - "value": "(", - }, - Object { - "loc": Object { - "end": Object { - "column": 15, - "line": 10, - }, - "start": Object { - "column": 14, - "line": 10, - }, - }, - "range": Array [ - 163, - 164, - ], - "type": "Punctuator", - "value": ")", - }, - Object { - "loc": Object { - "end": Object { - "column": 16, - "line": 10, - }, - "start": Object { - "column": 15, - "line": 10, - }, - }, - "range": Array [ - 164, - 165, - ], - "type": "Punctuator", - "value": "]", - }, - Object { - "loc": Object { - "end": Object { - "column": 18, - "line": 10, - }, - "start": Object { - "column": 17, - "line": 10, - }, - }, - "range": Array [ - 166, - 167, - ], - "type": "Punctuator", - "value": "=", - }, - Object { - "loc": Object { - "end": Object { - "column": 20, - "line": 10, - }, - "start": Object { - "column": 19, - "line": 10, - }, - }, - "range": Array [ - 168, - 169, - ], - "type": "Numeric", - "value": "1", - }, - Object { - "loc": Object { - "end": Object { - "column": 21, - "line": 10, - }, - "start": Object { - "column": 20, - "line": 10, - }, - }, - "range": Array [ - 169, - 170, - ], - "type": "Punctuator", - "value": ";", - }, - Object { - "loc": Object { - "end": Object { - "column": 1, - "line": 11, - }, - "start": Object { - "column": 0, - "line": 11, - }, - }, - "range": Array [ - 171, - 172, - ], - "type": "Punctuator", - "value": "}", - }, - ], - "type": "Program", -} -`; From 3c326c43f2574d5cab14c9e13bd35f0294fde514 Mon Sep 17 00:00:00 2001 From: Brad Zacher Date: Fri, 18 Nov 2022 15:18:33 +1030 Subject: [PATCH 16/20] add ast-spec testing tooling to allow us to expect babel to not support certain cases --- .../assertion/snapshots/1-TSESTree-AST.shot | 102 --------- .../snapshots/2-TSESTree-Tokens.shot | 136 ------------ .../assertion/snapshots/3-Babel-AST.shot | 102 --------- .../assertion/snapshots/4-Babel-Tokens.shot | 136 ------------ .../snapshots/6-AST-Alignment-Tokens.shot | 6 - .../{ => _error_}/modifier-declare/fixture.ts | 0 .../snapshots/1-TSESTree-Error.shot | 3 + .../snapshots/2-Babel-Error.shot | 3 + .../snapshots/3-Alignment-Error.shot | 3 + .../fixture.ts | 3 + .../snapshots/1-TSESTree-Error.shot | 3 + .../snapshots/2-Babel-Error.shot | 3 + .../snapshots/3-Alignment-Error.shot | 3 + .../modifier-abstract-with-value/config.ts | 4 + .../snapshots/3-Babel-Error.shot | 3 + .../fixtures/modifier-abstract/config.ts | 4 + .../snapshots/3-Babel-Error.shot | 3 + .../fixtures/modifier-override/fixture.ts | 4 +- .../snapshots/1-TSESTree-AST.shot | 29 ++- .../snapshots/2-TSESTree-Tokens.shot | 42 +++- .../snapshots/3-Babel-AST.shot} | 60 +++--- .../snapshots/4-Babel-Tokens.shot} | 74 ++++--- .../snapshots/5-AST-Alignment-AST.shot | 96 +++++++++ .../snapshots/6-AST-Alignment-Tokens.shot} | 2 +- .../with-annotation-no-value/config.ts | 4 + .../snapshots/3-Babel-Error.shot | 3 + .../with-annotation-with-value/config.ts | 4 + .../snapshots/3-Babel-Error.shot | 3 + .../tests/fixtures-with-differences-ast.shot | 1 + .../fixtures-with-differences-errors.shot | 2 + .../tests/fixtures-without-babel-support.shot | 10 + packages/ast-spec/tests/fixtures.test.ts | 199 ++++++++++++------ .../tests/util/parsers/parser-types.ts | 17 +- packages/ast-spec/tsconfig.json | 11 +- packages/ast-spec/typings/global.d.ts | 12 ++ 35 files changed, 450 insertions(+), 640 deletions(-) delete mode 100644 packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/_error_/assertion/snapshots/1-TSESTree-AST.shot delete mode 100644 packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/_error_/assertion/snapshots/2-TSESTree-Tokens.shot delete mode 100644 packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/_error_/assertion/snapshots/3-Babel-AST.shot delete mode 100644 packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/_error_/assertion/snapshots/4-Babel-Tokens.shot delete mode 100644 packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/_error_/assertion/snapshots/6-AST-Alignment-Tokens.shot rename packages/ast-spec/src/element/AccessorProperty/fixtures/{ => _error_}/modifier-declare/fixture.ts (100%) create mode 100644 packages/ast-spec/src/element/AccessorProperty/fixtures/_error_/modifier-declare/snapshots/1-TSESTree-Error.shot create mode 100644 packages/ast-spec/src/element/AccessorProperty/fixtures/_error_/modifier-declare/snapshots/2-Babel-Error.shot create mode 100644 packages/ast-spec/src/element/AccessorProperty/fixtures/_error_/modifier-declare/snapshots/3-Alignment-Error.shot create mode 100644 packages/ast-spec/src/element/AccessorProperty/fixtures/_error_/modifier-override-with-no-extends/fixture.ts create mode 100644 packages/ast-spec/src/element/AccessorProperty/fixtures/_error_/modifier-override-with-no-extends/snapshots/1-TSESTree-Error.shot create mode 100644 packages/ast-spec/src/element/AccessorProperty/fixtures/_error_/modifier-override-with-no-extends/snapshots/2-Babel-Error.shot create mode 100644 packages/ast-spec/src/element/AccessorProperty/fixtures/_error_/modifier-override-with-no-extends/snapshots/3-Alignment-Error.shot create mode 100644 packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-abstract-with-value/config.ts create mode 100644 packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-abstract-with-value/snapshots/3-Babel-Error.shot create mode 100644 packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-abstract/config.ts create mode 100644 packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-abstract/snapshots/3-Babel-Error.shot rename packages/ast-spec/src/element/AccessorProperty/fixtures/{modifier-declare/snapshots/1-TSESTree-AST.shot => modifier-override/snapshots/3-Babel-AST.shot} (50%) rename packages/ast-spec/src/element/AccessorProperty/fixtures/{modifier-declare/snapshots/2-TSESTree-Tokens.shot => modifier-override/snapshots/4-Babel-Tokens.shot} (54%) create mode 100644 packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-override/snapshots/5-AST-Alignment-AST.shot rename packages/ast-spec/src/{declaration/ExportNamedDeclaration/fixtures/_error_/assertion/snapshots/5-AST-Alignment-AST.shot => element/AccessorProperty/fixtures/modifier-override/snapshots/6-AST-Alignment-Tokens.shot} (52%) create mode 100644 packages/ast-spec/src/element/AccessorProperty/fixtures/with-annotation-no-value/config.ts create mode 100644 packages/ast-spec/src/element/AccessorProperty/fixtures/with-annotation-no-value/snapshots/3-Babel-Error.shot create mode 100644 packages/ast-spec/src/element/AccessorProperty/fixtures/with-annotation-with-value/config.ts create mode 100644 packages/ast-spec/src/element/AccessorProperty/fixtures/with-annotation-with-value/snapshots/3-Babel-Error.shot create mode 100644 packages/ast-spec/tests/fixtures-without-babel-support.shot create mode 100644 packages/ast-spec/typings/global.d.ts diff --git a/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/_error_/assertion/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/_error_/assertion/snapshots/1-TSESTree-AST.shot deleted file mode 100644 index 9136ca295cb..00000000000 --- a/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/_error_/assertion/snapshots/1-TSESTree-AST.shot +++ /dev/null @@ -1,102 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`AST Fixtures declaration ExportNamedDeclaration assertion TSESTree - AST 1`] = ` -Program { - type: "Program", - body: Array [ - ExportNamedDeclaration { - type: "ExportNamedDeclaration", - assertions: Array [ - ImportAttribute { - type: "ImportAttribute", - key: Identifier { - type: "Identifier", - name: "type", - - range: [35, 39], - loc: { - start: { column: 35, line: 1 }, - end: { column: 39, line: 1 }, - }, - }, - value: Literal { - type: "Literal", - raw: "'json'", - value: "json", - - range: [41, 47], - loc: { - start: { column: 41, line: 1 }, - end: { column: 47, line: 1 }, - }, - }, - - range: [35, 47], - loc: { - start: { column: 35, line: 1 }, - end: { column: 47, line: 1 }, - }, - }, - ], - declaration: null, - exportKind: "value", - source: Literal { - type: "Literal", - raw: "'mod'", - value: "mod", - - range: [20, 25], - loc: { - start: { column: 20, line: 1 }, - end: { column: 25, line: 1 }, - }, - }, - specifiers: Array [ - ExportSpecifier { - type: "ExportSpecifier", - exported: Identifier { - type: "Identifier", - name: "foo", - - range: [9, 12], - loc: { - start: { column: 9, line: 1 }, - end: { column: 12, line: 1 }, - }, - }, - exportKind: "value", - local: Identifier { - type: "Identifier", - name: "foo", - - range: [9, 12], - loc: { - start: { column: 9, line: 1 }, - end: { column: 12, line: 1 }, - }, - }, - - range: [9, 12], - loc: { - start: { column: 9, line: 1 }, - end: { column: 12, line: 1 }, - }, - }, - ], - - range: [0, 50], - loc: { - start: { column: 0, line: 1 }, - end: { column: 50, line: 1 }, - }, - }, - ], - sourceType: "module", - - range: [0, 51], - loc: { - start: { column: 0, line: 1 }, - end: { column: 0, line: 2 }, - }, -} -`; diff --git a/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/_error_/assertion/snapshots/2-TSESTree-Tokens.shot b/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/_error_/assertion/snapshots/2-TSESTree-Tokens.shot deleted file mode 100644 index 9a30eb2745c..00000000000 --- a/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/_error_/assertion/snapshots/2-TSESTree-Tokens.shot +++ /dev/null @@ -1,136 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`AST Fixtures declaration ExportNamedDeclaration assertion TSESTree - Tokens 1`] = ` -Array [ - Keyword { - type: "Keyword", - value: "export", - - range: [0, 6], - loc: { - start: { column: 0, line: 1 }, - end: { column: 6, line: 1 }, - }, - }, - Punctuator { - type: "Punctuator", - value: "{", - - range: [7, 8], - loc: { - start: { column: 7, line: 1 }, - end: { column: 8, line: 1 }, - }, - }, - Identifier { - type: "Identifier", - value: "foo", - - 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 }, - }, - }, - Identifier { - type: "Identifier", - value: "from", - - range: [15, 19], - loc: { - start: { column: 15, line: 1 }, - end: { column: 19, line: 1 }, - }, - }, - String { - type: "String", - value: "'mod'", - - range: [20, 25], - loc: { - start: { column: 20, line: 1 }, - end: { column: 25, line: 1 }, - }, - }, - Identifier { - type: "Identifier", - value: "assert", - - range: [26, 32], - loc: { - start: { column: 26, line: 1 }, - end: { column: 32, line: 1 }, - }, - }, - Punctuator { - type: "Punctuator", - value: "{", - - range: [33, 34], - loc: { - start: { column: 33, line: 1 }, - end: { column: 34, line: 1 }, - }, - }, - Identifier { - type: "Identifier", - value: "type", - - range: [35, 39], - loc: { - start: { column: 35, line: 1 }, - end: { column: 39, line: 1 }, - }, - }, - Punctuator { - type: "Punctuator", - value: ":", - - range: [39, 40], - loc: { - start: { column: 39, line: 1 }, - end: { column: 40, line: 1 }, - }, - }, - String { - type: "String", - value: "'json'", - - range: [41, 47], - loc: { - start: { column: 41, line: 1 }, - end: { column: 47, line: 1 }, - }, - }, - Punctuator { - type: "Punctuator", - value: "}", - - range: [48, 49], - loc: { - start: { column: 48, line: 1 }, - end: { column: 49, line: 1 }, - }, - }, - Punctuator { - type: "Punctuator", - value: ";", - - range: [49, 50], - loc: { - start: { column: 49, line: 1 }, - end: { column: 50, line: 1 }, - }, - }, -] -`; diff --git a/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/_error_/assertion/snapshots/3-Babel-AST.shot b/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/_error_/assertion/snapshots/3-Babel-AST.shot deleted file mode 100644 index b2ee980389e..00000000000 --- a/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/_error_/assertion/snapshots/3-Babel-AST.shot +++ /dev/null @@ -1,102 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`AST Fixtures declaration ExportNamedDeclaration assertion Babel - AST 1`] = ` -Program { - type: "Program", - body: Array [ - ExportNamedDeclaration { - type: "ExportNamedDeclaration", - assertions: Array [ - ImportAttribute { - type: "ImportAttribute", - key: Identifier { - type: "Identifier", - name: "type", - - range: [35, 39], - loc: { - start: { column: 35, line: 1 }, - end: { column: 39, line: 1 }, - }, - }, - value: Literal { - type: "Literal", - raw: "'json'", - value: "json", - - range: [41, 47], - loc: { - start: { column: 41, line: 1 }, - end: { column: 47, line: 1 }, - }, - }, - - range: [35, 47], - loc: { - start: { column: 35, line: 1 }, - end: { column: 47, line: 1 }, - }, - }, - ], - declaration: null, - exportKind: "value", - source: Literal { - type: "Literal", - raw: "'mod'", - value: "mod", - - range: [20, 25], - loc: { - start: { column: 20, line: 1 }, - end: { column: 25, line: 1 }, - }, - }, - specifiers: Array [ - ExportSpecifier { - type: "ExportSpecifier", - exported: Identifier { - type: "Identifier", - name: "foo", - - range: [9, 12], - loc: { - start: { column: 9, line: 1 }, - end: { column: 12, line: 1 }, - }, - }, - exportKind: "value", - local: Identifier { - type: "Identifier", - name: "foo", - - range: [9, 12], - loc: { - start: { column: 9, line: 1 }, - end: { column: 12, line: 1 }, - }, - }, - - range: [9, 12], - loc: { - start: { column: 9, line: 1 }, - end: { column: 12, line: 1 }, - }, - }, - ], - - range: [0, 50], - loc: { - start: { column: 0, line: 1 }, - end: { column: 50, line: 1 }, - }, - }, - ], - sourceType: "module", - - range: [0, 51], - loc: { - start: { column: 0, line: 1 }, - end: { column: 0, line: 2 }, - }, -} -`; diff --git a/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/_error_/assertion/snapshots/4-Babel-Tokens.shot b/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/_error_/assertion/snapshots/4-Babel-Tokens.shot deleted file mode 100644 index 95aa314bf6b..00000000000 --- a/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/_error_/assertion/snapshots/4-Babel-Tokens.shot +++ /dev/null @@ -1,136 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`AST Fixtures declaration ExportNamedDeclaration assertion Babel - Tokens 1`] = ` -Array [ - Keyword { - type: "Keyword", - value: "export", - - range: [0, 6], - loc: { - start: { column: 0, line: 1 }, - end: { column: 6, line: 1 }, - }, - }, - Punctuator { - type: "Punctuator", - value: "{", - - range: [7, 8], - loc: { - start: { column: 7, line: 1 }, - end: { column: 8, line: 1 }, - }, - }, - Identifier { - type: "Identifier", - value: "foo", - - 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 }, - }, - }, - Identifier { - type: "Identifier", - value: "from", - - range: [15, 19], - loc: { - start: { column: 15, line: 1 }, - end: { column: 19, line: 1 }, - }, - }, - String { - type: "String", - value: "'mod'", - - range: [20, 25], - loc: { - start: { column: 20, line: 1 }, - end: { column: 25, line: 1 }, - }, - }, - Identifier { - type: "Identifier", - value: "assert", - - range: [26, 32], - loc: { - start: { column: 26, line: 1 }, - end: { column: 32, line: 1 }, - }, - }, - Punctuator { - type: "Punctuator", - value: "{", - - range: [33, 34], - loc: { - start: { column: 33, line: 1 }, - end: { column: 34, line: 1 }, - }, - }, - Identifier { - type: "Identifier", - value: "type", - - range: [35, 39], - loc: { - start: { column: 35, line: 1 }, - end: { column: 39, line: 1 }, - }, - }, - Punctuator { - type: "Punctuator", - value: ":", - - range: [39, 40], - loc: { - start: { column: 39, line: 1 }, - end: { column: 40, line: 1 }, - }, - }, - String { - type: "String", - value: "'json'", - - range: [41, 47], - loc: { - start: { column: 41, line: 1 }, - end: { column: 47, line: 1 }, - }, - }, - Punctuator { - type: "Punctuator", - value: "}", - - range: [48, 49], - loc: { - start: { column: 48, line: 1 }, - end: { column: 49, line: 1 }, - }, - }, - Punctuator { - type: "Punctuator", - value: ";", - - range: [49, 50], - loc: { - start: { column: 49, line: 1 }, - end: { column: 50, line: 1 }, - }, - }, -] -`; diff --git a/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/_error_/assertion/snapshots/6-AST-Alignment-Tokens.shot b/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/_error_/assertion/snapshots/6-AST-Alignment-Tokens.shot deleted file mode 100644 index dade8ee29e7..00000000000 --- a/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/_error_/assertion/snapshots/6-AST-Alignment-Tokens.shot +++ /dev/null @@ -1,6 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`AST Fixtures declaration ExportNamedDeclaration assertion AST Alignment - Token 1`] = ` -"Snapshot Diff: -Compared values have no visual difference." -`; diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-declare/fixture.ts b/packages/ast-spec/src/element/AccessorProperty/fixtures/_error_/modifier-declare/fixture.ts similarity index 100% rename from packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-declare/fixture.ts rename to packages/ast-spec/src/element/AccessorProperty/fixtures/_error_/modifier-declare/fixture.ts diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/_error_/modifier-declare/snapshots/1-TSESTree-Error.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/_error_/modifier-declare/snapshots/1-TSESTree-Error.shot new file mode 100644 index 00000000000..e9efe0512eb --- /dev/null +++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/_error_/modifier-declare/snapshots/1-TSESTree-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures element AccessorProperty _error_ modifier-declare TSESTree - Error 1`] = `"NO ERROR"`; diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/_error_/modifier-declare/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/_error_/modifier-declare/snapshots/2-Babel-Error.shot new file mode 100644 index 00000000000..7d44c5a9712 --- /dev/null +++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/_error_/modifier-declare/snapshots/2-Babel-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures element AccessorProperty _error_ modifier-declare Babel - Error 1`] = `[SyntaxError: Missing semicolon. (2:22)]`; diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/_error_/modifier-declare/snapshots/3-Alignment-Error.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/_error_/modifier-declare/snapshots/3-Alignment-Error.shot new file mode 100644 index 00000000000..a6fbd60e31c --- /dev/null +++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/_error_/modifier-declare/snapshots/3-Alignment-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures element AccessorProperty _error_ modifier-declare Error Alignment 1`] = `"Babel errored but TSESTree didn't"`; diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/_error_/modifier-override-with-no-extends/fixture.ts b/packages/ast-spec/src/element/AccessorProperty/fixtures/_error_/modifier-override-with-no-extends/fixture.ts new file mode 100644 index 00000000000..3369657d82b --- /dev/null +++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/_error_/modifier-override-with-no-extends/fixture.ts @@ -0,0 +1,3 @@ +class Foo { + override accessor foo = 2; +} diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/_error_/modifier-override-with-no-extends/snapshots/1-TSESTree-Error.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/_error_/modifier-override-with-no-extends/snapshots/1-TSESTree-Error.shot new file mode 100644 index 00000000000..e1f58f42d42 --- /dev/null +++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/_error_/modifier-override-with-no-extends/snapshots/1-TSESTree-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures element AccessorProperty _error_ modifier-override-with-no-extends TSESTree - Error 1`] = `"NO ERROR"`; diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/_error_/modifier-override-with-no-extends/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/_error_/modifier-override-with-no-extends/snapshots/2-Babel-Error.shot new file mode 100644 index 00000000000..071d521919f --- /dev/null +++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/_error_/modifier-override-with-no-extends/snapshots/2-Babel-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures element AccessorProperty _error_ modifier-override-with-no-extends Babel - Error 1`] = `[SyntaxError: This member cannot have an 'override' modifier because its containing class does not extend another class. (2:2)]`; diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/_error_/modifier-override-with-no-extends/snapshots/3-Alignment-Error.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/_error_/modifier-override-with-no-extends/snapshots/3-Alignment-Error.shot new file mode 100644 index 00000000000..27d6eef74b0 --- /dev/null +++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/_error_/modifier-override-with-no-extends/snapshots/3-Alignment-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures element AccessorProperty _error_ modifier-override-with-no-extends Error Alignment 1`] = `"Babel errored but TSESTree didn't"`; diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-abstract-with-value/config.ts b/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-abstract-with-value/config.ts new file mode 100644 index 00000000000..76723298df6 --- /dev/null +++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-abstract-with-value/config.ts @@ -0,0 +1,4 @@ +export default { + // https://github.com/babel/babel/issues/15205 + expectBabelToNotSupport: true, +} satisfies ASTFixtureConfig; diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-abstract-with-value/snapshots/3-Babel-Error.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-abstract-with-value/snapshots/3-Babel-Error.shot new file mode 100644 index 00000000000..c49a847cd3a --- /dev/null +++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-abstract-with-value/snapshots/3-Babel-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures element AccessorProperty modifier-abstract-with-value Babel - Error 1`] = `[SyntaxError: Missing semicolon. (2:23)]`; diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-abstract/config.ts b/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-abstract/config.ts new file mode 100644 index 00000000000..76723298df6 --- /dev/null +++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-abstract/config.ts @@ -0,0 +1,4 @@ +export default { + // https://github.com/babel/babel/issues/15205 + expectBabelToNotSupport: true, +} satisfies ASTFixtureConfig; diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-abstract/snapshots/3-Babel-Error.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-abstract/snapshots/3-Babel-Error.shot new file mode 100644 index 00000000000..6f975b3a497 --- /dev/null +++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-abstract/snapshots/3-Babel-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures element AccessorProperty modifier-abstract Babel - Error 1`] = `[SyntaxError: Missing semicolon. (2:23)]`; diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-override/fixture.ts b/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-override/fixture.ts index 4db186874ab..70dd6b95f61 100644 --- a/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-override/fixture.ts +++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-override/fixture.ts @@ -1,3 +1,3 @@ -class Foo { - override accessor foo = 1; +class Foo extends Bar { + override accessor foo = 2; } diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-override/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-override/snapshots/1-TSESTree-AST.shot index 01f0402a3e4..b0e78060a09 100644 --- a/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-override/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-override/snapshots/1-TSESTree-AST.shot @@ -17,7 +17,7 @@ Program { type: "Identifier", name: "foo", - range: [32, 35], + range: [44, 47], loc: { start: { column: 20, line: 2 }, end: { column: 23, line: 2 }, @@ -27,17 +27,17 @@ Program { static: false, value: Literal { type: "Literal", - raw: "1", - value: 1, + raw: "2", + value: 2, - range: [38, 39], + range: [50, 51], loc: { start: { column: 26, line: 2 }, end: { column: 27, line: 2 }, }, }, - range: [14, 40], + range: [26, 52], loc: { start: { column: 2, line: 2 }, end: { column: 28, line: 2 }, @@ -45,9 +45,9 @@ Program { }, ], - range: [10, 42], + range: [22, 54], loc: { - start: { column: 10, line: 1 }, + start: { column: 22, line: 1 }, end: { column: 1, line: 3 }, }, }, @@ -61,9 +61,18 @@ Program { end: { column: 9, line: 1 }, }, }, - superClass: null, + superClass: Identifier { + type: "Identifier", + name: "Bar", + + range: [18, 21], + loc: { + start: { column: 18, line: 1 }, + end: { column: 21, line: 1 }, + }, + }, - range: [0, 42], + range: [0, 54], loc: { start: { column: 0, line: 1 }, end: { column: 1, line: 3 }, @@ -72,7 +81,7 @@ Program { ], sourceType: "script", - range: [0, 43], + range: [0, 55], loc: { start: { column: 0, line: 1 }, end: { column: 0, line: 4 }, diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-override/snapshots/2-TSESTree-Tokens.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-override/snapshots/2-TSESTree-Tokens.shot index 46fce83728c..24c22b85146 100644 --- a/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-override/snapshots/2-TSESTree-Tokens.shot +++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-override/snapshots/2-TSESTree-Tokens.shot @@ -22,21 +22,41 @@ Array [ end: { column: 9, line: 1 }, }, }, + Keyword { + type: "Keyword", + value: "extends", + + range: [10, 17], + loc: { + start: { column: 10, line: 1 }, + end: { column: 17, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "Bar", + + range: [18, 21], + loc: { + start: { column: 18, line: 1 }, + end: { column: 21, line: 1 }, + }, + }, Punctuator { type: "Punctuator", value: "{", - range: [10, 11], + range: [22, 23], loc: { - start: { column: 10, line: 1 }, - end: { column: 11, line: 1 }, + start: { column: 22, line: 1 }, + end: { column: 23, line: 1 }, }, }, Identifier { type: "Identifier", value: "override", - range: [14, 22], + range: [26, 34], loc: { start: { column: 2, line: 2 }, end: { column: 10, line: 2 }, @@ -46,7 +66,7 @@ Array [ type: "Identifier", value: "accessor", - range: [23, 31], + range: [35, 43], loc: { start: { column: 11, line: 2 }, end: { column: 19, line: 2 }, @@ -56,7 +76,7 @@ Array [ type: "Identifier", value: "foo", - range: [32, 35], + range: [44, 47], loc: { start: { column: 20, line: 2 }, end: { column: 23, line: 2 }, @@ -66,7 +86,7 @@ Array [ type: "Punctuator", value: "=", - range: [36, 37], + range: [48, 49], loc: { start: { column: 24, line: 2 }, end: { column: 25, line: 2 }, @@ -74,9 +94,9 @@ Array [ }, Numeric { type: "Numeric", - value: "1", + value: "2", - range: [38, 39], + range: [50, 51], loc: { start: { column: 26, line: 2 }, end: { column: 27, line: 2 }, @@ -86,7 +106,7 @@ Array [ type: "Punctuator", value: ";", - range: [39, 40], + range: [51, 52], loc: { start: { column: 27, line: 2 }, end: { column: 28, line: 2 }, @@ -96,7 +116,7 @@ Array [ type: "Punctuator", value: "}", - range: [41, 42], + range: [53, 54], loc: { start: { column: 0, line: 3 }, end: { column: 1, line: 3 }, diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-declare/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-override/snapshots/3-Babel-AST.shot similarity index 50% rename from packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-declare/snapshots/1-TSESTree-AST.shot rename to packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-override/snapshots/3-Babel-AST.shot index 0b61be5984a..49d82178de5 100644 --- a/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-declare/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-override/snapshots/3-Babel-AST.shot @@ -1,6 +1,6 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`AST Fixtures element AccessorProperty modifier-declare TSESTree - AST 1`] = ` +exports[`AST Fixtures element AccessorProperty modifier-override Babel - AST 1`] = ` Program { type: "Program", body: Array [ @@ -9,53 +9,44 @@ Program { body: ClassBody { type: "ClassBody", body: Array [ - AccessorProperty { - type: "AccessorProperty", + ClassAccessorProperty { + type: "ClassAccessorProperty", computed: false, - declare: true, key: Identifier { type: "Identifier", name: "foo", - range: [31, 34], + range: [44, 47], loc: { - start: { column: 19, line: 2 }, - end: { column: 22, line: 2 }, + start: { column: 20, line: 2 }, + end: { column: 23, line: 2 }, }, }, - override: false, + override: true, static: false, - typeAnnotation: TSTypeAnnotation { - type: "TSTypeAnnotation", - typeAnnotation: TSNumberKeyword { - type: "TSNumberKeyword", + value: Literal { + type: "Literal", + raw: "2", + value: 2, - range: [36, 42], - loc: { - start: { column: 24, line: 2 }, - end: { column: 30, line: 2 }, - }, - }, - - range: [34, 42], + range: [50, 51], loc: { - start: { column: 22, line: 2 }, - end: { column: 30, line: 2 }, + start: { column: 26, line: 2 }, + end: { column: 27, line: 2 }, }, }, - value: null, - range: [14, 43], + range: [26, 52], loc: { start: { column: 2, line: 2 }, - end: { column: 31, line: 2 }, + end: { column: 28, line: 2 }, }, }, ], - range: [10, 45], + range: [22, 54], loc: { - start: { column: 10, line: 1 }, + start: { column: 22, line: 1 }, end: { column: 1, line: 3 }, }, }, @@ -69,9 +60,18 @@ Program { end: { column: 9, line: 1 }, }, }, - superClass: null, + superClass: Identifier { + type: "Identifier", + name: "Bar", + + range: [18, 21], + loc: { + start: { column: 18, line: 1 }, + end: { column: 21, line: 1 }, + }, + }, - range: [0, 45], + range: [0, 54], loc: { start: { column: 0, line: 1 }, end: { column: 1, line: 3 }, @@ -80,7 +80,7 @@ Program { ], sourceType: "script", - range: [0, 46], + range: [0, 55], loc: { start: { column: 0, line: 1 }, end: { column: 0, line: 4 }, diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-declare/snapshots/2-TSESTree-Tokens.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-override/snapshots/4-Babel-Tokens.shot similarity index 54% rename from packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-declare/snapshots/2-TSESTree-Tokens.shot rename to packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-override/snapshots/4-Babel-Tokens.shot index c9f1a1a1da8..dd9763a4fcd 100644 --- a/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-declare/snapshots/2-TSESTree-Tokens.shot +++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-override/snapshots/4-Babel-Tokens.shot @@ -1,6 +1,6 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`AST Fixtures element AccessorProperty modifier-declare TSESTree - Tokens 1`] = ` +exports[`AST Fixtures element AccessorProperty modifier-override Babel - Tokens 1`] = ` Array [ Keyword { type: "Keyword", @@ -22,81 +22,101 @@ Array [ end: { column: 9, line: 1 }, }, }, + Keyword { + type: "Keyword", + value: "extends", + + range: [10, 17], + loc: { + start: { column: 10, line: 1 }, + end: { column: 17, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "Bar", + + range: [18, 21], + loc: { + start: { column: 18, line: 1 }, + end: { column: 21, line: 1 }, + }, + }, Punctuator { type: "Punctuator", value: "{", - range: [10, 11], + range: [22, 23], loc: { - start: { column: 10, line: 1 }, - end: { column: 11, line: 1 }, + start: { column: 22, line: 1 }, + end: { column: 23, line: 1 }, }, }, Identifier { type: "Identifier", - value: "declare", + value: "override", - range: [14, 21], + range: [26, 34], loc: { start: { column: 2, line: 2 }, - end: { column: 9, line: 2 }, + end: { column: 10, line: 2 }, }, }, Identifier { type: "Identifier", value: "accessor", - range: [22, 30], + range: [35, 43], loc: { - start: { column: 10, line: 2 }, - end: { column: 18, line: 2 }, + start: { column: 11, line: 2 }, + end: { column: 19, line: 2 }, }, }, Identifier { type: "Identifier", value: "foo", - range: [31, 34], + range: [44, 47], loc: { - start: { column: 19, line: 2 }, - end: { column: 22, line: 2 }, + start: { column: 20, line: 2 }, + end: { column: 23, line: 2 }, }, }, Punctuator { type: "Punctuator", - value: ":", + value: "=", - range: [34, 35], + range: [48, 49], loc: { - start: { column: 22, line: 2 }, - end: { column: 23, line: 2 }, + start: { column: 24, line: 2 }, + end: { column: 25, line: 2 }, }, }, - Identifier { - type: "Identifier", - value: "number", + Numeric { + type: "Numeric", + value: "2", - range: [36, 42], + range: [50, 51], loc: { - start: { column: 24, line: 2 }, - end: { column: 30, line: 2 }, + start: { column: 26, line: 2 }, + end: { column: 27, line: 2 }, }, }, Punctuator { type: "Punctuator", value: ";", - range: [42, 43], + range: [51, 52], loc: { - start: { column: 30, line: 2 }, - end: { column: 31, line: 2 }, + start: { column: 27, line: 2 }, + end: { column: 28, line: 2 }, }, }, Punctuator { type: "Punctuator", value: "}", - range: [44, 45], + range: [53, 54], loc: { start: { column: 0, line: 3 }, end: { column: 1, line: 3 }, diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-override/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-override/snapshots/5-AST-Alignment-AST.shot new file mode 100644 index 00000000000..7949a056f9a --- /dev/null +++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-override/snapshots/5-AST-Alignment-AST.shot @@ -0,0 +1,96 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures element AccessorProperty modifier-override AST Alignment - AST 1`] = ` +"Snapshot Diff: +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + ClassDeclaration { + type: 'ClassDeclaration', + body: ClassBody { + type: 'ClassBody', + body: Array [ +- AccessorProperty { +- type: 'AccessorProperty', ++ ClassAccessorProperty { ++ type: 'ClassAccessorProperty', + computed: false, +- declare: false, + key: Identifier { + type: 'Identifier', + name: 'foo', + + range: [44, 47], + loc: { + start: { column: 20, line: 2 }, + end: { column: 23, line: 2 }, + }, + }, + override: true, + static: false, + value: Literal { + type: 'Literal', + raw: '2', + value: 2, + + range: [50, 51], + loc: { + start: { column: 26, line: 2 }, + end: { column: 27, line: 2 }, + }, + }, + + range: [26, 52], + loc: { + start: { column: 2, line: 2 }, + end: { column: 28, line: 2 }, + }, + }, + ], + + range: [22, 54], + loc: { + start: { column: 22, line: 1 }, + end: { column: 1, line: 3 }, + }, + }, + id: Identifier { + type: 'Identifier', + name: 'Foo', + + range: [6, 9], + loc: { + start: { column: 6, line: 1 }, + end: { column: 9, line: 1 }, + }, + }, + superClass: Identifier { + type: 'Identifier', + name: 'Bar', + + range: [18, 21], + loc: { + start: { column: 18, line: 1 }, + end: { column: 21, line: 1 }, + }, + }, + + range: [0, 54], + loc: { + start: { column: 0, line: 1 }, + end: { column: 1, line: 3 }, + }, + }, + ], + sourceType: 'script', + + range: [0, 55], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 4 }, + }, + }" +`; diff --git a/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/_error_/assertion/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-override/snapshots/6-AST-Alignment-Tokens.shot similarity index 52% rename from packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/_error_/assertion/snapshots/5-AST-Alignment-AST.shot rename to packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-override/snapshots/6-AST-Alignment-Tokens.shot index 258519a7adf..4585c5481d0 100644 --- a/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/_error_/assertion/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-override/snapshots/6-AST-Alignment-Tokens.shot @@ -1,6 +1,6 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`AST Fixtures declaration ExportNamedDeclaration assertion AST Alignment - AST 1`] = ` +exports[`AST Fixtures element AccessorProperty modifier-override AST Alignment - Token 1`] = ` "Snapshot Diff: Compared values have no visual difference." `; diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/with-annotation-no-value/config.ts b/packages/ast-spec/src/element/AccessorProperty/fixtures/with-annotation-no-value/config.ts new file mode 100644 index 00000000000..76723298df6 --- /dev/null +++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/with-annotation-no-value/config.ts @@ -0,0 +1,4 @@ +export default { + // https://github.com/babel/babel/issues/15205 + expectBabelToNotSupport: true, +} satisfies ASTFixtureConfig; diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/with-annotation-no-value/snapshots/3-Babel-Error.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/with-annotation-no-value/snapshots/3-Babel-Error.shot new file mode 100644 index 00000000000..95932fa9389 --- /dev/null +++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/with-annotation-no-value/snapshots/3-Babel-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures element AccessorProperty with-annotation-no-value Babel - Error 1`] = `[SyntaxError: Missing semicolon. (2:15)]`; diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/with-annotation-with-value/config.ts b/packages/ast-spec/src/element/AccessorProperty/fixtures/with-annotation-with-value/config.ts new file mode 100644 index 00000000000..76723298df6 --- /dev/null +++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/with-annotation-with-value/config.ts @@ -0,0 +1,4 @@ +export default { + // https://github.com/babel/babel/issues/15205 + expectBabelToNotSupport: true, +} satisfies ASTFixtureConfig; diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/with-annotation-with-value/snapshots/3-Babel-Error.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/with-annotation-with-value/snapshots/3-Babel-Error.shot new file mode 100644 index 00000000000..58104f64f7b --- /dev/null +++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/with-annotation-with-value/snapshots/3-Babel-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures element AccessorProperty with-annotation-with-value Babel - Error 1`] = `[SyntaxError: Missing semicolon. (2:15)]`; diff --git a/packages/ast-spec/tests/fixtures-with-differences-ast.shot b/packages/ast-spec/tests/fixtures-with-differences-ast.shot index bc403cfd80f..e6ea1804e84 100644 --- a/packages/ast-spec/tests/fixtures-with-differences-ast.shot +++ b/packages/ast-spec/tests/fixtures-with-differences-ast.shot @@ -29,6 +29,7 @@ Set { "element/AccessorProperty/fixtures/key-computed-string/fixture.ts", "element/AccessorProperty/fixtures/key-private/fixture.ts", "element/AccessorProperty/fixtures/key-string/fixture.ts", + "element/AccessorProperty/fixtures/modifier-override/fixture.ts", "element/AccessorProperty/fixtures/modifier-private/fixture.ts", "element/AccessorProperty/fixtures/modifier-protected/fixture.ts", "element/AccessorProperty/fixtures/modifier-public/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 7946dc0daab..68799952497 100644 --- a/packages/ast-spec/tests/fixtures-with-differences-errors.shot +++ b/packages/ast-spec/tests/fixtures-with-differences-errors.shot @@ -21,6 +21,8 @@ Object { "declaration/TSInterfaceDeclaration/fixtures/_error_/non-identifier-extends/fixture.ts", "declaration/TSTypeAliasDeclaration/fixtures/_error_/missing-type-parameter/fixture.ts", "declaration/VariableDeclaration/fixtures/_error_/missing-id-without-value/fixture.ts", + "element/AccessorProperty/fixtures/_error_/modifier-declare/fixture.ts", + "element/AccessorProperty/fixtures/_error_/modifier-override-with-no-extends/fixture.ts", }, "TSESTree errored but Babel didn't": Set { "declaration/ExportAllDeclaration/fixtures/_error_/named-non-identifier/fixture.ts", diff --git a/packages/ast-spec/tests/fixtures-without-babel-support.shot b/packages/ast-spec/tests/fixtures-without-babel-support.shot new file mode 100644 index 00000000000..ad37f067766 --- /dev/null +++ b/packages/ast-spec/tests/fixtures-without-babel-support.shot @@ -0,0 +1,10 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures List fixtures we expect babel to not support 1`] = ` +Set { + "element/AccessorProperty/fixtures/modifier-abstract-with-value/fixture.ts", + "element/AccessorProperty/fixtures/modifier-abstract/fixture.ts", + "element/AccessorProperty/fixtures/with-annotation-no-value/fixture.ts", + "element/AccessorProperty/fixtures/with-annotation-with-value/fixture.ts", +} +`; diff --git a/packages/ast-spec/tests/fixtures.test.ts b/packages/ast-spec/tests/fixtures.test.ts index 3fff2ead3f2..957b9a16eec 100644 --- a/packages/ast-spec/tests/fixtures.test.ts +++ b/packages/ast-spec/tests/fixtures.test.ts @@ -25,6 +25,7 @@ const ONLY = [].join(path.sep); const fixturesWithASTDifferences = new Set(); const fixturesWithTokenDifferences = new Set(); +const fixturesConfiguredToExpectBabelToNotSupport = new Set(); enum ErrorLabel { TSESTree = "TSESTree errored but Babel didn't", Babel = "Babel errored but TSESTree didn't", @@ -36,46 +37,67 @@ const fixturesWithErrorDifferences = { [ErrorLabel.Babel]: new Set(), } as const; -const validFixtures = glob.sync(`${SRC_DIR}/**/fixtures/*/*.{ts,tsx}`); -const errorFixtures = glob.sync(`${SRC_DIR}/**/fixtures/_error_/*/*.{ts,tsx}`); +const VALID_FIXTURES: readonly string[] = glob.sync( + `${SRC_DIR}/**/fixtures/*/fixture.{ts,tsx}`, +); +const ERROR_FIXTURES: readonly string[] = glob.sync( + `${SRC_DIR}/**/fixtures/_error_/*/fixture.{ts,tsx}`, +); -const fixtures: readonly Fixture[] = [...validFixtures, ...errorFixtures].map( +const FIXTURES: readonly Fixture[] = [...VALID_FIXTURES, ...ERROR_FIXTURES].map( absolute => { const relativeToSrc = path.relative(SRC_DIR, absolute); const { dir, ext } = path.parse(relativeToSrc); const segments = dir.split(path.sep).filter(s => s !== 'fixtures'); const name = segments.pop()!; - const snapshotPath = path.join(SRC_DIR, dir, 'snapshots'); + const fixtureDir = path.join(SRC_DIR, dir); + const configPath = path.join(fixtureDir, 'config' /* .ts */); + const snapshotPath = path.join(fixtureDir, 'snapshots'); return { absolute, - name, + config: ((): ASTFixtureConfig => { + try { + return require(configPath).default; + } catch { + return {}; + } + })(), ext, isError: absolute.includes('/_error_/'), isJSX: ext.endsWith('x'), + name, relative: path.relative(SRC_DIR, absolute), segments, - snapshotPath, snapshotFiles: { success: { tsestree: { - ast: path.join(snapshotPath, '1-TSESTree-AST.shot'), - tokens: path.join(snapshotPath, '2-TSESTree-Tokens.shot'), + ast: (i: number) => + path.join(snapshotPath, `${i}-TSESTree-AST.shot`), + tokens: (i: number) => + path.join(snapshotPath, `${i}-TSESTree-Tokens.shot`), }, babel: { - ast: path.join(snapshotPath, '3-Babel-AST.shot'), - tokens: path.join(snapshotPath, '4-Babel-Tokens.shot'), + ast: (i: number) => path.join(snapshotPath, `${i}-Babel-AST.shot`), + tokens: (i: number) => + path.join(snapshotPath, `${i}-Babel-Tokens.shot`), }, alignment: { - ast: path.join(snapshotPath, '5-AST-Alignment-AST.shot'), - tokens: path.join(snapshotPath, '6-AST-Alignment-Tokens.shot'), + ast: (i: number) => + path.join(snapshotPath, `${i}-AST-Alignment-AST.shot`), + tokens: (i: number) => + path.join(snapshotPath, `${i}-AST-Alignment-Tokens.shot`), }, }, error: { - tsestree: path.join(snapshotPath, '1-TSESTree-Error.shot'), - babel: path.join(snapshotPath, '2-Babel-Error.shot'), - alignment: path.join(snapshotPath, '3-Alignment-Error.shot'), + tsestree: (i: number) => + path.join(snapshotPath, `${i}-TSESTree-Error.shot`), + babel: (i: number) => + path.join(snapshotPath, `${i}-Babel-Error.shot`), + alignment: (i: number) => + path.join(snapshotPath, `${i}-Alignment-Error.shot`), }, }, + snapshotPath, }; }, ); @@ -130,6 +152,8 @@ function nestDescribe(fixture: Fixture, segments = fixture.segments): void { errorLabel = ErrorLabel.None; } + let snapshotCounter = 1; + if (fixture.isError) { if ( errorLabel === ErrorLabel.TSESTree || @@ -140,17 +164,17 @@ function nestDescribe(fixture: Fixture, segments = fixture.segments): void { it('TSESTree - Error', () => { expect(tsestreeParsed.error).toMatchSpecificSnapshot( - fixture.snapshotFiles.error.tsestree, + fixture.snapshotFiles.error.tsestree(snapshotCounter++), ); }); it('Babel - Error', () => { expect(babelParsed.error).toMatchSpecificSnapshot( - fixture.snapshotFiles.error.babel, + fixture.snapshotFiles.error.babel(snapshotCounter++), ); }); it('Error Alignment', () => { expect(errorLabel).toMatchSpecificSnapshot( - fixture.snapshotFiles.error.alignment, + fixture.snapshotFiles.error.alignment(snapshotCounter++), ); }); it('Should parse with errors', () => { @@ -162,63 +186,77 @@ function nestDescribe(fixture: Fixture, segments = fixture.segments): void { it('TSESTree - AST', () => { expectSuccessResponse(tsestreeParsed); expect(tsestreeParsed.ast).toMatchSpecificSnapshot( - fixture.snapshotFiles.success.tsestree.ast, + fixture.snapshotFiles.success.tsestree.ast(snapshotCounter++), ); }); it('TSESTree - Tokens', () => { expectSuccessResponse(tsestreeParsed); expect(tsestreeParsed.tokens).toMatchSpecificSnapshot( - fixture.snapshotFiles.success.tsestree.tokens, + fixture.snapshotFiles.success.tsestree.tokens(snapshotCounter++), ); }); - it('Babel - AST', () => { - expectSuccessResponse(babelParsed); - expect(babelParsed.ast).toMatchSpecificSnapshot( - fixture.snapshotFiles.success.babel.ast, - ); - }); - it('Babel - Tokens', () => { - expectSuccessResponse(babelParsed); - expect(babelParsed.tokens).toMatchSpecificSnapshot( - fixture.snapshotFiles.success.babel.tokens, - ); - }); + if (fixture.config.expectBabelToNotSupport === true) { + fixturesConfiguredToExpectBabelToNotSupport.add(fixture.relative); - it('AST Alignment - AST', () => { - expectSuccessResponse(tsestreeParsed); - expectSuccessResponse(babelParsed); - const diffResult = snapshotDiff( - 'TSESTree', - tsestreeParsed.ast, - 'Babel', - babelParsed.ast, - ); - expect(diffResult).toMatchSpecificSnapshot( - fixture.snapshotFiles.success.alignment.ast, - ); + // eslint-disable-next-line jest/no-identical-title -- intentional duplication that won't ever happen due to exclusionary conditions + it('Babel - Error', () => { + expect(babelParsed.error).toMatchSpecificSnapshot( + fixture.snapshotFiles.error.babel(snapshotCounter++), + ); + }); + // eslint-disable-next-line jest/no-disabled-tests -- intentional skip for CLI documentation purposes + it.skip('Babel - Skipped as this fixture is configured to expect babel to error', () => {}); + // eslint-disable-next-line jest/no-disabled-tests -- intentional skip for CLI documentation purposes + it.skip('AST Alignment - Skipped as this fixture is configured to expect babel to error', () => {}); + } else { + it('Babel - AST', () => { + expectSuccessResponse(babelParsed); + expect(babelParsed.ast).toMatchSpecificSnapshot( + fixture.snapshotFiles.success.babel.ast(snapshotCounter++), + ); + }); + it('Babel - Tokens', () => { + expectSuccessResponse(babelParsed); + expect(babelParsed.tokens).toMatchSpecificSnapshot( + fixture.snapshotFiles.success.babel.tokens(snapshotCounter++), + ); + }); + it('AST Alignment - AST', () => { + expectSuccessResponse(tsestreeParsed); + expectSuccessResponse(babelParsed); + const diffResult = snapshotDiff( + 'TSESTree', + tsestreeParsed.ast, + 'Babel', + babelParsed.ast, + ); + expect(diffResult).toMatchSpecificSnapshot( + fixture.snapshotFiles.success.alignment.ast(snapshotCounter++), + ); - if (diffHasChanges(diffResult)) { - fixturesWithASTDifferences.add(fixture.relative); - } - }); - it('AST Alignment - Token', () => { - expectSuccessResponse(tsestreeParsed); - expectSuccessResponse(babelParsed); - const diffResult = snapshotDiff( - 'TSESTree', - tsestreeParsed.tokens, - 'Babel', - babelParsed.tokens, - ); - expect(diffResult).toMatchSpecificSnapshot( - fixture.snapshotFiles.success.alignment.tokens, - ); + if (diffHasChanges(diffResult)) { + fixturesWithASTDifferences.add(fixture.relative); + } + }); + it('AST Alignment - Token', () => { + expectSuccessResponse(tsestreeParsed); + expectSuccessResponse(babelParsed); + const diffResult = snapshotDiff( + 'TSESTree', + tsestreeParsed.tokens, + 'Babel', + babelParsed.tokens, + ); + expect(diffResult).toMatchSpecificSnapshot( + fixture.snapshotFiles.success.alignment.tokens(snapshotCounter++), + ); - if (diffHasChanges(diffResult)) { - fixturesWithTokenDifferences.add(fixture.relative); - } - }); + if (diffHasChanges(diffResult)) { + fixturesWithTokenDifferences.add(fixture.relative); + } + }); + } it('Should parse with no errors', () => { // log the error for debug purposes in case there wasn't supposed to be an error @@ -228,7 +266,9 @@ function nestDescribe(fixture: Fixture, segments = fixture.segments): void { case ErrorLabel.Babel: expectErrorResponse(babelParsed); - console.error('Babel:\n', babelParsed.error); + if (fixture.config.expectBabelToNotSupport !== true) { + console.error('Babel:\n', babelParsed.error); + } break; case ErrorLabel.TSESTree: @@ -244,15 +284,33 @@ function nestDescribe(fixture: Fixture, segments = fixture.segments): void { break; } + // NOTE - the comments below exist so that they show up in the stack trace jest shows + // when the test fails. Yes, sadly, they're duplicated, but it's necessary to + // provide the best and most understandable DevX that we can here. + // Jest will print a code frame with the fail line as well as 2 lines before and after + + // if this fails and you WERE expecting a parser error, then your fixture should be in the `_error_` subfolder + // if this fails and you WEREN'T expecting a parser error - then something is broken. + expect(errorLabel).not.toBe(ErrorLabel.TSESTree); + // if this fails and you WERE expecting a parser error, then your fixture should be in the `_error_` subfolder // if this fails and you WEREN'T expecting a parser error - then something is broken. - expect(errorLabel).toBe(ErrorLabel.None); + expect(errorLabel).not.toBe(ErrorLabel.Both); + + if (fixture.config.expectBabelToNotSupport === true) { + // if this fails and you WERE expecting a parser error, then Babel parsed without error and you should remove the `expectBabelToNotSupport` config. + expect(errorLabel).toBe(ErrorLabel.Babel); + } else { + // if this fails and you WERE expecting a parser error, then your fixture should be in the `_error_` subfolder + // if this fails and you WEREN'T expecting a parser error - then something is broken. + expect(errorLabel).not.toBe(ErrorLabel.Babel); + } }); } }; if ([...fixture.segments, fixture.name].join(path.sep) === ONLY) { - // eslint-disable-next-line jest/no-focused-tests + // eslint-disable-next-line jest/no-focused-tests -- intentional focused test that only happens during development describe.only(fixture.name, test); } else { describe(fixture.name, test); @@ -261,7 +319,7 @@ function nestDescribe(fixture: Fixture, segments = fixture.segments): void { } describe('AST Fixtures', () => { - fixtures.forEach(f => nestDescribe(f)); + FIXTURES.forEach(f => nestDescribe(f)); // once we've run all the tests, snapshot the list of fixtures that have differences for easy reference it('List fixtures with AST differences', () => { @@ -279,4 +337,9 @@ describe('AST Fixtures', () => { path.resolve(__dirname, 'fixtures-with-differences-errors.shot'), ); }); + it('List fixtures we expect babel to not support', () => { + expect(fixturesConfiguredToExpectBabelToNotSupport).toMatchSpecificSnapshot( + path.resolve(__dirname, 'fixtures-without-babel-support.shot'), + ); + }); }); diff --git a/packages/ast-spec/tests/util/parsers/parser-types.ts b/packages/ast-spec/tests/util/parsers/parser-types.ts index 1278d43a99e..4538d8ed4a9 100644 --- a/packages/ast-spec/tests/util/parsers/parser-types.ts +++ b/packages/ast-spec/tests/util/parsers/parser-types.ts @@ -1,17 +1,19 @@ +type SnapshotPathFn = (i: number) => string; + interface SuccessSnapshotPaths { - readonly ast: string; - readonly tokens: string; + readonly ast: SnapshotPathFn; + readonly tokens: SnapshotPathFn; } export interface Fixture { readonly absolute: string; - readonly name: string; + readonly config: ASTFixtureConfig; readonly ext: string; readonly isError: boolean; readonly isJSX: boolean; + readonly name: string; readonly relative: string; readonly segments: string[]; - readonly snapshotPath: string; readonly snapshotFiles: { readonly success: { readonly tsestree: SuccessSnapshotPaths; @@ -19,11 +21,12 @@ export interface Fixture { readonly alignment: SuccessSnapshotPaths; }; readonly error: { - readonly tsestree: string; - readonly babel: string; - readonly alignment: string; + readonly tsestree: SnapshotPathFn; + readonly babel: SnapshotPathFn; + readonly alignment: SnapshotPathFn; }; }; + readonly snapshotPath: string; } export enum ParserResponseType { diff --git a/packages/ast-spec/tsconfig.json b/packages/ast-spec/tsconfig.json index fd3827cd5ba..35ae2aa3a17 100644 --- a/packages/ast-spec/tsconfig.json +++ b/packages/ast-spec/tsconfig.json @@ -4,7 +4,14 @@ "composite": false, "rootDir": "." }, - "include": ["src", "typings", "tests", "tools", "./rollup.config.ts"], - "exclude": ["**/fixtures/**"], + "include": [ + "src", + "typings", + "tests", + "tools", + "./rollup.config.ts", + "**/fixtures/**/config.ts" + ], + "exclude": ["**/fixtures/**/fixture.ts"], "references": [{ "path": "../typescript-estree/tsconfig.build.json" }] } diff --git a/packages/ast-spec/typings/global.d.ts b/packages/ast-spec/typings/global.d.ts new file mode 100644 index 00000000000..53492891ed9 --- /dev/null +++ b/packages/ast-spec/typings/global.d.ts @@ -0,0 +1,12 @@ +/** + * We define this as a global type to make it easier to consume from fixtures. + * It saves us having to import the type into `src` files from a test utils folder. + * This is a convenient property because it saves us from a lot of `../`! + */ +interface ASTFixtureConfig { + /** + * Specifies that we expect that babel doesn't yet support the code in this fixture, so we expect that it will error. + * This should not be used if we expect babel to throw for this feature due to a valid parser error! + */ + readonly expectBabelToNotSupport?: boolean; +} From cff6c30d6c688dcade55382e5db50ed2822a4a6e Mon Sep 17 00:00:00 2001 From: Brad Zacher Date: Fri, 18 Nov 2022 15:25:32 +1030 Subject: [PATCH 17/20] explicitly list the non-support reason in the config and snapshot --- .../fixtures/modifier-abstract-with-value/config.ts | 3 +-- .../fixtures/modifier-abstract/config.ts | 3 +-- .../fixtures/with-annotation-no-value/config.ts | 3 +-- .../fixtures/with-annotation-with-value/config.ts | 3 +-- .../tests/fixtures-without-babel-support.shot | 10 +++++----- packages/ast-spec/tests/fixtures.test.ts | 13 ++++++++----- packages/ast-spec/typings/global.d.ts | 4 +++- 7 files changed, 20 insertions(+), 19 deletions(-) diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-abstract-with-value/config.ts b/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-abstract-with-value/config.ts index 76723298df6..61e0e137a0e 100644 --- a/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-abstract-with-value/config.ts +++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-abstract-with-value/config.ts @@ -1,4 +1,3 @@ export default { - // https://github.com/babel/babel/issues/15205 - expectBabelToNotSupport: true, + expectBabelToNotSupport: 'https://github.com/babel/babel/issues/15205', } satisfies ASTFixtureConfig; diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-abstract/config.ts b/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-abstract/config.ts index 76723298df6..61e0e137a0e 100644 --- a/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-abstract/config.ts +++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-abstract/config.ts @@ -1,4 +1,3 @@ export default { - // https://github.com/babel/babel/issues/15205 - expectBabelToNotSupport: true, + expectBabelToNotSupport: 'https://github.com/babel/babel/issues/15205', } satisfies ASTFixtureConfig; diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/with-annotation-no-value/config.ts b/packages/ast-spec/src/element/AccessorProperty/fixtures/with-annotation-no-value/config.ts index 76723298df6..61e0e137a0e 100644 --- a/packages/ast-spec/src/element/AccessorProperty/fixtures/with-annotation-no-value/config.ts +++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/with-annotation-no-value/config.ts @@ -1,4 +1,3 @@ export default { - // https://github.com/babel/babel/issues/15205 - expectBabelToNotSupport: true, + expectBabelToNotSupport: 'https://github.com/babel/babel/issues/15205', } satisfies ASTFixtureConfig; diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/with-annotation-with-value/config.ts b/packages/ast-spec/src/element/AccessorProperty/fixtures/with-annotation-with-value/config.ts index 76723298df6..61e0e137a0e 100644 --- a/packages/ast-spec/src/element/AccessorProperty/fixtures/with-annotation-with-value/config.ts +++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/with-annotation-with-value/config.ts @@ -1,4 +1,3 @@ export default { - // https://github.com/babel/babel/issues/15205 - expectBabelToNotSupport: true, + expectBabelToNotSupport: 'https://github.com/babel/babel/issues/15205', } satisfies ASTFixtureConfig; diff --git a/packages/ast-spec/tests/fixtures-without-babel-support.shot b/packages/ast-spec/tests/fixtures-without-babel-support.shot index ad37f067766..a4022f6319b 100644 --- a/packages/ast-spec/tests/fixtures-without-babel-support.shot +++ b/packages/ast-spec/tests/fixtures-without-babel-support.shot @@ -1,10 +1,10 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`AST Fixtures List fixtures we expect babel to not support 1`] = ` -Set { - "element/AccessorProperty/fixtures/modifier-abstract-with-value/fixture.ts", - "element/AccessorProperty/fixtures/modifier-abstract/fixture.ts", - "element/AccessorProperty/fixtures/with-annotation-no-value/fixture.ts", - "element/AccessorProperty/fixtures/with-annotation-with-value/fixture.ts", +Map { + "element/AccessorProperty/fixtures/modifier-abstract-with-value/fixture.ts" => "https://github.com/babel/babel/issues/15205", + "element/AccessorProperty/fixtures/modifier-abstract/fixture.ts" => "https://github.com/babel/babel/issues/15205", + "element/AccessorProperty/fixtures/with-annotation-no-value/fixture.ts" => "https://github.com/babel/babel/issues/15205", + "element/AccessorProperty/fixtures/with-annotation-with-value/fixture.ts" => "https://github.com/babel/babel/issues/15205", } `; diff --git a/packages/ast-spec/tests/fixtures.test.ts b/packages/ast-spec/tests/fixtures.test.ts index 957b9a16eec..df70fe613eb 100644 --- a/packages/ast-spec/tests/fixtures.test.ts +++ b/packages/ast-spec/tests/fixtures.test.ts @@ -25,7 +25,7 @@ const ONLY = [].join(path.sep); const fixturesWithASTDifferences = new Set(); const fixturesWithTokenDifferences = new Set(); -const fixturesConfiguredToExpectBabelToNotSupport = new Set(); +const fixturesConfiguredToExpectBabelToNotSupport = new Map(); enum ErrorLabel { TSESTree = "TSESTree errored but Babel didn't", Babel = "Babel errored but TSESTree didn't", @@ -196,8 +196,11 @@ function nestDescribe(fixture: Fixture, segments = fixture.segments): void { ); }); - if (fixture.config.expectBabelToNotSupport === true) { - fixturesConfiguredToExpectBabelToNotSupport.add(fixture.relative); + if (fixture.config.expectBabelToNotSupport != null) { + fixturesConfiguredToExpectBabelToNotSupport.set( + fixture.relative, + fixture.config.expectBabelToNotSupport, + ); // eslint-disable-next-line jest/no-identical-title -- intentional duplication that won't ever happen due to exclusionary conditions it('Babel - Error', () => { @@ -266,7 +269,7 @@ function nestDescribe(fixture: Fixture, segments = fixture.segments): void { case ErrorLabel.Babel: expectErrorResponse(babelParsed); - if (fixture.config.expectBabelToNotSupport !== true) { + if (fixture.config.expectBabelToNotSupport == null) { console.error('Babel:\n', babelParsed.error); } break; @@ -297,7 +300,7 @@ function nestDescribe(fixture: Fixture, segments = fixture.segments): void { // if this fails and you WEREN'T expecting a parser error - then something is broken. expect(errorLabel).not.toBe(ErrorLabel.Both); - if (fixture.config.expectBabelToNotSupport === true) { + if (fixture.config.expectBabelToNotSupport != null) { // if this fails and you WERE expecting a parser error, then Babel parsed without error and you should remove the `expectBabelToNotSupport` config. expect(errorLabel).toBe(ErrorLabel.Babel); } else { diff --git a/packages/ast-spec/typings/global.d.ts b/packages/ast-spec/typings/global.d.ts index 53492891ed9..4464c06fbcf 100644 --- a/packages/ast-spec/typings/global.d.ts +++ b/packages/ast-spec/typings/global.d.ts @@ -7,6 +7,8 @@ interface ASTFixtureConfig { /** * Specifies that we expect that babel doesn't yet support the code in this fixture, so we expect that it will error. * This should not be used if we expect babel to throw for this feature due to a valid parser error! + * + * The value should be a description of why there isn't support - for example a github issue URL. */ - readonly expectBabelToNotSupport?: boolean; + readonly expectBabelToNotSupport?: string; } From 7201322773ad2ee6f4a1553b487f5137a1262ddf Mon Sep 17 00:00:00 2001 From: Brad Zacher Date: Fri, 18 Nov 2022 15:32:12 +1030 Subject: [PATCH 18/20] add missing tsabstractaccessorproperty visitor keys --- packages/visitor-keys/src/visitor-keys.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/visitor-keys/src/visitor-keys.ts b/packages/visitor-keys/src/visitor-keys.ts index 7a59c5f63b9..0ec52f03d92 100644 --- a/packages/visitor-keys/src/visitor-keys.ts +++ b/packages/visitor-keys/src/visitor-keys.ts @@ -69,6 +69,7 @@ const additionalKeys: AdditionalKeys = { Decorator: ['expression'], // TS-prefixed nodes + TSAbstractAccessorProperty: ['key', 'value', 'decorators'], TSAbstractKeyword: [], TSAbstractMethodDefinition: ['key', 'value'], TSAbstractPropertyDefinition: ['decorators', 'key', 'typeAnnotation'], From acffe0dc22192226956dc829b637d5b164cbef0a Mon Sep 17 00:00:00 2001 From: Brad Zacher Date: Fri, 18 Nov 2022 16:05:54 +1030 Subject: [PATCH 19/20] remove dead snapshots --- .../kind-type/snapshots/1-TSESTree-AST.shot | 48 ----------- .../snapshots/2-TSESTree-Tokens.shot | 86 ------------------- .../async/snapshots/1-TSESTree-AST.shot | 40 --------- .../async/snapshots/2-TSESTree-Tokens.shot | 76 ---------------- .../semantic-diagnostics-enabled.test.ts.snap | 10 --- 5 files changed, 260 deletions(-) delete mode 100644 packages/ast-spec/src/declaration/ExportAllDeclaration/fixtures/_error_/kind-type/snapshots/1-TSESTree-AST.shot delete mode 100644 packages/ast-spec/src/declaration/ExportAllDeclaration/fixtures/_error_/kind-type/snapshots/2-TSESTree-Tokens.shot delete mode 100644 packages/ast-spec/src/declaration/TSDeclareFunction/fixtures/_error_/async/snapshots/1-TSESTree-AST.shot delete mode 100644 packages/ast-spec/src/declaration/TSDeclareFunction/fixtures/_error_/async/snapshots/2-TSESTree-Tokens.shot diff --git a/packages/ast-spec/src/declaration/ExportAllDeclaration/fixtures/_error_/kind-type/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/declaration/ExportAllDeclaration/fixtures/_error_/kind-type/snapshots/1-TSESTree-AST.shot deleted file mode 100644 index 4e1ab2405d4..00000000000 --- a/packages/ast-spec/src/declaration/ExportAllDeclaration/fixtures/_error_/kind-type/snapshots/1-TSESTree-AST.shot +++ /dev/null @@ -1,48 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`AST Fixtures declaration ExportAllDeclaration kind-type TSESTree - AST 1`] = ` -Program { - type: "Program", - body: Array [ - ExportAllDeclaration { - type: "ExportAllDeclaration", - assertions: Array [], - exported: Identifier { - type: "Identifier", - name: "x", - - range: [17, 18], - loc: { - start: { column: 17, line: 1 }, - end: { column: 18, line: 1 }, - }, - }, - exportKind: "type", - source: Literal { - type: "Literal", - raw: "'a'", - value: "a", - - range: [24, 27], - loc: { - start: { column: 24, line: 1 }, - end: { column: 27, line: 1 }, - }, - }, - - range: [0, 28], - loc: { - start: { column: 0, line: 1 }, - end: { column: 28, line: 1 }, - }, - }, - ], - sourceType: "module", - - range: [0, 29], - loc: { - start: { column: 0, line: 1 }, - end: { column: 0, line: 2 }, - }, -} -`; diff --git a/packages/ast-spec/src/declaration/ExportAllDeclaration/fixtures/_error_/kind-type/snapshots/2-TSESTree-Tokens.shot b/packages/ast-spec/src/declaration/ExportAllDeclaration/fixtures/_error_/kind-type/snapshots/2-TSESTree-Tokens.shot deleted file mode 100644 index f5bfa8f5615..00000000000 --- a/packages/ast-spec/src/declaration/ExportAllDeclaration/fixtures/_error_/kind-type/snapshots/2-TSESTree-Tokens.shot +++ /dev/null @@ -1,86 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`AST Fixtures declaration ExportAllDeclaration kind-type TSESTree - Tokens 1`] = ` -Array [ - Keyword { - type: "Keyword", - value: "export", - - range: [0, 6], - loc: { - start: { column: 0, line: 1 }, - end: { column: 6, line: 1 }, - }, - }, - Identifier { - type: "Identifier", - value: "type", - - range: [7, 11], - loc: { - start: { column: 7, 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: "as", - - range: [14, 16], - loc: { - start: { column: 14, line: 1 }, - end: { column: 16, line: 1 }, - }, - }, - Identifier { - type: "Identifier", - value: "x", - - range: [17, 18], - loc: { - start: { column: 17, line: 1 }, - end: { column: 18, line: 1 }, - }, - }, - Identifier { - type: "Identifier", - value: "from", - - range: [19, 23], - loc: { - start: { column: 19, line: 1 }, - end: { column: 23, line: 1 }, - }, - }, - String { - type: "String", - value: "'a'", - - range: [24, 27], - loc: { - start: { column: 24, line: 1 }, - end: { column: 27, line: 1 }, - }, - }, - Punctuator { - type: "Punctuator", - value: ";", - - range: [27, 28], - loc: { - start: { column: 27, line: 1 }, - end: { column: 28, line: 1 }, - }, - }, -] -`; diff --git a/packages/ast-spec/src/declaration/TSDeclareFunction/fixtures/_error_/async/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/declaration/TSDeclareFunction/fixtures/_error_/async/snapshots/1-TSESTree-AST.shot deleted file mode 100644 index d01382249a1..00000000000 --- a/packages/ast-spec/src/declaration/TSDeclareFunction/fixtures/_error_/async/snapshots/1-TSESTree-AST.shot +++ /dev/null @@ -1,40 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`AST Fixtures declaration TSDeclareFunction async TSESTree - AST 1`] = ` -Program { - type: "Program", - body: Array [ - TSDeclareFunction { - type: "TSDeclareFunction", - async: true, - declare: true, - expression: false, - generator: false, - id: Identifier { - type: "Identifier", - name: "foo", - - range: [23, 26], - loc: { - start: { column: 23, line: 1 }, - end: { column: 26, line: 1 }, - }, - }, - params: Array [], - - range: [0, 29], - loc: { - start: { column: 0, line: 1 }, - end: { column: 29, line: 1 }, - }, - }, - ], - sourceType: "script", - - range: [0, 30], - loc: { - start: { column: 0, line: 1 }, - end: { column: 0, line: 2 }, - }, -} -`; diff --git a/packages/ast-spec/src/declaration/TSDeclareFunction/fixtures/_error_/async/snapshots/2-TSESTree-Tokens.shot b/packages/ast-spec/src/declaration/TSDeclareFunction/fixtures/_error_/async/snapshots/2-TSESTree-Tokens.shot deleted file mode 100644 index 57b56f38b08..00000000000 --- a/packages/ast-spec/src/declaration/TSDeclareFunction/fixtures/_error_/async/snapshots/2-TSESTree-Tokens.shot +++ /dev/null @@ -1,76 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`AST Fixtures declaration TSDeclareFunction async TSESTree - Tokens 1`] = ` -Array [ - Identifier { - type: "Identifier", - value: "declare", - - range: [0, 7], - loc: { - start: { column: 0, line: 1 }, - end: { column: 7, line: 1 }, - }, - }, - Identifier { - type: "Identifier", - value: "async", - - range: [8, 13], - loc: { - start: { column: 8, line: 1 }, - end: { column: 13, line: 1 }, - }, - }, - Keyword { - type: "Keyword", - value: "function", - - range: [14, 22], - loc: { - start: { column: 14, line: 1 }, - end: { column: 22, line: 1 }, - }, - }, - Identifier { - type: "Identifier", - value: "foo", - - 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 }, - }, - }, - Punctuator { - type: "Punctuator", - value: ")", - - range: [27, 28], - loc: { - start: { column: 27, line: 1 }, - end: { column: 28, line: 1 }, - }, - }, - Punctuator { - type: "Punctuator", - value: ";", - - range: [28, 29], - loc: { - start: { column: 28, line: 1 }, - end: { column: 29, line: 1 }, - }, - }, -] -`; diff --git a/packages/typescript-estree/tests/lib/__snapshots__/semantic-diagnostics-enabled.test.ts.snap b/packages/typescript-estree/tests/lib/__snapshots__/semantic-diagnostics-enabled.test.ts.snap index 2fe1877e218..204da250a86 100644 --- a/packages/typescript-estree/tests/lib/__snapshots__/semantic-diagnostics-enabled.test.ts.snap +++ b/packages/typescript-estree/tests/lib/__snapshots__/semantic-diagnostics-enabled.test.ts.snap @@ -1733,16 +1733,6 @@ exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" e exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/basics/async-function-with-var-declaration.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/basics/auto-accessor-1.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/basics/auto-accessor-2.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/basics/auto-accessor-3.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/basics/auto-accessor-4.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/basics/auto-accessor-5.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/basics/await-without-async-function.src 1`] = ` TSError { "column": 14, From e510ce4f4444f1372570b5e04a5c56f50251abdb Mon Sep 17 00:00:00 2001 From: Brad Zacher Date: Mon, 28 Nov 2022 11:25:44 +1030 Subject: [PATCH 20/20] add scope analysis support --- .../src/referencer/ClassVisitor.ts | 34 ++- .../declaration/abstract-accessor-property.ts | 5 + .../abstract-accessor-property.ts.shot | 88 +++++++ .../accessor-property-type-annotation.ts | 4 + .../accessor-property-type-annotation.ts.shot | 88 +++++++ .../class/declaration/accessor-property.ts | 7 + .../declaration/accessor-property.ts.shot | 152 ++++++++++++ packages/visitor-keys/src/visitor-keys.ts | 224 +++++++++++++----- 8 files changed, 538 insertions(+), 64 deletions(-) create mode 100644 packages/scope-manager/tests/fixtures/class/declaration/abstract-accessor-property.ts create mode 100644 packages/scope-manager/tests/fixtures/class/declaration/abstract-accessor-property.ts.shot create mode 100644 packages/scope-manager/tests/fixtures/class/declaration/accessor-property-type-annotation.ts create mode 100644 packages/scope-manager/tests/fixtures/class/declaration/accessor-property-type-annotation.ts.shot create mode 100644 packages/scope-manager/tests/fixtures/class/declaration/accessor-property.ts create mode 100644 packages/scope-manager/tests/fixtures/class/declaration/accessor-property.ts.shot diff --git a/packages/scope-manager/src/referencer/ClassVisitor.ts b/packages/scope-manager/src/referencer/ClassVisitor.ts index 3aced282e44..5f84e37404f 100644 --- a/packages/scope-manager/src/referencer/ClassVisitor.ts +++ b/packages/scope-manager/src/referencer/ClassVisitor.ts @@ -83,9 +83,13 @@ class ClassVisitor extends Visitor { } protected visitPropertyDefinition( - node: TSESTree.TSAbstractPropertyDefinition | TSESTree.PropertyDefinition, + node: + | TSESTree.AccessorProperty + | TSESTree.PropertyDefinition + | TSESTree.TSAbstractAccessorProperty + | TSESTree.TSAbstractPropertyDefinition, ): void { - this.visitProperty(node); + this.visitPropertyBase(node); /** * class A { * @meta // <--- check this @@ -229,9 +233,11 @@ class ClassVisitor extends Visitor { this.#referencer.close(node); } - protected visitProperty( + protected visitPropertyBase( node: + | TSESTree.AccessorProperty | TSESTree.PropertyDefinition + | TSESTree.TSAbstractAccessorProperty | TSESTree.TSAbstractPropertyDefinition | TSESTree.TSAbstractMethodDefinition, ): void { @@ -240,7 +246,10 @@ class ClassVisitor extends Visitor { } if (node.value) { - if (node.type === AST_NODE_TYPES.PropertyDefinition) { + if ( + node.type === AST_NODE_TYPES.PropertyDefinition || + node.type === AST_NODE_TYPES.AccessorProperty + ) { this.#referencer.scopeManager.nestClassFieldInitializerScope( node.value, ); @@ -248,7 +257,10 @@ class ClassVisitor extends Visitor { this.#referencer.visit(node.value); - if (node.type === AST_NODE_TYPES.PropertyDefinition) { + if ( + node.type === AST_NODE_TYPES.PropertyDefinition || + node.type === AST_NODE_TYPES.AccessorProperty + ) { this.#referencer.close(node.value); } } @@ -328,6 +340,10 @@ class ClassVisitor extends Visitor { // Visit selectors // ///////////////////// + protected AccessorProperty(node: TSESTree.AccessorProperty): void { + this.visitPropertyDefinition(node); + } + protected ClassBody(node: TSESTree.ClassBody): void { // this is here on purpose so that this visitor explicitly declares visitors // for all nodes it cares about (see the instance visit method above) @@ -342,6 +358,12 @@ class ClassVisitor extends Visitor { this.visitMethod(node); } + protected TSAbstractAccessorProperty( + node: TSESTree.TSAbstractAccessorProperty, + ): void { + this.visitPropertyDefinition(node); + } + protected TSAbstractPropertyDefinition( node: TSESTree.TSAbstractPropertyDefinition, ): void { @@ -351,7 +373,7 @@ class ClassVisitor extends Visitor { protected TSAbstractMethodDefinition( node: TSESTree.TSAbstractMethodDefinition, ): void { - this.visitProperty(node); + this.visitPropertyBase(node); } protected Identifier(node: TSESTree.Identifier): void { diff --git a/packages/scope-manager/tests/fixtures/class/declaration/abstract-accessor-property.ts b/packages/scope-manager/tests/fixtures/class/declaration/abstract-accessor-property.ts new file mode 100644 index 00000000000..b84caed0b39 --- /dev/null +++ b/packages/scope-manager/tests/fixtures/class/declaration/abstract-accessor-property.ts @@ -0,0 +1,5 @@ +type T = 1; + +abstract class Foo { + abstract prop: T; +} diff --git a/packages/scope-manager/tests/fixtures/class/declaration/abstract-accessor-property.ts.shot b/packages/scope-manager/tests/fixtures/class/declaration/abstract-accessor-property.ts.shot new file mode 100644 index 00000000000..c895afba904 --- /dev/null +++ b/packages/scope-manager/tests/fixtures/class/declaration/abstract-accessor-property.ts.shot @@ -0,0 +1,88 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`class declaration abstract-accessor-property 1`] = ` +ScopeManager { + variables: Array [ + ImplicitGlobalConstTypeVariable, + Variable$2 { + defs: Array [ + TypeDefinition$1 { + name: Identifier<"T">, + node: TSTypeAliasDeclaration$1, + }, + ], + name: "T", + references: Array [ + Reference$1 { + identifier: Identifier<"T">, + isRead: true, + isTypeReference: true, + isValueReference: false, + isWrite: false, + resolved: Variable$2, + }, + ], + isValueVariable: false, + isTypeVariable: true, + }, + Variable$3 { + defs: Array [ + ClassNameDefinition$2 { + name: Identifier<"Foo">, + node: ClassDeclaration$2, + }, + ], + name: "Foo", + references: Array [], + isValueVariable: true, + isTypeVariable: true, + }, + Variable$4 { + defs: Array [ + ClassNameDefinition$3 { + name: Identifier<"Foo">, + node: ClassDeclaration$2, + }, + ], + name: "Foo", + references: Array [], + isValueVariable: true, + isTypeVariable: true, + }, + ], + scopes: Array [ + GlobalScope$1 { + block: Program$3, + isStrict: false, + references: Array [], + set: Map { + "const" => ImplicitGlobalConstTypeVariable, + "T" => Variable$2, + "Foo" => Variable$3, + }, + type: "global", + upper: null, + variables: Array [ + ImplicitGlobalConstTypeVariable, + Variable$2, + Variable$3, + ], + }, + ClassScope$2 { + block: ClassDeclaration$2, + isStrict: true, + references: Array [ + Reference$1, + ], + set: Map { + "Foo" => Variable$4, + }, + type: "class", + upper: GlobalScope$1, + variables: Array [ + Variable$4, + ], + }, + ], +} +`; diff --git a/packages/scope-manager/tests/fixtures/class/declaration/accessor-property-type-annotation.ts b/packages/scope-manager/tests/fixtures/class/declaration/accessor-property-type-annotation.ts new file mode 100644 index 00000000000..824821d682e --- /dev/null +++ b/packages/scope-manager/tests/fixtures/class/declaration/accessor-property-type-annotation.ts @@ -0,0 +1,4 @@ +type T = 1; +class A { + prop: T; +} diff --git a/packages/scope-manager/tests/fixtures/class/declaration/accessor-property-type-annotation.ts.shot b/packages/scope-manager/tests/fixtures/class/declaration/accessor-property-type-annotation.ts.shot new file mode 100644 index 00000000000..fb8248edefe --- /dev/null +++ b/packages/scope-manager/tests/fixtures/class/declaration/accessor-property-type-annotation.ts.shot @@ -0,0 +1,88 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`class declaration accessor-property-type-annotation 1`] = ` +ScopeManager { + variables: Array [ + ImplicitGlobalConstTypeVariable, + Variable$2 { + defs: Array [ + TypeDefinition$1 { + name: Identifier<"T">, + node: TSTypeAliasDeclaration$1, + }, + ], + name: "T", + references: Array [ + Reference$1 { + identifier: Identifier<"T">, + isRead: true, + isTypeReference: true, + isValueReference: false, + isWrite: false, + resolved: Variable$2, + }, + ], + isValueVariable: false, + isTypeVariable: true, + }, + Variable$3 { + defs: Array [ + ClassNameDefinition$2 { + name: Identifier<"A">, + node: ClassDeclaration$2, + }, + ], + name: "A", + references: Array [], + isValueVariable: true, + isTypeVariable: true, + }, + Variable$4 { + defs: Array [ + ClassNameDefinition$3 { + name: Identifier<"A">, + node: ClassDeclaration$2, + }, + ], + name: "A", + references: Array [], + isValueVariable: true, + isTypeVariable: true, + }, + ], + scopes: Array [ + GlobalScope$1 { + block: Program$3, + isStrict: false, + references: Array [], + set: Map { + "const" => ImplicitGlobalConstTypeVariable, + "T" => Variable$2, + "A" => Variable$3, + }, + type: "global", + upper: null, + variables: Array [ + ImplicitGlobalConstTypeVariable, + Variable$2, + Variable$3, + ], + }, + ClassScope$2 { + block: ClassDeclaration$2, + isStrict: true, + references: Array [ + Reference$1, + ], + set: Map { + "A" => Variable$4, + }, + type: "class", + upper: GlobalScope$1, + variables: Array [ + Variable$4, + ], + }, + ], +} +`; diff --git a/packages/scope-manager/tests/fixtures/class/declaration/accessor-property.ts b/packages/scope-manager/tests/fixtures/class/declaration/accessor-property.ts new file mode 100644 index 00000000000..e75d9def3e9 --- /dev/null +++ b/packages/scope-manager/tests/fixtures/class/declaration/accessor-property.ts @@ -0,0 +1,7 @@ +const x = 1; +class A { + prop1 = 1; + prop2 = x; +} + +const unresolved = prop1; diff --git a/packages/scope-manager/tests/fixtures/class/declaration/accessor-property.ts.shot b/packages/scope-manager/tests/fixtures/class/declaration/accessor-property.ts.shot new file mode 100644 index 00000000000..88914131b5c --- /dev/null +++ b/packages/scope-manager/tests/fixtures/class/declaration/accessor-property.ts.shot @@ -0,0 +1,152 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`class declaration accessor-property 1`] = ` +ScopeManager { + variables: Array [ + ImplicitGlobalConstTypeVariable, + Variable$2 { + defs: Array [ + VariableDefinition$1 { + name: Identifier<"x">, + node: VariableDeclarator$1, + }, + ], + name: "x", + references: Array [ + Reference$1 { + identifier: Identifier<"x">, + init: true, + isRead: false, + isTypeReference: false, + isValueReference: true, + isWrite: true, + resolved: Variable$2, + writeExpr: Literal$2, + }, + Reference$2 { + identifier: Identifier<"x">, + isRead: true, + isTypeReference: false, + isValueReference: true, + isWrite: false, + resolved: Variable$2, + }, + ], + isValueVariable: true, + isTypeVariable: false, + }, + Variable$3 { + defs: Array [ + ClassNameDefinition$2 { + name: Identifier<"A">, + node: ClassDeclaration$3, + }, + ], + name: "A", + references: Array [], + isValueVariable: true, + isTypeVariable: true, + }, + Variable$4 { + defs: Array [ + ClassNameDefinition$3 { + name: Identifier<"A">, + node: ClassDeclaration$3, + }, + ], + name: "A", + references: Array [], + isValueVariable: true, + isTypeVariable: true, + }, + Variable$5 { + defs: Array [ + VariableDefinition$4 { + name: Identifier<"unresolved">, + node: VariableDeclarator$4, + }, + ], + name: "unresolved", + references: Array [ + Reference$3 { + identifier: Identifier<"unresolved">, + init: true, + isRead: false, + isTypeReference: false, + isValueReference: true, + isWrite: true, + resolved: Variable$5, + writeExpr: Identifier<"prop1">, + }, + ], + isValueVariable: true, + isTypeVariable: false, + }, + ], + scopes: Array [ + GlobalScope$1 { + block: Program$5, + isStrict: false, + references: Array [ + Reference$1, + Reference$3, + Reference$4 { + identifier: Identifier<"prop1">, + isRead: true, + isTypeReference: false, + isValueReference: true, + isWrite: false, + resolved: null, + }, + ], + set: Map { + "const" => ImplicitGlobalConstTypeVariable, + "x" => Variable$2, + "A" => Variable$3, + "unresolved" => Variable$5, + }, + type: "global", + upper: null, + variables: Array [ + ImplicitGlobalConstTypeVariable, + Variable$2, + Variable$3, + Variable$5, + ], + }, + ClassScope$2 { + block: ClassDeclaration$3, + isStrict: true, + references: Array [], + set: Map { + "A" => Variable$4, + }, + type: "class", + upper: GlobalScope$1, + variables: Array [ + Variable$4, + ], + }, + ClassFieldInitializerScope$3 { + block: Literal$6, + isStrict: true, + references: Array [], + set: Map {}, + type: "class-field-initializer", + upper: ClassScope$2, + variables: Array [], + }, + ClassFieldInitializerScope$4 { + block: Identifier<"x">, + isStrict: true, + references: Array [ + Reference$2, + ], + set: Map {}, + type: "class-field-initializer", + upper: ClassScope$2, + variables: Array [], + }, + ], +} +`; diff --git a/packages/visitor-keys/src/visitor-keys.ts b/packages/visitor-keys/src/visitor-keys.ts index 0ec52f03d92..80a8b8c9c78 100644 --- a/packages/visitor-keys/src/visitor-keys.ts +++ b/packages/visitor-keys/src/visitor-keys.ts @@ -10,94 +10,197 @@ type GetNodeTypeKeys = Exclude< 'type' | 'loc' | 'range' | 'parent' >; +type KeysDefinedInESLintVisitorKeysCore = + | AST_NODE_TYPES.AssignmentExpression + | AST_NODE_TYPES.AssignmentPattern + | AST_NODE_TYPES.ArrayExpression + | AST_NODE_TYPES.ArrayPattern + | AST_NODE_TYPES.ArrowFunctionExpression + | AST_NODE_TYPES.AwaitExpression + | AST_NODE_TYPES.BlockStatement + | AST_NODE_TYPES.BinaryExpression + | AST_NODE_TYPES.BreakStatement + | AST_NODE_TYPES.CallExpression + | AST_NODE_TYPES.CatchClause + | AST_NODE_TYPES.ChainExpression + | AST_NODE_TYPES.ClassBody + | AST_NODE_TYPES.ClassDeclaration + | AST_NODE_TYPES.ClassExpression + | AST_NODE_TYPES.ConditionalExpression + | AST_NODE_TYPES.ContinueStatement + | AST_NODE_TYPES.DebuggerStatement + | AST_NODE_TYPES.DoWhileStatement + | AST_NODE_TYPES.EmptyStatement + | AST_NODE_TYPES.ExportAllDeclaration + | AST_NODE_TYPES.ExportDefaultDeclaration + | AST_NODE_TYPES.ExportNamedDeclaration + | AST_NODE_TYPES.ExportSpecifier + | AST_NODE_TYPES.ExpressionStatement + // | AST_NODE_TYPES.ExperimentalRestProperty + // | AST_NODE_TYPES.ExperimentalSpreadProperty + | AST_NODE_TYPES.ForStatement + | AST_NODE_TYPES.ForInStatement + | AST_NODE_TYPES.ForOfStatement + | AST_NODE_TYPES.FunctionDeclaration + | AST_NODE_TYPES.FunctionExpression + | AST_NODE_TYPES.Identifier + | AST_NODE_TYPES.IfStatement + | AST_NODE_TYPES.ImportDeclaration + | AST_NODE_TYPES.ImportDefaultSpecifier + | AST_NODE_TYPES.ImportExpression + | AST_NODE_TYPES.ImportNamespaceSpecifier + | AST_NODE_TYPES.ImportSpecifier + | AST_NODE_TYPES.JSXAttribute + | AST_NODE_TYPES.JSXClosingElement + | AST_NODE_TYPES.JSXElement + | AST_NODE_TYPES.JSXEmptyExpression + | AST_NODE_TYPES.JSXExpressionContainer + | AST_NODE_TYPES.JSXIdentifier + | AST_NODE_TYPES.JSXMemberExpression + | AST_NODE_TYPES.JSXNamespacedName + | AST_NODE_TYPES.JSXOpeningElement + | AST_NODE_TYPES.JSXSpreadAttribute + | AST_NODE_TYPES.JSXText + | AST_NODE_TYPES.JSXFragment + | AST_NODE_TYPES.JSXClosingFragment + | AST_NODE_TYPES.JSXOpeningFragment + | AST_NODE_TYPES.Literal + | AST_NODE_TYPES.LabeledStatement + | AST_NODE_TYPES.LogicalExpression + | AST_NODE_TYPES.MemberExpression + | AST_NODE_TYPES.MetaProperty + | AST_NODE_TYPES.MethodDefinition + | AST_NODE_TYPES.NewExpression + | AST_NODE_TYPES.ObjectExpression + | AST_NODE_TYPES.ObjectPattern + | AST_NODE_TYPES.PrivateIdentifier + | AST_NODE_TYPES.Program + | AST_NODE_TYPES.Property + | AST_NODE_TYPES.PropertyDefinition + | AST_NODE_TYPES.RestElement + | AST_NODE_TYPES.ReturnStatement + | AST_NODE_TYPES.SequenceExpression + | AST_NODE_TYPES.SpreadElement + | AST_NODE_TYPES.StaticBlock + | AST_NODE_TYPES.Super + | AST_NODE_TYPES.SwitchStatement + | AST_NODE_TYPES.SwitchCase + | AST_NODE_TYPES.TaggedTemplateExpression + | AST_NODE_TYPES.TemplateElement + | AST_NODE_TYPES.TemplateLiteral + | AST_NODE_TYPES.ThisExpression + | AST_NODE_TYPES.ThrowStatement + | AST_NODE_TYPES.TryStatement + | AST_NODE_TYPES.UnaryExpression + | AST_NODE_TYPES.UpdateExpression + | AST_NODE_TYPES.VariableDeclaration + | AST_NODE_TYPES.VariableDeclarator + | AST_NODE_TYPES.WhileStatement + | AST_NODE_TYPES.WithStatement + | AST_NODE_TYPES.YieldExpression; + // strictly type the arrays of keys provided to make sure we keep this config in sync with the type defs type AdditionalKeys = { - readonly [T in AST_NODE_TYPES]?: readonly GetNodeTypeKeys[]; + readonly // require keys for all nodes NOT defined in `eslint-visitor-keys` + [T in Exclude< + AST_NODE_TYPES, + KeysDefinedInESLintVisitorKeysCore + >]: readonly GetNodeTypeKeys[]; +} & { + readonly // optionally allow keys for all nodes defined in `eslint-visitor-keys` + [T in KeysDefinedInESLintVisitorKeysCore]?: readonly GetNodeTypeKeys[]; }; -const additionalKeys: AdditionalKeys = { - // Stage 3 Import Assertions - ImportAttribute: ['key', 'value'], - // Stage 3 Accessor Property - AccessorProperty: ['key', 'value', 'decorators'], +/** + * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! IMPORTANT NOTE !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + * + * The key arrays should be sorted in the order in which you would want to visit + * the child keys - don't just sort them alphabetically. + */ + +// eslint-disable-next-line @typescript-eslint/explicit-function-return-type -- TODO - add ignore IIFE option +const SharedVisitorKeys = (() => { + const FunctionType = ['typeParameters', 'params', 'returnType'] as const; + const AnonymousFunction = [...FunctionType, 'body'] as const; + const AbstractPropertyDefinition = [ + 'decorators', + 'key', + 'typeAnnotation', + ] as const; + + return { + AnonymousFunction, + Function: ['id', ...AnonymousFunction], + FunctionType, + + ClassDeclaration: [ + 'decorators', + 'id', + 'typeParameters', + 'superClass', + 'superTypeParameters', + 'implements', + 'body', + ], + + AbstractPropertyDefinition: ['decorators', 'key', 'typeAnnotation'], + PropertyDefinition: [...AbstractPropertyDefinition, 'value'], + TypeAssertion: ['expression', 'typeAnnotation'], + } as const; +})(); - // Additional Properties. +const additionalKeys: AdditionalKeys = { + AccessorProperty: SharedVisitorKeys.PropertyDefinition, ArrayPattern: ['decorators', 'elements', 'typeAnnotation'], - ArrowFunctionExpression: ['typeParameters', 'params', 'returnType', 'body'], + ArrowFunctionExpression: SharedVisitorKeys.AnonymousFunction, AssignmentPattern: ['decorators', 'left', 'right', 'typeAnnotation'], CallExpression: ['callee', 'typeParameters', 'arguments'], - ClassDeclaration: [ - 'decorators', - 'id', - 'typeParameters', - 'superClass', - 'superTypeParameters', - 'implements', - 'body', - ], - ClassExpression: [ - 'decorators', - 'id', - 'typeParameters', - 'superClass', - 'superTypeParameters', - 'implements', - 'body', - ], + ClassDeclaration: SharedVisitorKeys.ClassDeclaration, + ClassExpression: SharedVisitorKeys.ClassDeclaration, + Decorator: ['expression'], ExportAllDeclaration: ['exported', 'source', 'assertions'], ExportNamedDeclaration: ['declaration', 'specifiers', 'source', 'assertions'], - FunctionDeclaration: ['id', 'typeParameters', 'params', 'returnType', 'body'], - FunctionExpression: ['id', 'typeParameters', 'params', 'returnType', 'body'], + FunctionDeclaration: SharedVisitorKeys.Function, + FunctionExpression: SharedVisitorKeys.Function, Identifier: ['decorators', 'typeAnnotation'], + ImportAttribute: ['key', 'value'], ImportDeclaration: ['specifiers', 'source', 'assertions'], ImportExpression: ['source', 'attributes'], + JSXClosingFragment: [], + JSXOpeningElement: ['name', 'typeParameters', 'attributes'], + JSXOpeningFragment: [], + JSXSpreadChild: ['expression'], MethodDefinition: ['decorators', 'key', 'value', 'typeParameters'], NewExpression: ['callee', 'typeParameters', 'arguments'], ObjectPattern: ['decorators', 'properties', 'typeAnnotation'], - PropertyDefinition: ['decorators', 'key', 'typeAnnotation', 'value'], + PropertyDefinition: SharedVisitorKeys.PropertyDefinition, RestElement: ['decorators', 'argument', 'typeAnnotation'], - TaggedTemplateExpression: ['tag', 'typeParameters', 'quasi'], StaticBlock: ['body'], - - // JSX - JSXOpeningElement: ['name', 'typeParameters', 'attributes'], - JSXClosingFragment: [], - JSXOpeningFragment: [], - JSXSpreadChild: ['expression'], - - // Additional Nodes. - Decorator: ['expression'], - - // TS-prefixed nodes - TSAbstractAccessorProperty: ['key', 'value', 'decorators'], + TaggedTemplateExpression: ['tag', 'typeParameters', 'quasi'], + TSAbstractAccessorProperty: SharedVisitorKeys.AbstractPropertyDefinition, TSAbstractKeyword: [], TSAbstractMethodDefinition: ['key', 'value'], - TSAbstractPropertyDefinition: ['decorators', 'key', 'typeAnnotation'], + TSAbstractPropertyDefinition: SharedVisitorKeys.AbstractPropertyDefinition, TSAnyKeyword: [], TSArrayType: ['elementType'], - TSAsExpression: ['expression', 'typeAnnotation'], + TSAsExpression: SharedVisitorKeys.TypeAssertion, TSAsyncKeyword: [], TSBigIntKeyword: [], TSBooleanKeyword: [], - TSCallSignatureDeclaration: ['typeParameters', 'params', 'returnType'], + TSCallSignatureDeclaration: SharedVisitorKeys.FunctionType, TSClassImplements: ['expression', 'typeParameters'], TSConditionalType: ['checkType', 'extendsType', 'trueType', 'falseType'], - TSConstructorType: ['typeParameters', 'params', 'returnType'], - TSConstructSignatureDeclaration: ['typeParameters', 'params', 'returnType'], - TSDeclareFunction: ['id', 'typeParameters', 'params', 'returnType', 'body'], + TSConstructorType: SharedVisitorKeys.FunctionType, + TSConstructSignatureDeclaration: SharedVisitorKeys.FunctionType, + TSDeclareFunction: SharedVisitorKeys.Function, TSDeclareKeyword: [], - TSEmptyBodyFunctionExpression: [ - 'id', - 'typeParameters', - 'params', - 'returnType', - ], + TSEmptyBodyFunctionExpression: ['id', ...SharedVisitorKeys.FunctionType], TSEnumDeclaration: ['id', 'members'], TSEnumMember: ['id', 'initializer'], TSExportAssignment: ['expression'], TSExportKeyword: [], TSExternalModuleReference: ['expression'], - TSFunctionType: ['typeParameters', 'params', 'returnType'], + TSFunctionType: SharedVisitorKeys.FunctionType, TSImportEqualsDeclaration: ['id', 'moduleReference'], TSImportType: ['parameter', 'qualifier', 'typeParameters'], TSIndexedAccessType: ['indexType', 'objectType'], @@ -130,7 +233,12 @@ const additionalKeys: AdditionalKeys = { TSQualifiedName: ['left', 'right'], TSReadonlyKeyword: [], TSRestType: ['typeAnnotation'], - TSSatisfiesExpression: ['typeAnnotation', 'expression'], + TSSatisfiesExpression: [ + // this is intentionally different to SharedVisitorKeys.TypeAssertion because + // the type annotation comes first in the source code + 'typeAnnotation', + 'expression', + ], TSStaticKeyword: [], TSStringKeyword: [], TSSymbolKeyword: [], @@ -139,7 +247,7 @@ const additionalKeys: AdditionalKeys = { TSTupleType: ['elementTypes'], TSTypeAliasDeclaration: ['id', 'typeParameters', 'typeAnnotation'], TSTypeAnnotation: ['typeAnnotation'], - TSTypeAssertion: ['typeAnnotation', 'expression'], + TSTypeAssertion: SharedVisitorKeys.TypeAssertion, TSTypeLiteral: ['members'], TSTypeOperator: ['typeAnnotation'], TSTypeParameter: ['name', 'constraint', 'default'], @@ -152,7 +260,7 @@ const additionalKeys: AdditionalKeys = { TSUnionType: ['types'], TSUnknownKeyword: [], TSVoidKeyword: [], -} as const; +}; const visitorKeys: VisitorKeys = eslintVisitorKeys.unionWith(additionalKeys);