Skip to content

Commit e201fb4

Browse files
kaicataldohzoo
authored andcommitted
Make 2018 the default ecmaVersion for rules relying on parserOptions (babel#556)
1 parent 1dedd1b commit e201fb4

6 files changed

+6
-17
lines changed

lib/analyze-scope.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -318,7 +318,7 @@ module.exports = function(ast, parserOptions) {
318318
parserOptions.ecmaFeatures.globalReturn) === true,
319319
impliedStrict: false,
320320
sourceType: ast.sourceType,
321-
ecmaVersion: parserOptions.ecmaVersion || 6,
321+
ecmaVersion: parserOptions.ecmaVersion || 2018,
322322
fallback,
323323
};
324324

lib/index.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ exports.parse = function(code, options) {
66

77
exports.parseForESLint = function(code, options) {
88
options = options || {};
9-
options.ecmaVersion = options.ecmaVersion || 6;
9+
options.ecmaVersion = options.ecmaVersion || 2018;
1010
options.sourceType = options.sourceType || "module";
1111
options.allowImportExportEverywhere =
1212
options.allowImportExportEverywhere || false;

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@
4545
"eslint-plugin-flowtype": "^2.30.3",
4646
"eslint-plugin-import": "^2.8.0",
4747
"eslint-plugin-prettier": "^2.1.2",
48-
"espree": "^3.4.0",
48+
"espree": "^3.5.2",
4949
"husky": "^0.14.0",
5050
"lint-staged": "^4.0.0",
5151
"mocha": "^4.0.0",

test/babel-eslint.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ function parseAndAssertSame(code) {
3737
range: true,
3838
comment: true,
3939
attachComment: true,
40-
ecmaVersion: 8,
40+
ecmaVersion: 2018,
4141
sourceType: "module",
4242
});
4343
var babylonAST = babelEslint.parseForESLint(code, {
@@ -71,7 +71,7 @@ function parseAndAssertSame(code) {
7171
// assert.equal(esAST, babylonAST);
7272
}
7373

74-
describe("babylon-to-esprima", () => {
74+
describe("babylon-to-espree", () => {
7575
describe("compatibility", () => {
7676
it("should allow ast.analyze to be called without options", function() {
7777
var esAST = babelEslint.parseForESLint("`test`", {

test/non-regression.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ function verifyAndAssertMessagesWithSpecificESLint(
1919
es6: true,
2020
},
2121
parserOptions: {
22-
ecmaVersion: 8,
22+
ecmaVersion: 2018,
2323
ecmaFeatures: {
2424
jsx: true,
2525
experimentalObjectRestSpread: true,

yarn.lock

-11
Original file line numberDiff line numberDiff line change
@@ -65,10 +65,6 @@ acorn@^3.0.4:
6565
version "3.3.0"
6666
resolved "https://registry.yarnpkg.com/acorn/-/acorn-3.3.0.tgz#45e37fb39e8da3f25baee3ff5369e2bb5f22017a"
6767

68-
acorn@^5.0.1:
69-
version "5.0.3"
70-
resolved "https://registry.yarnpkg.com/acorn/-/acorn-5.0.3.tgz#c460df08491463f028ccb82eab3730bf01087b3d"
71-
7268
acorn@^5.2.1:
7369
version "5.2.1"
7470
resolved "https://registry.yarnpkg.com/acorn/-/acorn-5.2.1.tgz#317ac7821826c22c702d66189ab8359675f135d7"
@@ -599,13 +595,6 @@ eslint@^4.14.0:
599595
table "^4.0.1"
600596
text-table "~0.2.0"
601597

602-
espree@^3.4.0:
603-
version "3.4.3"
604-
resolved "https://registry.yarnpkg.com/espree/-/espree-3.4.3.tgz#2910b5ccd49ce893c2ffffaab4fd8b3a31b82374"
605-
dependencies:
606-
acorn "^5.0.1"
607-
acorn-jsx "^3.0.0"
608-
609598
espree@^3.5.2:
610599
version "3.5.2"
611600
resolved "https://registry.yarnpkg.com/espree/-/espree-3.5.2.tgz#756ada8b979e9dcfcdb30aad8d1a9304a905e1ca"

0 commit comments

Comments
 (0)