Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: update to TypeScript 4.9 #5716

Merged
merged 9 commits into from Nov 17, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 4 additions & 4 deletions package.json
Expand Up @@ -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",
Expand Down Expand Up @@ -104,11 +104,11 @@
"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.2-rc"
},
"resolutions": {
"typescript": "~4.8.3",
"@types/node": "^18.0.0",
"typescript": "~4.9.2-rc",
"@types/node": "^18.11.9",
"//": "Pin jest to v29 across the repo",
"@jest/create-cache-key-function": "^29",
"@jest/reporters": "^29",
Expand Down
18 changes: 12 additions & 6 deletions packages/scope-manager/src/lib/dom.ts
Expand Up @@ -66,7 +66,7 @@ export const dom = {
DeviceMotionEventInit: TYPE,
DeviceMotionEventRotationRateInit: TYPE,
DeviceOrientationEventInit: TYPE,
DisplayMediaStreamConstraints: TYPE,
DisplayMediaStreamOptions: TYPE,
DocumentTimelineOptions: TYPE,
DoubleRange: TYPE,
DragEventInit: TYPE,
Expand Down Expand Up @@ -143,7 +143,6 @@ export const dom = {
MediaMetadataInit: TYPE,
MediaPositionState: TYPE,
MediaQueryListEventInit: TYPE,
MediaRecorderErrorEventInit: TYPE,
MediaRecorderOptions: TYPE,
MediaSessionActionDetails: TYPE,
MediaStreamAudioSourceOptions: TYPE,
Expand Down Expand Up @@ -184,6 +183,7 @@ export const dom = {
PeriodicWaveConstraints: TYPE,
PeriodicWaveOptions: TYPE,
PermissionDescriptor: TYPE,
PictureInPictureEventInit: TYPE,
PointerEventInit: TYPE,
PopStateEventInit: TYPE,
PositionOptions: TYPE,
Expand Down Expand Up @@ -243,6 +243,7 @@ export const dom = {
RTCStats: TYPE,
RTCTrackEventInit: TYPE,
RTCTransportStats: TYPE,
ReadableStreamGetReaderOptions: TYPE,
ReadableStreamReadDoneResult: TYPE,
ReadableStreamReadValueResult: TYPE,
ReadableWritablePair: TYPE,
Expand Down Expand Up @@ -284,6 +285,8 @@ export const dom = {
TransitionEventInit: TYPE,
UIEventInit: TYPE,
ULongRange: TYPE,
UnderlyingByteSource: TYPE,
UnderlyingDefaultSource: TYPE,
UnderlyingSink: TYPE,
UnderlyingSource: TYPE,
ValidityStateFlags: TYPE,
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -1123,8 +1130,6 @@ export const dom = {
TimerHandler: TYPE,
Transferable: TYPE,
Uint32List: TYPE,
UvmEntries: TYPE,
UvmEntry: TYPE,
VibratePattern: TYPE,
WindowProxy: TYPE,
XMLHttpRequestBodyInit: TYPE,
Expand Down Expand Up @@ -1227,7 +1232,6 @@ export const dom = {
RTCIceCandidateType: TYPE,
RTCIceComponent: TYPE,
RTCIceConnectionState: TYPE,
RTCIceCredentialType: TYPE,
RTCIceGathererState: TYPE,
RTCIceGatheringState: TYPE,
RTCIceProtocol: TYPE,
Expand All @@ -1243,6 +1247,8 @@ export const dom = {
RTCSignalingState: TYPE,
RTCStatsIceCandidatePairState: TYPE,
RTCStatsType: TYPE,
ReadableStreamReaderMode: TYPE,
ReadableStreamType: TYPE,
ReadyState: TYPE,
RecordingState: TYPE,
ReferrerPolicy: TYPE,
Expand Down
11 changes: 11 additions & 0 deletions 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 type { ImplicitLibVariableOptions } from '../variable';
import { TYPE_VALUE } from './base-config';

export const es2019_intl = {
Intl: TYPE_VALUE,
} as Record<string, ImplicitLibVariableOptions>;
2 changes: 2 additions & 0 deletions packages/scope-manager/src/lib/es2019.ts
Expand Up @@ -6,6 +6,7 @@
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';
Expand All @@ -16,4 +17,5 @@ export const es2019 = {
...es2019_object,
...es2019_string,
...es2019_symbol,
...es2019_intl,
} as Record<string, ImplicitLibVariableOptions>;
2 changes: 2 additions & 0 deletions packages/scope-manager/src/lib/index.ts
Expand Up @@ -38,6 +38,7 @@ 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';
Expand Down Expand Up @@ -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,
Expand Down
6 changes: 6 additions & 0 deletions packages/scope-manager/src/lib/webworker.ts
Expand Up @@ -88,6 +88,7 @@ export const webworker = {
QueuingStrategyInit: TYPE,
RTCEncodedAudioFrameMetadata: TYPE,
RTCEncodedVideoFrameMetadata: TYPE,
ReadableStreamGetReaderOptions: TYPE,
ReadableStreamReadDoneResult: TYPE,
ReadableStreamReadValueResult: TYPE,
ReadableWritablePair: TYPE,
Expand All @@ -108,6 +109,8 @@ export const webworker = {
TextDecoderOptions: TYPE,
TextEncoderEncodeIntoResult: TYPE,
Transformer: TYPE,
UnderlyingByteSource: TYPE,
UnderlyingDefaultSource: TYPE,
UnderlyingSink: TYPE,
UnderlyingSource: TYPE,
VideoColorSpaceInit: TYPE,
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -431,6 +435,8 @@ export const webworker = {
PremultiplyAlpha: TYPE,
PushEncryptionKeyName: TYPE,
RTCEncodedVideoFrameType: TYPE,
ReadableStreamReaderMode: TYPE,
ReadableStreamType: TYPE,
ReferrerPolicy: TYPE,
RequestCache: TYPE,
RequestCredentials: TYPE,
Expand Down
2 changes: 1 addition & 1 deletion packages/scope-manager/src/referencer/Referencer.ts
Expand Up @@ -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),
Expand Down
1 change: 1 addition & 0 deletions packages/types/src/lib.ts
Expand Up @@ -46,6 +46,7 @@ type Lib =
| 'es2019.object'
| 'es2019.string'
| 'es2019.symbol'
| 'es2019.intl'
| 'es2020.bigint'
| 'es2020.date'
| 'es2020.promise'
Expand Down
Expand Up @@ -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.2-rc'];
const ACTIVE_TYPESCRIPT_VERSION = ts.version;
const isRunningSupportedTypeScriptVersion = semver.satisfies(
ACTIVE_TYPESCRIPT_VERSION,
Expand Down
@@ -1,18 +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 54e4c65..aa00912 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 {
JSDocComment = 323,
JSDocText = 324,
JSDocTypeLiteral = 325,
@@ -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;
Expand All @@ -26,7 +26,7 @@ index 0fd60ae..02f4fe7 100644
function getModifiers(node: HasModifiers): readonly Modifier[] | undefined;
/**
* Gets the JSDoc parameter tags for the node if present.
@@ -4834,7 +4840,13 @@ declare namespace ts {
@@ -4857,7 +4863,13 @@ declare namespace ts {
}
declare namespace ts {
function setTextRange<T extends TextRange>(range: T, location: TextRange | undefined): T;
Expand All @@ -40,7 +40,7 @@ index 0fd60ae..02f4fe7 100644
function canHaveDecorators(node: Node): node is HasDecorators;
}
declare namespace ts {
@@ -7924,7 +7936,7 @@ declare namespace ts {
@@ -7958,7 +7970,7 @@ declare namespace ts {
* const decorators = ts.canHaveDecorators(node) ? ts.getDecorators(node) : undefined;
* ```
*/
Expand Down
16 changes: 8 additions & 8 deletions yarn.lock
Expand Up @@ -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"
Expand Down Expand Up @@ -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.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"
Expand Down