From 67e30cd0efe6b0cf4d86ba2d8ebbe71838305b43 Mon Sep 17 00:00:00 2001 From: sosukesuzuki Date: Fri, 29 Oct 2021 18:40:58 +0900 Subject: [PATCH 1/4] feat: update to typescript 4.5 --- README.md | 2 +- package.json | 4 ++-- packages/typescript-estree/src/parser.ts | 4 ++-- yarn.lock | 8 ++++---- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index 2443ba50a162..d2374728b652 100644 --- a/README.md +++ b/README.md @@ -233,7 +233,7 @@ The latest version under the `canary` tag **(latest commit to master)** is: ## Supported TypeScript Version -**The version range of TypeScript currently supported by this parser is `>=3.3.1 <4.5.0`.** +**The version range of TypeScript currently supported by this parser is `>=3.3.1 <4.6.0`.** These versions are what we test against. diff --git a/package.json b/package.json index 1fac8603db6e..d9bd788cf4c5 100644 --- a/package.json +++ b/package.json @@ -131,10 +131,10 @@ "ts-jest": "^27.0.5", "ts-node": "^10.4.0", "tslint": "^6.1.3", - "typescript": ">=3.3.1 <4.5.0" + "typescript": ">=3.3.1 <4.6.0 || 4.5.0-beta" }, "resolutions": { "@types/node": "^16.11.4", - "typescript": "4.4.4" + "typescript": "4.5.0-beta" } } diff --git a/packages/typescript-estree/src/parser.ts b/packages/typescript-estree/src/parser.ts index 9a9dc04a771e..4b3bc8a83599 100644 --- a/packages/typescript-estree/src/parser.ts +++ b/packages/typescript-estree/src/parser.ts @@ -30,12 +30,12 @@ const log = debug('typescript-eslint:typescript-estree:parser'); * 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.5.0'; +const SUPPORTED_TYPESCRIPT_VERSIONS = '>=3.3.1 <4.6.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.4.0-beta', '4.4.1-rc']; +const SUPPORTED_PRERELEASE_RANGES: string[] = ['4.5.0-beta']; const ACTIVE_TYPESCRIPT_VERSION = ts.version; const isRunningSupportedTypeScriptVersion = semver.satisfies( ACTIVE_TYPESCRIPT_VERSION, diff --git a/yarn.lock b/yarn.lock index ae247d519540..92d6c41ac25e 100644 --- a/yarn.lock +++ b/yarn.lock @@ -14610,10 +14610,10 @@ typedarray@^0.0.6: resolved "https://registry.yarnpkg.com/typedarray/-/typedarray-0.0.6.tgz#867ac74e3864187b1d3d47d996a78ec5c8830777" integrity sha1-hnrHTjhkGHsdPUfZlqeOxciDB3c= -typescript@*, typescript@4.4.4, "typescript@>=3.3.1 <4.5.0", typescript@^4.1.0-dev.20201026, typescript@^4.4.3, typescript@~4.4.2: - version "4.4.4" - resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.4.4.tgz#2cd01a1a1f160704d3101fd5a58ff0f9fcb8030c" - integrity sha512-DqGhF5IKoBl8WNf8C1gu8q0xZSInh9j1kJJMqT3a94w1JzVaBU4EXOSMrz9yDqMT0xt3selp83fuFMQ0uzv6qA== +typescript@*, typescript@4.5.0-beta, "typescript@>=3.3.1 <4.6.0 || 4.5.0-beta", typescript@^4.1.0-dev.20201026, typescript@^4.4.3, typescript@~4.4.2: + version "4.5.0-beta" + resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.5.0-beta.tgz#f2e2724d93c35e7a0d0d1e55a22d1e4efb2181c7" + integrity sha512-7PvWhki2lwukaR9osVhFnNzxaE4LM+gC94dlwcvS+Tqz8+U65va7FbKo02bT+/MFlnMPM8bsPUXvHiMD/Mg3Jg== ua-parser-js@^0.7.30: version "0.7.31" From 2c9a911a7e9b64f7b74dd34152ad2493f912a33d Mon Sep 17 00:00:00 2001 From: sosukesuzuki Date: Fri, 29 Oct 2021 18:50:01 +0900 Subject: [PATCH 2/4] test(eslint-plugin): update tests --- .../tests/rules/restrict-template-expressions.test.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/eslint-plugin/tests/rules/restrict-template-expressions.test.ts b/packages/eslint-plugin/tests/rules/restrict-template-expressions.test.ts index fea8b82501ae..be300242e3d2 100644 --- a/packages/eslint-plugin/tests/rules/restrict-template-expressions.test.ts +++ b/packages/eslint-plugin/tests/rules/restrict-template-expressions.test.ts @@ -361,7 +361,7 @@ ruleTester.run('restrict-template-expressions', rule, { errors: [ { messageId: 'invalidType', - data: { type: 'any' }, + data: { type: 'T' }, line: 3, column: 27, }, From c1d42f01ca781e96e3f306a220b8b7a571f1e14d Mon Sep 17 00:00:00 2001 From: sosukesuzuki Date: Wed, 3 Nov 2021 19:01:03 +0900 Subject: [PATCH 3/4] chore: use typescript@4.5.1-rc --- package.json | 4 ++-- packages/typescript-estree/src/parser.ts | 2 +- yarn.lock | 8 ++++---- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/package.json b/package.json index d9bd788cf4c5..685bdd3092c3 100644 --- a/package.json +++ b/package.json @@ -131,10 +131,10 @@ "ts-jest": "^27.0.5", "ts-node": "^10.4.0", "tslint": "^6.1.3", - "typescript": ">=3.3.1 <4.6.0 || 4.5.0-beta" + "typescript": ">=3.3.1 <4.6.0 || 4.5.1-rc" }, "resolutions": { "@types/node": "^16.11.4", - "typescript": "4.5.0-beta" + "typescript": "4.5.1-rc" } } diff --git a/packages/typescript-estree/src/parser.ts b/packages/typescript-estree/src/parser.ts index 4b3bc8a83599..65847192bd54 100644 --- a/packages/typescript-estree/src/parser.ts +++ b/packages/typescript-estree/src/parser.ts @@ -35,7 +35,7 @@ const SUPPORTED_TYPESCRIPT_VERSIONS = '>=3.3.1 <4.6.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.5.0-beta']; +const SUPPORTED_PRERELEASE_RANGES: string[] = ['4.5.0-beta', '4.5.1-rc']; const ACTIVE_TYPESCRIPT_VERSION = ts.version; const isRunningSupportedTypeScriptVersion = semver.satisfies( ACTIVE_TYPESCRIPT_VERSION, diff --git a/yarn.lock b/yarn.lock index 92d6c41ac25e..ea80c3afcdb3 100644 --- a/yarn.lock +++ b/yarn.lock @@ -14610,10 +14610,10 @@ typedarray@^0.0.6: resolved "https://registry.yarnpkg.com/typedarray/-/typedarray-0.0.6.tgz#867ac74e3864187b1d3d47d996a78ec5c8830777" integrity sha1-hnrHTjhkGHsdPUfZlqeOxciDB3c= -typescript@*, typescript@4.5.0-beta, "typescript@>=3.3.1 <4.6.0 || 4.5.0-beta", typescript@^4.1.0-dev.20201026, typescript@^4.4.3, typescript@~4.4.2: - version "4.5.0-beta" - resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.5.0-beta.tgz#f2e2724d93c35e7a0d0d1e55a22d1e4efb2181c7" - integrity sha512-7PvWhki2lwukaR9osVhFnNzxaE4LM+gC94dlwcvS+Tqz8+U65va7FbKo02bT+/MFlnMPM8bsPUXvHiMD/Mg3Jg== +typescript@*, typescript@4.5.1-rc, "typescript@>=3.3.1 <4.6.0 || 4.5.1-rc", typescript@^4.1.0-dev.20201026, typescript@^4.4.3, typescript@~4.4.2: + version "4.5.1-rc" + resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.5.1-rc.tgz#02155eaa0579d11babb2a55dcbd796948a994bb3" + integrity sha512-tQBWW1DCFqweyhSzsAUSFgssJ3uuRBh0zyOkRV4CaFF2rMBkGU0I+MqPMch0qhGCUGXjOW7FgMrbQLS6PE3Z6Q== ua-parser-js@^0.7.30: version "0.7.31" From 8026509796a785d6be28a7ad8230ada2b24cb9e4 Mon Sep 17 00:00:00 2001 From: sosukesuzuki Date: Wed, 3 Nov 2021 19:29:39 +0900 Subject: [PATCH 4/4] test(typescript-estree): fix tests for ts bug --- .../js/{included.js => included01.js} | 0 .../js/{included.jsx => included02.jsx} | 0 .../js/{notIncluded.js => notIncluded01.js} | 0 .../js/{notIncluded.jsx => notIncluded02.jsx} | 0 .../ts/{included.ts => included01.ts} | 0 .../ts/{included.tsx => included02.tsx} | 0 .../ts/{notIncluded.ts => notIncluded01.ts} | 0 .../ts/{notIncluded.tsx => notIncluded02.tsx} | 0 .../fixtures/invalidFileErrors/tsconfig.json | 8 +++---- .../lib/__snapshots__/parse.test.ts.snap | 8 +++---- .../typescript-estree/tests/lib/parse.test.ts | 24 ++++++++++++------- 11 files changed, 23 insertions(+), 17 deletions(-) rename packages/typescript-estree/tests/fixtures/invalidFileErrors/js/{included.js => included01.js} (100%) rename packages/typescript-estree/tests/fixtures/invalidFileErrors/js/{included.jsx => included02.jsx} (100%) rename packages/typescript-estree/tests/fixtures/invalidFileErrors/js/{notIncluded.js => notIncluded01.js} (100%) rename packages/typescript-estree/tests/fixtures/invalidFileErrors/js/{notIncluded.jsx => notIncluded02.jsx} (100%) rename packages/typescript-estree/tests/fixtures/invalidFileErrors/ts/{included.ts => included01.ts} (100%) rename packages/typescript-estree/tests/fixtures/invalidFileErrors/ts/{included.tsx => included02.tsx} (100%) rename packages/typescript-estree/tests/fixtures/invalidFileErrors/ts/{notIncluded.ts => notIncluded01.ts} (100%) rename packages/typescript-estree/tests/fixtures/invalidFileErrors/ts/{notIncluded.tsx => notIncluded02.tsx} (100%) diff --git a/packages/typescript-estree/tests/fixtures/invalidFileErrors/js/included.js b/packages/typescript-estree/tests/fixtures/invalidFileErrors/js/included01.js similarity index 100% rename from packages/typescript-estree/tests/fixtures/invalidFileErrors/js/included.js rename to packages/typescript-estree/tests/fixtures/invalidFileErrors/js/included01.js diff --git a/packages/typescript-estree/tests/fixtures/invalidFileErrors/js/included.jsx b/packages/typescript-estree/tests/fixtures/invalidFileErrors/js/included02.jsx similarity index 100% rename from packages/typescript-estree/tests/fixtures/invalidFileErrors/js/included.jsx rename to packages/typescript-estree/tests/fixtures/invalidFileErrors/js/included02.jsx diff --git a/packages/typescript-estree/tests/fixtures/invalidFileErrors/js/notIncluded.js b/packages/typescript-estree/tests/fixtures/invalidFileErrors/js/notIncluded01.js similarity index 100% rename from packages/typescript-estree/tests/fixtures/invalidFileErrors/js/notIncluded.js rename to packages/typescript-estree/tests/fixtures/invalidFileErrors/js/notIncluded01.js diff --git a/packages/typescript-estree/tests/fixtures/invalidFileErrors/js/notIncluded.jsx b/packages/typescript-estree/tests/fixtures/invalidFileErrors/js/notIncluded02.jsx similarity index 100% rename from packages/typescript-estree/tests/fixtures/invalidFileErrors/js/notIncluded.jsx rename to packages/typescript-estree/tests/fixtures/invalidFileErrors/js/notIncluded02.jsx diff --git a/packages/typescript-estree/tests/fixtures/invalidFileErrors/ts/included.ts b/packages/typescript-estree/tests/fixtures/invalidFileErrors/ts/included01.ts similarity index 100% rename from packages/typescript-estree/tests/fixtures/invalidFileErrors/ts/included.ts rename to packages/typescript-estree/tests/fixtures/invalidFileErrors/ts/included01.ts diff --git a/packages/typescript-estree/tests/fixtures/invalidFileErrors/ts/included.tsx b/packages/typescript-estree/tests/fixtures/invalidFileErrors/ts/included02.tsx similarity index 100% rename from packages/typescript-estree/tests/fixtures/invalidFileErrors/ts/included.tsx rename to packages/typescript-estree/tests/fixtures/invalidFileErrors/ts/included02.tsx diff --git a/packages/typescript-estree/tests/fixtures/invalidFileErrors/ts/notIncluded.ts b/packages/typescript-estree/tests/fixtures/invalidFileErrors/ts/notIncluded01.ts similarity index 100% rename from packages/typescript-estree/tests/fixtures/invalidFileErrors/ts/notIncluded.ts rename to packages/typescript-estree/tests/fixtures/invalidFileErrors/ts/notIncluded01.ts diff --git a/packages/typescript-estree/tests/fixtures/invalidFileErrors/ts/notIncluded.tsx b/packages/typescript-estree/tests/fixtures/invalidFileErrors/ts/notIncluded02.tsx similarity index 100% rename from packages/typescript-estree/tests/fixtures/invalidFileErrors/ts/notIncluded.tsx rename to packages/typescript-estree/tests/fixtures/invalidFileErrors/ts/notIncluded02.tsx diff --git a/packages/typescript-estree/tests/fixtures/invalidFileErrors/tsconfig.json b/packages/typescript-estree/tests/fixtures/invalidFileErrors/tsconfig.json index 9f3d8cab0be7..f4d9ad5a8d7e 100644 --- a/packages/typescript-estree/tests/fixtures/invalidFileErrors/tsconfig.json +++ b/packages/typescript-estree/tests/fixtures/invalidFileErrors/tsconfig.json @@ -3,10 +3,10 @@ "allowJs": true }, "include": [ - "ts/included.ts", - "ts/included.tsx", - "js/included.js", - "js/included.jsx", + "ts/included01.ts", + "ts/included02.tsx", + "js/included01.js", + "js/included02.jsx", "other/included.vue" ] } diff --git a/packages/typescript-estree/tests/lib/__snapshots__/parse.test.ts.snap b/packages/typescript-estree/tests/lib/__snapshots__/parse.test.ts.snap index c1c63f861b61..e1610759df96 100644 --- a/packages/typescript-estree/tests/lib/__snapshots__/parse.test.ts.snap +++ b/packages/typescript-estree/tests/lib/__snapshots__/parse.test.ts.snap @@ -34,25 +34,25 @@ The file must be included in at least one of the projects provided." exports[`parseAndGenerateServices invalid file error messages project includes errors for not included files 1`] = ` "\\"parserOptions.project\\" has been set for @typescript-eslint/parser. -The file does not match your project config: ts/notIncluded.ts. +The file does not match your project config: ts/notIncluded0j1.ts. The file must be included in at least one of the projects provided." `; exports[`parseAndGenerateServices invalid file error messages project includes errors for not included files 2`] = ` "\\"parserOptions.project\\" has been set for @typescript-eslint/parser. -The file does not match your project config: ts/notIncluded.tsx. +The file does not match your project config: ts/notIncluded02.tsx. The file must be included in at least one of the projects provided." `; exports[`parseAndGenerateServices invalid file error messages project includes errors for not included files 3`] = ` "\\"parserOptions.project\\" has been set for @typescript-eslint/parser. -The file does not match your project config: js/notIncluded.js. +The file does not match your project config: js/notIncluded01.js. The file must be included in at least one of the projects provided." `; exports[`parseAndGenerateServices invalid file error messages project includes errors for not included files 4`] = ` "\\"parserOptions.project\\" has been set for @typescript-eslint/parser. -The file does not match your project config: js/notIncluded.jsx. +The file does not match your project config: js/notIncluded02.jsx. The file must be included in at least one of the projects provided." `; diff --git a/packages/typescript-estree/tests/lib/parse.test.ts b/packages/typescript-estree/tests/lib/parse.test.ts index f74bcc81794d..cd573fcd291f 100644 --- a/packages/typescript-estree/tests/lib/parse.test.ts +++ b/packages/typescript-estree/tests/lib/parse.test.ts @@ -518,23 +518,29 @@ describe('parseAndGenerateServices', () => { describe('project includes', () => { it("doesn't error for matched files", () => { - expect(testParse('ts/included.ts')).not.toThrow(); - expect(testParse('ts/included.tsx')).not.toThrow(); - expect(testParse('js/included.js')).not.toThrow(); - expect(testParse('js/included.jsx')).not.toThrow(); + expect(testParse('ts/included01.ts')).not.toThrow(); + expect(testParse('ts/included02.tsx')).not.toThrow(); + expect(testParse('js/included01.js')).not.toThrow(); + expect(testParse('js/included02.jsx')).not.toThrow(); }); it('errors for not included files', () => { - expect(testParse('ts/notIncluded.ts')).toThrowErrorMatchingSnapshot(); - expect(testParse('ts/notIncluded.tsx')).toThrowErrorMatchingSnapshot(); - expect(testParse('js/notIncluded.js')).toThrowErrorMatchingSnapshot(); - expect(testParse('js/notIncluded.jsx')).toThrowErrorMatchingSnapshot(); + expect( + testParse('ts/notIncluded0j1.ts'), + ).toThrowErrorMatchingSnapshot(); + expect( + testParse('ts/notIncluded02.tsx'), + ).toThrowErrorMatchingSnapshot(); + expect(testParse('js/notIncluded01.js')).toThrowErrorMatchingSnapshot(); + expect( + testParse('js/notIncluded02.jsx'), + ).toThrowErrorMatchingSnapshot(); }); }); describe('"parserOptions.extraFileExtensions" is empty', () => { it('should not error', () => { - expect(testParse('ts/included.ts', [])).not.toThrow(); + expect(testParse('ts/included01.ts', [])).not.toThrow(); }); it('the extension does not match', () => {