Skip to content
This repository was archived by the owner on Jan 19, 2019. It is now read-only.

Commit 219135b

Browse files
committed
Upgrade: typescript-estree to 13.5.1
1 parent 1b9195a commit 219135b

File tree

7 files changed

+28
-45
lines changed

7 files changed

+28
-45
lines changed

analyze-scope.js

+3-7
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ class Referencer extends OriginalReferencer {
120120
const { defs, identifiers } = upperScope.set.get(id.name);
121121
for (let i = 0; i < defs.length; ++i) {
122122
const def = defs[i];
123-
if (def.type === "FunctionName" && def.node.type === "TSEmptyBodyFunctionDeclaration") {
123+
if (def.type === "FunctionName" && def.node.type === "TSDeclareFunction") {
124124
defs.splice(i, 1);
125125
identifiers.splice(i, 1);
126126
break;
@@ -292,10 +292,10 @@ class Referencer extends OriginalReferencer {
292292
/**
293293
* Define the variable of this function declaration only once.
294294
* Because to avoid confusion of `no-redeclare` rule by overloading.
295-
* @param {TSEmptyBodyFunctionDeclaration} node The TSEmptyBodyFunctionDeclaration node to visit.
295+
* @param {TSDeclareFunction} node The TSDeclareFunction node to visit.
296296
* @returns {void}
297297
*/
298-
TSEmptyBodyFunctionDeclaration(node) {
298+
TSDeclareFunction(node) {
299299
const upperTypeMode = this.typeMode;
300300
const scope = this.currentScope();
301301
const { id, typeParameters, params, returnType } = node;
@@ -319,10 +319,6 @@ class Referencer extends OriginalReferencer {
319319
this.typeMode = upperTypeMode;
320320
}
321321

322-
TSEmptyBodyDeclareFunction(node) {
323-
this.TSEmptyBodyFunctionDeclaration(node);
324-
}
325-
326322
/**
327323
* Create reference objects for the references in parameters and return type.
328324
* @param {TSEmptyBodyFunctionExpression} node The TSEmptyBodyFunctionExpression node to visit.

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@
4646
"dependencies": {
4747
"eslint-scope": "^4.0.0",
4848
"eslint-visitor-keys": "^1.0.0",
49-
"typescript-estree": "12.0.0"
49+
"typescript-estree": "13.5.1"
5050
},
5151
"devDependencies": {
5252
"eslint": "^4.19.1",

parser.js

-8
Original file line numberDiff line numberDiff line change
@@ -41,16 +41,8 @@ exports.parseForESLint = function parseForESLint(code, options) {
4141
traverser.traverse(ast, {
4242
enter: node => {
4343
switch (node.type) {
44-
// Just for backward compatibility.
45-
case "TSDeclareFunction":
46-
if (!node.body) {
47-
node.type = "TSEmptyBodyDeclareFunction";
48-
}
49-
break;
50-
5144
// Function#body cannot be null in ESTree spec.
5245
case "FunctionExpression":
53-
case "FunctionDeclaration":
5446
if (!node.body) {
5547
node.type = `TSEmptyBody${node.type}`;
5648
}

tests/lib/__snapshots__/ecma-features.js.snap

+2-2
Original file line numberDiff line numberDiff line change
@@ -102133,7 +102133,7 @@ Object {
102133102133
0,
102134102134
24,
102135102135
],
102136-
"type": "TSEmptyBodyFunctionDeclaration",
102136+
"type": "TSDeclareFunction",
102137102137
},
102138102138
],
102139102139
"comments": Array [],
@@ -102468,7 +102468,7 @@ Object {
102468102468
0,
102469102469
23,
102470102470
],
102471-
"type": "TSEmptyBodyFunctionDeclaration",
102471+
"type": "TSDeclareFunction",
102472102472
},
102473102473
],
102474102474
"comments": Array [],

tests/lib/__snapshots__/scope-analysis.js.snap

+2-2
Original file line numberDiff line numberDiff line change
@@ -1689,7 +1689,7 @@ Object {
16891689
0,
16901690
37,
16911691
],
1692-
"type": "TSEmptyBodyDeclareFunction",
1692+
"type": "TSDeclareFunction",
16931693
},
16941694
"parent": null,
16951695
"type": "FunctionName",
@@ -4188,7 +4188,7 @@ Object {
41884188
0,
41894189
18,
41904190
],
4191-
"type": "TSEmptyBodyFunctionDeclaration",
4191+
"type": "TSDeclareFunction",
41924192
},
41934193
"parent": null,
41944194
"type": "FunctionName",

tests/lib/__snapshots__/typescript.js.snap

+17-20
Original file line numberDiff line numberDiff line change
@@ -10822,7 +10822,7 @@ Object {
1082210822
"line": 9,
1082310823
},
1082410824
},
10825-
"parameters": Array [
10825+
"params": Array [
1082610826
Object {
1082710827
"argument": Object {
1082810828
"loc": Object {
@@ -10914,20 +10914,19 @@ Object {
1091410914
180,
1091510915
205,
1091610916
],
10917-
"type": "TSConstructorType",
10918-
"typeAnnotation": Object {
10917+
"returnType": Object {
1091910918
"loc": Object {
1092010919
"end": Object {
1092110920
"column": 47,
1092210921
"line": 9,
1092310922
},
1092410923
"start": Object {
10925-
"column": 44,
10924+
"column": 43,
1092610925
"line": 9,
1092710926
},
1092810927
},
1092910928
"range": Array [
10930-
202,
10929+
201,
1093110930
205,
1093210931
],
1093310932
"type": "TSTypeAnnotation",
@@ -10967,7 +10966,7 @@ Object {
1096710966
},
1096810967
},
1096910968
},
10970-
"typeParameters": null,
10969+
"type": "TSConstructorType",
1097110970
},
1097210971
"typeParameters": Object {
1097310972
"loc": Object {
@@ -20726,7 +20725,7 @@ Object {
2072620725
"type": "TSStringKeyword",
2072720726
},
2072820727
},
20729-
"type": "TSEmptyBodyDeclareFunction",
20728+
"type": "TSDeclareFunction",
2073020729
},
2073120730
],
2073220731
"comments": Array [],
@@ -23686,7 +23685,7 @@ Object {
2368623685
"line": 1,
2368723686
},
2368823687
},
23689-
"parameters": Array [
23688+
"params": Array [
2369023689
Object {
2369123690
"loc": Object {
2369223691
"end": Object {
@@ -23744,20 +23743,19 @@ Object {
2374423743
27,
2374523744
46,
2374623745
],
23747-
"type": "TSFunctionType",
23748-
"typeAnnotation": Object {
23746+
"returnType": Object {
2374923747
"loc": Object {
2375023748
"end": Object {
2375123749
"column": 46,
2375223750
"line": 1,
2375323751
},
2375423752
"start": Object {
23755-
"column": 40,
23753+
"column": 39,
2375623754
"line": 1,
2375723755
},
2375823756
},
2375923757
"range": Array [
23760-
40,
23758+
39,
2376123759
46,
2376223760
],
2376323761
"type": "TSTypeAnnotation",
@@ -23779,7 +23777,7 @@ Object {
2377923777
"type": "TSVoidKeyword",
2378023778
},
2378123779
},
23782-
"typeParameters": null,
23780+
"type": "TSFunctionType",
2378323781
},
2378423782
},
2378523783
"loc": Object {
@@ -43967,7 +43965,7 @@ Object {
4396743965
"line": 2,
4396843966
},
4396943967
},
43970-
"parameters": Array [
43968+
"params": Array [
4397143969
Object {
4397243970
"loc": Object {
4397343971
"end": Object {
@@ -44095,20 +44093,19 @@ Object {
4409544093
49,
4409644094
79,
4409744095
],
44098-
"type": "TSFunctionType",
44099-
"typeAnnotation": Object {
44096+
"returnType": Object {
4410044097
"loc": Object {
4410144098
"end": Object {
4410244099
"column": 57,
4410344100
"line": 2,
4410444101
},
4410544102
"start": Object {
44106-
"column": 51,
44103+
"column": 50,
4410744104
"line": 2,
4410844105
},
4410944106
},
4411044107
"range": Array [
44111-
73,
44108+
72,
4411244109
79,
4411344110
],
4411444111
"type": "TSTypeAnnotation",
@@ -44130,7 +44127,7 @@ Object {
4413044127
"type": "TSVoidKeyword",
4413144128
},
4413244129
},
44133-
"typeParameters": null,
44130+
"type": "TSFunctionType",
4413444131
},
4413544132
},
4413644133
},
@@ -66021,7 +66018,7 @@ Object {
6602166018
},
6602266019
},
6602366020
},
66024-
"type": "TSEmptyBodyFunctionDeclaration",
66021+
"type": "TSDeclareFunction",
6602566022
},
6602666023
"loc": Object {
6602766024
"end": Object {

visitor-keys.js

+3-5
Original file line numberDiff line numberDiff line change
@@ -39,10 +39,9 @@ module.exports = Evk.unionWith({
3939
TSCallSignatureDeclaration: ["typeParameters", "params", "returnType"],
4040
TSConditionalType: ["checkType", "extendsType", "trueType", "falseType"],
4141
TSConstructSignatureDeclaration: ["typeParameters", "params", "returnType"],
42-
TSConstructorType: ["typeAnnotation", "parameters"],
42+
TSConstructorType: ["typeParameters", "params", "returnType"],
43+
TSDeclareFunction: ["id", "typeParameters", "params", "returnType"],
4344
TSDeclareKeyword: [],
44-
TSEmptyBodyDeclareFunction: ["id", "typeParameters", "params", "returnType"],
45-
TSEmptyBodyFunctionDeclaration: ["id", "typeParameters", "params", "returnType"],
4645
TSEmptyBodyFunctionExpression: ["id", "typeParameters", "params", "returnType"],
4746
TSEnumDeclaration: ["members"],
4847
TSEnumMember: ["id", "initializer"],
@@ -59,13 +58,12 @@ module.exports = Evk.unionWith({
5958
TSInterfaceDeclaration: ["id", "typeParameters", "heritage", "body"],
6059
TSInterfaceHeritage: ["id", "typeParameters"],
6160
TSImportEqualsDeclaration: ["id", "moduleReference"],
62-
TSFunctionType: ["parameters", "typeAnnotation"],
61+
TSFunctionType: ["typeParameters", "params", "returnType"],
6362
TSMappedType: ["typeParameter"],
6463
TSMethodSignature: ["typeAnnotation", "typeParameters", "key", "params"],
6564
TSModuleBlock: ["body"],
6665
TSModuleDeclaration: ["id", "body"],
6766
TSNamespaceExportDeclaration: ["id"],
68-
TSNamespaceFunctionDeclaration: [],
6967
TSNonNullExpression: ["expression"],
7068
TSNeverKeyword: [],
7169
TSNullKeyword: [],

0 commit comments

Comments
 (0)