Skip to content
This repository was archived by the owner on Aug 18, 2021. It is now read-only.

Commit 15e8d6f

Browse files
rubennorteexistentialism
authored andcommittedJun 29, 2018
Breaking: Upgraded Babel to 7.0.0-beta.51 (#642)
* Upgraded Babel to 7.0.0-beta.51, with changes to decorators * Removed support for Node 4 and added it for Node 10 * nit: fix typo [skip ci]
1 parent e865104 commit 15e8d6f

File tree

5 files changed

+168
-73
lines changed

5 files changed

+168
-73
lines changed
 

‎.travis.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
sudo: false
22
language: node_js
33
node_js:
4+
- "10"
45
- "8"
56
- "6"
6-
- "4"
77

88
matrix:
99
fast_finish: true

‎lib/parse.js

+7-4
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,15 @@
11
"use strict";
22

33
var babylonToEspree = require("./babylon-to-espree");
4-
var parse = require("babylon").parse;
5-
var tt = require("babylon").tokTypes;
4+
var parse = require("@babel/parser").parse;
5+
var tt = require("@babel/parser").tokTypes;
66
var traverse = require("@babel/traverse").default;
77
var codeFrameColumns = require("@babel/code-frame").codeFrameColumns;
88

99
module.exports = function(code, options) {
10+
const legacyDecorators =
11+
options.ecmaFeatures && options.ecmaFeatures.legacyDecorators;
12+
1013
var opts = {
1114
codeFrame: options.hasOwnProperty("codeFrame") ? options.codeFrame : true,
1215
sourceType: options.sourceType,
@@ -16,14 +19,14 @@ module.exports = function(code, options) {
1619
ranges: true,
1720
tokens: true,
1821
plugins: [
19-
"flow",
22+
["flow", { all: true }],
2023
"jsx",
2124
"estree",
2225
"asyncFunctions",
2326
"asyncGenerators",
2427
"classConstructorCall",
2528
"classProperties",
26-
"decorators",
29+
legacyDecorators ? "decorators-legacy" : "decorators",
2730
"doExpressions",
2831
"exponentiationOperator",
2932
"exportDefaultFrom",

‎package.json

+5-5
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,10 @@
1111
"url": "https://github.com/babel/babel-eslint.git"
1212
},
1313
"dependencies": {
14-
"@babel/code-frame": "7.0.0-beta.44",
15-
"@babel/traverse": "7.0.0-beta.44",
16-
"@babel/types": "7.0.0-beta.44",
17-
"babylon": "7.0.0-beta.44",
14+
"@babel/code-frame": "7.0.0-beta.51",
15+
"@babel/parser": "7.0.0-beta.51",
16+
"@babel/traverse": "7.0.0-beta.51",
17+
"@babel/types": "7.0.0-beta.51",
1818
"eslint-scope": "~3.7.1",
1919
"eslint-visitor-keys": "^1.0.0"
2020
},
@@ -30,7 +30,7 @@
3030
"author": "Sebastian McKenzie <sebmck@gmail.com>",
3131
"license": "MIT",
3232
"engines": {
33-
"node": ">=4"
33+
"node": ">=6"
3434
},
3535
"bugs": {
3636
"url": "https://github.com/babel/babel-eslint/issues"

‎test/non-regression.js

+100-12
Original file line numberDiff line numberDiff line change
@@ -476,7 +476,7 @@ describe("verify", () => {
476476
);
477477
});
478478

479-
it("polymorphpic types #109", () => {
479+
it("polymorphic types #109", () => {
480480
verifyAndAssertMessages(
481481
"export default function groupByEveryN<T>(array: Array<T>, n: number): Array<Array<?T>> { n; }",
482482
{ "no-unused-vars": 1, "no-undef": 1 }
@@ -494,7 +494,7 @@ describe("verify", () => {
494494
);
495495
});
496496

497-
it("polymorphpic/generic types for class #123", () => {
497+
it("polymorphic/generic types for class #123", () => {
498498
verifyAndAssertMessages(
499499
`
500500
class Box<T> {
@@ -507,7 +507,7 @@ describe("verify", () => {
507507
);
508508
});
509509

510-
it("polymorphpic/generic types for function #123", () => {
510+
it("polymorphic/generic types for function #123", () => {
511511
verifyAndAssertMessages(
512512
`
513513
export function identity<T>(value) {
@@ -518,7 +518,7 @@ describe("verify", () => {
518518
);
519519
});
520520

521-
it("polymorphpic/generic types for type alias #123", () => {
521+
it("polymorphic/generic types for type alias #123", () => {
522522
verifyAndAssertMessages(
523523
`
524524
import Bar from './Bar';
@@ -528,7 +528,7 @@ describe("verify", () => {
528528
);
529529
});
530530

531-
it("polymorphpic/generic types - outside of fn scope #123", () => {
531+
it("polymorphic/generic types - outside of fn scope #123", () => {
532532
verifyAndAssertMessages(
533533
`
534534
export function foo<T>(value) { value; };
@@ -542,7 +542,7 @@ describe("verify", () => {
542542
);
543543
});
544544

545-
it("polymorphpic/generic types - extending unknown #123", () => {
545+
it("polymorphic/generic types - extending unknown #123", () => {
546546
verifyAndAssertMessages(
547547
`
548548
import Bar from 'bar';
@@ -553,6 +553,16 @@ describe("verify", () => {
553553
);
554554
});
555555

556+
it("polymorphic/generic types - function calls", () => {
557+
verifyAndAssertMessages(
558+
`
559+
function f<T>(): T {}
560+
f<T>();
561+
`,
562+
{ "no-unused-vars": 1, "no-undef": 1 }
563+
);
564+
});
565+
556566
it("support declarations #132", () => {
557567
verifyAndAssertMessages(
558568
`
@@ -1124,9 +1134,32 @@ describe("verify", () => {
11241134
);
11251135
});
11261136

1127-
describe("decorators #72", () => {
1137+
describe("decorators #72 (legacy)", () => {
1138+
function verifyDecoratorsLegacyAndAssertMessages(
1139+
code,
1140+
rules,
1141+
expectedMessages,
1142+
sourceType
1143+
) {
1144+
const overrideConfig = {
1145+
parserOptions: {
1146+
ecmaFeatures: {
1147+
legacyDecorators: true,
1148+
},
1149+
sourceType,
1150+
},
1151+
};
1152+
return verifyAndAssertMessages(
1153+
code,
1154+
rules,
1155+
expectedMessages,
1156+
sourceType,
1157+
overrideConfig
1158+
);
1159+
}
1160+
11281161
it("class declaration", () => {
1129-
verifyAndAssertMessages(
1162+
verifyDecoratorsLegacyAndAssertMessages(
11301163
`
11311164
import classDeclaration from 'decorator';
11321165
import decoratorParameter from 'decorator';
@@ -1140,7 +1173,7 @@ describe("verify", () => {
11401173
});
11411174

11421175
it("method definition", () => {
1143-
verifyAndAssertMessages(
1176+
verifyDecoratorsLegacyAndAssertMessages(
11441177
`
11451178
import classMethodDeclarationA from 'decorator';
11461179
import decoratorParameter from 'decorator';
@@ -1158,7 +1191,7 @@ describe("verify", () => {
11581191
});
11591192

11601193
it("method definition get/set", () => {
1161-
verifyAndAssertMessages(
1194+
verifyDecoratorsLegacyAndAssertMessages(
11621195
`
11631196
import classMethodDeclarationA from 'decorator';
11641197
import decoratorParameter from 'decorator';
@@ -1178,7 +1211,7 @@ describe("verify", () => {
11781211
});
11791212

11801213
it("object property", () => {
1181-
verifyAndAssertMessages(
1214+
verifyDecoratorsLegacyAndAssertMessages(
11821215
`
11831216
import classMethodDeclarationA from 'decorator';
11841217
import decoratorParameter from 'decorator';
@@ -1197,7 +1230,7 @@ describe("verify", () => {
11971230
});
11981231

11991232
it("object property get/set", () => {
1200-
verifyAndAssertMessages(
1233+
verifyDecoratorsLegacyAndAssertMessages(
12011234
`
12021235
import classMethodDeclarationA from 'decorator';
12031236
import decoratorParameter from 'decorator';
@@ -1218,6 +1251,61 @@ describe("verify", () => {
12181251
});
12191252
});
12201253

1254+
describe("decorators #72", () => {
1255+
it("class declaration", () => {
1256+
verifyAndAssertMessages(
1257+
`
1258+
import classDeclaration from 'decorator';
1259+
import decoratorParameter from 'decorator';
1260+
export
1261+
@classDeclaration((parameter) => parameter)
1262+
@classDeclaration(decoratorParameter)
1263+
@classDeclaration
1264+
class TextareaAutosize {}
1265+
`,
1266+
{ "no-unused-vars": 1 }
1267+
);
1268+
});
1269+
1270+
it("method definition", () => {
1271+
verifyAndAssertMessages(
1272+
`
1273+
import classMethodDeclarationA from 'decorator';
1274+
import decoratorParameter from 'decorator';
1275+
export class TextareaAutosize {
1276+
@classMethodDeclarationA((parameter) => parameter)
1277+
@classMethodDeclarationA(decoratorParameter)
1278+
@classMethodDeclarationA
1279+
methodDeclaration(e) {
1280+
e();
1281+
}
1282+
}
1283+
`,
1284+
{ "no-unused-vars": 1 }
1285+
);
1286+
});
1287+
1288+
it("method definition get/set", () => {
1289+
verifyAndAssertMessages(
1290+
`
1291+
import classMethodDeclarationA from 'decorator';
1292+
import decoratorParameter from 'decorator';
1293+
export class TextareaAutosize {
1294+
@classMethodDeclarationA((parameter) => parameter)
1295+
@classMethodDeclarationA(decoratorParameter)
1296+
@classMethodDeclarationA
1297+
get bar() { }
1298+
@classMethodDeclarationA((parameter) => parameter)
1299+
@classMethodDeclarationA(decoratorParameter)
1300+
@classMethodDeclarationA
1301+
set bar(val) { val; }
1302+
}
1303+
`,
1304+
{ "no-unused-vars": 1 }
1305+
);
1306+
});
1307+
});
1308+
12211309
it("detects minimal no-unused-vars case #120", () => {
12221310
verifyAndAssertMessages("var unused;", { "no-unused-vars": 1 }, [
12231311
"1:5 'unused' is defined but never used. no-unused-vars",

‎yarn.lock

+55-51
Original file line numberDiff line numberDiff line change
@@ -10,19 +10,19 @@
1010
esutils "^2.0.2"
1111
js-tokens "^3.0.0"
1212

13-
"@babel/code-frame@7.0.0-beta.44":
14-
version "7.0.0-beta.44"
15-
resolved "https://registry.yarnpkg.com/@babel/code-frame/-/code-frame-7.0.0-beta.44.tgz#2a02643368de80916162be70865c97774f3adbd9"
13+
"@babel/code-frame@7.0.0-beta.51":
14+
version "7.0.0-beta.51"
15+
resolved "https://registry.yarnpkg.com/@babel/code-frame/-/code-frame-7.0.0-beta.51.tgz#bd71d9b192af978df915829d39d4094456439a0c"
1616
dependencies:
17-
"@babel/highlight" "7.0.0-beta.44"
17+
"@babel/highlight" "7.0.0-beta.51"
1818

19-
"@babel/generator@7.0.0-beta.44":
20-
version "7.0.0-beta.44"
21-
resolved "https://registry.yarnpkg.com/@babel/generator/-/generator-7.0.0-beta.44.tgz#c7e67b9b5284afcf69b309b50d7d37f3e5033d42"
19+
"@babel/generator@7.0.0-beta.51":
20+
version "7.0.0-beta.51"
21+
resolved "https://registry.yarnpkg.com/@babel/generator/-/generator-7.0.0-beta.51.tgz#6c7575ffde761d07485e04baedc0392c6d9e30f6"
2222
dependencies:
23-
"@babel/types" "7.0.0-beta.44"
23+
"@babel/types" "7.0.0-beta.51"
2424
jsesc "^2.5.1"
25-
lodash "^4.2.0"
25+
lodash "^4.17.5"
2626
source-map "^0.5.0"
2727
trim-right "^1.0.1"
2828

@@ -34,40 +34,44 @@
3434
"@babel/template" "7.0.0-beta.36"
3535
"@babel/types" "7.0.0-beta.36"
3636

37-
"@babel/helper-function-name@7.0.0-beta.44":
38-
version "7.0.0-beta.44"
39-
resolved "https://registry.yarnpkg.com/@babel/helper-function-name/-/helper-function-name-7.0.0-beta.44.tgz#e18552aaae2231100a6e485e03854bc3532d44dd"
37+
"@babel/helper-function-name@7.0.0-beta.51":
38+
version "7.0.0-beta.51"
39+
resolved "https://registry.yarnpkg.com/@babel/helper-function-name/-/helper-function-name-7.0.0-beta.51.tgz#21b4874a227cf99ecafcc30a90302da5a2640561"
4040
dependencies:
41-
"@babel/helper-get-function-arity" "7.0.0-beta.44"
42-
"@babel/template" "7.0.0-beta.44"
43-
"@babel/types" "7.0.0-beta.44"
41+
"@babel/helper-get-function-arity" "7.0.0-beta.51"
42+
"@babel/template" "7.0.0-beta.51"
43+
"@babel/types" "7.0.0-beta.51"
4444

4545
"@babel/helper-get-function-arity@7.0.0-beta.36":
4646
version "7.0.0-beta.36"
4747
resolved "https://registry.yarnpkg.com/@babel/helper-get-function-arity/-/helper-get-function-arity-7.0.0-beta.36.tgz#f5383bac9a96b274828b10d98900e84ee43e32b8"
4848
dependencies:
4949
"@babel/types" "7.0.0-beta.36"
5050

51-
"@babel/helper-get-function-arity@7.0.0-beta.44":
52-
version "7.0.0-beta.44"
53-
resolved "https://registry.yarnpkg.com/@babel/helper-get-function-arity/-/helper-get-function-arity-7.0.0-beta.44.tgz#d03ca6dd2b9f7b0b1e6b32c56c72836140db3a15"
51+
"@babel/helper-get-function-arity@7.0.0-beta.51":
52+
version "7.0.0-beta.51"
53+
resolved "https://registry.yarnpkg.com/@babel/helper-get-function-arity/-/helper-get-function-arity-7.0.0-beta.51.tgz#3281b2d045af95c172ce91b20825d85ea4676411"
5454
dependencies:
55-
"@babel/types" "7.0.0-beta.44"
55+
"@babel/types" "7.0.0-beta.51"
5656

57-
"@babel/helper-split-export-declaration@7.0.0-beta.44":
58-
version "7.0.0-beta.44"
59-
resolved "https://registry.yarnpkg.com/@babel/helper-split-export-declaration/-/helper-split-export-declaration-7.0.0-beta.44.tgz#c0b351735e0fbcb3822c8ad8db4e583b05ebd9dc"
57+
"@babel/helper-split-export-declaration@7.0.0-beta.51":
58+
version "7.0.0-beta.51"
59+
resolved "https://registry.yarnpkg.com/@babel/helper-split-export-declaration/-/helper-split-export-declaration-7.0.0-beta.51.tgz#8a6c3f66c4d265352fc077484f9f6e80a51ab978"
6060
dependencies:
61-
"@babel/types" "7.0.0-beta.44"
61+
"@babel/types" "7.0.0-beta.51"
6262

63-
"@babel/highlight@7.0.0-beta.44":
64-
version "7.0.0-beta.44"
65-
resolved "https://registry.yarnpkg.com/@babel/highlight/-/highlight-7.0.0-beta.44.tgz#18c94ce543916a80553edcdcf681890b200747d5"
63+
"@babel/highlight@7.0.0-beta.51":
64+
version "7.0.0-beta.51"
65+
resolved "https://registry.yarnpkg.com/@babel/highlight/-/highlight-7.0.0-beta.51.tgz#e8844ae25a1595ccfd42b89623b4376ca06d225d"
6666
dependencies:
6767
chalk "^2.0.0"
6868
esutils "^2.0.2"
6969
js-tokens "^3.0.0"
7070

71+
"@babel/parser@7.0.0-beta.51":
72+
version "7.0.0-beta.51"
73+
resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.0.0-beta.51.tgz#27cec2df409df60af58270ed8f6aa55409ea86f6"
74+
7175
"@babel/template@7.0.0-beta.36":
7276
version "7.0.0-beta.36"
7377
resolved "https://registry.yarnpkg.com/@babel/template/-/template-7.0.0-beta.36.tgz#02e903de5d68bd7899bce3c5b5447e59529abb00"
@@ -77,14 +81,14 @@
7781
babylon "7.0.0-beta.36"
7882
lodash "^4.2.0"
7983

80-
"@babel/template@7.0.0-beta.44":
81-
version "7.0.0-beta.44"
82-
resolved "https://registry.yarnpkg.com/@babel/template/-/template-7.0.0-beta.44.tgz#f8832f4fdcee5d59bf515e595fc5106c529b394f"
84+
"@babel/template@7.0.0-beta.51":
85+
version "7.0.0-beta.51"
86+
resolved "https://registry.yarnpkg.com/@babel/template/-/template-7.0.0-beta.51.tgz#9602a40aebcf357ae9677e2532ef5fc810f5fbff"
8387
dependencies:
84-
"@babel/code-frame" "7.0.0-beta.44"
85-
"@babel/types" "7.0.0-beta.44"
86-
babylon "7.0.0-beta.44"
87-
lodash "^4.2.0"
88+
"@babel/code-frame" "7.0.0-beta.51"
89+
"@babel/parser" "7.0.0-beta.51"
90+
"@babel/types" "7.0.0-beta.51"
91+
lodash "^4.17.5"
8892

8993
"@babel/traverse@7.0.0-beta.36":
9094
version "7.0.0-beta.36"
@@ -99,20 +103,20 @@
99103
invariant "^2.2.0"
100104
lodash "^4.2.0"
101105

102-
"@babel/traverse@7.0.0-beta.44":
103-
version "7.0.0-beta.44"
104-
resolved "https://registry.yarnpkg.com/@babel/traverse/-/traverse-7.0.0-beta.44.tgz#a970a2c45477ad18017e2e465a0606feee0d2966"
106+
"@babel/traverse@7.0.0-beta.51":
107+
version "7.0.0-beta.51"
108+
resolved "https://registry.yarnpkg.com/@babel/traverse/-/traverse-7.0.0-beta.51.tgz#981daf2cec347a6231d3aa1d9e1803b03aaaa4a8"
105109
dependencies:
106-
"@babel/code-frame" "7.0.0-beta.44"
107-
"@babel/generator" "7.0.0-beta.44"
108-
"@babel/helper-function-name" "7.0.0-beta.44"
109-
"@babel/helper-split-export-declaration" "7.0.0-beta.44"
110-
"@babel/types" "7.0.0-beta.44"
111-
babylon "7.0.0-beta.44"
110+
"@babel/code-frame" "7.0.0-beta.51"
111+
"@babel/generator" "7.0.0-beta.51"
112+
"@babel/helper-function-name" "7.0.0-beta.51"
113+
"@babel/helper-split-export-declaration" "7.0.0-beta.51"
114+
"@babel/parser" "7.0.0-beta.51"
115+
"@babel/types" "7.0.0-beta.51"
112116
debug "^3.1.0"
113117
globals "^11.1.0"
114118
invariant "^2.2.0"
115-
lodash "^4.2.0"
119+
lodash "^4.17.5"
116120

117121
"@babel/types@7.0.0-beta.36":
118122
version "7.0.0-beta.36"
@@ -122,12 +126,12 @@
122126
lodash "^4.2.0"
123127
to-fast-properties "^2.0.0"
124128

125-
"@babel/types@7.0.0-beta.44":
126-
version "7.0.0-beta.44"
127-
resolved "https://registry.yarnpkg.com/@babel/types/-/types-7.0.0-beta.44.tgz#6b1b164591f77dec0a0342aca995f2d046b3a757"
129+
"@babel/types@7.0.0-beta.51":
130+
version "7.0.0-beta.51"
131+
resolved "https://registry.yarnpkg.com/@babel/types/-/types-7.0.0-beta.51.tgz#d802b7b543b5836c778aa691797abf00f3d97ea9"
128132
dependencies:
129133
esutils "^2.0.2"
130-
lodash "^4.2.0"
134+
lodash "^4.17.5"
131135
to-fast-properties "^2.0.0"
132136

133137
acorn-jsx@^3.0.0:
@@ -238,10 +242,6 @@ babylon@7.0.0-beta.36:
238242
version "7.0.0-beta.36"
239243
resolved "https://registry.yarnpkg.com/babylon/-/babylon-7.0.0-beta.36.tgz#3a3683ba6a9a1e02b0aa507c8e63435e39305b9e"
240244

241-
babylon@7.0.0-beta.44:
242-
version "7.0.0-beta.44"
243-
resolved "https://registry.yarnpkg.com/babylon/-/babylon-7.0.0-beta.44.tgz#89159e15e6e30c5096e22d738d8c0af8a0e8ca1d"
244-
245245
balanced-match@^1.0.0:
246246
version "1.0.0"
247247
resolved "https://registry.yarnpkg.com/balanced-match/-/balanced-match-1.0.0.tgz#89b4d199ab2bee49de164ea02b89ce462d71b767"
@@ -1121,6 +1121,10 @@ lodash@^4.15.0, lodash@^4.17.4, lodash@^4.2.0, lodash@^4.3.0:
11211121
version "4.17.5"
11221122
resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.5.tgz#99a92d65c0272debe8c96b6057bc8fbfa3bed511"
11231123

1124+
lodash@^4.17.5:
1125+
version "4.17.10"
1126+
resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.10.tgz#1b7793cf7259ea38fb3661d4d38b3260af8ae4e7"
1127+
11241128
log-symbols@^1.0.2:
11251129
version "1.0.2"
11261130
resolved "https://registry.yarnpkg.com/log-symbols/-/log-symbols-1.0.2.tgz#376ff7b58ea3086a0f09facc74617eca501e1a18"

0 commit comments

Comments
 (0)
This repository has been archived.