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

Commit 7a97f15

Browse files
author
Kai Cataldo
committed
Update to @babel/core@>=7.2
1 parent 505a719 commit 7a97f15

File tree

4 files changed

+115
-29
lines changed

4 files changed

+115
-29
lines changed

lib/index.js

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,30 @@
11
"use strict";
22

3+
const semver = require("semver");
4+
const babelCore = require("@babel/core");
5+
const packageJson = require("../package.json");
6+
7+
const CURRENT_BABEL_VERSION = babelCore.version;
8+
const SUPPORTED_BABEL_VERSION_RANGE =
9+
packageJson.peerDependencies["@babel/core"];
10+
const IS_RUNNING_SUPPORTED_VERSION = semver.satisfies(
11+
CURRENT_BABEL_VERSION,
12+
SUPPORTED_BABEL_VERSION_RANGE
13+
);
14+
315
exports.parse = function(code, options) {
416
return exports.parseForESLint(code, options).ast;
517
};
618

719
exports.parseForESLint = function(code, options) {
20+
if (!IS_RUNNING_SUPPORTED_VERSION) {
21+
throw new Error(
22+
`babel-eslint@${
23+
packageJson.version
24+
} does not support @babel/core@${CURRENT_BABEL_VERSION}. Please downgrade to babel-eslint@^10 or upgrade to @babel/core@${SUPPORTED_BABEL_VERSION_RANGE}`
25+
);
26+
}
27+
828
options = options || {};
929
options.ecmaVersion = options.ecmaVersion || 2018;
1030
options.sourceType = options.sourceType || "module";

lib/parse.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
"use strict";
22

33
const babylonToEspree = require("./babylon-to-espree");
4-
const { parseSync: parse, traverse } = require("@babel/core");
5-
const tt = require("@babel/parser").tokTypes;
4+
const { parseSync: parse, tokTypes: tt, traverse } = require("@babel/core");
65

76
module.exports = function(code, options) {
87
const opts = {

package.json

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,17 +29,16 @@
2929
"lib"
3030
],
3131
"peerDependencies": {
32-
"@babel/core": ">=7.1.5",
33-
"@babel/parser": ">=7.1.5",
32+
"@babel/core": ">=7.2.0",
3433
"eslint": ">= 4.12.1"
3534
},
3635
"dependencies": {
3736
"eslint-scope": "3.7.1",
38-
"eslint-visitor-keys": "^1.0.0"
37+
"eslint-visitor-keys": "^1.0.0",
38+
"semver": "^5.6.0"
3939
},
4040
"devDependencies": {
41-
"@babel/core": "^7.1.5",
42-
"@babel/parser": "^7.1.5",
41+
"@babel/core": "^7.2.0",
4342
"@babel/plugin-proposal-class-properties": "^7.1.0",
4443
"@babel/plugin-proposal-decorators": "^7.1.2",
4544
"@babel/plugin-proposal-nullish-coalescing-operator": "^7.0.0",

yarn.lock

Lines changed: 90 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -14,21 +14,21 @@
1414
dependencies:
1515
"@babel/highlight" "^7.0.0"
1616

17-
"@babel/core@^7.1.5":
18-
version "7.1.5"
19-
resolved "https://registry.yarnpkg.com/@babel/core/-/core-7.1.5.tgz#abb32d7aa247a91756469e788998db6a72b93090"
20-
integrity sha512-vOyH020C56tQvte++i+rX2yokZcRfbv/kKcw+/BCRw/cK6dvsr47aCzm8oC1XHwMSEWbqrZKzZRLzLnq6SFMsg==
17+
"@babel/core@^7.2.0":
18+
version "7.2.2"
19+
resolved "https://registry.yarnpkg.com/@babel/core/-/core-7.2.2.tgz#07adba6dde27bb5ad8d8672f15fde3e08184a687"
20+
integrity sha512-59vB0RWt09cAct5EIe58+NzGP4TFSD3Bz//2/ELy3ZeTeKF6VTD1AXlH8BGGbCX0PuobZBsIzO7IAI9PH67eKw==
2121
dependencies:
2222
"@babel/code-frame" "^7.0.0"
23-
"@babel/generator" "^7.1.5"
24-
"@babel/helpers" "^7.1.5"
25-
"@babel/parser" "^7.1.5"
26-
"@babel/template" "^7.1.2"
27-
"@babel/traverse" "^7.1.5"
28-
"@babel/types" "^7.1.5"
23+
"@babel/generator" "^7.2.2"
24+
"@babel/helpers" "^7.2.0"
25+
"@babel/parser" "^7.2.2"
26+
"@babel/template" "^7.2.2"
27+
"@babel/traverse" "^7.2.2"
28+
"@babel/types" "^7.2.2"
2929
convert-source-map "^1.1.0"
30-
debug "^3.1.0"
31-
json5 "^0.5.0"
30+
debug "^4.1.0"
31+
json5 "^2.1.0"
3232
lodash "^4.17.10"
3333
resolve "^1.3.2"
3434
semver "^5.4.1"
@@ -55,6 +55,17 @@
5555
source-map "^0.5.0"
5656
trim-right "^1.0.1"
5757

58+
"@babel/generator@^7.2.2":
59+
version "7.2.2"
60+
resolved "https://registry.yarnpkg.com/@babel/generator/-/generator-7.2.2.tgz#18c816c70962640eab42fe8cae5f3947a5c65ccc"
61+
integrity sha512-I4o675J/iS8k+P38dvJ3IBGqObLXyQLTxtrR4u9cSUJOURvafeEWb/pFMOTwtNrmq73mJzyF6ueTbO1BtN0Zeg==
62+
dependencies:
63+
"@babel/types" "^7.2.2"
64+
jsesc "^2.5.1"
65+
lodash "^4.17.10"
66+
source-map "^0.5.0"
67+
trim-right "^1.0.1"
68+
5869
"@babel/helper-annotate-as-pure@^7.0.0":
5970
version "7.0.0"
6071
resolved "https://registry.yarnpkg.com/@babel/helper-annotate-as-pure/-/helper-annotate-as-pure-7.0.0.tgz#323d39dd0b50e10c7c06ca7d7638e6864d8c5c32"
@@ -238,14 +249,14 @@
238249
"@babel/traverse" "^7.1.0"
239250
"@babel/types" "^7.0.0"
240251

241-
"@babel/helpers@^7.1.5":
242-
version "7.1.5"
243-
resolved "https://registry.yarnpkg.com/@babel/helpers/-/helpers-7.1.5.tgz#68bfc1895d685f2b8f1995e788dbfe1f6ccb1996"
244-
integrity sha512-2jkcdL02ywNBry1YNFAH/fViq4fXG0vdckHqeJk+75fpQ2OH+Az6076tX/M0835zA45E0Cqa6pV5Kiv9YOqjEg==
252+
"@babel/helpers@^7.2.0":
253+
version "7.2.0"
254+
resolved "https://registry.yarnpkg.com/@babel/helpers/-/helpers-7.2.0.tgz#8335f3140f3144270dc63c4732a4f8b0a50b7a21"
255+
integrity sha512-Fr07N+ea0dMcMN8nFpuK6dUIT7/ivt9yKQdEEnjVS83tG2pHwPi03gYmk/tyuwONnZ+sY+GFFPlWGgCtW1hF9A==
245256
dependencies:
246257
"@babel/template" "^7.1.2"
247258
"@babel/traverse" "^7.1.5"
248-
"@babel/types" "^7.1.5"
259+
"@babel/types" "^7.2.0"
249260

250261
251262
version "7.0.0-beta.44"
@@ -268,6 +279,11 @@
268279
resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.1.5.tgz#20b7d5e7e1811ba996f8a868962ea7dd2bfcd2fc"
269280
integrity sha512-WXKf5K5HT6X0kKiCOezJZFljsfxKV1FpU8Tf1A7ZpGvyd/Q4hlrJm2EwoH2onaUq3O4tLDp+4gk0hHPsMyxmOg==
270281

282+
"@babel/parser@^7.2.2":
283+
version "7.2.2"
284+
resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.2.2.tgz#37ebdbc88a2e1ebc6c8dd3d35ea9436e3e39e477"
285+
integrity sha512-UNTmQ5cSLDeBGBl+s7JeowkqIHgmFAGBnLDdIzFmUNSuS5JF0XBcN59jsh/vJO/YjfsBqMxhMjoFGmNExmf0FA==
286+
271287
"@babel/plugin-proposal-async-generator-functions@^7.1.0":
272288
version "7.1.0"
273289
resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-async-generator-functions/-/plugin-proposal-async-generator-functions-7.1.0.tgz#41c1a702e10081456e23a7b74d891922dd1bb6ce"
@@ -807,6 +823,15 @@
807823
"@babel/parser" "^7.1.2"
808824
"@babel/types" "^7.1.2"
809825

826+
"@babel/template@^7.2.2":
827+
version "7.2.2"
828+
resolved "https://registry.yarnpkg.com/@babel/template/-/template-7.2.2.tgz#005b3fdf0ed96e88041330379e0da9a708eb2907"
829+
integrity sha512-zRL0IMM02AUDwghf5LMSSDEz7sBCO2YnNmpg3uWTZj/v1rcG2BmQUvaGU8GhU8BvfMh1k2KIAYZ7Ji9KXPUg7g==
830+
dependencies:
831+
"@babel/code-frame" "^7.0.0"
832+
"@babel/parser" "^7.2.2"
833+
"@babel/types" "^7.2.2"
834+
810835
811836
version "7.0.0-beta.44"
812837
resolved "https://registry.yarnpkg.com/@babel/traverse/-/traverse-7.0.0-beta.44.tgz#a970a2c45477ad18017e2e465a0606feee0d2966"
@@ -837,6 +862,21 @@
837862
globals "^11.1.0"
838863
lodash "^4.17.10"
839864

865+
"@babel/traverse@^7.2.2":
866+
version "7.2.2"
867+
resolved "https://registry.yarnpkg.com/@babel/traverse/-/traverse-7.2.2.tgz#961039de1f9bcb946d807efe2dba9c92e859d188"
868+
integrity sha512-E5Bn9FSwHpSkUhthw/XEuvFZxIgrqb9M8cX8j5EUQtrUG5DQUy6bFyl7G7iQ1D1Czudor+xkmp81JbLVVM0Sjg==
869+
dependencies:
870+
"@babel/code-frame" "^7.0.0"
871+
"@babel/generator" "^7.2.2"
872+
"@babel/helper-function-name" "^7.1.0"
873+
"@babel/helper-split-export-declaration" "^7.0.0"
874+
"@babel/parser" "^7.2.2"
875+
"@babel/types" "^7.2.2"
876+
debug "^4.1.0"
877+
globals "^11.1.0"
878+
lodash "^4.17.10"
879+
840880
841881
version "7.0.0-beta.44"
842882
resolved "https://registry.yarnpkg.com/@babel/types/-/types-7.0.0-beta.44.tgz#6b1b164591f77dec0a0342aca995f2d046b3a757"
@@ -854,6 +894,15 @@
854894
lodash "^4.17.10"
855895
to-fast-properties "^2.0.0"
856896

897+
"@babel/types@^7.2.0", "@babel/types@^7.2.2":
898+
version "7.2.2"
899+
resolved "https://registry.yarnpkg.com/@babel/types/-/types-7.2.2.tgz#44e10fc24e33af524488b716cdaee5360ea8ed1e"
900+
integrity sha512-fKCuD6UFUMkR541eDWL+2ih/xFZBXPOg/7EQFeTluMDebfqR4jrpaCjLhkWlQS4hT6nRa2PMEgXKbRB5/H2fpg==
901+
dependencies:
902+
esutils "^2.0.2"
903+
lodash "^4.17.10"
904+
to-fast-properties "^2.0.0"
905+
857906
"@samverschueren/stream-to-observable@^0.3.0":
858907
version "0.3.0"
859908
resolved "https://registry.yarnpkg.com/@samverschueren/stream-to-observable/-/stream-to-observable-0.3.0.tgz#ecdf48d532c58ea477acfcab80348424f8d0662f"
@@ -1230,6 +1279,13 @@ debug@^2.2.0, debug@^2.3.3, debug@^2.6.8, debug@^2.6.9:
12301279
dependencies:
12311280
ms "2.0.0"
12321281

1282+
debug@^4.1.0:
1283+
version "4.1.0"
1284+
resolved "https://registry.yarnpkg.com/debug/-/debug-4.1.0.tgz#373687bffa678b38b1cd91f861b63850035ddc87"
1285+
integrity sha512-heNPJUJIqC+xB6ayLAMHaIrmN9HKa7aQO8MGqKpvCA+uJYVcvR6l5kgdrhRuwPFHU7P5/A1w0BjByPHwpfTDKg==
1286+
dependencies:
1287+
ms "^2.1.1"
1288+
12331289
decode-uri-component@^0.2.0:
12341290
version "0.2.0"
12351291
resolved "https://registry.yarnpkg.com/decode-uri-component/-/decode-uri-component-0.2.0.tgz#eb3913333458775cb84cd1a1fae062106bb87545"
@@ -2038,10 +2094,12 @@ json-stable-stringify-without-jsonify@^1.0.1:
20382094
version "1.0.1"
20392095
resolved "https://registry.yarnpkg.com/json-stable-stringify-without-jsonify/-/json-stable-stringify-without-jsonify-1.0.1.tgz#9db7b59496ad3f3cfef30a75142d2d930ad72651"
20402096

2041-
json5@^0.5.0:
2042-
version "0.5.1"
2043-
resolved "https://registry.yarnpkg.com/json5/-/json5-0.5.1.tgz#1eade7acc012034ad84e2396767ead9fa5495821"
2044-
integrity sha1-Hq3nrMASA0rYTiOWdn6tn6VJWCE=
2097+
json5@^2.1.0:
2098+
version "2.1.0"
2099+
resolved "https://registry.yarnpkg.com/json5/-/json5-2.1.0.tgz#e7a0c62c48285c628d20a10b85c89bb807c32850"
2100+
integrity sha512-8Mh9h6xViijj36g7Dxi+Y4S6hNGV96vcJZr/SrlHh1LR/pEn/8j/+qIBbs44YKl69Lrfctp4QD+AdWLTMqEZAQ==
2101+
dependencies:
2102+
minimist "^1.2.0"
20452103

20462104
kind-of@^3.0.2, kind-of@^3.0.3, kind-of@^3.2.0:
20472105
version "3.2.2"
@@ -2253,6 +2311,11 @@ [email protected]:
22532311
version "0.0.8"
22542312
resolved "https://registry.yarnpkg.com/minimist/-/minimist-0.0.8.tgz#857fcabfc3397d2625b8228262e86aa7a011b05d"
22552313

2314+
minimist@^1.2.0:
2315+
version "1.2.0"
2316+
resolved "https://registry.yarnpkg.com/minimist/-/minimist-1.2.0.tgz#a35008b20f41383eec1fb914f4cd5df79a264284"
2317+
integrity sha1-o1AIsg9BOD7sH7kU9M1d95omQoQ=
2318+
22562319
mixin-deep@^1.2.0:
22572320
version "1.3.1"
22582321
resolved "https://registry.yarnpkg.com/mixin-deep/-/mixin-deep-1.3.1.tgz#a49e7268dce1a0d9698e45326c5626df3543d0fe"
@@ -2285,6 +2348,11 @@ [email protected]:
22852348
version "2.0.0"
22862349
resolved "https://registry.yarnpkg.com/ms/-/ms-2.0.0.tgz#5608aeadfc00be6c2901df5f9861788de0d597c8"
22872350

2351+
ms@^2.1.1:
2352+
version "2.1.1"
2353+
resolved "https://registry.yarnpkg.com/ms/-/ms-2.1.1.tgz#30a5864eb3ebb0a66f2ebe6d727af06a09d86e0a"
2354+
integrity sha512-tgp+dl5cGk28utYktBsrFqA7HKgrhgPsg6Z/EfhWI4gl1Hwq8B/GmY/0oXZ6nF8hDVesS/FpnYaD/kOWhYQvyg==
2355+
22882356
22892357
version "0.0.7"
22902358
resolved "http://registry.npm.taobao.org/mute-stream/download/mute-stream-0.0.7.tgz#3075ce93bc21b8fab43e1bc4da7e8115ed1e7bab"
@@ -2764,7 +2832,7 @@ semver-compare@^1.0.0:
27642832
version "5.5.0"
27652833
resolved "https://registry.yarnpkg.com/semver/-/semver-5.5.0.tgz#dc4bbc7a6ca9d916dee5d43516f0092b58f7b8ab"
27662834

2767-
semver@^5.3.0, semver@^5.4.1:
2835+
semver@^5.3.0, semver@^5.4.1, semver@^5.6.0:
27682836
version "5.6.0"
27692837
resolved "https://registry.yarnpkg.com/semver/-/semver-5.6.0.tgz#7e74256fbaa49c75aa7c7a205cc22799cac80004"
27702838
integrity sha512-RS9R6R35NYgQn++fkDWaOmqGoj4Ek9gGs+DPxNUZKuwE183xjJroKvyo1IzVFeXvUrvmALy6FWD5xrdJT25gMg==

0 commit comments

Comments
 (0)