Skip to content

Commit

Permalink
chore: update to typescript 4.5-rc (#4073)
Browse files Browse the repository at this point in the history
* feat: update to typescript 4.5

* test(eslint-plugin): update tests

* chore: use typescript@4.5.1-rc

* test(typescript-estree): fix tests for ts bug
  • Loading branch information
sosukesuzuki committed Nov 11, 2021
1 parent d4ab138 commit cee6137
Show file tree
Hide file tree
Showing 16 changed files with 33 additions and 27 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -108,10 +108,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.1-rc"
},
"resolutions": {
"@types/node": "^16.11.4",
"typescript": "4.4.4"
"typescript": "4.5.1-rc"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -361,7 +361,7 @@ ruleTester.run('restrict-template-expressions', rule, {
errors: [
{
messageId: 'invalidType',
data: { type: 'any' },
data: { type: 'T' },
line: 3,
column: 27,
},
Expand Down
4 changes: 2 additions & 2 deletions packages/typescript-estree/src/parser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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', '4.5.1-rc'];
const ACTIVE_TYPESCRIPT_VERSION = ts.version;
const isRunningSupportedTypeScriptVersion = semver.satisfies(
ACTIVE_TYPESCRIPT_VERSION,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"
]
}
Original file line number Diff line number Diff line change
Expand Up @@ -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."
`;

Expand Down
24 changes: 15 additions & 9 deletions packages/typescript-estree/tests/lib/parse.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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', () => {
Expand Down
8 changes: 4 additions & 4 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -13500,10 +13500,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.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"
Expand Down

0 comments on commit cee6137

Please sign in to comment.