Merge pull request babel/babel-eslint#215 from zertosh/master
babylon/espree option alignment
This commit is contained in:
parent
c435628b6a
commit
204ba86418
@ -370,12 +370,11 @@ exports.parse = function (code) {
|
|||||||
|
|
||||||
exports.parseNoPatch = function (code) {
|
exports.parseNoPatch = function (code) {
|
||||||
var opts = {
|
var opts = {
|
||||||
locations: true,
|
|
||||||
ranges: true,
|
|
||||||
sourceType: "module",
|
sourceType: "module",
|
||||||
strictMode: true,
|
strictMode: true,
|
||||||
allowHashBang: true,
|
allowImportExportEverywhere: false, // consistent with espree
|
||||||
ecmaVersion: Infinity,
|
allowReturnOutsideFunction: true,
|
||||||
|
allowSuperOutsideMethod: true,
|
||||||
plugins: [
|
plugins: [
|
||||||
"flow",
|
"flow",
|
||||||
"jsx",
|
"jsx",
|
||||||
@ -391,7 +390,7 @@ exports.parseNoPatch = function (code) {
|
|||||||
"objectRestSpread",
|
"objectRestSpread",
|
||||||
"trailingFunctionCommas"
|
"trailingFunctionCommas"
|
||||||
]
|
]
|
||||||
};
|
};
|
||||||
|
|
||||||
var ast;
|
var ast;
|
||||||
try {
|
try {
|
||||||
|
|||||||
@ -388,4 +388,18 @@ describe("acorn-to-esprima", function () {
|
|||||||
"}"
|
"}"
|
||||||
].join("\n"));
|
].join("\n"));
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it("do not allow import export everywhere", function() {
|
||||||
|
assert.throws(function () {
|
||||||
|
parseAndAssertSame("function F() { import a from \"a\"; }");
|
||||||
|
}, /Illegal import declaration/)
|
||||||
|
});
|
||||||
|
|
||||||
|
it("return outside function", function () {
|
||||||
|
parseAndAssertSame("return;");
|
||||||
|
});
|
||||||
|
|
||||||
|
it("super outside method", function () {
|
||||||
|
parseAndAssertSame("function F() { super(); }");
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user