Skip to content

Commit 623febf

Browse files
authored
feat(typescript-estree): support for parsing 3.7 features (#1045)
1 parent 854620e commit 623febf

50 files changed

Lines changed: 20524 additions & 6839 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.vscode/launch.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
"program": "${workspaceFolder}/node_modules/jest/bin/jest.js",
1313
"args": [
1414
"--runInBand",
15+
"--no-coverage",
1516
// needs the '' around it so that the () are properly handled
1617
"'tests/(.+/)?${fileBasenameNoExtension}'"
1718
],
@@ -27,6 +28,8 @@
2728
"program": "${workspaceFolder}/node_modules/jest/bin/jest.js",
2829
"args": [
2930
"--runInBand",
31+
"--no-cache",
32+
"--no-coverage",
3033
"${relativeFile}"
3134
],
3235
"sourceMaps": true,

.vscode/settings.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,6 @@
2222
"javascript.preferences.importModuleSpecifier": "auto",
2323
"typescript.preferences.importModuleSpecifier": "auto",
2424
"javascript.preferences.quoteStyle": "single",
25-
"typescript.preferences.quoteStyle": "single",
26-
"editor.defaultFormatter": "esbenp.prettier-vscode"
25+
"typescript.preferences.quoteStyle": "single",
26+
"editor.defaultFormatter": "esbenp.prettier-vscode"
2727
}

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -235,9 +235,9 @@ The latest version under the `canary` tag **(latest commit to master)** is:
235235

236236
## Supported TypeScript Version
237237

238-
We will always endeavor to support the latest stable version of TypeScript. Sometimes, but not always, changes in TypeScript will not require breaking changes in this project, and so we are able to support more than one version of TypeScript.
238+
We will always endeavor to support the latest stable version of TypeScript. Sometimes, but not always, changes in TypeScript will not require breaking changes in this project, and so we are able to support more than one version of TypeScript. In some cases, we may even be able to support additional pre-releases (i.e. betas and release candidates) of TypeScript, but only if doing so does not require us to compromise on support for the latest stable version.
239239

240-
**The version range of TypeScript currently supported by this parser is `>=3.2.1 <3.7.0`.**
240+
**The version range of TypeScript currently supported by this parser is `>=3.2.1 <3.8.0`.**
241241

242242
This is reflected in the `devDependency` requirement within the package.json file, and it is what the tests will be run against. We have an open `peerDependency` requirement in order to allow for experimentation on newer/beta versions of TypeScript.
243243

package.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,10 +73,13 @@
7373
"ts-jest": "^24.0.0",
7474
"ts-node": "^8.3.0",
7575
"tslint": "^5.19.0",
76-
"typescript": ">=3.2.1 <3.7.0"
76+
"typescript": ">=3.2.1 <3.8.0 >3.7.0-dev.0"
7777
},
7878
"collective": {
7979
"type": "opencollective",
8080
"url": "https://opencollective.com/typescript-eslint"
81+
},
82+
"resolutions": {
83+
"typescript": "^3.7.0-beta"
8184
}
8285
}

packages/eslint-plugin-tslint/tsconfig.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
{
22
"extends": "./tsconfig.build.json",
33
"compilerOptions": {
4-
"rootDir": ".",
5-
"noEmit": true
4+
"composite": false,
5+
"rootDir": "."
66
},
77
"include": ["src", "tests"],
88
"exclude": ["tests/test-project", "tests/test-tslint-rules-directory"]

packages/eslint-plugin/src/rules/adjacent-overload-signatures.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,8 +90,6 @@ export default util.createRule({
9090
case AST_NODE_TYPES.TSTypeLiteral:
9191
return node.members;
9292
}
93-
94-
return [];
9593
}
9694

9795
/**

packages/eslint-plugin/src/rules/indent.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -292,7 +292,7 @@ export default util.createRule<Options, MessageIds>({
292292
range: moduleReference.range,
293293
loc: moduleReference.loc,
294294
},
295-
},
295+
} as TSESTree.VariableDeclarator,
296296
],
297297

298298
// location data
@@ -313,6 +313,8 @@ export default util.createRule<Options, MessageIds>({
313313
parent: node.parent,
314314
range: node.range,
315315
loc: node.loc,
316+
optional: false,
317+
computed: true,
316318
});
317319
},
318320

@@ -420,6 +422,8 @@ export default util.createRule<Options, MessageIds>({
420422
parent: node.parent,
421423
range: node.range,
422424
loc: node.loc,
425+
optional: false,
426+
computed: false,
423427
});
424428
},
425429

packages/eslint-plugin/src/rules/prefer-readonly.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,9 @@ export default util.createRule<Options, MessageIds>({
162162
function getEsNodesFromViolatingNode(
163163
violatingNode: ParameterOrPropertyDeclaration,
164164
): { esNode: TSESTree.Node; nameNode: TSESTree.Node } {
165-
if (ts.isParameterPropertyDeclaration(violatingNode)) {
165+
if (
166+
ts.isParameterPropertyDeclaration(violatingNode, violatingNode.parent)
167+
) {
166168
return {
167169
esNode: parserServices.tsNodeToESTreeNodeMap.get(violatingNode.name),
168170
nameNode: parserServices.tsNodeToESTreeNodeMap.get(
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
{
22
"extends": "./tsconfig.build.json",
33
"compilerOptions": {
4-
"rootDir": ".",
5-
"noEmit": true
4+
"composite": false,
5+
"rootDir": "."
66
},
77
"include": ["src", "typings", "tests", "tools"]
88
}
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
{
22
"extends": "./tsconfig.build.json",
33
"compilerOptions": {
4-
"rootDir": ".",
5-
"noEmit": true
4+
"composite": false,
5+
"rootDir": "."
66
},
77
"include": ["src", "typings", "tests", "tools"]
88
}

0 commit comments

Comments
 (0)