Comparing version 1.5.0 to 1.6.0
@@ -285,5 +285,10 @@ /** | ||
* @param {ASTNode} body The function body | ||
* @param {ASTNode} rest The node representing a rest argument. | ||
* @param {boolean} generator True if the function is a generator, false if not. | ||
* @param {boolean} expression True if the function is created via an expression. | ||
* Always false for declarations, but kept here to be in sync with | ||
* FunctionExpression objects. | ||
* @returns {ASTNode} An ASTNode representing a function declaration | ||
*/ | ||
createFunctionDeclaration: function (id, params, defaults, body) { | ||
createFunctionDeclaration: function (id, params, defaults, body, rest, generator, expression) { | ||
return { | ||
@@ -293,7 +298,7 @@ type: astNodeTypes.FunctionDeclaration, | ||
params: params, | ||
defaults: defaults, | ||
defaults: defaults || [], | ||
body: body, | ||
rest: null, | ||
generator: false, | ||
expression: false | ||
rest: rest || null, | ||
generator: !!generator, | ||
expression: !!expression | ||
}; | ||
@@ -308,5 +313,8 @@ }, | ||
* @param {ASTNode} body The function body | ||
* @returns {ASTNode} An ASTNode representing a function expression | ||
* @param {ASTNode} rest The node representing a rest argument. | ||
* @param {boolean} generator True if the function is a generator, false if not. | ||
* @param {boolean} expression True if the function is created via an expression. | ||
* @returns {ASTNode} An ASTNode representing a function declaration | ||
*/ | ||
createFunctionExpression: function (id, params, defaults, body) { | ||
createFunctionExpression: function (id, params, defaults, body, rest, generator, expression) { | ||
return { | ||
@@ -316,7 +324,7 @@ type: astNodeTypes.FunctionExpression, | ||
params: params, | ||
defaults: defaults, | ||
defaults: defaults || [], | ||
body: body, | ||
rest: null, | ||
generator: false, | ||
expression: false | ||
rest: rest || null, | ||
generator: !!generator, | ||
expression: !!expression | ||
}; | ||
@@ -637,2 +645,10 @@ }, | ||
createYieldExpression: function (argument, delegate) { | ||
return { | ||
type: astNodeTypes.YieldExpression, | ||
argument: argument, | ||
delegate: delegate | ||
}; | ||
}, | ||
createJSXAttribute: function (name, value) { | ||
@@ -639,0 +655,0 @@ return { |
@@ -82,2 +82,3 @@ /** | ||
WithStatement: "WithStatement", | ||
YieldExpression: "YieldExpression", | ||
JSXIdentifier: "JSXIdentifier", | ||
@@ -84,0 +85,0 @@ JSXNamespacedName: "JSXNamespacedName", |
@@ -69,4 +69,10 @@ /** | ||
// Allow duplicate object literal properties (except '__proto__') | ||
objectLiteralDuplicateProperties: false, | ||
// enable parsing of generators/yield | ||
generators: false, | ||
// React JSX parsing | ||
jsx: false | ||
}; |
@@ -61,2 +61,3 @@ /** | ||
IllegalReturn: "Illegal return statement", | ||
IllegalYield: "Illegal yield expression", | ||
StrictModeWith: "Strict mode code may not include a with statement", | ||
@@ -71,2 +72,3 @@ StrictCatchVariable: "Catch variable may not be eval or arguments in strict mode", | ||
StrictDuplicateProperty: "Duplicate data property in object literal not allowed in strict mode", | ||
DuplicatePrototypeProperty: "Duplicate '__proto__' property in object literal are not allowed", | ||
AccessorDataProperty: "Object literal may not have data and accessor property with the same name", | ||
@@ -73,0 +75,0 @@ AccessorGetSet: "Object literal may not have multiple get/set accessors with the same name", |
@@ -139,3 +139,4 @@ /** | ||
isKeyword: function(id, strict) { | ||
isKeyword: function(id, strict, ecmaFeatures) { | ||
if (strict && this.isStrictModeReservedWord(id)) { | ||
@@ -160,3 +161,3 @@ return true; | ||
return (id === "while") || (id === "break") || (id === "catch") || | ||
(id === "throw") || (id === "const") || (id === "yield") || | ||
(id === "throw") || (id === "const") || (!ecmaFeatures.generators && id === "yield") || | ||
(id === "class") || (id === "super"); | ||
@@ -163,0 +164,0 @@ case 6: |
@@ -11,3 +11,3 @@ { | ||
}, | ||
"version": "1.5.0", | ||
"version": "1.6.0", | ||
"files": [ | ||
@@ -14,0 +14,0 @@ "bin", |
@@ -78,15 +78,21 @@ # Espree | ||
// enable parsing of for-of statement | ||
forOf: false, | ||
forOf: true, | ||
// enable parsing computed object literal properties | ||
objectLiteralComputedProperties: false, | ||
objectLiteralComputedProperties: true, | ||
// enable parsing of shorthand object literal methods | ||
objectLiteralShorthandMethods: false, | ||
objectLiteralShorthandMethods: true, | ||
// enable parsing of shorthand object literal properties | ||
objectLiteralShorthandProperties: false, | ||
objectLiteralShorthandProperties: true, | ||
// Allow duplicate object literal properties (except '__proto__') | ||
objectLiteralDuplicateProperties: true, | ||
// enable parsing of generators/yield | ||
generators: true, | ||
// React JSX parsing | ||
jsx: false | ||
jsx: true | ||
} | ||
@@ -174,1 +180,14 @@ }); | ||
Please see the [tracking issue](https://github.com/eslint/espree/issues/10) for the most up-to-date information. | ||
### Why use Espree instead of Esprima? | ||
* Faster turnaround time on bug fixes | ||
* More frequent releases | ||
* Better communication and responsiveness to issues | ||
* Ongoing development | ||
### Why use Espree instead of Esprima-FB? | ||
* Opt-in to just the ECMAScript 6 features you want | ||
* JSX support is off by default, so you're not forced to use it to use ECMAScript 6 | ||
* Stricter ECMAScript 6 support |
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
253807
6372
192