diff --git a/package.json b/package.json index 17e6aeaafa0f..4ed71a07a7b4 100644 --- a/package.json +++ b/package.json @@ -117,7 +117,7 @@ "ts-node": "10.7.0", "tslint": "^6.1.3", "tsx": "^3.12.7", - "typescript": ">=4.3.5 <5.2.0 || 5.2.1-rc" + "typescript": ">=4.3.5 <5.3.0" }, "resolutions": { "@jest/create-cache-key-function": "^29", @@ -142,7 +142,7 @@ "jest-util": "^29", "pretty-format": "^29", "tsx": "^3.12.7", - "typescript": "5.2.1-rc" + "typescript": "5.2.2" }, "packageManager": "yarn@3.6.2" } diff --git a/packages/scope-manager/tools/generate-lib.ts b/packages/scope-manager/tools/generate-lib.ts index 13cc9eaec093..d4572f24d3f7 100644 --- a/packages/scope-manager/tools/generate-lib.ts +++ b/packages/scope-manager/tools/generate-lib.ts @@ -1,5 +1,6 @@ import type { TSESTree } from '@typescript-eslint/types'; import { AST_TOKEN_TYPES } from '@typescript-eslint/types'; +import { ESLint } from '@typescript-eslint/utils/ts-eslint'; import * as fs from 'fs'; import * as path from 'path'; import { format, resolveConfig } from 'prettier'; @@ -53,6 +54,7 @@ const TYPES_FILE = path.resolve( 'src', 'lib.ts', ); +const BARREL_PATH = path.join(OUTPUT_FOLDER, 'index.ts'); const BASE_CONFIG_MODULE_NAME = 'base-config'; const SHARED_CONFIG_MODULE = path.resolve( @@ -110,7 +112,7 @@ function getReferences( return references; } -function main(): void { +async function main(): Promise { try { rimraf.sync(OUTPUT_FOLDER); } catch { @@ -122,6 +124,12 @@ function main(): void { // ignored } + const filesWritten: string[] = [ + SHARED_CONFIG_MODULE, + TYPES_FILE, + BARREL_PATH, + ]; + // the shared fs.writeFileSync( SHARED_CONFIG_MODULE, @@ -222,7 +230,9 @@ function main(): void { } const formattedCode = formatCode(code); - fs.writeFileSync(path.join(OUTPUT_FOLDER, `${libName}.ts`), formattedCode); + const writePath = path.join(OUTPUT_FOLDER, `${libName}.ts`); + fs.writeFileSync(writePath, formattedCode); + filesWritten.push(writePath); console.log( 'Wrote', @@ -254,7 +264,7 @@ function main(): void { const formattedBarrelCode = formatCode(barrelCode); - fs.writeFileSync(path.join(OUTPUT_FOLDER, 'index.ts'), formattedBarrelCode); + fs.writeFileSync(BARREL_PATH, formattedBarrelCode); console.log('Wrote barrel file'); // generate a string union type for the lib names @@ -270,6 +280,17 @@ function main(): void { fs.writeFileSync(TYPES_FILE, formattedLibUnionCode); console.log('Wrote Lib union type file'); + + const lint = new ESLint({ + fix: true, + }); + const results = await lint.lintFiles(filesWritten); + await ESLint.outputFixes(results); + console.log('Autofixed lint errors'); } -main(); +main().catch(e => { + console.error(e); + // eslint-disable-next-line no-process-exit + process.exit(1); +}); diff --git a/packages/typescript-estree/src/parseSettings/warnAboutTSVersion.ts b/packages/typescript-estree/src/parseSettings/warnAboutTSVersion.ts index 1bc33c89542f..a92c690ee6d0 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 /docs/users/Versioning.mdx * in the typescript-eslint monorepo */ -const SUPPORTED_TYPESCRIPT_VERSIONS = '>=4.3.5 <5.2.0'; +const SUPPORTED_TYPESCRIPT_VERSIONS = '>=4.3.5 <5.3.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[] = ['5.2.1-rc']; +const SUPPORTED_PRERELEASE_RANGES: string[] = []; const ACTIVE_TYPESCRIPT_VERSION = ts.version; const isRunningSupportedTypeScriptVersion = semver.satisfies( ACTIVE_TYPESCRIPT_VERSION, diff --git a/packages/website/src/vendor/sandbox.d.ts b/packages/website/src/vendor/sandbox.d.ts index 14b3310bb49c..9a43757ba3db 100644 --- a/packages/website/src/vendor/sandbox.d.ts +++ b/packages/website/src/vendor/sandbox.d.ts @@ -115,6 +115,7 @@ export declare const createTypeScriptSandbox: ( }; /** A list of TypeScript versions you can use with the TypeScript sandbox */ supportedVersions: readonly [ + '5.2.1-rc', '5.2.0-beta', '5.1.6', '5.0.4', diff --git a/packages/website/src/vendor/typescript-vfs.d.ts b/packages/website/src/vendor/typescript-vfs.d.ts index 81d54ea45366..e6c7df7b4391 100644 --- a/packages/website/src/vendor/typescript-vfs.d.ts +++ b/packages/website/src/vendor/typescript-vfs.d.ts @@ -46,7 +46,8 @@ export declare function createVirtualTypeScriptEnvironment( ): VirtualTypeScriptEnvironment; /** * Grab the list of lib files for a particular target, will return a bit more than necessary (by including - * the dom) but that's OK + * the dom) but that's OK, we're really working with the constraint that you can't get a list of files + * when running in a browser. * * @param target The compiler settings target baseline * @param ts A copy of the TypeScript module @@ -58,10 +59,13 @@ export declare const knownLibFilesForCompilerOptions: ( /** * Sets up a Map with lib contents by grabbing the necessary files from * the local copy of typescript via the file system. + * + * The first two args are un-used, but kept around so as to not cause a + * semver major bump for no gain to module users. */ export declare const createDefaultMapFromNodeModules: ( - compilerOptions: CompilerOptions, - ts?: typeof ts, + _compilerOptions: CompilerOptions, + _ts?: typeof ts, tsLibDirectory?: string, ) => Map; /** diff --git a/yarn.lock b/yarn.lock index dda2a22bc286..1aefdc54ab67 100644 --- a/yarn.lock +++ b/yarn.lock @@ -6019,7 +6019,7 @@ __metadata: ts-node: 10.7.0 tslint: ^6.1.3 tsx: ^3.12.7 - typescript: ">=4.3.5 <5.2.0 || 5.2.1-rc" + typescript: ">=4.3.5 <5.3.0" languageName: unknown linkType: soft @@ -20017,23 +20017,23 @@ __metadata: languageName: node linkType: hard -"typescript@npm:5.2.1-rc": - version: 5.2.1-rc - resolution: "typescript@npm:5.2.1-rc" +"typescript@npm:5.2.2": + version: 5.2.2 + resolution: "typescript@npm:5.2.2" bin: tsc: bin/tsc tsserver: bin/tsserver - checksum: 0bea857151b74d76d36af16e77ad348b1fbf9630b0002be4cda9713fee692e50e2faa5d1d63fccbc3e3a4999e0356c0b722d993344ab0d014ecfc4d500b178ca + checksum: 7912821dac4d962d315c36800fe387cdc0a6298dba7ec171b350b4a6e988b51d7b8f051317786db1094bd7431d526b648aba7da8236607febb26cf5b871d2d3c languageName: node linkType: hard -"typescript@patch:typescript@npm%3A5.2.1-rc#~builtin": - version: 5.2.1-rc - resolution: "typescript@patch:typescript@npm%3A5.2.1-rc#~builtin::version=5.2.1-rc&hash=f3b441" +"typescript@patch:typescript@npm%3A5.2.2#~builtin": + version: 5.2.2 + resolution: "typescript@patch:typescript@npm%3A5.2.2#~builtin::version=5.2.2&hash=f3b441" bin: tsc: bin/tsc tsserver: bin/tsserver - checksum: 3128667694c92cdafc4683aa3c75c6da4e9d38b95464cad6e9d76732d2a8c55b12fa7d20ccae59c46b2baabbecd04ed8e1ec2bad7fb1da01200b800dfacd2eb7 + checksum: 0f4da2f15e6f1245e49db15801dbee52f2bbfb267e1c39225afdab5afee1a72839cd86000e65ee9d7e4dfaff12239d28beaf5ee431357fcced15fb08583d72ca languageName: node linkType: hard