diff --git a/lib/jsdoc/src/astnode.js b/lib/jsdoc/src/astnode.js index 2d526bd6..ae688b6e 100644 --- a/lib/jsdoc/src/astnode.js +++ b/lib/jsdoc/src/astnode.js @@ -128,6 +128,9 @@ var nodeToValue = exports.nodeToValue = function(node) { break; case Syntax.AssignmentExpression: + // falls through + + case Syntax.AssignmentPattern: str = nodeToValue(node.left); break; @@ -218,6 +221,10 @@ var nodeToValue = exports.nodeToValue = function(node) { str = JSON.stringify(tempObject); break; + case Syntax.RestElement: + str = nodeToValue(node.argument); + break; + case Syntax.ThisExpression: str = 'this'; break; @@ -255,14 +262,11 @@ exports.nodeToString = nodeToValue; var getParamNames = exports.getParamNames = function(node) { var params; - if ( !node || (!node.params && !node.rest) ) { + if (!node || !node.params) { return []; } params = node.params.slice(0); - if (node.rest) { - params.push(node.rest); - } return params.map(function(param) { return nodeToValue(param); diff --git a/lib/jsdoc/src/syntax.js b/lib/jsdoc/src/syntax.js index 1f2d7ac0..2b466c4f 100644 --- a/lib/jsdoc/src/syntax.js +++ b/lib/jsdoc/src/syntax.js @@ -49,9 +49,11 @@ exports.Syntax = { ObjectPattern: 'ObjectPattern', Program: 'Program', Property: 'Property', + RestElement: 'RestElement', ReturnStatement: 'ReturnStatement', SequenceExpression: 'SequenceExpression', SpreadElement: 'SpreadElement', + Super: 'Super', SwitchCase: 'SwitchCase', SwitchStatement: 'SwitchStatement', TaggedTemplateExpression: 'TaggedTemplateExpression', diff --git a/lib/jsdoc/src/visitor.js b/lib/jsdoc/src/visitor.js index 82650662..60a30b91 100644 --- a/lib/jsdoc/src/visitor.js +++ b/lib/jsdoc/src/visitor.js @@ -117,9 +117,30 @@ function makeInlineParamsFinisher(parser) { } /** - * For rest parameters, create a function that will automatically update the rest parameter's - * documentation to indicate that the parameter is repeatable. If the parameter is not documented, - * the function's doclet will remain unchanged. + * Given an array of nodes that represent function parameters, find the node for the rest parameter, + * if any. + * + * @private + * @param {Array.} params - An array of nodes that represent function parameters. + * @return {Object?} The node for the rest parameter. + */ +function findRestParam(params) { + var restParam = null; + + params.some(function(param) { + if (param.type === Syntax.RestElement) { + restParam = param; + return true; + } + }); + + return restParam; +} + +/** + * For functions that may include a rest parameter, create a function that will automatically update + * the rest parameter's documentation to indicate that the parameter is repeatable. If the parameter + * is not documented, the function's doclet will remain unchanged. * * @private * @param {module:jsdoc/src/parser.Parser} parser - The JSDoc parser. @@ -137,20 +158,46 @@ function makeRestParamFinisher(parser) { } documentedParams = doclet.params = doclet.params || []; - restNode = e.code.node.rest; - for (var i = documentedParams.length - 1; i >= 0; i--) { - if (documentedParams[i].name === restNode.name) { - documentedParams[i].variable = true; - break; + restNode = findRestParam(e.code.node.params); + + if (restNode) { + for (var i = documentedParams.length - 1; i >= 0; i--) { + if (documentedParams[i].name === restNode.argument.name) { + documentedParams[i].variable = true; + break; + } } } }; } /** - * For functions that have at least one parameter with default values, create a function that will - * automatically add the parameters' default values to the function's documentation. If any default - * value is already documented, the function's doclet will remain unchanged. + * Given an array of nodes that represent function parameters, find the nodes for the default + * parameters, if any. + * + * @private + * @param {Array.} params - An array of nodes that represent function parameters. + * @return {Array.} The nodes for the default parameters. + */ +function findDefaultParams(params) { + var defaultParams = []; + + params.forEach(function(param) { + if (param.type === Syntax.AssignmentPattern) { + defaultParams.push(param); + } + else { + defaultParams.push(null); + } + }); + + return defaultParams; +} + +/** + * For functions that may have at least one parameter with default values, create a function that + * will automatically add the parameters' default values to the function's documentation. If any + * default value is already documented, the function's doclet will remain unchanged. * * This function is only intended to handle default parameters whose node type is `Syntax.Literal` * (string, numeric, and boolean literals). This is because more complex default values may include, @@ -167,15 +214,16 @@ function makeDefaultParamFinisher(parser) { var defaultValues; var doclet = e.doclet; var documentedParams; + var paramName; var params; if (!doclet) { return; } - defaultValues = e.code.node.defaults; documentedParams = doclet.params = doclet.params || []; params = e.code.node.params; + defaultValues = findDefaultParams(e.code.node.params); for (var i = 0, j = 0, l = params.length; i < l; i++) { // bail out if we ran out of documented params @@ -184,16 +232,22 @@ function makeDefaultParamFinisher(parser) { } // if the current parameter doesn't appear to be documented, move to the next one - if (params[i].name !== documentedParams[j].name) { + paramName = params[i].type === Syntax.AssignmentPattern ? + params[i].left.name : + params[i].name; + if (paramName !== documentedParams[j].name) { continue; } // add the default value iff a) a literal default value is defined in the code, // b) no default value is documented, and c) the default value is not an empty string - if (defaultValues[i] && defaultValues[i].type === Syntax.Literal && + if (defaultValues[i] && + defaultValues[i].right && + defaultValues[i].right.type === Syntax.Literal && typeof documentedParams[j].defaultvalue === 'undefined' && - defaultValues[i].value !== '') { - documentedParams[j].defaultvalue = jsdoc.src.astnode.nodeToValue(defaultValues[i]); + defaultValues[i].right.value !== '') { + documentedParams[j].defaultvalue = + jsdoc.src.astnode.nodeToValue(defaultValues[i].right); } // move to the next documented param @@ -502,13 +556,10 @@ Visitor.prototype.makeSymbolFoundEvent = function(node, parser, filename) { extras.finishers = []; // handle cases where at least one parameter has a default value - if (node.defaults && node.defaults.length) { - extras.finishers.push( makeDefaultParamFinisher(parser) ); - } + extras.finishers.push( makeDefaultParamFinisher(parser) ); + // handle rest parameters - if (node.rest) { - extras.finishers.push( makeRestParamFinisher(parser) ); - } + extras.finishers.push( makeRestParamFinisher(parser) ); e = new SymbolFound(node, filename, extras); diff --git a/lib/jsdoc/src/walker.js b/lib/jsdoc/src/walker.js index 2f5e374c..030b8098 100644 --- a/lib/jsdoc/src/walker.js +++ b/lib/jsdoc/src/walker.js @@ -75,17 +75,7 @@ walkers[Syntax.ArrowFunctionExpression] = function(node, parent, state, cb) { cb(node.params[i], node, state); } - for (i = 0, l = node.defaults.length; i < l; i++) { - if (node.defaults[i]) { - cb(node.defaults[i], node, state); - } - } - cb(node.body, node, state); - - if (node.rest) { - cb(node.rest, node, state); - } }; walkers[Syntax.AssignmentExpression] = function(node, parent, state, cb) { @@ -350,6 +340,12 @@ walkers[Syntax.Property] = function(node, parent, state, cb) { cb(node.value, node, state); }; +walkers[Syntax.RestElement] = function(node, parent, state, cb) { + if (node.argument) { + cb(node.argument, node, state); + } +}; + walkers[Syntax.ReturnStatement] = function(node, parent, state, cb) { if (node.argument) { cb(node.argument, node, state); @@ -368,6 +364,8 @@ walkers[Syntax.SpreadElement] = function(node, parent, state, cb) { } }; +walkers[Syntax.Super] = leafNode; + walkers[Syntax.SwitchCase] = function(node, parent, state, cb) { if (node.test) { cb(node.test, node, state); @@ -426,20 +424,10 @@ walkers[Syntax.TryStatement] = function(node, parent, state, cb) { cb(node.block, node, state); - // handle Esprima ASTs, which deviate from the spec a bit - if ( node.handlers && Array.isArray(node.handlers) && node.handlers[0] ) { - cb(node.handlers[0].body, node, state); - } - else if (node.handler) { + if (node.handler) { cb(node.handler.body, node, state); } - if (node.guardedHandlers) { - for (i = 0, l = node.guardedHandlers.length; i < l; i++) { - cb(node.guardedHandlers[i].body, node, state); - } - } - if (node.finalizer) { cb(node.finalizer, node, state); } diff --git a/node_modules/espree/espree.js b/node_modules/espree/espree.js index 44c222f7..86f9436e 100644 --- a/node_modules/espree/espree.js +++ b/node_modules/espree/espree.js @@ -2277,9 +2277,7 @@ function parsePropertyFunction(paramInfo, options) { return markerApply(options.marker, astNodeFactory.createFunctionExpression( null, paramInfo.params, - paramInfo.defaults, body, - paramInfo.rest, generator, body.type !== astNodeTypes.BlockStatement )); @@ -2388,11 +2386,9 @@ function tryParseMethodDefinition(token, key, computed, marker) { value = parsePropertyFunction({ params: [], - defaults: [], stricted: null, firstRestricted: null, - message: null, - rest: null + message: null }, { marker: methodMarker }); @@ -2408,19 +2404,14 @@ function tryParseMethodDefinition(token, key, computed, marker) { options = { params: [], defaultCount: 0, - defaults: [], stricted: null, firstRestricted: null, - paramSet: new StringMap(), - rest: null + paramSet: new StringMap() }; if (match(")")) { throwErrorTolerant(lookahead, Messages.UnexpectedToken, lookahead.value); } else { parseParam(options); - if (options.defaultCount === 0) { - options.defaults = []; - } } expect(")"); @@ -2521,20 +2512,15 @@ function parseObjectProperty() { options = { params: [], defaultCount: 0, - defaults: [], stricted: null, firstRestricted: null, - paramSet: new StringMap(), - rest: null + paramSet: new StringMap() }; if (match(")")) { throwErrorTolerant(lookahead, Messages.UnexpectedToken, lookahead.value); } else { parseParam(options); - if (options.defaultCount === 0) { - options.defaults = []; - } } expect(")"); @@ -2866,7 +2852,7 @@ function parsePrimaryExpression() { if (allowSuper && matchKeyword("super") && state.inFunctionBody) { marker = markerCreate(); lex(); - return markerApply(marker, astNodeFactory.createIdentifier("super")); + return markerApply(marker, astNodeFactory.createSuper()); } if (matchKeyword("this")) { @@ -2910,7 +2896,6 @@ function parseArguments() { var args = [], arg; expect("("); - if (!match(")")) { while (index < length) { arg = parseSpreadOrAssignmentExpression(); @@ -3276,12 +3261,10 @@ function parseConciseBody() { } function reinterpretAsCoverFormalsList(expressions) { - var i, len, param, params, defaults, defaultCount, options, rest; + var i, len, param, params, options, + allowRestParams = extra.ecmaFeatures.restParams; params = []; - defaults = []; - defaultCount = 0; - rest = null; options = { paramSet: new StringMap() }; @@ -3290,23 +3273,34 @@ function reinterpretAsCoverFormalsList(expressions) { param = expressions[i]; if (param.type === astNodeTypes.Identifier) { params.push(param); - defaults.push(null); validateParam(options, param, param.name); } else if (param.type === astNodeTypes.ObjectExpression || param.type === astNodeTypes.ArrayExpression) { reinterpretAsDestructuredParameter(options, param); params.push(param); - defaults.push(null); } else if (param.type === astNodeTypes.SpreadElement) { assert(i === len - 1, "It is guaranteed that SpreadElement is last element by parseExpression"); if (param.argument.type !== astNodeTypes.Identifier) { - throwError({}, Messages.InvalidLHSInFormalsList); + throwError({}, Messages.UnexpectedToken, "["); } + + if (!allowRestParams) { + // can't get correct line/column here :( + throwError({}, Messages.UnexpectedToken, "."); + } + reinterpretAsDestructuredParameter(options, param.argument); - rest = param.argument; + param.type = astNodeTypes.RestElement; + params.push(param); + } else if (param.type === astNodeTypes.RestElement) { + params.push(param); + validateParam(options, param.argument, param.argument.name); } else if (param.type === astNodeTypes.AssignmentExpression) { - params.push(param.left); - defaults.push(param.right); - ++defaultCount; + + // TODO: Find a less hacky way of doing this + param.type = astNodeTypes.AssignmentPattern; + delete param.operator; + + params.push(param); validateParam(options, param.left, param.left.name); } else { return null; @@ -3320,15 +3314,8 @@ function reinterpretAsCoverFormalsList(expressions) { ); } - // must be here so it's not an array of [null, null] - if (defaultCount === 0) { - defaults = []; - } - return { params: params, - defaults: defaults, - rest: rest, stricted: options.stricted, firstRestricted: options.firstRestricted, message: options.message @@ -3353,9 +3340,7 @@ function parseArrowFunctionExpression(options, marker) { strict = previousStrict; return markerApply(marker, astNodeFactory.createArrowFunctionExpression( options.params, - options.defaults, body, - options.rest, body.type !== astNodeTypes.BlockStatement )); } @@ -3696,6 +3681,30 @@ function parseConstLetDeclaration(kind) { return markerApply(marker, astNodeFactory.createVariableDeclaration(declarations, kind)); } + +function parseRestElement() { + var param, + marker = markerCreate(); + + lex(); + + if (match("{")) { + throwError(lookahead, Messages.ObjectPatternAsRestParameter); + } + + param = parseVariableIdentifier(); + + if (match("=")) { + throwError(lookahead, Messages.DefaultRestParameter); + } + + if (!match(")")) { + throwError(lookahead, Messages.ParameterAfterRestParameter); + } + + return markerApply(marker, astNodeFactory.createRestElement(param)); +} + // 12.3 Empty Statement function parseEmptyStatement() { @@ -4059,6 +4068,9 @@ function parseSwitchCase() { break; } statement = parseSourceElement(); + if (typeof statement === "undefined") { + break; + } consequent.push(statement); } @@ -4402,19 +4414,21 @@ function validateParam(options, param, name) { } function parseParam(options) { - var token, rest, param, def, + var token, param, def, allowRestParams = extra.ecmaFeatures.restParams, allowDestructuring = extra.ecmaFeatures.destructuring, - allowDefaultParams = extra.ecmaFeatures.defaultParams; - + allowDefaultParams = extra.ecmaFeatures.defaultParams, + marker = markerCreate(); token = lookahead; if (token.value === "...") { if (!allowRestParams) { throwUnexpected(lookahead); } - token = lex(); - rest = true; + param = parseRestElement(); + validateParam(options, param.argument, param.argument.name); + options.params.push(param); + return false; } if (match("[")) { @@ -4424,9 +4438,6 @@ function parseParam(options) { param = parseArrayInitialiser(); reinterpretAsDestructuredParameter(options, param); } else if (match("{")) { - if (rest) { - throwError({}, Messages.ObjectPatternAsRestParameter); - } if (!allowDestructuring) { throwUnexpected(lookahead); } @@ -4438,9 +4449,6 @@ function parseParam(options) { } if (match("=")) { - if (rest) { - throwErrorTolerant(lookahead, Messages.DefaultRestParameter); - } if (allowDefaultParams || allowDestructuring) { lex(); def = parseAssignmentExpression(); @@ -4450,17 +4458,18 @@ function parseParam(options) { } } - if (rest) { - if (!match(")")) { - throwError({}, Messages.ParameterAfterRestParameter); - } - options.rest = param; - return false; + if (def) { + options.params.push(markerApply( + marker, + astNodeFactory.createAssignmentPattern( + param, + def + ) + )); + } else { + options.params.push(param); } - options.params.push(param); - options.defaults.push(def ? def : null); // TODO: determine if null or undefined (see: #55) - return !match(")"); } @@ -4471,8 +4480,6 @@ function parseParams(firstRestricted) { options = { params: [], defaultCount: 0, - defaults: [], - rest: null, firstRestricted: firstRestricted }; @@ -4490,14 +4497,8 @@ function parseParams(firstRestricted) { expect(")"); - if (options.defaultCount === 0) { - options.defaults = []; - } - return { params: options.params, - defaults: options.defaults, - rest: options.rest, stricted: options.stricted, firstRestricted: options.firstRestricted, message: options.message @@ -4564,9 +4565,7 @@ function parseFunctionDeclaration(identifierIsOptional) { astNodeFactory.createFunctionDeclaration( id, tmp.params, - tmp.defaults, body, - tmp.rest, generator, false ) @@ -4631,9 +4630,7 @@ function parseFunctionExpression() { astNodeFactory.createFunctionExpression( id, tmp.params, - tmp.defaults, body, - tmp.rest, generator, false ) @@ -4656,7 +4653,15 @@ function parseYieldExpression() { delegateFlag = true; } - expr = parseAssignmentExpression(); + if (peekLineTerminator()) { + return markerApply(marker, astNodeFactory.createYieldExpression(null, delegateFlag)); + } + + if (!match(";") && !match(")")) { + if (!match("}") && lookahead.type !== Token.EOF) { + expr = parseAssignmentExpression(); + } + } return markerApply(marker, astNodeFactory.createYieldExpression(expr, delegateFlag)); } @@ -5006,7 +5011,8 @@ function parseClassBody() { } if (!isStatic) { - if (!method.computed && (method.key.name || method.key.value.toString()) === "constructor") { + + if (!method.computed && (method.key.name || (method.key.value && method.key.value.toString())) === "constructor") { if (method.kind !== "method" || !method.method || method.value.generator) { throwUnexpected(token, Messages.ConstructorSpecialMethod); } diff --git a/node_modules/espree/lib/ast-node-factory.js b/node_modules/espree/lib/ast-node-factory.js index 11594a30..56bdbcad 100644 --- a/node_modules/espree/lib/ast-node-factory.js +++ b/node_modules/espree/lib/ast-node-factory.js @@ -44,7 +44,7 @@ module.exports = { * @param {ASTNode[]} elements An array of ASTNode elements * @returns {ASTNode} An ASTNode representing the entire array expression */ - createArrayExpression: function (elements) { + createArrayExpression: function(elements) { return { type: astNodeTypes.ArrayExpression, elements: elements @@ -54,22 +54,18 @@ module.exports = { /** * Create an Arrow Function Expression ASTNode * @param {ASTNode} params The function arguments - * @param {ASTNode} defaults Any default arguments * @param {ASTNode} body The function body - * @param {ASTNode} rest The rest parameter * @param {boolean} expression True if the arrow 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 the entire arrow function expression */ - createArrowFunctionExpression: function (params, defaults, body, rest, expression) { + createArrowFunctionExpression: function (params, body, expression) { return { type: astNodeTypes.ArrowFunctionExpression, id: null, params: params, - defaults: defaults, body: body, - rest: rest, generator: false, expression: expression }; @@ -82,7 +78,7 @@ module.exports = { * @param {ASTNode} right The right operand * @returns {ASTNode} An ASTNode representing the entire assignment expression */ - createAssignmentExpression: function (operator, left, right) { + createAssignmentExpression: function(operator, left, right) { return { type: astNodeTypes.AssignmentExpression, operator: operator, @@ -91,6 +87,20 @@ module.exports = { }; }, + /** + * Create an ASTNode representation of an assignment pattern (default parameters) + * @param {ASTNode} left The left operand + * @param {ASTNode} right The right operand + * @returns {ASTNode} An ASTNode representing the entire assignment pattern + */ + createAssignmentPattern: function(left, right) { + return { + type: astNodeTypes.AssignmentPattern, + left: left, + right: right + }; + }, + /** * Create an ASTNode representation of a binary expression * @param {ASTNode} operator The assignment operator @@ -98,7 +108,7 @@ module.exports = { * @param {ASTNode} right The right operand * @returns {ASTNode} An ASTNode representing the entire binary expression */ - createBinaryExpression: function (operator, left, right) { + createBinaryExpression: function(operator, left, right) { var type = (operator === "||" || operator === "&&") ? astNodeTypes.LogicalExpression : astNodeTypes.BinaryExpression; return { @@ -114,7 +124,7 @@ module.exports = { * @param {ASTNode} body The block statement body * @returns {ASTNode} An ASTNode representing the entire block statement */ - createBlockStatement: function (body) { + createBlockStatement: function(body) { return { type: astNodeTypes.BlockStatement, body: body @@ -126,7 +136,7 @@ module.exports = { * @param {ASTNode} label The break statement label * @returns {ASTNode} An ASTNode representing the break statement */ - createBreakStatement: function (label) { + createBreakStatement: function(label) { return { type: astNodeTypes.BreakStatement, label: label @@ -139,7 +149,7 @@ module.exports = { * @param {ASTNode[]} args An array of ASTNodes representing the function call arguments * @returns {ASTNode} An ASTNode representing the entire call expression */ - createCallExpression: function (callee, args) { + createCallExpression: function(callee, args) { return { type: astNodeTypes.CallExpression, callee: callee, @@ -153,7 +163,7 @@ module.exports = { * @param {ASTNode} body The catch block body * @returns {ASTNode} An ASTNode representing the entire catch clause */ - createCatchClause: function (param, body) { + createCatchClause: function(param, body) { return { type: astNodeTypes.CatchClause, param: param, @@ -166,14 +176,14 @@ module.exports = { * @param {ASTNode} body The node representing the body of the class. * @returns {ASTNode} An ASTNode representing the class body. */ - createClassBody: function (body) { + createClassBody: function(body) { return { type: astNodeTypes.ClassBody, body: body }; }, - createClassExpression: function (id, superClass, body) { + createClassExpression: function(id, superClass, body) { return { type: astNodeTypes.ClassExpression, id: id, @@ -182,7 +192,7 @@ module.exports = { }; }, - createClassDeclaration: function (id, superClass, body) { + createClassDeclaration: function(id, superClass, body) { return { type: astNodeTypes.ClassDeclaration, id: id, @@ -191,7 +201,7 @@ module.exports = { }; }, - createMethodDefinition: function (propertyType, kind, key, value, computed) { + createMethodDefinition: function(propertyType, kind, key, value, computed) { return { type: astNodeTypes.MethodDefinition, key: key, @@ -209,7 +219,7 @@ module.exports = { * @param {ASTNode} alternate The code to be run if the test returns false * @returns {ASTNode} An ASTNode representing the entire conditional expression */ - createConditionalExpression: function (test, consequent, alternate) { + createConditionalExpression: function(test, consequent, alternate) { return { type: astNodeTypes.ConditionalExpression, test: test, @@ -223,7 +233,7 @@ module.exports = { * @param {?ASTNode} label The optional continue label (null if not set) * @returns {ASTNode} An ASTNode representing the continue statement */ - createContinueStatement: function (label) { + createContinueStatement: function(label) { return { type: astNodeTypes.ContinueStatement, label: label @@ -234,7 +244,7 @@ module.exports = { * Create an ASTNode representation of a debugger statement * @returns {ASTNode} An ASTNode representing the debugger statement */ - createDebuggerStatement: function () { + createDebuggerStatement: function() { return { type: astNodeTypes.DebuggerStatement }; @@ -244,7 +254,7 @@ module.exports = { * Create an ASTNode representation of an empty statement * @returns {ASTNode} An ASTNode representing an empty statement */ - createEmptyStatement: function () { + createEmptyStatement: function() { return { type: astNodeTypes.EmptyStatement }; @@ -255,7 +265,7 @@ module.exports = { * @param {ASTNode} expression The expression * @returns {ASTNode} An ASTNode representing an expression statement */ - createExpressionStatement: function (expression) { + createExpressionStatement: function(expression) { return { type: astNodeTypes.ExpressionStatement, expression: expression @@ -268,7 +278,7 @@ module.exports = { * @param {ASTNode} body The while loop body * @returns {ASTNode} An ASTNode representing a while statement */ - createWhileStatement: function (test, body) { + createWhileStatement: function(test, body) { return { type: astNodeTypes.WhileStatement, test: test, @@ -282,7 +292,7 @@ module.exports = { * @param {ASTNode} body The do..while loop body * @returns {ASTNode} An ASTNode representing a do..while statement */ - createDoWhileStatement: function (test, body) { + createDoWhileStatement: function(test, body) { return { type: astNodeTypes.DoWhileStatement, body: body, @@ -298,7 +308,7 @@ module.exports = { * @param {ASTNode} body The statement body * @returns {ASTNode} An ASTNode representing a for statement */ - createForStatement: function (init, test, update, body) { + createForStatement: function(init, test, update, body) { return { type: astNodeTypes.ForStatement, init: init, @@ -315,7 +325,7 @@ module.exports = { * @param {ASTNode} body The statement body * @returns {ASTNode} An ASTNode representing a for..in statement */ - createForInStatement: function (left, right, body) { + createForInStatement: function(left, right, body) { return { type: astNodeTypes.ForInStatement, left: left, @@ -332,7 +342,7 @@ module.exports = { * @param {ASTNode} body The statement body * @returns {ASTNode} An ASTNode representing a for..of statement */ - createForOfStatement: function (left, right, body) { + createForOfStatement: function(left, right, body) { return { type: astNodeTypes.ForOfStatement, left: left, @@ -345,23 +355,19 @@ module.exports = { * Create an ASTNode representation of a function declaration * @param {ASTNode} id The function name * @param {ASTNode} params The function arguments - * @param {ASTNode} defaults Any default arguments (ES6-only feature) * @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, rest, generator, expression) { + createFunctionDeclaration: function (id, params, body, generator, expression) { return { type: astNodeTypes.FunctionDeclaration, id: id, params: params || [], - defaults: defaults || [], body: body, - rest: rest || null, generator: !!generator, expression: !!expression }; @@ -371,21 +377,17 @@ module.exports = { * Create an ASTNode representation of a function expression * @param {ASTNode} id The function name * @param {ASTNode} params The function arguments - * @param {ASTNode} defaults Any default arguments (ES6-only feature) * @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. * @returns {ASTNode} An ASTNode representing a function declaration */ - createFunctionExpression: function (id, params, defaults, body, rest, generator, expression) { + createFunctionExpression: function (id, params, body, generator, expression) { return { type: astNodeTypes.FunctionExpression, id: id, params: params || [], - defaults: defaults || [], body: body, - rest: rest || null, generator: !!generator, expression: !!expression }; @@ -396,7 +398,7 @@ module.exports = { * @param {ASTNode} name The identifier name * @returns {ASTNode} An ASTNode representing an identifier */ - createIdentifier: function (name) { + createIdentifier: function(name) { return { type: astNodeTypes.Identifier, name: name @@ -410,7 +412,7 @@ module.exports = { * @param {ASTNode} alternate the "else" alternate statement * @returns {ASTNode} An ASTNode representing an if statement */ - createIfStatement: function (test, consequent, alternate) { + createIfStatement: function(test, consequent, alternate) { return { type: astNodeTypes.IfStatement, test: test, @@ -425,7 +427,7 @@ module.exports = { * @param {ASTNode} body The labeled statement body * @returns {ASTNode} An ASTNode representing a labeled statement */ - createLabeledStatement: function (label, body) { + createLabeledStatement: function(label, body) { return { type: astNodeTypes.LabeledStatement, label: label, @@ -439,7 +441,7 @@ module.exports = { * @param {string} source The source code to get the literal from * @returns {ASTNode} An ASTNode representing the new literal */ - createLiteralFromSource: function (token, source) { + createLiteralFromSource: function(token, source) { var node = { type: astNodeTypes.Literal, value: token.value, @@ -462,7 +464,7 @@ module.exports = { * @param {boolean} tail True if this is the final element in a template string * @returns {ASTNode} An ASTNode representing the template string element */ - createTemplateElement: function (value, tail) { + createTemplateElement: function(value, tail) { return { type: astNodeTypes.TemplateElement, value: value, @@ -476,7 +478,7 @@ module.exports = { * @param {ASTNode[]} expressions An array of the template string expressions * @returns {ASTNode} An ASTNode representing the template string */ - createTemplateLiteral: function (quasis, expressions) { + createTemplateLiteral: function(quasis, expressions) { return { type: astNodeTypes.TemplateLiteral, quasis: quasis, @@ -489,7 +491,7 @@ module.exports = { * @param {ASTNode} argument The array being spread * @returns {ASTNode} An ASTNode representing a spread element */ - createSpreadElement: function (argument) { + createSpreadElement: function(argument) { return { type: astNodeTypes.SpreadElement, argument: argument @@ -503,7 +505,7 @@ module.exports = { * the template string itself. * @returns {ASTNode} An ASTNode representing the tagged template */ - createTaggedTemplateExpression: function (tag, quasi) { + createTaggedTemplateExpression: function(tag, quasi) { return { type: astNodeTypes.TaggedTemplateExpression, tag: tag, @@ -518,7 +520,7 @@ module.exports = { * @param {ASTNode} property The object-property being referenced * @returns {ASTNode} An ASTNode representing a member expression */ - createMemberExpression: function (accessor, object, property) { + createMemberExpression: function(accessor, object, property) { return { type: astNodeTypes.MemberExpression, computed: accessor === "[", @@ -533,7 +535,7 @@ module.exports = { * @param {ASTNode} args The arguments passed to the constructor * @returns {ASTNode} An ASTNode representing a new expression */ - createNewExpression: function (callee, args) { + createNewExpression: function(callee, args) { return { type: astNodeTypes.NewExpression, callee: callee, @@ -547,7 +549,7 @@ module.exports = { * properties and associated values * @returns {ASTNode} An ASTNode representing a new object expression */ - createObjectExpression: function (properties) { + createObjectExpression: function(properties) { return { type: astNodeTypes.ObjectExpression, properties: properties @@ -560,7 +562,7 @@ module.exports = { * @param {ASTNode} argument The operator argument * @returns {ASTNode} An ASTNode representing a postfix expression */ - createPostfixExpression: function (operator, argument) { + createPostfixExpression: function(operator, argument) { return { type: astNodeTypes.UpdateExpression, operator: operator, @@ -575,7 +577,7 @@ module.exports = { * @param {string} sourceType Either "module" or "script". * @returns {ASTNode} An ASTNode representing an entire program */ - createProgram: function (body, sourceType) { + createProgram: function(body, sourceType) { return { type: astNodeTypes.Program, body: body, @@ -593,7 +595,7 @@ module.exports = { * @param {boolean} computed True if the property value has been computed * @returns {ASTNode} An ASTNode representing an object property */ - createProperty: function (kind, key, value, method, shorthand, computed) { + createProperty: function(kind, key, value, method, shorthand, computed) { return { type: astNodeTypes.Property, key: key, @@ -605,12 +607,24 @@ module.exports = { }; }, + /** + * Create an ASTNode representation of a rest element + * @param {ASTNode} argument The rest argument + * @returns {ASTNode} An ASTNode representing a rest element + */ + createRestElement: function (argument) { + return { + type: astNodeTypes.RestElement, + argument: argument + }; + }, + /** * Create an ASTNode representation of a return statement * @param {?ASTNode} argument The return argument, null if no argument is provided * @returns {ASTNode} An ASTNode representing a return statement */ - createReturnStatement: function (argument) { + createReturnStatement: function(argument) { return { type: astNodeTypes.ReturnStatement, argument: argument @@ -622,20 +636,30 @@ module.exports = { * @param {ASTNode[]} expressions An array containing each expression, in order * @returns {ASTNode} An ASTNode representing a sequence of expressions */ - createSequenceExpression: function (expressions) { + createSequenceExpression: function(expressions) { return { type: astNodeTypes.SequenceExpression, expressions: expressions }; }, + /** + * Create an ASTNode representation of super + * @returns {ASTNode} An ASTNode representing super + */ + createSuper: function() { + return { + type: astNodeTypes.Super + }; + }, + /** * Create an ASTNode representation of a switch case statement * @param {ASTNode} test The case value to test against the switch value * @param {ASTNode} consequent The consequent case statement * @returns {ASTNode} An ASTNode representing a switch case */ - createSwitchCase: function (test, consequent) { + createSwitchCase: function(test, consequent) { return { type: astNodeTypes.SwitchCase, test: test, @@ -649,7 +673,7 @@ module.exports = { * @param {ASTNode[]} cases An array of switch case statements * @returns {ASTNode} An ASTNode representing a switch statement */ - createSwitchStatement: function (discriminant, cases) { + createSwitchStatement: function(discriminant, cases) { return { type: astNodeTypes.SwitchStatement, discriminant: discriminant, @@ -661,7 +685,7 @@ module.exports = { * Create an ASTNode representation of a this statement * @returns {ASTNode} An ASTNode representing a this statement */ - createThisExpression: function () { + createThisExpression: function() { return { type: astNodeTypes.ThisExpression }; @@ -672,7 +696,7 @@ module.exports = { * @param {ASTNode} argument The argument to throw * @returns {ASTNode} An ASTNode representing a throw statement */ - createThrowStatement: function (argument) { + createThrowStatement: function(argument) { return { type: astNodeTypes.ThrowStatement, argument: argument @@ -686,12 +710,10 @@ module.exports = { * @param {?ASTNode} finalizer The final code block to run after the try/catch has run * @returns {ASTNode} An ASTNode representing a try statement */ - createTryStatement: function (block, handler, finalizer) { + createTryStatement: function(block, handler, finalizer) { return { type: astNodeTypes.TryStatement, block: block, - guardedHandlers: [], - handlers: handler ? [ handler ] : [], handler: handler, finalizer: finalizer }; @@ -703,7 +725,7 @@ module.exports = { * @param {ASTNode} argument The unary operand * @returns {ASTNode} An ASTNode representing a unary expression */ - createUnaryExpression: function (operator, argument) { + createUnaryExpression: function(operator, argument) { if (operator === "++" || operator === "--") { return { type: astNodeTypes.UpdateExpression, @@ -726,7 +748,7 @@ module.exports = { * @param {string} kind The kind of variable created ("var", "let", etc.) * @returns {ASTNode} An ASTNode representing a variable declaration */ - createVariableDeclaration: function (declarations, kind) { + createVariableDeclaration: function(declarations, kind) { return { type: astNodeTypes.VariableDeclaration, declarations: declarations, @@ -740,7 +762,7 @@ module.exports = { * @param {ASTNode} init The variable's initial value * @returns {ASTNode} An ASTNode representing a variable declarator */ - createVariableDeclarator: function (id, init) { + createVariableDeclarator: function(id, init) { return { type: astNodeTypes.VariableDeclarator, id: id, @@ -754,7 +776,7 @@ module.exports = { * @param {ASTNode} body The with statement body * @returns {ASTNode} An ASTNode representing a with statement */ - createWithStatement: function (object, body) { + createWithStatement: function(object, body) { return { type: astNodeTypes.WithStatement, object: object, @@ -762,15 +784,15 @@ module.exports = { }; }, - createYieldExpression: function (argument, delegate) { + createYieldExpression: function(argument, delegate) { return { type: astNodeTypes.YieldExpression, - argument: argument, + argument: argument || null, delegate: delegate }; }, - createJSXAttribute: function (name, value) { + createJSXAttribute: function(name, value) { return { type: astNodeTypes.JSXAttribute, name: name, @@ -778,21 +800,21 @@ module.exports = { }; }, - createJSXSpreadAttribute: function (argument) { + createJSXSpreadAttribute: function(argument) { return { type: astNodeTypes.JSXSpreadAttribute, argument: argument }; }, - createJSXIdentifier: function (name) { + createJSXIdentifier: function(name) { return { type: astNodeTypes.JSXIdentifier, name: name }; }, - createJSXNamespacedName: function (namespace, name) { + createJSXNamespacedName: function(namespace, name) { return { type: astNodeTypes.JSXNamespacedName, namespace: namespace, @@ -800,7 +822,7 @@ module.exports = { }; }, - createJSXMemberExpression: function (object, property) { + createJSXMemberExpression: function(object, property) { return { type: astNodeTypes.JSXMemberExpression, object: object, @@ -808,7 +830,7 @@ module.exports = { }; }, - createJSXElement: function (openingElement, closingElement, children) { + createJSXElement: function(openingElement, closingElement, children) { return { type: astNodeTypes.JSXElement, openingElement: openingElement, @@ -817,20 +839,20 @@ module.exports = { }; }, - createJSXEmptyExpression: function () { + createJSXEmptyExpression: function() { return { type: astNodeTypes.JSXEmptyExpression }; }, - createJSXExpressionContainer: function (expression) { + createJSXExpressionContainer: function(expression) { return { type: astNodeTypes.JSXExpressionContainer, expression: expression }; }, - createJSXOpeningElement: function (name, attributes, selfClosing) { + createJSXOpeningElement: function(name, attributes, selfClosing) { return { type: astNodeTypes.JSXOpeningElement, name: name, @@ -839,14 +861,14 @@ module.exports = { }; }, - createJSXClosingElement: function (name) { + createJSXClosingElement: function(name) { return { type: astNodeTypes.JSXClosingElement, name: name }; }, - createExportSpecifier: function (local, exported) { + createExportSpecifier: function(local, exported) { return { type: astNodeTypes.ExportSpecifier, exported: exported || local, @@ -854,21 +876,21 @@ module.exports = { }; }, - createImportDefaultSpecifier: function (local) { + createImportDefaultSpecifier: function(local) { return { type: astNodeTypes.ImportDefaultSpecifier, local: local }; }, - createImportNamespaceSpecifier: function (local) { + createImportNamespaceSpecifier: function(local) { return { type: astNodeTypes.ImportNamespaceSpecifier, local: local }; }, - createExportNamedDeclaration: function (declaration, specifiers, source) { + createExportNamedDeclaration: function(declaration, specifiers, source) { return { type: astNodeTypes.ExportNamedDeclaration, declaration: declaration, @@ -877,21 +899,21 @@ module.exports = { }; }, - createExportDefaultDeclaration: function (declaration) { + createExportDefaultDeclaration: function(declaration) { return { type: astNodeTypes.ExportDefaultDeclaration, declaration: declaration }; }, - createExportAllDeclaration: function (source) { + createExportAllDeclaration: function(source) { return { type: astNodeTypes.ExportAllDeclaration, source: source }; }, - createImportSpecifier: function (local, imported) { + createImportSpecifier: function(local, imported) { return { type: astNodeTypes.ImportSpecifier, local: local || imported, @@ -899,7 +921,7 @@ module.exports = { }; }, - createImportDeclaration: function (specifiers, source) { + createImportDeclaration: function(specifiers, source) { return { type: astNodeTypes.ImportDeclaration, specifiers: specifiers, diff --git a/node_modules/espree/lib/ast-node-types.js b/node_modules/espree/lib/ast-node-types.js index 7976f341..5d14b7f4 100644 --- a/node_modules/espree/lib/ast-node-types.js +++ b/node_modules/espree/lib/ast-node-types.js @@ -74,9 +74,11 @@ module.exports = { ObjectPattern: "ObjectPattern", Program: "Program", Property: "Property", + RestElement: "RestElement", ReturnStatement: "ReturnStatement", SequenceExpression: "SequenceExpression", SpreadElement: "SpreadElement", + Super: "Super", SwitchCase: "SwitchCase", SwitchStatement: "SwitchStatement", TaggedTemplateExpression: "TaggedTemplateExpression", diff --git a/node_modules/espree/lib/messages.js b/node_modules/espree/lib/messages.js index a7780b64..b0f324f8 100644 --- a/node_modules/espree/lib/messages.js +++ b/node_modules/espree/lib/messages.js @@ -69,7 +69,7 @@ module.exports = { StrictParamName: "Parameter name eval or arguments is not allowed in strict mode", StrictParamDupe: "Strict mode function may not have duplicate parameter names", TemplateOctalLiteral: "Octal literals are not allowed in template strings.", - ParameterAfterRestParameter: "Rest parameter must be final parameter of an argument list", + ParameterAfterRestParameter: "Rest parameter must be last formal parameter", DefaultRestParameter: "Rest parameter can not have a default value", ElementAfterSpreadElement: "Spread must be the final element of an element list", ObjectPatternAsRestParameter: "Invalid rest parameter", diff --git a/node_modules/espree/package.json b/node_modules/espree/package.json index b3306b0d..255bdc07 100644 --- a/node_modules/espree/package.json +++ b/node_modules/espree/package.json @@ -11,7 +11,7 @@ "esparse": "./bin/esparse.js", "esvalidate": "./bin/esvalidate.js" }, - "version": "1.12.3", + "version": "2.0.3", "files": [ "bin", "lib", @@ -27,7 +27,7 @@ }, "repository": { "type": "git", - "url": "http://github.com/eslint/espree.git" + "url": "git+ssh://git@github.com/eslint/espree.git" }, "bugs": { "url": "http://github.com/eslint/espree.git" @@ -44,7 +44,7 @@ "complexity-report": "~0.6.1", "dateformat": "^1.0.11", "eslint": "^0.9.2", - "esprima": "git://github.com/ariya/esprima#harmony", + "esprima": "git://github.com/jquery/esprima.git", "esprima-fb": "^8001.2001.0-dev-harmony-fb", "istanbul": "~0.2.6", "json-diff": "~0.3.1", @@ -83,10 +83,26 @@ "benchmark-quick": "node test/benchmarks.js quick" }, "dependencies": {}, - "readme": "# Espree\n\nEspree is an actively-maintained fork Esprima, a high performance,\nstandard-compliant [ECMAScript](http://www.ecma-international.org/publications/standards/Ecma-262.htm)\nparser written in ECMAScript (also popularly known as\n[JavaScript](http://en.wikipedia.org/wiki/JavaScript)).\n\n## Features\n\n- Full support for ECMAScript 5.1 ([ECMA-262](http://www.ecma-international.org/publications/standards/Ecma-262.htm))\n- Sensible syntax tree format compatible with Mozilla\n[Parser AST](https://developer.mozilla.org/en/SpiderMonkey/Parser_API)\n- Optional tracking of syntax node location (index-based and line-column)\n- Heavily tested (> 650 unit tests) with full code coverage\n\n## Usage\n\nInstall:\n\n```\nnpm i espree --save\n```\n\nAnd in your Node.js code:\n\n```javascript\nvar espree = require(\"espree\");\n\nvar ast = espree.parse(code);\n```\n\nThere is a second argument to `parse()` that allows you to specify various options:\n\n```javascript\nvar espree = require(\"espree\");\n\nvar ast = espree.parse(code, {\n\n // attach range information to each node\n range: true,\n\n // attach line/column location information to each node\n loc: true,\n\n // create a top-level comments array containing all comments\n comments: true,\n\n // attach comments to the closest relevant node as leadingComments and\n // trailingComments\n attachComment: true,\n\n // create a top-level tokens array containing all tokens\n tokens: true,\n\n // try to continue parsing if an error is encountered, store errors in a\n // top-level errors array\n tolerant: true,\n\n // specify parsing features (default only has blockBindings: true)\n ecmaFeatures: {\n\n // enable parsing of arrow functions\n arrowFunctions: true,\n\n // enable parsing of let/const\n blockBindings: true,\n\n // enable parsing of destructured arrays and objects\n destructuring: true,\n\n // enable parsing of regular expression y flag\n regexYFlag: true,\n\n // enable parsing of regular expression u flag\n regexUFlag: true,\n\n // enable parsing of template strings\n templateStrings: true,\n\n // enable parsing of binary literals\n binaryLiterals: true,\n\n // enable parsing of ES6 octal literals\n octalLiterals: true,\n\n // enable parsing unicode code point escape sequences\n unicodeCodePointEscapes: true,\n\n // enable parsing of default parameters\n defaultParams: true,\n\n // enable parsing of rest parameters\n restParams: true,\n\n // enable parsing of for-of statement\n forOf: true,\n\n // enable parsing computed object literal properties\n objectLiteralComputedProperties: true,\n\n // enable parsing of shorthand object literal methods\n objectLiteralShorthandMethods: true,\n\n // enable parsing of shorthand object literal properties\n objectLiteralShorthandProperties: true,\n\n // Allow duplicate object literal properties (except '__proto__')\n objectLiteralDuplicateProperties: true,\n\n // enable parsing of generators/yield\n generators: true,\n\n // enable parsing spread operator\n spread: true,\n\n // enable parsing classes\n classes: true,\n\n // enable parsing of modules\n modules: true,\n\n // enable React JSX parsing\n jsx: true,\n\n // enable return in global scope\n globalReturn: true\n }\n});\n```\n\n## Plans\n\nEspree starts as a fork of Esprima v1.2.2, the last stable published released of Esprima before work on ECMAScript 6 began. Espree's first version is therefore v1.2.2 and is 100% compatible with Esprima v1.2.2 as a drop-in replacement. The version number will be incremented based on [semantic versioning](http://semver.org/) as features and bug fixes are added.\n\nThe immediate plans are:\n\n1. Move away from giant files and move towards small, modular files that are easier to manage.\n1. Move towards CommonJS for all files and use browserify to create browser bundles.\n1. Support ECMAScript version filtering, allowing users to specify which version the parser should work in (similar to Acorn's `ecmaVersion` property).\n1. Add tests to track comment attachment.\n1. Add well-thought-out features that are useful for tools developers.\n1. Add full support for ECMAScript 6.\n1. Add optional parsing of JSX.\n\n## Esprima Compatibility Going Forward\n\nThe primary goal is to produce the exact same AST structure as Esprima and Acorn, and that takes precedence over anything else. (The AST structure being the SpiderMonkey Parser API with JSX extensions.) Separate from that, Espree may deviate from what Esprima outputs in terms of where and how comments are attached, as well as what additional information is available on AST nodes. That is to say, Espree may add more things to the AST nodes than Esprima does but the overall AST structure produced will be the same.\n\nEspree may also deviate from Esprima in the interface it exposes.\n\n## Frequent and Incremental Releases\n\nEspree will not do giant releases. Releases will happen periodically as changes are made and incremental releases will be made towards larger goals. For instance, we will not have one big release for ECMAScript 6 support. Instead, we will implement ECMAScript 6, piece-by-piece, hiding those pieces behind an `ecmaFeatures` property that allows you to opt-in to use those features.\n\n## Contributing\n\nIssues and pull requests will be triaged and responded to as quickly as possible. We operate under the [ESLint Contributor Guidelines](http://eslint.org/docs/developer-guide/contributing.html), so please be sure to read them before contributing. If you're not sure where to dig in, check out the [issues](https://github.com/eslint/espree/issues).\n\nEspree is licensed under a permissive BSD 3-clause license.\n\n## Build Commands\n\n* `npm test` - run all linting and tests\n* `npm run lint` - run all linting\n* `npm run browserify` - creates a version of Espree that is usable in a browser\n\n## Known Incompatibilities\n\nIn an effort to help those wanting to transition from other parsers to Espree, the following is a list of noteworthy incompatibilities with other parsers. These are known differences that we do not intend to change.\n\n### Esprima 1.2.2\n\n* None.\n\n### Esprima/Harmony Branch\n\n* Esprima/Harmony uses a different comment attachment algorithm that results in some comments being added in different places than Espree. The algorithm Espree uses is the same one used in Esprima 1.2.2.\n* Template tokens have a `head` property in addition to `tail`. Esprima has only `tail`.\n\n### Esprima-FB\n\n* All Esprima/Harmony incompatibilities.\n\n## Frequently Asked Questions\n\n### Why are you forking Esprima?\n\n[ESLint](http://eslint.org) has been relying on Esprima as its parser from the beginning. While that was fine when the JavaScript language was evolving slowly, the pace of development has increased dramatically and Esprima has fallen behind. ESLint, like many other tools reliant on Esprima, has been stuck in using new JavaScript language features until Esprima updates, and that has caused our users frustration.\n\nWe decided the only way for us to move forward was to create our own parser, bringing us inline with JSHint and JSLint, and allowing us to keep implementing new features as we need them. We chose to fork Esprima instead of starting from scratch in order to move as quickly as possible with a compatible API.\n\n### Have you tried working with Esprima?\n\nYes. Since the start of ESLint, we've regularly filed bugs and feature requests with Esprima. Unfortunately, we've been unable to make much progress towards getting our needs addressed.\n\n### Why don't you just use Facebook's Esprima fork?\n\n`esprima-fb` is Facebook's Esprima fork that features JSX and Flow type annotations. We tried working with `esprima-fb` in our evaluation of how to support ECMAScript 6 and JSX in ESLint. Unfortunately, we were hampered by bugs that were part of Esprima (not necessarily Facebook's code). Since `esprima-fb` tracks the Esprima Harmony branch, that means we still were unable to get fixes or features we needed in a timely manner.\n\n### Why don't you just use Acorn?\n\nAcorn is a great JavaScript parser that produces an AST that is compatible with Esprima. Unfortunately, ESLint relies on more than just the AST to do its job. It relies on Esprima's tokens and comment attachment features to get a complete picture of the source code. We investigated switching to Acorn, but the inconsistencies between Esprima and Acorn created too much work for a project like ESLint.\n\nWe expect there are other tools like ESLint that rely on more than just the AST produced by Esprima, and so a drop-in replacement will help those projects as well as ESLint.\n\n### What ECMAScript 6 features do you support?\n\nPlease see the [tracking issue](https://github.com/eslint/espree/issues/10) for the most up-to-date information.\n\n### Why use Espree instead of Esprima?\n\n* Faster turnaround time on bug fixes\n* More frequent releases\n* Better communication and responsiveness to issues\n* Ongoing development\n\n### Why use Espree instead of Esprima-FB?\n\n* Opt-in to just the ECMAScript 6 features you want\n* JSX support is off by default, so you're not forced to use it to use ECMAScript 6\n* Stricter ECMAScript 6 support\n", - "readmeFilename": "README.md", - "_id": "espree@1.12.3", - "_shasum": "04ceeada91bda077a38c040c125ba186b13bb3cc", - "_from": "espree@~1.12.0", - "_resolved": "https://registry.npmjs.org/espree/-/espree-1.12.3.tgz" + "gitHead": "b60b597cfe4834aacd16c90179ce73e22705c132", + "_id": "espree@2.0.3", + "_shasum": "1fbdff60a410bd0d416b1ab3d6230d34b7a450e1", + "_from": "espree@>=2.0.3 <2.1.0", + "_npmVersion": "1.4.28", + "_npmUser": { + "name": "nzakas", + "email": "nicholas@nczconsulting.com" + }, + "maintainers": [ + { + "name": "nzakas", + "email": "nicholas@nczconsulting.com" + } + ], + "dist": { + "shasum": "1fbdff60a410bd0d416b1ab3d6230d34b7a450e1", + "tarball": "http://registry.npmjs.org/espree/-/espree-2.0.3.tgz" + }, + "directories": {}, + "_resolved": "https://registry.npmjs.org/espree/-/espree-2.0.3.tgz", + "readme": "ERROR: No README data found!" } diff --git a/package.json b/package.json index f0aca4ba..b121db2d 100644 --- a/package.json +++ b/package.json @@ -17,7 +17,7 @@ "bluebird": "~2.9.14", "catharsis": "~0.8.7", "escape-string-regexp": "~1.0.2", - "espree": "~1.12.3", + "espree": "~2.0.3", "js2xmlparser": "~0.1.7", "marked": "~0.3.2", "requizzle": "~0.2.0",