Make 2018 the default ecmaVersion for rules relying on parserOptions (babel/babel-eslint#556)

This commit is contained in:
Kai Cataldo 2018-01-08 17:45:24 -05:00
parent 660180b932
commit 97c9442511
6 changed files with 6 additions and 17 deletions

View File

@ -318,7 +318,7 @@ module.exports = function(ast, parserOptions) {
parserOptions.ecmaFeatures.globalReturn) === true, parserOptions.ecmaFeatures.globalReturn) === true,
impliedStrict: false, impliedStrict: false,
sourceType: ast.sourceType, sourceType: ast.sourceType,
ecmaVersion: parserOptions.ecmaVersion || 6, ecmaVersion: parserOptions.ecmaVersion || 2018,
fallback, fallback,
}; };

View File

@ -6,7 +6,7 @@ exports.parse = function(code, options) {
exports.parseForESLint = function(code, options) { exports.parseForESLint = function(code, options) {
options = options || {}; options = options || {};
options.ecmaVersion = options.ecmaVersion || 6; options.ecmaVersion = options.ecmaVersion || 2018;
options.sourceType = options.sourceType || "module"; options.sourceType = options.sourceType || "module";
options.allowImportExportEverywhere = options.allowImportExportEverywhere =
options.allowImportExportEverywhere || false; options.allowImportExportEverywhere || false;

View File

@ -45,7 +45,7 @@
"eslint-plugin-flowtype": "^2.30.3", "eslint-plugin-flowtype": "^2.30.3",
"eslint-plugin-import": "^2.8.0", "eslint-plugin-import": "^2.8.0",
"eslint-plugin-prettier": "^2.1.2", "eslint-plugin-prettier": "^2.1.2",
"espree": "^3.4.0", "espree": "^3.5.2",
"husky": "^0.14.0", "husky": "^0.14.0",
"lint-staged": "^4.0.0", "lint-staged": "^4.0.0",
"mocha": "^4.0.0", "mocha": "^4.0.0",

View File

@ -37,7 +37,7 @@ function parseAndAssertSame(code) {
range: true, range: true,
comment: true, comment: true,
attachComment: true, attachComment: true,
ecmaVersion: 8, ecmaVersion: 2018,
sourceType: "module", sourceType: "module",
}); });
var babylonAST = babelEslint.parseForESLint(code, { var babylonAST = babelEslint.parseForESLint(code, {
@ -71,7 +71,7 @@ function parseAndAssertSame(code) {
// assert.equal(esAST, babylonAST); // assert.equal(esAST, babylonAST);
} }
describe("babylon-to-esprima", () => { describe("babylon-to-espree", () => {
describe("compatibility", () => { describe("compatibility", () => {
it("should allow ast.analyze to be called without options", function() { it("should allow ast.analyze to be called without options", function() {
var esAST = babelEslint.parseForESLint("`test`", { var esAST = babelEslint.parseForESLint("`test`", {

View File

@ -19,7 +19,7 @@ function verifyAndAssertMessagesWithSpecificESLint(
es6: true, es6: true,
}, },
parserOptions: { parserOptions: {
ecmaVersion: 8, ecmaVersion: 2018,
ecmaFeatures: { ecmaFeatures: {
jsx: true, jsx: true,
experimentalObjectRestSpread: true, experimentalObjectRestSpread: true,

View File

@ -65,10 +65,6 @@ acorn@^3.0.4:
version "3.3.0" version "3.3.0"
resolved "https://registry.yarnpkg.com/acorn/-/acorn-3.3.0.tgz#45e37fb39e8da3f25baee3ff5369e2bb5f22017a" resolved "https://registry.yarnpkg.com/acorn/-/acorn-3.3.0.tgz#45e37fb39e8da3f25baee3ff5369e2bb5f22017a"
acorn@^5.0.1:
version "5.0.3"
resolved "https://registry.yarnpkg.com/acorn/-/acorn-5.0.3.tgz#c460df08491463f028ccb82eab3730bf01087b3d"
acorn@^5.2.1: acorn@^5.2.1:
version "5.2.1" version "5.2.1"
resolved "https://registry.yarnpkg.com/acorn/-/acorn-5.2.1.tgz#317ac7821826c22c702d66189ab8359675f135d7" resolved "https://registry.yarnpkg.com/acorn/-/acorn-5.2.1.tgz#317ac7821826c22c702d66189ab8359675f135d7"
@ -599,13 +595,6 @@ eslint@^4.14.0:
table "^4.0.1" table "^4.0.1"
text-table "~0.2.0" text-table "~0.2.0"
espree@^3.4.0:
version "3.4.3"
resolved "https://registry.yarnpkg.com/espree/-/espree-3.4.3.tgz#2910b5ccd49ce893c2ffffaab4fd8b3a31b82374"
dependencies:
acorn "^5.0.1"
acorn-jsx "^3.0.0"
espree@^3.5.2: espree@^3.5.2:
version "3.5.2" version "3.5.2"
resolved "https://registry.yarnpkg.com/espree/-/espree-3.5.2.tgz#756ada8b979e9dcfcdb30aad8d1a9304a905e1ca" resolved "https://registry.yarnpkg.com/espree/-/espree-3.5.2.tgz#756ada8b979e9dcfcdb30aad8d1a9304a905e1ca"