pax_global_header00006660000000000000000000000064130764730530014522gustar00rootroot0000000000000052 comment=94bb5a1d36c5624fb612de2dd704ffa586d38845 babel-eslint-7.2.3/000077500000000000000000000000001307647305300140745ustar00rootroot00000000000000babel-eslint-7.2.3/.eslintignore000066400000000000000000000000161307647305300165740ustar00rootroot00000000000000test/fixtures babel-eslint-7.2.3/.eslintrc.js000066400000000000000000000002271307647305300163340ustar00rootroot00000000000000module.exports = { root: true, extends: "babel", rules: { "no-var": 0, "max-len": 0 }, env: { node: true, mocha: true } }; babel-eslint-7.2.3/.gitignore000066400000000000000000000000331307647305300160600ustar00rootroot00000000000000node_modules npm-debug.log babel-eslint-7.2.3/.travis.yml000066400000000000000000000003751307647305300162120ustar00rootroot00000000000000sudo: false language: node_js node_js: - "4" - "5" - "6" matrix: fast_finish: true include: - node_js: "node" env: LINT=true script: - 'if [ -n "${LINT-}" ]; then npm run lint ; fi' - 'if [ -z "${LINT-}" ]; then npm test ; fi' babel-eslint-7.2.3/CONTRIBUTING.md000066400000000000000000000011171307647305300163250ustar00rootroot00000000000000# Contributing Thanks for contributing! If you're about to report an issue - please first check if it's already been reported in the [issues page](https://github.com/babel/babel-eslint/issues). Also check to see if the latest versions of eslint/babel-eslint still produce the issue. Also check out the [Known Issues](https://github.com/babel/babel-eslint#known-issues) section of the README. If you are having issues with JSX you might want to check out eslint-plugin-react. If there's an issue with new experimental syntax you might need to report that in eslint-plugin-babel instead. babel-eslint-7.2.3/LICENSE000066400000000000000000000021131307647305300150760ustar00rootroot00000000000000Copyright (c) 2014-2016 Sebastian McKenzie MIT License Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. babel-eslint-7.2.3/Makefile000066400000000000000000000001451307647305300155340ustar00rootroot00000000000000.PHONY: publish-patch publish-patch: mocha npm version patch npm publish git push --follow-tags babel-eslint-7.2.3/README.md000066400000000000000000000076561307647305300153710ustar00rootroot00000000000000# babel-eslint [![npm](https://img.shields.io/npm/v/babel-eslint.svg)](https://www.npmjs.com/package/babel-eslint) [![travis](https://img.shields.io/travis/babel/babel-eslint/master.svg)](https://travis-ci.org/babel/babel-eslint) [![npm-downloads](https://img.shields.io/npm/dm/babel-eslint.svg)](https://www.npmjs.com/package/babel-eslint) **babel-eslint** allows you to lint **ALL** valid Babel code with the fantastic [ESLint](https://github.com/eslint/eslint). ### Why Use babel-eslint You only need to use babel-eslint if you are using types (Flow) or experimental features not supported in ESLint itself yet. Otherwise try the default parser (you don't have to use it just because you are using Babel). --- > If there is an issue, first check if it can be reproduced with the regular parser or with the latest versions of `eslint` and `babel-eslint`! For questions and support please visit the [`#linting`](https://babeljs.slack.com/messages/linting/) babel slack channel (sign up [here](https://babel-slack.herokuapp.com))! > Note that the `ecmaFeatures` config property may still be required for ESLint to work properly with features not in ECMAScript 5 by default. Examples are `globalReturn` and `modules`). ## Known Issues Flow: > Check out [eslint-plugin-flowtype](https://github.com/gajus/eslint-plugin-flowtype): An `eslint` plugin that makes flow type annotations global variables and marks declarations as used. Solves the problem of false positives with `no-undef` and `no-unused-vars`. - `no-undef` for global flow types: `ReactElement`, `ReactClass` [#130](https://github.com/babel/babel-eslint/issues/130#issuecomment-111215076) - Workaround: define types as globals in `.eslintrc` or define types and import them `import type ReactElement from './types'` - `no-unused-vars/no-undef` with Flow declarations (`declare module A {}`) [#132](https://github.com/babel/babel-eslint/issues/132#issuecomment-112815926) Modules/strict mode - `no-unused-vars: [2, {vars: local}]` [#136](https://github.com/babel/babel-eslint/issues/136) Please check out [eslint-plugin-react](https://github.com/yannickcr/eslint-plugin-react) for React/JSX issues - `no-unused-vars` with jsx Please check out [eslint-plugin-babel](https://github.com/babel/eslint-plugin-babel) for other issues ## How does it work? ESLint allows custom parsers. This is great but some of the syntax nodes that Babel supports aren't supported by ESLint. When using this plugin, ESLint is monkeypatched and your code is transformed into code that ESLint can understand. All location info such as line numbers, columns is also retained so you can track down errors with ease. Basically `babel-eslint` exports an [`index.js`](/index.js) that a linter can use. It just needs to export a `parse` method that takes in a string of code and outputs an AST. ## Usage > ESLint 1.x | Use <= 5.x > ESLint 2.x | Use >= 6.x ### Supported ESLint versions ESLint | babel-eslint ------------ | ------------- 3.x | >= 6.x ### Install ```sh $ npm install eslint@3.x babel-eslint@6 --save-dev ``` ### Setup **.eslintrc** ```json { "parser": "babel-eslint", "rules": { "strict": 0 } } ``` Check out the [ESLint docs](http://eslint.org/docs/rules/) for all possible rules. ### Configuration `sourceType` can be set to `'module'`(default) or `'script'` if your code isn't using ECMAScript modules. `allowImportExportEverywhere` can be set to true to allow import and export declarations to appear anywhere a statement is allowed if your build environment supports that. By default, import and export declarations can only appear at a program's top level. `codeFrame` can be set to false to disable the code frame in the reporter. This is useful since some eslint formatters don't play well with it. **.eslintrc** ```json { "parser": "babel-eslint", "parserOptions": { "sourceType": "module", "allowImportExportEverywhere": false, "codeFrame": false } } ``` ### Run ```sh $ eslint your-files-here ``` babel-eslint-7.2.3/babylon-to-espree/000077500000000000000000000000001307647305300174235ustar00rootroot00000000000000babel-eslint-7.2.3/babylon-to-espree/attachComments.js000066400000000000000000000040211307647305300227300ustar00rootroot00000000000000"use strict"; // comment fixes module.exports = function (ast, comments, tokens) { if (comments.length) { var firstComment = comments[0]; var lastComment = comments[comments.length - 1]; // fixup program start if (!tokens.length) { // if no tokens, the program starts at the end of the last comment ast.start = lastComment.end; ast.loc.start.line = lastComment.loc.end.line; ast.loc.start.column = lastComment.loc.end.column; if (ast.leadingComments === null && ast.innerComments.length) { ast.leadingComments = ast.innerComments; } } else if (firstComment.start < tokens[0].start) { // if there are comments before the first token, the program starts at the first token var token = tokens[0]; // ast.start = token.start; // ast.loc.start.line = token.loc.start.line; // ast.loc.start.column = token.loc.start.column; // estraverse do not put leading comments on first node when the comment // appear before the first token if (ast.body.length) { var node = ast.body[0]; node.leadingComments = []; var firstTokenStart = token.start; var len = comments.length; for (var i = 0; i < len && comments[i].start < firstTokenStart; i++) { node.leadingComments.push(comments[i]); } } } // fixup program end if (tokens.length) { var lastToken = tokens[tokens.length - 1]; if (lastComment.end > lastToken.end) { // If there is a comment after the last token, the program ends at the // last token and not the comment // ast.end = lastToken.end; ast.range[1] = lastToken.end; ast.loc.end.line = lastToken.loc.end.line; ast.loc.end.column = lastToken.loc.end.column; } } } else { if (!tokens.length) { ast.loc.start.line = 1; ast.loc.end.line = 1; } } if (ast.body && ast.body.length > 0) { ast.loc.start.line = ast.body[0].loc.start.line; ast.range[0] = ast.body[0].start; } }; babel-eslint-7.2.3/babylon-to-espree/convertComments.js000066400000000000000000000007311307647305300231500ustar00rootroot00000000000000"use strict"; module.exports = function (comments) { for (var i = 0; i < comments.length; i++) { var comment = comments[i]; if (comment.type === "CommentBlock") { comment.type = "Block"; } else if (comment.type === "CommentLine") { comment.type = "Line"; } // sometimes comments don't get ranges computed, // even with options.ranges === true if (!comment.range) { comment.range = [comment.start, comment.end]; } } }; babel-eslint-7.2.3/babylon-to-espree/convertTemplateType.js000066400000000000000000000047651307647305300240130ustar00rootroot00000000000000"use strict"; module.exports = function (tokens, tt) { var startingToken = 0; var currentToken = 0; var numBraces = 0; // track use of {} var numBackQuotes = 0; // track number of nested templates function isBackQuote(token) { return tokens[token].type === tt.backQuote; } function isTemplateStarter(token) { return isBackQuote(token) || // only can be a template starter when in a template already tokens[token].type === tt.braceR && numBackQuotes > 0; } function isTemplateEnder(token) { return isBackQuote(token) || tokens[token].type === tt.dollarBraceL; } // append the values between start and end function createTemplateValue(start, end) { var value = ""; while (start <= end) { if (tokens[start].value) { value += tokens[start].value; } else if (tokens[start].type !== tt.template) { value += tokens[start].type.label; } start++; } return value; } // create Template token function replaceWithTemplateType(start, end) { var templateToken = { type: "Template", value: createTemplateValue(start, end), start: tokens[start].start, end: tokens[end].end, loc: { start: tokens[start].loc.start, end: tokens[end].loc.end } }; // put new token in place of old tokens tokens.splice(start, end - start + 1, templateToken); } function trackNumBraces(token) { if (tokens[token].type === tt.braceL) { numBraces++; } else if (tokens[token].type === tt.braceR) { numBraces--; } } while (startingToken < tokens.length) { // template start: check if ` or } if (isTemplateStarter(startingToken) && numBraces === 0) { if (isBackQuote(startingToken)) { numBackQuotes++; } currentToken = startingToken + 1; // check if token after template start is "template" if (currentToken >= tokens.length - 1 || tokens[currentToken].type !== tt.template) { break; } // template end: find ` or ${ while (!isTemplateEnder(currentToken)) { if (currentToken >= tokens.length - 1) { break; } currentToken++; } if (isBackQuote(currentToken)) { numBackQuotes--; } // template start and end found: create new token replaceWithTemplateType(startingToken, currentToken); } else if (numBackQuotes > 0) { trackNumBraces(startingToken); } startingToken++; } }; babel-eslint-7.2.3/babylon-to-espree/index.js000066400000000000000000000020141307647305300210650ustar00rootroot00000000000000"use strict"; var attachComments = require("./attachComments"); var convertComments = require("./convertComments"); var toTokens = require("./toTokens"); var toAST = require("./toAST"); module.exports = function (ast, traverse, tt, code) { // remove EOF token, eslint doesn't use this for anything and it interferes // with some rules see https://github.com/babel/babel-eslint/issues/2 // todo: find a more elegant way to do this ast.tokens.pop(); // convert tokens ast.tokens = toTokens(ast.tokens, tt, code); // add comments convertComments(ast.comments); // transform esprima and acorn divergent nodes toAST(ast, traverse, code); // ast.program.tokens = ast.tokens; // ast.program.comments = ast.comments; // ast = ast.program; // remove File ast.type = "Program"; ast.sourceType = ast.program.sourceType; ast.directives = ast.program.directives; ast.body = ast.program.body; delete ast.program; delete ast._paths; attachComments(ast, ast.comments, ast.tokens); }; babel-eslint-7.2.3/babylon-to-espree/toAST.js000066400000000000000000000137611307647305300207630ustar00rootroot00000000000000"use strict"; var convertComments = require("./convertComments"); module.exports = function (ast, traverse, code) { var state = { source: code }; ast.range = [ast.start, ast.end]; traverse(ast, astTransformVisitor, null, state); }; function changeToLiteral(node, state) { node.type = "Literal"; if (!node.raw) { if (node.extra && node.extra.raw) { node.raw = node.extra.raw; } else { node.raw = state.source.slice(node.start, node.end); } } } var astTransformVisitor = { noScope: true, enter (path) { var node = path.node; node.range = [node.start, node.end]; // private var to track original node type node._babelType = node.type; if (node.innerComments) { node.trailingComments = node.innerComments; delete node.innerComments; } if (node.trailingComments) { convertComments(node.trailingComments); } if (node.leadingComments) { convertComments(node.leadingComments); } // make '_paths' non-enumerable (babel-eslint #200) Object.defineProperty(node, "_paths", { value: node._paths, writable: true }); }, exit (path, state) { var node = path.node; // fixDirectives if (path.isFunction() || path.isProgram()) { var directivesContainer = node; var body = node.body; if (node.type !== "Program") { directivesContainer = body; body = body.body; } if (directivesContainer.directives) { for (var i = directivesContainer.directives.length - 1; i >= 0; i--) { var directive = directivesContainer.directives[i]; directive.type = "ExpressionStatement"; directive.expression = directive.value; delete directive.value; directive.expression.type = "Literal"; changeToLiteral(directive.expression, state); body.unshift(directive); } delete directivesContainer.directives; } } if (path.isJSXText()) { node.type = "Literal"; node.raw = node.value; } if (path.isNumericLiteral() || path.isStringLiteral()) { changeToLiteral(node, state); } if (path.isBooleanLiteral()) { node.type = "Literal"; node.raw = String(node.value); } if (path.isNullLiteral()) { node.type = "Literal"; node.raw = "null"; node.value = null; } if (path.isRegExpLiteral()) { node.type = "Literal"; node.raw = node.extra.raw; node.value = {}; node.regex = { pattern: node.pattern, flags: node.flags }; delete node.extra; delete node.pattern; delete node.flags; } if (path.isObjectProperty()) { node.type = "Property"; node.kind = "init"; } if (path.isClassMethod() || path.isObjectMethod()) { var code = state.source.slice(node.key.end, node.body.start); var offset = code.indexOf("("); node.value = { type: "FunctionExpression", id: node.id, params: node.params, body: node.body, async: node.async, generator: node.generator, expression: node.expression, defaults: [], // basic support - TODO: remove (old esprima) loc: { start: { line: node.key.loc.start.line, column: node.key.loc.end.column + offset // a[() {] }, end: node.body.loc.end } }; // [asdf]() { node.value.range = [node.key.end + offset, node.body.end]; node.value.start = node.value.range && node.value.range[0] || node.value.loc.start.column; node.value.end = node.value.range && node.value.range[1] || node.value.loc.end.column; if (node.returnType) { node.value.returnType = node.returnType; } if (node.typeParameters) { node.value.typeParameters = node.typeParameters; } if (path.isClassMethod()) { node.type = "MethodDefinition"; } if (path.isObjectMethod()) { node.type = "Property"; if (node.kind === "method") { node.kind = "init"; } } delete node.body; delete node.id; delete node.async; delete node.generator; delete node.expression; delete node.params; delete node.returnType; delete node.typeParameters; } if (path.isRestProperty() || path.isSpreadProperty()) { node.type = `Experimental${node.type}`; } if (path.isTypeParameter && path.isTypeParameter()) { node.type = "Identifier"; node.typeAnnotation = node.bound; delete node.bound; } // flow: prevent "no-undef" // for "Component" in: "let x: React.Component" if (path.isQualifiedTypeIdentifier()) { delete node.id; } // for "b" in: "var a: { b: Foo }" if (path.isObjectTypeProperty()) { delete node.key; } // for "indexer" in: "var a: {[indexer: string]: number}" if (path.isObjectTypeIndexer()) { delete node.id; } // for "param" in: "var a: { func(param: Foo): Bar };" if (path.isFunctionTypeParam()) { delete node.name; } // modules if (path.isImportDeclaration()) { delete node.isType; } if (path.isExportDeclaration()) { var declar = path.get("declaration"); if (declar.isClassExpression()) { node.declaration.type = "ClassDeclaration"; } else if (declar.isFunctionExpression()) { node.declaration.type = "FunctionDeclaration"; } } // TODO: remove (old esprima) if (path.isFunction()) { if (!node.defaults) { node.defaults = []; } } // template string range fixes if (path.isTemplateLiteral()) { for (var j = 0; j < node.quasis.length; j++) { var q = node.quasis[j]; q.range[0] -= 1; if (q.tail) { q.range[1] += 1; } else { q.range[1] += 2; } q.loc.start.column -= 1; if (q.tail) { q.loc.end.column += 1; } else { q.loc.end.column += 2; } } } } }; babel-eslint-7.2.3/babylon-to-espree/toToken.js000066400000000000000000000044141307647305300214070ustar00rootroot00000000000000"use strict"; module.exports = function (token, tt, source) { var type = token.type; token.range = [token.start, token.end]; if (type === tt.name) { token.type = "Identifier"; } else if (type === tt.semi || type === tt.comma || type === tt.parenL || type === tt.parenR || type === tt.braceL || type === tt.braceR || type === tt.slash || type === tt.dot || type === tt.bracketL || type === tt.bracketR || type === tt.ellipsis || type === tt.arrow || type === tt.star || type === tt.incDec || type === tt.colon || type === tt.question || type === tt.template || type === tt.backQuote || type === tt.dollarBraceL || type === tt.at || type === tt.logicalOR || type === tt.logicalAND || type === tt.bitwiseOR || type === tt.bitwiseXOR || type === tt.bitwiseAND || type === tt.equality || type === tt.relational || type === tt.bitShift || type === tt.plusMin || type === tt.modulo || type === tt.exponent || type === tt.prefix || type === tt.doubleColon || type.isAssign) { token.type = "Punctuator"; if (!token.value) token.value = type.label; } else if (type === tt.jsxTagStart) { token.type = "Punctuator"; token.value = "<"; } else if (type === tt.jsxTagEnd) { token.type = "Punctuator"; token.value = ">"; } else if (type === tt.jsxName) { token.type = "JSXIdentifier"; } else if (type === tt.jsxText) { token.type = "JSXText"; } else if (type.keyword === "null") { token.type = "Null"; } else if (type.keyword === "false" || type.keyword === "true") { token.type = "Boolean"; } else if (type.keyword) { token.type = "Keyword"; } else if (type === tt.num) { token.type = "Numeric"; token.value = source.slice(token.start, token.end); } else if (type === tt.string) { token.type = "String"; token.value = source.slice(token.start, token.end); } else if (type === tt.regexp) { token.type = "RegularExpression"; var value = token.value; token.regex = { pattern: value.pattern, flags: value.flags }; token.value = `/${value.pattern}/${value.flags}`; } return token; }; babel-eslint-7.2.3/babylon-to-espree/toTokens.js000066400000000000000000000007741307647305300215770ustar00rootroot00000000000000"use strict"; var convertTemplateType = require("./convertTemplateType"); var toToken = require("./toToken"); module.exports = function (tokens, tt, code) { // transform tokens to type "Template" convertTemplateType(tokens, tt); var transformedTokens = []; for (var i = 0; i < tokens.length; i++) { var token = tokens[i]; if (token.type !== "CommentLine" && token.type !== "CommentBlock") { transformedTokens.push(toToken(token, tt, code)); } } return transformedTokens; }; babel-eslint-7.2.3/index.js000066400000000000000000000324351307647305300155500ustar00rootroot00000000000000var babylonToEspree = require("./babylon-to-espree"); var Module = require("module"); var path = require("path"); var parse = require("babylon").parse; var t = require("babel-types"); var tt = require("babylon").tokTypes; var traverse = require("babel-traverse").default; var codeFrame = require("babel-code-frame"); var hasPatched = false; var eslintOptions = {}; function getModules() { try { // avoid importing a local copy of eslint, try to find a peer dependency var eslintLoc = Module._resolveFilename("eslint", module.parent); } catch (err) { try { // avoids breaking in jest where module.parent is undefined eslintLoc = require.resolve("eslint"); } catch (err) { throw new ReferenceError("couldn't resolve eslint"); } } // get modules relative to what eslint will load var eslintMod = new Module(eslintLoc); eslintMod.filename = eslintLoc; eslintMod.paths = Module._nodeModulePaths(path.dirname(eslintLoc)); try { var escope = eslintMod.require("eslint-scope"); var Definition = eslintMod.require("eslint-scope/lib/definition").Definition; var referencer = eslintMod.require("eslint-scope/lib/referencer"); } catch (err) { escope = eslintMod.require("escope"); Definition = eslintMod.require("escope/lib/definition").Definition; referencer = eslintMod.require("escope/lib/referencer"); } var estraverse = eslintMod.require("estraverse"); if (referencer.__esModule) referencer = referencer.default; return { Definition, escope, estraverse, referencer, }; } function monkeypatch(modules) { var Definition = modules.Definition; var escope = modules.escope; var estraverse = modules.estraverse; var referencer = modules.referencer; Object.assign(estraverse.VisitorKeys, t.VISITOR_KEYS); estraverse.VisitorKeys.MethodDefinition.push("decorators"); estraverse.VisitorKeys.Property.push("decorators"); var analyze = escope.analyze; escope.analyze = function (ast, opts) { opts.ecmaVersion = eslintOptions.ecmaVersion; opts.sourceType = eslintOptions.sourceType; if (eslintOptions.globalReturn !== undefined) { opts.nodejsScope = eslintOptions.globalReturn; } var results = analyze.call(this, ast, opts); return results; }; // if there are decorators, then visit each function visitDecorators(node) { if (!node.decorators) { return; } for (var i = 0; i < node.decorators.length; i++) { if (node.decorators[i].expression) { this.visit(node.decorators[i]); } } } // iterate through part of t.VISITOR_KEYS var flowFlippedAliasKeys = t.FLIPPED_ALIAS_KEYS.Flow.concat([ "ArrayPattern", "ClassDeclaration", "ClassExpression", "FunctionDeclaration", "FunctionExpression", "Identifier", "ObjectPattern", "RestElement" ]); var visitorKeysMap = Object.keys(t.VISITOR_KEYS).reduce(function(acc, key) { var value = t.VISITOR_KEYS[key]; if (flowFlippedAliasKeys.indexOf(value) === -1) { acc[key] = value; } return acc; }, {}); var propertyTypes = { // loops callProperties: { type: "loop", values: ["value"] }, indexers: { type: "loop", values: ["key", "value"] }, properties: { type: "loop", values: ["argument", "value"] }, types: { type: "loop" }, params: { type: "loop" }, // single property argument: { type: "single" }, elementType: { type: "single" }, qualification: { type: "single" }, rest: { type: "single" }, returnType: { type: "single" }, // others typeAnnotation: { type: "typeAnnotation" }, typeParameters: { type: "typeParameters" }, id: { type: "id" } }; function visitTypeAnnotation(node) { // get property to check (params, id, etc...) var visitorValues = visitorKeysMap[node.type]; if (!visitorValues) { return; } // can have multiple properties for (var i = 0; i < visitorValues.length; i++) { var visitorValue = visitorValues[i]; var propertyType = propertyTypes[visitorValue]; var nodeProperty = node[visitorValue]; // check if property or type is defined if (propertyType == null || nodeProperty == null) { continue; } if (propertyType.type === "loop") { for (var j = 0; j < nodeProperty.length; j++) { if (Array.isArray(propertyType.values)) { for (var k = 0; k < propertyType.values.length; k++) { var loopPropertyNode = nodeProperty[j][propertyType.values[k]]; if (loopPropertyNode) { checkIdentifierOrVisit.call(this, loopPropertyNode); } } } else { checkIdentifierOrVisit.call(this, nodeProperty[j]); } } } else if (propertyType.type === "single") { checkIdentifierOrVisit.call(this, nodeProperty); } else if (propertyType.type === "typeAnnotation") { visitTypeAnnotation.call(this, node.typeAnnotation); } else if (propertyType.type === "typeParameters") { for (var l = 0; l < node.typeParameters.params.length; l++) { checkIdentifierOrVisit.call(this, node.typeParameters.params[l]); } } else if (propertyType.type === "id") { if (node.id.type === "Identifier") { checkIdentifierOrVisit.call(this, node.id); } else { visitTypeAnnotation.call(this, node.id); } } } } function checkIdentifierOrVisit(node) { if (node.typeAnnotation) { visitTypeAnnotation.call(this, node.typeAnnotation); } else if (node.type === "Identifier") { this.visit(node); } else { visitTypeAnnotation.call(this, node); } } function nestTypeParamScope(manager, node) { var parentScope = manager.__currentScope; var scope = new escope.Scope(manager, "type-parameters", parentScope, node, false); manager.__nestScope(scope); for (var j = 0; j < node.typeParameters.params.length; j++) { var name = node.typeParameters.params[j]; scope.__define(name, new Definition("TypeParameter", name, name)); if (name.typeAnnotation) { checkIdentifierOrVisit.call(this, name); } } scope.__define = function() { return parentScope.__define.apply(parentScope, arguments); }; return scope; } // visit decorators that are in: ClassDeclaration / ClassExpression var visitClass = referencer.prototype.visitClass; referencer.prototype.visitClass = function(node) { visitDecorators.call(this, node); var typeParamScope; if (node.typeParameters) { typeParamScope = nestTypeParamScope.call(this, this.scopeManager, node); } // visit flow type: ClassImplements if (node.implements) { for (var i = 0; i < node.implements.length; i++) { checkIdentifierOrVisit.call(this, node.implements[i]); } } if (node.superTypeParameters) { for (var k = 0; k < node.superTypeParameters.params.length; k++) { checkIdentifierOrVisit.call(this, node.superTypeParameters.params[k]); } } visitClass.call(this, node); if (typeParamScope) { this.close(node); } }; // visit decorators that are in: Property / MethodDefinition var visitProperty = referencer.prototype.visitProperty; referencer.prototype.visitProperty = function(node) { if (node.value && node.value.type === "TypeCastExpression") { visitTypeAnnotation.call(this, node.value); } visitDecorators.call(this, node); visitProperty.call(this, node); }; // visit ClassProperty as a Property. referencer.prototype.ClassProperty = function(node) { if (node.typeAnnotation) { visitTypeAnnotation.call(this, node.typeAnnotation); } this.visitProperty(node); }; // visit flow type in FunctionDeclaration, FunctionExpression, ArrowFunctionExpression var visitFunction = referencer.prototype.visitFunction; referencer.prototype.visitFunction = function(node) { var typeParamScope; if (node.typeParameters) { typeParamScope = nestTypeParamScope.call(this, this.scopeManager, node); } if (node.returnType) { checkIdentifierOrVisit.call(this, node.returnType); } // only visit if function parameters have types if (node.params) { for (var i = 0; i < node.params.length; i++) { var param = node.params[i]; if (param.typeAnnotation) { checkIdentifierOrVisit.call(this, param); } else if (t.isAssignmentPattern(param)) { if (param.left.typeAnnotation) { checkIdentifierOrVisit.call(this, param.left); } } } } // set ArrayPattern/ObjectPattern visitor keys back to their original. otherwise // escope will traverse into them and include the identifiers within as declarations estraverse.VisitorKeys.ObjectPattern = ["properties"]; estraverse.VisitorKeys.ArrayPattern = ["elements"]; visitFunction.call(this, node); // set them back to normal... estraverse.VisitorKeys.ObjectPattern = t.VISITOR_KEYS.ObjectPattern; estraverse.VisitorKeys.ArrayPattern = t.VISITOR_KEYS.ArrayPattern; if (typeParamScope) { this.close(node); } }; // visit flow type in VariableDeclaration var variableDeclaration = referencer.prototype.VariableDeclaration; referencer.prototype.VariableDeclaration = function(node) { if (node.declarations) { for (var i = 0; i < node.declarations.length; i++) { var id = node.declarations[i].id; var typeAnnotation = id.typeAnnotation; if (typeAnnotation) { checkIdentifierOrVisit.call(this, typeAnnotation); } } } variableDeclaration.call(this, node); }; function createScopeVariable (node, name) { this.currentScope().variableScope.__define(name, new Definition( "Variable", name, node, null, null, null ) ); } referencer.prototype.InterfaceDeclaration = function(node) { createScopeVariable.call(this, node, node.id); var typeParamScope; if (node.typeParameters) { typeParamScope = nestTypeParamScope.call(this, this.scopeManager, node); } // TODO: Handle mixins for (var i = 0; i < node.extends.length; i++) { visitTypeAnnotation.call(this, node.extends[i]); } visitTypeAnnotation.call(this, node.body); if (typeParamScope) { this.close(node); } }; referencer.prototype.TypeAlias = function(node) { createScopeVariable.call(this, node, node.id); var typeParamScope; if (node.typeParameters) { typeParamScope = nestTypeParamScope.call(this, this.scopeManager, node); } if (node.right) { visitTypeAnnotation.call(this, node.right); } if (typeParamScope) { this.close(node); } }; referencer.prototype.DeclareModule = referencer.prototype.DeclareFunction = referencer.prototype.DeclareVariable = referencer.prototype.DeclareClass = function(node) { if (node.id) { createScopeVariable.call(this, node, node.id); } var typeParamScope; if (node.typeParameters) { typeParamScope = nestTypeParamScope.call(this, this.scopeManager, node); } if (typeParamScope) { this.close(node); } }; } exports.parse = function (code, options) { options = options || {}; eslintOptions.ecmaVersion = options.ecmaVersion = options.ecmaVersion || 6; eslintOptions.sourceType = options.sourceType = options.sourceType || "module"; eslintOptions.allowImportExportEverywhere = options.allowImportExportEverywhere = options.allowImportExportEverywhere || false; if (options.sourceType === "module") { eslintOptions.globalReturn = false; } else { delete eslintOptions.globalReturn; } if (!hasPatched) { hasPatched = true; try { monkeypatch(getModules()); } catch (err) { console.error(err.stack); process.exit(1); } } return exports.parseNoPatch(code, options); }; exports.parseNoPatch = function (code, options) { var opts = { codeFrame: options.hasOwnProperty("codeFrame") ? options.codeFrame : true, sourceType: options.sourceType, allowImportExportEverywhere: options.allowImportExportEverywhere, // consistent with espree allowReturnOutsideFunction: true, allowSuperOutsideMethod: true, plugins: [ "flow", "jsx", "asyncFunctions", "asyncGenerators", "classConstructorCall", "classProperties", "decorators", "doExpressions", "exponentiationOperator", "exportExtensions", "functionBind", "functionSent", "objectRestSpread", "trailingFunctionCommas", "dynamicImport" ] }; var ast; try { ast = parse(code, opts); } catch (err) { if (err instanceof SyntaxError) { err.lineNumber = err.loc.line; err.column = err.loc.column; if (opts.codeFrame) { err.lineNumber = err.loc.line; err.column = err.loc.column + 1; // remove trailing "(LINE:COLUMN)" acorn message and add in esprima syntax error message start err.message = "Line " + err.lineNumber + ": " + err.message.replace(/ \((\d+):(\d+)\)$/, "") + // add codeframe "\n\n" + codeFrame(code, err.lineNumber, err.column, { highlightCode: true }); } } throw err; } babylonToEspree(ast, traverse, tt, code); return ast; }; babel-eslint-7.2.3/package.json000066400000000000000000000023521307647305300163640ustar00rootroot00000000000000{ "name": "babel-eslint", "version": "7.2.3", "description": "Custom parser for ESLint", "main": "index.js", "files": [ "index.js", "babylon-to-espree" ], "repository": { "type": "git", "url": "https://github.com/babel/babel-eslint.git" }, "dependencies": { "babel-code-frame": "^6.22.0", "babel-traverse": "^6.23.1", "babel-types": "^6.23.0", "babylon": "^6.17.0" }, "scripts": { "test": "npm run lint && npm run test-only", "test-only": "mocha", "lint": "eslint index.js babylon-to-espree test", "fix": "eslint index.js babylon-to-espree test --fix", "preversion": "npm test", "changelog": "git log `git describe --tags --abbrev=0`..HEAD --pretty=format:' * %s (%an)' | grep -v 'Merge pull request'" }, "author": "Sebastian McKenzie ", "license": "MIT", "engines": { "node": ">=4" }, "bugs": { "url": "https://github.com/babel/babel-eslint/issues" }, "homepage": "https://github.com/babel/babel-eslint", "devDependencies": { "babel-eslint": "^7.0.0", "dedent": "^0.7.0", "eslint": "^3.18.0", "eslint-config-babel": "^6.0.0", "eslint-plugin-flowtype": "^2.30.3", "espree": "^3.4.0", "mocha": "^3.0.0" } } babel-eslint-7.2.3/test/000077500000000000000000000000001307647305300150535ustar00rootroot00000000000000babel-eslint-7.2.3/test/babel-eslint.js000066400000000000000000000266361307647305300177670ustar00rootroot00000000000000var assert = require("assert"); var babelEslint = require(".."); var espree = require("espree"); var util = require("util"); var unpad = require("dedent"); // Checks if the source ast implements the target ast. Ignores extra keys on source ast function assertImplementsAST(target, source, path) { if (!path) { path = []; } function error(text) { var err = new Error(`At ${path.join(".")}: ${text}:`); err.depth = path.length + 1; throw err; } var typeA = target === null ? "null" : typeof target; var typeB = source === null ? "null" : typeof source; if (typeA !== typeB) { error(`have different types (${typeA} !== ${typeB}) (${target} !== ${source})`); } else if (typeA === "object") { var keysTarget = Object.keys(target); for (var i in keysTarget) { var key = keysTarget[i]; path.push(key); assertImplementsAST(target[key], source[key], path); path.pop(); } } else if (target !== source) { error(`are different (${JSON.stringify(target)} !== ${JSON.stringify(source)})`); } } function lookup(obj, keypath, backwardsDepth) { if (!keypath) { return obj; } return keypath.split(".").slice(0, -1 * backwardsDepth) .reduce((base, segment) => { return base && base[segment], obj; }); } function parseAndAssertSame(code) { var esAST = espree.parse(code, { ecmaFeatures: { // enable JSX parsing jsx: true, // enable return in global scope globalReturn: true, // enable implied strict mode (if ecmaVersion >= 5) impliedStrict: true, // allow experimental object rest/spread experimentalObjectRestSpread: true }, tokens: true, loc: true, range: true, comment: true, attachComment: true, ecmaVersion: 8, sourceType: "module" }); var babylonAST = babelEslint.parse(code); try { assertImplementsAST(esAST, babylonAST); } catch (err) { var traversal = err.message.slice(3, err.message.indexOf(":")); if (esAST.tokens) { delete esAST.tokens; } if (babylonAST.tokens) { delete babylonAST.tokens; } err.message += unpad(` espree: ${util.inspect(lookup(esAST, traversal, 2), { depth: err.depth, colors: true })} babel-eslint: ${util.inspect(lookup(babylonAST, traversal, 2), { depth: err.depth, colors: true })} `); throw err; } // assert.equal(esAST, babylonAST); } describe("babylon-to-esprima", () => { describe("templates", () => { it("empty template string", () => { parseAndAssertSame("``"); }); it("template string", () => { parseAndAssertSame("`test`"); }); it("template string using $", () => { parseAndAssertSame("`$`"); }); it("template string with expression", () => { parseAndAssertSame("`${a}`"); }); it("template string with multiple expressions", () => { parseAndAssertSame("`${a}${b}${c}`"); }); it("template string with expression and strings", () => { parseAndAssertSame("`a${a}a`"); }); it("template string with binary expression", () => { parseAndAssertSame("`a${a + b}a`"); }); it("tagged template", () => { parseAndAssertSame("jsx``"); }); it("tagged template with expression", () => { parseAndAssertSame("jsx``"); }); it("tagged template with new operator", () => { parseAndAssertSame("new raw`42`"); }); it("template with nested function/object", () => { parseAndAssertSame("`outer${{x: {y: 10}}}bar${`nested${function(){return 1;}}endnest`}end`"); }); it("template with braces inside and outside of template string #96", () => { parseAndAssertSame("if (a) { var target = `{}a:${webpackPort}{}}}}`; } else { app.use(); }"); }); it("template also with braces #96", () => { parseAndAssertSame( unpad(` export default function f1() { function f2(foo) { const bar = 3; return \`\${foo} \${bar}\`; } return f2; } `) ); }); it("template with destructuring #31", () => { parseAndAssertSame( unpad(` module.exports = { render() { var {name} = this.props; return Math.max(null, \`Name: \${name}, Name: \${name}\`); } }; `) ); }); }); it("simple expression", () => { parseAndAssertSame("a = 1"); }); it("class declaration", () => { parseAndAssertSame("class Foo {}"); }); it("class expression", () => { parseAndAssertSame("var a = class Foo {}"); }); it("jsx expression", () => { parseAndAssertSame(""); }); it("jsx expression with 'this' as identifier", () => { parseAndAssertSame(""); }); it("jsx expression with a dynamic attribute", () => { parseAndAssertSame(""); }); it("jsx expression with a member expression as identifier", () => { parseAndAssertSame(""); }); it("jsx expression with spread", () => { parseAndAssertSame("var myDivElement =
;"); }); it("empty jsx text", () => { parseAndAssertSame(""); }); it("jsx text with content", () => { parseAndAssertSame("Hello, world!"); }); it("nested jsx", () => { parseAndAssertSame("
\n

Wat

\n
"); }); it("default import", () => { parseAndAssertSame("import foo from \"foo\";"); }); it("import specifier", () => { parseAndAssertSame("import { foo } from \"foo\";"); }); it("import specifier with name", () => { parseAndAssertSame("import { foo as bar } from \"foo\";"); }); it("import bare", () => { parseAndAssertSame("import \"foo\";"); }); it("export default class declaration", () => { parseAndAssertSame("export default class Foo {}"); }); it("export default class expression", () => { parseAndAssertSame("export default class {}"); }); it("export default function declaration", () => { parseAndAssertSame("export default function Foo() {}"); }); it("export default function expression", () => { parseAndAssertSame("export default function () {}"); }); it("export all", () => { parseAndAssertSame("export * from \"foo\";"); }); it("export named", () => { parseAndAssertSame("export { foo };"); }); it("export named alias", () => { parseAndAssertSame("export { foo as bar };"); }); it.skip("empty program with line comment", () => { parseAndAssertSame("// single comment"); }); it.skip("empty program with block comment", () => { parseAndAssertSame(" /* multiline\n * comment\n*/"); }); it("line comments", () => { parseAndAssertSame( unpad(` // single comment var foo = 15; // comment next to statement // second comment after statement `) ); }); it("block comments", () => { parseAndAssertSame( unpad(` /* single comment */ var foo = 15; /* comment next to statement */ /* * multiline * comment */ `) ); }); it("block comments #124", () => { parseAndAssertSame( unpad(` React.createClass({ render() { // return ( //
// ); // <-- this is the line that is reported } }); `) ); }); it("null", () => { parseAndAssertSame("null"); }); it("boolean", () => { parseAndAssertSame("if (true) {} else if (false) {}"); }); it("regexp", () => { parseAndAssertSame("/affix-top|affix-bottom|affix|[a-z]/"); }); it("regexp in a template string", () => { parseAndAssertSame("`${/\\d/.exec(\"1\")[0]}`"); }); it("first line is empty", () => { parseAndAssertSame("\nimport Immutable from \"immutable\";"); }); it("empty", () => { parseAndAssertSame(""); }); it("jsdoc", () => { parseAndAssertSame( unpad(` /** * @param {object} options * @return {number} */ const test = function({ a, b, c }) { return a + b + c; }; module.exports = test; `) ); }); it("empty block with comment", () => { parseAndAssertSame( unpad(` function a () { try { b(); } catch (e) { // asdf } } `) ); }); describe("babel 6 tests", () => { it("MethodDefinition", () => { parseAndAssertSame( unpad(` export default class A { a() {} } `) ); }); it("MethodDefinition 2", () => { parseAndAssertSame("export default class Bar { get bar() { return 42; }}"); }); it("ClassMethod", () => { parseAndAssertSame( unpad(` class A { constructor() { } } `) ); }); it("ClassMethod multiple params", () => { parseAndAssertSame( unpad(` class A { constructor(a, b, c) { } } `) ); }); it("ClassMethod multiline", () => { parseAndAssertSame( unpad(` class A { constructor ( a, b, c ) { } } `) ); }); it("ClassMethod oneline", () => { parseAndAssertSame("class A { constructor(a, b, c) {} }"); }); it("ObjectMethod", () => { parseAndAssertSame( unpad(` var a = { b(c) { } } `) ); }); it("do not allow import export everywhere", () => { assert.throws(() => { parseAndAssertSame("function F() { import a from \"a\"; }"); }, /SyntaxError: 'import' and 'export' may only appear at the top level/); }); it("return outside function", () => { parseAndAssertSame("return;"); }); it("super outside method", () => { parseAndAssertSame("function F() { super(); }"); }); it("StringLiteral", () => { parseAndAssertSame(""); parseAndAssertSame(""); parseAndAssertSame("a"); }); it("getters and setters", () => { parseAndAssertSame("class A { get x ( ) { ; } }"); parseAndAssertSame( unpad(` class A { get x( ) { ; } } `) ); parseAndAssertSame("class A { set x (a) { ; } }"); parseAndAssertSame( unpad(` class A { set x(a ) { ; } } `) ); parseAndAssertSame( unpad(` var B = { get x () { return this.ecks; }, set x (ecks) { this.ecks = ecks; } }; `) ); }); it("RestOperator", () => { parseAndAssertSame("var { a, ...b } = c"); parseAndAssertSame("var [ a, ...b ] = c"); parseAndAssertSame("var a = function (...b) {}"); }); it("SpreadOperator", () => { parseAndAssertSame("var a = { b, ...c }"); parseAndAssertSame("var a = [ a, ...b ]"); parseAndAssertSame("var a = sum(...b)"); }); it("Async/Await", () => { parseAndAssertSame( unpad(` async function a() { await 1; } `) ); }); }); }); babel-eslint-7.2.3/test/fixtures/000077500000000000000000000000001307647305300167245ustar00rootroot00000000000000babel-eslint-7.2.3/test/fixtures/rules/000077500000000000000000000000001307647305300200565ustar00rootroot00000000000000babel-eslint-7.2.3/test/fixtures/rules/strict/000077500000000000000000000000001307647305300213665ustar00rootroot00000000000000babel-eslint-7.2.3/test/fixtures/rules/strict/function-with.js000066400000000000000000000000421307647305300245160ustar00rootroot00000000000000function x () { "use strict"; } babel-eslint-7.2.3/test/fixtures/rules/strict/function-without.js000066400000000000000000000000211307647305300252430ustar00rootroot00000000000000function x () {} babel-eslint-7.2.3/test/fixtures/rules/strict/global-with-function-with.js000066400000000000000000000000611307647305300267260ustar00rootroot00000000000000"use strict"; function x () { "use strict"; } babel-eslint-7.2.3/test/fixtures/rules/strict/global-with-function-without.js000066400000000000000000000000401307647305300274530ustar00rootroot00000000000000"use strict"; function x () {} babel-eslint-7.2.3/test/fixtures/rules/strict/global-with.js000066400000000000000000000003371307647305300241400ustar00rootroot00000000000000"use strict"; /* The empty statement is intentional. As of now, ESLint won't enforce string: [2, "global"] on a program with an empty body. A test for that without massaging the AST to ESlint's input format should fail. */ babel-eslint-7.2.3/test/fixtures/rules/strict/none.js000066400000000000000000000000321307647305300226560ustar00rootroot00000000000000"no use strict anywhere"; babel-eslint-7.2.3/test/fixtures/rules/syntax-error.js000066400000000000000000000000731307647305300230710ustar00rootroot00000000000000class ClassName { constructor() { }, aMethod() {} } babel-eslint-7.2.3/test/integration.js000066400000000000000000000146001307647305300177350ustar00rootroot00000000000000var assert = require("assert"); var eslint = require("eslint"); var fs = require("fs"); var path = require("path"); var paths = { fixtures: path.join(__dirname, "fixtures", "rules"), }; var encoding = "utf8"; var errorLevel = 2; var baseEslintOpts = { parser: require.resolve(".."), parserOptions: { sourceType: "script" } }; /** * Load a fixture and run eslint.linter.verify() on it. * Pass the return value to done(). * @param object opts * @param function done */ function lint (opts, done) { readFixture(opts.fixture, (err, src) => { if (err) return done(err); done(null, eslint.linter.verify(src, opts.eslint)); }); } /** * Read a fixture file, passing the content to done(). * @param string|array id * @param function done */ function readFixture (id, done) { if (Array.isArray(id)) id = path.join.apply(path, id); if (!path.extname(id)) id += ".js"; fs.readFile( path.join(paths.fixtures, id), encoding, done ); } // readFixture describe("Rules:", () => { describe("`strict`", strictSuite); }); // describe function strictSuite () { var ruleId = "strict"; describe("when set to 'never'", () => { var eslintOpts = Object.assign({}, baseEslintOpts, { rules: {}, }); eslintOpts.rules[ruleId] = [errorLevel, "never"]; ["global-with", "function-with"].forEach((fixture) => { it(`should error on ${fixture.match(/^[^-]+/)[0]} directive`, (done) => { lint({ fixture: ["strict", fixture], eslint: eslintOpts, }, (err, report) => { if (err) return done(err); assert(report[0].ruleId === ruleId); done(); }); } ); // it }); }); // describe describe("when set to 'global'", () => { var eslintOpts = Object.assign({}, baseEslintOpts, { rules: {} }); eslintOpts.rules[ruleId] = [errorLevel, "global"]; it("shouldn't error on single global directive", (done) => { lint({ fixture: ["strict", "global-with"], eslint: eslintOpts, }, (err, report) => { if (err) return done(err); assert(!report.length); done(); }); }); // it it("should error twice on global directive: no and function directive: yes", (done) => { lint({ fixture: ["strict", "function-with"], eslint: eslintOpts, }, (err, report) => { if (err) return done(err); [0, 1].forEach((i) => { assert(report[i].ruleId === ruleId); }); done(); }); }); // it it("should error on function directive", (done) => { lint({ fixture: ["strict", "global-with-function-with"], eslint: eslintOpts, }, (err, report) => { if (err) return done(err); assert(report[0].ruleId === ruleId); // This is to make sure the test fails prior to adapting Babel AST // directive representation to ESLint format. Otherwise it reports an // error for missing global directive that masquerades as the expected // result of the previous assertion. assert(report[0].nodeType !== "Program"); done(); }); }); // it it("should error on no directive", (done) => { lint({ fixture: ["strict", "none"], eslint: eslintOpts, }, (err, report) => { if (err) return done(err); assert(report[0].ruleId === ruleId); done(); }); }); // it }); // describe describe("when set to 'function'", () => { var eslintOpts = Object.assign({}, baseEslintOpts, { rules: {} }); eslintOpts.rules[ruleId] = [errorLevel, "function"]; it("shouldn't error on single function directive", (done) => { lint({ fixture: ["strict", "function-with"], eslint: eslintOpts, }, (err, report) => { if (err) return done(err); assert(!report.length); done(); }); }); // it it("should error twice on function directive: no and global directive: yes", (done) => { lint({ fixture: ["strict", "global-with-function-without"], eslint: eslintOpts, }, (err, report) => { if (err) return done(err); [0, 1].forEach((i) => { assert(report[i].ruleId === ruleId); }); done(); }); }); // it it("should error on only global directive", (done) => { lint({ fixture: ["strict", "global-with"], eslint: eslintOpts, }, (err, report) => { if (err) return done(err); assert(report[0].ruleId === ruleId); done(); }); }); // it it("should error on extraneous global directive", (done) => { lint({ fixture: ["strict", "global-with-function-with"], eslint: eslintOpts, }, (err, report) => { if (err) return done(err); assert(report[0].ruleId === ruleId); assert(report[0].nodeType.indexOf("Function") === -1); done(); }); }); // it }); // describe describe("When \"codeFrame\"", () => { // Strip chalk colors, these are not relevant for the test const stripAnsi = (str) => str.replace( /[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]/g, "" ); it("should display codeFrame when option is absent", (done) => { lint({ fixture: ["syntax-error"], eslint: baseEslintOpts }, (err, report) => { if (err) return done(err); assert(stripAnsi(report[0].message).indexOf("^\n 5 |") > -1); done(); }); }); it("should display codeFrame when option is true", (done) => { lint({ fixture: ["syntax-error"], eslint: Object.assign({}, baseEslintOpts, { parserOptions: { codeFrame: true } }) }, (err, report) => { if (err) return done(err); assert(stripAnsi(report[0].message).indexOf("^\n 5 |") > -1); done(); }); }); it("should not display codeFrame when option is false", (done) => { lint({ fixture: ["syntax-error"], eslint: Object.assign({}, baseEslintOpts, { parserOptions: { codeFrame: false } }) }, (err, report) => { if (err) return done(err); assert(stripAnsi(report[0].message).indexOf("^\n 5 |") === -1); done(); }); }); }); } babel-eslint-7.2.3/test/non-regression.js000066400000000000000000001224051307647305300203650ustar00rootroot00000000000000/*eslint-env mocha*/ "use strict"; var eslint = require("eslint"); var unpad = require("dedent"); function verifyAndAssertMessages(code, rules, expectedMessages, sourceType, overrideConfig) { var config = { parser: require.resolve(".."), rules, env: { node: true, es6: true }, parserOptions: { ecmaVersion: 8, ecmaFeatures: { jsx: true, experimentalObjectRestSpread: true, globalReturn: true }, sourceType } }; if (overrideConfig) { for (var key in overrideConfig) { config[key] = overrideConfig[key]; } } var messages = eslint.linter.verify(code, config); if (messages.length !== expectedMessages.length) { throw new Error(`Expected ${expectedMessages.length} message(s), got ${messages.length}\n${JSON.stringify(messages, null, 2)}`); } messages.forEach((message, i) => { var formatedMessage = `${message.line}:${message.column} ${message.message}${(message.ruleId ? ` ${message.ruleId}` : "")}`; if (formatedMessage !== expectedMessages[i]) { throw new Error( unpad(` Message ${i} does not match: Expected: ${expectedMessages[i]} Actual: ${formatedMessage} `) ); } }); } describe("verify", () => { it("arrow function support (issue #1)", () => { verifyAndAssertMessages( "describe('stuff', () => {});", {}, [] ); }); it("EOL validation (issue #2)", () => { verifyAndAssertMessages( "module.exports = \"something\";", { "eol-last": 1, "semi": 1 }, [ "1:30 Newline required at end of file but not found. eol-last" ] ); }); xit("Readable error messages (issue #3)", () => { verifyAndAssertMessages( "{ , res }", {}, [ "1:3 Parsing error: Unexpected token" ] ); }); it("Modules support (issue #5)", () => { verifyAndAssertMessages( unpad(` import Foo from 'foo'; export default Foo; export const c = 'c'; export class Store {} `), {}, [] ); }); it("Rest parameters (issue #7)", () => { verifyAndAssertMessages( "function foo(...args) { return args; }", { "no-undef": 1 }, [] ); }); it("Exported classes should be used (issue #8)", () => { verifyAndAssertMessages( "class Foo {} module.exports = Foo;", { "no-unused-vars": 1 }, [] ); }); it("super keyword in class (issue #10)", () => { verifyAndAssertMessages( "class Foo { constructor() { super() } }", { "no-undef": 1 }, [] ); }); it("Rest parameter in destructuring assignment (issue #11)", () => { verifyAndAssertMessages( "const [a, ...rest] = ['1', '2', '3']; module.exports = rest;", { "no-undef": 1 }, [] ); }); it("JSX attribute names marked as variables (issue #12)", () => { verifyAndAssertMessages( "module.exports =
", { "no-undef": 1 }, [] ); }); it("Multiple destructured assignment with compound properties (issue #16)", () => { verifyAndAssertMessages( "module.exports = { ...a.a, ...a.b };", { "no-dupe-keys": 1 }, [] ); }); it("Arrow function with non-block bodies (issue #20)", () => { verifyAndAssertMessages( "\"use strict\"; () => 1", { "strict": [1, "global"] }, [], "script" ); }); it("#242", () => { verifyAndAssertMessages( "\"use strict\"; asdf;", { "no-irregular-whitespace": 1 }, [], {} ); }); it("await keyword (issue #22)", () => { verifyAndAssertMessages( "async function foo() { await bar(); }", { "no-unused-expressions": 1 }, [] ); }); it("arrow functions (issue #27)", () => { verifyAndAssertMessages( "[1, 2, 3].map(i => i * 2);", { "func-names": 1, "space-before-blocks": 1 }, [] ); }); it("comment with padded-blocks (issue #33)", () => { verifyAndAssertMessages( unpad(` if (a) { // i'm a comment! let b = c } `), { "padded-blocks": [1, "never"] }, [] ); }); describe("flow", () => { it("check regular function", () => { verifyAndAssertMessages( "function a(b, c) { b += 1; c += 1; return b + c; } a;", { "no-unused-vars": 1, "no-undef": 1 }, [] ); }); it("type alias", () => { verifyAndAssertMessages( "type SomeNewType = any;", { "no-undef": 1 }, [] ); }); it("type cast expression #102", () => { verifyAndAssertMessages( "for (let a of (a: Array)) {}", {}, [] ); }); it("multiple nullable type annotations and return #108", () => { verifyAndAssertMessages( unpad(` import type Foo from 'foo'; import type Foo2 from 'foo'; import type Foo3 from 'foo'; function log(foo: ?Foo, foo2: ?Foo2): ?Foo3 { console.log(foo, foo2); } log(1, 2); `), { "no-unused-vars": 1, "no-undef": 1 }, [] ); }); it("interface declaration", () => { verifyAndAssertMessages( unpad(` interface Foo {}; interface Bar { foo: Foo, }; `), { "no-unused-vars": 1, "no-undef": 1 }, [ "2:11 'Bar' is defined but never used. no-unused-vars" ] ); }); it("type parameter bounds (classes)", () => { verifyAndAssertMessages( unpad(` import type {Foo, Foo2} from 'foo'; import Base from 'base'; class Log extends Base { messages: {[T1]: T2}; } new Log(); `), { "no-unused-vars": 1, "no-undef": 1 }, [ "3:34 'T4' is defined but never used. no-unused-vars" ] ); }); it("type parameter scope (classes)", () => { verifyAndAssertMessages( unpad(` T; class Foo {} T; new Foo(); `), { "no-unused-vars": 1, "no-undef": 1 }, [ "1:1 'T' is not defined. no-undef", "2:11 'T' is defined but never used. no-unused-vars", "3:1 'T' is not defined. no-undef" ] ); }); it("type parameter bounds (interfaces)", () => { verifyAndAssertMessages( unpad(` import type {Foo, Foo2, Bar} from ''; interface Log extends Bar { messages: {[T1]: T2}; } `), { "no-unused-vars": 1, "no-undef": 1 }, [ "2:11 'Log' is defined but never used. no-unused-vars", "2:38 'T4' is defined but never used. no-unused-vars" ] ); }); it("type parameter scope (interfaces)", () => { verifyAndAssertMessages( unpad(` T; interface Foo {}; T; Foo; `), { "no-unused-vars": 1, "no-undef": 1 }, [ "1:1 'T' is not defined. no-undef", "2:15 'T' is defined but never used. no-unused-vars", "3:1 'T' is not defined. no-undef" ] ); }); it("type parameter bounds (type aliases)", () => { verifyAndAssertMessages( unpad(` import type {Foo, Foo2, Foo3} from 'foo'; type Log = { messages: {[T1]: T2}; delay: Foo3; }; `), { "no-unused-vars": 1, "no-undef": 1 }, [ "2:6 'Log' is defined but never used. no-unused-vars", "2:29 'T3' is defined but never used. no-unused-vars" ] ); }); it("type parameter scope (type aliases)", () => { verifyAndAssertMessages( unpad(` T; type Foo = {}; T; Foo; `), { "no-unused-vars": 1, "no-undef": 1 }, [ "1:1 'T' is not defined. no-undef", "2:10 'T' is defined but never used. no-unused-vars", "3:1 'T' is not defined. no-undef" ] ); }); it("type parameter bounds (functions)", () => { verifyAndAssertMessages( unpad(` import type Foo from 'foo'; import type Foo2 from 'foo'; function log(a: T1, b: T2): T3 { return a + b; } log(1, 2); `), { "no-unused-vars": 1, "no-undef": 1 }, [ "3:37 'T4' is defined but never used. no-unused-vars" ] ); }); it("type parameter scope (functions)", () => { verifyAndAssertMessages( unpad(` T; function log() {} T; log; `), { "no-unused-vars": 1, "no-undef": 1 }, [ "1:1 'T' is not defined. no-undef", "2:14 'T' is defined but never used. no-unused-vars", "3:1 'T' is not defined. no-undef" ] ); }); it("nested type annotations", () => { verifyAndAssertMessages( unpad(` import type Foo from 'foo'; function foo(callback: () => Foo) { return callback(); } foo(); `), { "no-unused-vars": 1, "no-undef": 1 }, [] ); }); it("type in var declaration", () => { verifyAndAssertMessages( unpad(` import type Foo from 'foo'; var x: Foo = 1; x; `), { "no-unused-vars": 1, "no-undef": 1 }, [] ); }); it("object type annotation", () => { verifyAndAssertMessages( unpad(` import type Foo from 'foo'; var a: {numVal: Foo}; a; `), { "no-unused-vars": 1, "no-undef": 1 }, [] ); }); it("object property types", () => { verifyAndAssertMessages( unpad(` import type Foo from 'foo'; import type Foo2 from 'foo'; var a = { circle: (null : ?{ setNativeProps(props: Foo): Foo2 }) }; a; `), { "no-unused-vars": 1, "no-undef": 1 }, [] ); }); it("namespaced types", () => { verifyAndAssertMessages( unpad(` var React = require('react-native'); var b = { openExternalExample: (null: ?React.Component) }; var c = { render(): React.Component {} }; b; c; `), { "no-unused-vars": 1, "no-undef": 1 }, [] ); }); it("ArrayTypeAnnotation", () => { verifyAndAssertMessages( unpad(` import type Foo from 'foo'; var x: Foo[]; x; `), { "no-unused-vars": 1, "no-undef": 1 }, [] ); }); it("ClassImplements", () => { verifyAndAssertMessages( unpad(` import type Bar from 'foo'; export default class Foo implements Bar {} `), { "no-unused-vars": 1, "no-undef": 1 }, [] ); }); it("type alias creates declaration + usage", () => { verifyAndAssertMessages( unpad(` type Foo = any; var x : Foo = 1; x; `), { "no-unused-vars": 1, "no-undef": 1 }, [] ); }); it("type alias with type parameters", () => { verifyAndAssertMessages( unpad(` import type Bar from 'foo'; import type Foo3 from 'foo'; type Foo = Bar var x : Foo = 1; x; `), { "no-unused-vars": 1, "no-undef": 1 }, [] ); }); it("export type alias", () => { verifyAndAssertMessages( unpad(` import type Foo2 from 'foo'; export type Foo = Foo2; `), { "no-unused-vars": 1, "no-undef": 1 }, [] ); }); it("polymorphpic types #109", () => { verifyAndAssertMessages( "export default function groupByEveryN(array: Array, n: number): Array> { n; }", { "no-unused-vars": 1, "no-undef": 1 }, [] ); }); it("types definition from import", () => { verifyAndAssertMessages( unpad(` import type Promise from 'bluebird'; type Operation = () => Promise; x: Operation; `), { "no-unused-vars": 1, "no-undef": 1 }, [] ); }); it("polymorphpic/generic types for class #123", () => { verifyAndAssertMessages( unpad(` class Box { value: T; } var box = new Box(); console.log(box.value); `), { "no-unused-vars": 1, "no-undef": 1 }, [] ); }); it("polymorphpic/generic types for function #123", () => { verifyAndAssertMessages( unpad(` export function identity(value) { var a: T = value; a; } `), { "no-unused-vars": 1, "no-undef": 1 }, [] ); }); it("polymorphpic/generic types for type alias #123", () => { verifyAndAssertMessages( unpad(` import Bar from './Bar'; type Foo = Bar; var x: Foo = 1; console.log(x); `), { "no-unused-vars": 1, "no-undef": 1 }, [] ); }); it("polymorphpic/generic types - outside of fn scope #123", () => { verifyAndAssertMessages( unpad(` export function foo(value) { value; }; var b: T = 1; b; `), { "no-unused-vars": 1, "no-undef": 1 }, [ "1:21 'T' is defined but never used. no-unused-vars", "2:8 'T' is not defined. no-undef" ] ); }); it("polymorphpic/generic types - extending unknown #123", () => { verifyAndAssertMessages( unpad(` import Bar from 'bar'; export class Foo extends Bar {} `), { "no-unused-vars": 1, "no-undef": 1 }, [ "2:30 'T' is not defined. no-undef" ] ); }); it("support declarations #132", () => { verifyAndAssertMessages( unpad(` declare class A { static () : number } declare module B { declare var x: number; } declare function foo(): void; declare var bar A; B; foo(); bar; `), { "no-undef": 1, "no-unused-vars": 1 }, [] ); }); it("supports type spreading", () => { verifyAndAssertMessages( unpad(` type U = {}; type T = {a: number, ...U, ...V}; `), { "no-undef": 1, "no-unused-vars": 1 }, [ "2:6 'T' is defined but never used. no-unused-vars", "2:31 'V' is not defined. no-undef" ] ); }); it("1", () => { verifyAndAssertMessages( unpad(` import type Foo from 'foo'; import type Foo2 from 'foo'; export default function(a: Foo, b: ?Foo2, c){ a; b; c; } `), { "no-unused-vars": 1, "no-undef": 1 }, [] ); }); it("2", () => { verifyAndAssertMessages( unpad(` import type Foo from 'foo'; export default function(a: () => Foo){ a; } `), { "no-unused-vars": 1, "no-undef": 1 }, [] ); }); it("3", () => { verifyAndAssertMessages( unpad(` import type Foo from 'foo'; import type Foo2 from 'foo'; export default function(a: (_:Foo) => Foo2){ a; } `), { "no-unused-vars": 1, "no-undef": 1 }, [] ); }); it("4", () => { verifyAndAssertMessages( unpad(` import type Foo from 'foo'; import type Foo2 from 'foo'; import type Foo3 from 'foo'; export default function(a: (_1:Foo, _2:Foo2) => Foo3){ a; } `), { "no-unused-vars": 1, "no-undef": 1 }, [] ); }); it("5", () => { verifyAndAssertMessages( unpad(` import type Foo from 'foo'; import type Foo2 from 'foo'; export default function(a: (_1:Foo, ...foo:Array) => number){ a; } `), { "no-unused-vars": 1, "no-undef": 1 }, [] ); }); it("6", () => { verifyAndAssertMessages( unpad(` import type Foo from 'foo'; export default function(): Foo {} `), { "no-unused-vars": 1, "no-undef": 1 }, [] ); }); it("7", () => { verifyAndAssertMessages( unpad(` import type Foo from 'foo'; export default function():() => Foo {} `), { "no-unused-vars": 1, "no-undef": 1 }, [] ); }); it("8", () => { verifyAndAssertMessages( unpad(` import type Foo from 'foo'; import type Foo2 from 'foo'; export default function():(_?:Foo) => Foo2{} `), { "no-unused-vars": 1, "no-undef": 1 }, [] ); }); it("9", () => { verifyAndAssertMessages( "export default function (a: T1, b: T2) { b; }", { "no-unused-vars": 1, "no-undef": 1 }, [] ); }); it("10", () => { verifyAndAssertMessages( "var a=function(a: T1, b: T2) {return a + b;}; a;", { "no-unused-vars": 1, "no-undef": 1 }, [] ); }); it("11", () => { verifyAndAssertMessages( "var a={*id(x: T): T { x; }}; a;", { "no-unused-vars": 1, "no-undef": 1 }, [] ); }); it("12", () => { verifyAndAssertMessages( "var a={async id(x: T): T { x; }}; a;", { "no-unused-vars": 1, "no-undef": 1 }, [] ); }); it("13", () => { verifyAndAssertMessages( "var a={123(x: T): T { x; }}; a;", { "no-unused-vars": 1, "no-undef": 1 }, [] ); }); it("14", () => { verifyAndAssertMessages( unpad(` import type Foo from 'foo'; import type Foo2 from 'foo'; export default class Bar {set fooProp(value:Foo):Foo2{ value; }} `), { "no-unused-vars": 1, "no-undef": 1 }, [] ); }); it("15", () => { verifyAndAssertMessages( unpad(` import type Foo2 from 'foo'; export default class Foo {get fooProp(): Foo2{}} `), { "no-unused-vars": 1, "no-undef": 1 }, [] ); }); it("16", () => { verifyAndAssertMessages( unpad(` import type Foo from 'foo'; var numVal:Foo; numVal; `), { "no-unused-vars": 1, "no-undef": 1 }, [] ); }); it("17", () => { verifyAndAssertMessages( unpad(` import type Foo from 'foo'; var a: {numVal: Foo;}; a; `), { "no-unused-vars": 1, "no-undef": 1 }, [] ); }); it("18", () => { verifyAndAssertMessages( unpad(` import type Foo from 'foo'; import type Foo2 from 'foo'; import type Foo3 from 'foo'; var a: ?{numVal: Foo; [indexer: Foo2]: Foo3}; a; `), { "no-unused-vars": 1, "no-undef": 1 }, [] ); }); it("19", () => { verifyAndAssertMessages( unpad(` import type Foo from 'foo'; import type Foo2 from 'foo'; var a: {numVal: Foo; subObj?: ?{strVal: Foo2}}; a; `), { "no-unused-vars": 1, "no-undef": 1 }, [] ); }); it("20", () => { verifyAndAssertMessages( unpad(` import type Foo from 'foo'; import type Foo2 from 'foo'; import type Foo3 from 'foo'; import type Foo4 from 'foo'; var a: { [a: Foo]: Foo2; [b: Foo3]: Foo4; }; a; `), { "no-unused-vars": 1, "no-undef": 1 }, [] ); }); it("21", () => { verifyAndAssertMessages( unpad(` import type Foo from 'foo'; import type Foo2 from 'foo'; import type Foo3 from 'foo'; var a: {add(x:Foo, ...y:Array): Foo3}; a; `), { "no-unused-vars": 1, "no-undef": 1 }, [] ); }); it("22", () => { verifyAndAssertMessages( unpad(` import type Foo from 'foo'; import type Foo2 from 'foo'; import type Foo3 from 'foo'; var a: { id(x: Foo2): Foo3; }; a; `), { "no-unused-vars": 1, "no-undef": 1 }, [] ); }); it("23", () => { verifyAndAssertMessages( unpad(` import type Foo from 'foo'; var a:Array = [1, 2, 3]; a; `), { "no-unused-vars": 1, "no-undef": 1 }, [] ); }); it("24", () => { verifyAndAssertMessages( unpad(` import type Baz from 'baz'; export default class Bar extends Baz { }; `), { "no-unused-vars": 1, "no-undef": 1 }, [] ); }); it("25", () => { verifyAndAssertMessages( "export default class Bar { bar(): T { return 42; }}", { "no-unused-vars": 1, "no-undef": 1 }, [] ); }); it("26", () => { verifyAndAssertMessages( unpad(` import type Foo from 'foo'; import type Foo2 from 'foo'; export default class Bar { static prop1:Foo; prop2:Foo2; } `), { "no-unused-vars": 1, "no-undef": 1 }, [] ); }); it("27", () => { verifyAndAssertMessages( unpad(` import type Foo from 'foo'; import type Foo2 from 'foo'; var x : Foo | Foo2 = 4; x; `), { "no-unused-vars": 1, "no-undef": 1 }, [] ); }); it("28", () => { verifyAndAssertMessages( unpad(` import type Foo from 'foo'; import type Foo2 from 'foo'; var x : () => Foo | () => Foo2; x; `), { "no-unused-vars": 1, "no-undef": 1 }, [] ); }); it("29", () => { verifyAndAssertMessages( unpad(` import type Foo from 'foo'; import type Foo2 from 'foo'; var x: typeof Foo | number = Foo2; x; `), { "no-unused-vars": 1, "no-undef": 1 }, [] ); }); it("30", () => { verifyAndAssertMessages( unpad(` import type Foo from 'foo'; var {x}: {x: Foo; } = { x: 'hello' }; x; `), { "no-unused-vars": 1, "no-undef": 1 }, [] ); }); it("31", () => { verifyAndAssertMessages( unpad(` import type Foo from 'foo'; var [x]: Array = [ 'hello' ]; x; `), { "no-unused-vars": 1, "no-undef": 1 }, [] ); }); it("32", () => { verifyAndAssertMessages( unpad(` import type Foo from 'foo'; export default function({x}: { x: Foo; }) { x; } `), { "no-unused-vars": 1, "no-undef": 1 }, [] ); }); it("33", () => { verifyAndAssertMessages( unpad(` import type Foo from 'foo'; function foo([x]: Array) { x; } foo(); `), { "no-unused-vars": 1, "no-undef": 1 }, [] ); }); it("34", () => { verifyAndAssertMessages( unpad(` import type Foo from 'foo'; import type Foo2 from 'foo'; var a: Map >; a; `), { "no-unused-vars": 1, "no-undef": 1 }, [] ); }); it("35", () => { verifyAndAssertMessages( unpad(` import type Foo from 'foo'; var a: ?Promise[]; a; `), { "no-unused-vars": 1, "no-undef": 1 }, [] ); }); it("36", () => { verifyAndAssertMessages( unpad(` import type Foo from 'foo'; import type Foo2 from 'foo'; var a:(...rest:Array) => Foo2; a; `), { "no-unused-vars": 1, "no-undef": 1 }, [] ); }); it("37", () => { verifyAndAssertMessages( unpad(` import type Foo from 'foo'; import type Foo2 from 'foo'; import type Foo3 from 'foo'; import type Foo4 from 'foo'; var a: (x: Foo2, ...y:Foo3[]) => Foo4; a; `), { "no-unused-vars": 1, "no-undef": 1 }, [] ); }); it("38", () => { verifyAndAssertMessages( unpad(` import type {foo, bar} from 'baz'; foo; bar; `), { "no-unused-vars": 1, "no-undef": 1 }, [] ); }); it("39", () => { verifyAndAssertMessages( unpad(` import type {foo as bar} from 'baz'; bar; `), { "no-unused-vars": 1, "no-undef": 1 }, [] ); }); it("40", () => { verifyAndAssertMessages( unpad(` import type from 'foo'; type; `), { "no-unused-vars": 1, "no-undef": 1 }, [] ); }); it("41", () => { verifyAndAssertMessages( unpad(` import type, {foo} from 'bar'; type; foo; `), { "no-unused-vars": 1, "no-undef": 1 }, [] ); }); it("42", () => { verifyAndAssertMessages( unpad(` import type * as namespace from 'bar'; namespace; `), { "no-unused-vars": 1, "no-undef": 1 }, [] ); }); it("43", () => { verifyAndAssertMessages( unpad(` import type Foo from 'foo'; var a: Foo[]; a; `), { "no-unused-vars": 1, "no-undef": 1 }, [] ); }); it("44", () => { verifyAndAssertMessages( unpad(` import type Foo from 'foo'; var a: ?Foo[]; a; `), { "no-unused-vars": 1, "no-undef": 1 }, [] ); }); it("45", () => { verifyAndAssertMessages( unpad(` import type Foo from 'foo'; var a: (?Foo)[]; a; `), { "no-unused-vars": 1, "no-undef": 1 }, [] ); }); it("46", () => { verifyAndAssertMessages( unpad(` import type Foo from 'foo'; var a: () => Foo[]; a; `), { "no-unused-vars": 1, "no-undef": 1 }, [] ); }); it("47", () => { verifyAndAssertMessages( unpad(` import type Foo from 'foo'; var a: (() => Foo)[]; a; `), { "no-unused-vars": 1, "no-undef": 1 }, [] ); }); it("48", () => { verifyAndAssertMessages( unpad(` import type Foo from 'foo'; var a: typeof Foo[]; a; `), { "no-unused-vars": 1, "no-undef": 1 }, [] ); }); it("49", () => { verifyAndAssertMessages( unpad(` import type Foo from 'foo'; import type Foo2 from 'foo'; import type Foo3 from 'foo'; var a : [Foo, Foo2,] = [123, 'duck',]; a; `), { "no-unused-vars": 1, "no-undef": 1 }, [] ); }); }); it("class usage", () => { verifyAndAssertMessages( "class Lol {} module.exports = Lol;", { "no-unused-vars": 1 }, [] ); }); it("class definition: gaearon/redux#24", () => { verifyAndAssertMessages( unpad(` export default function root(stores) { return DecoratedComponent => class ReduxRootDecorator { a() { DecoratedComponent; stores; } }; } `), { "no-undef": 1, "no-unused-vars": 1 }, [] ); }); it("class properties #71", () => { verifyAndAssertMessages( "class Lol { foo = 'bar'; }", { "no-undef": 1 }, [] ); }); it("template strings #31", () => { verifyAndAssertMessages( "console.log(`${a}, b`);", { "comma-spacing": 1 }, [] ); }); it("template with destructuring #31", () => { verifyAndAssertMessages( unpad(` module.exports = { render() { var {name} = this.props; return Math.max(null, \`Name: \${name}, Name: \${name}\`); } }; `), { "comma-spacing": 1 }, [] ); }); describe("decorators #72", () => { it("class declaration", () => { verifyAndAssertMessages( unpad(` import classDeclaration from 'decorator'; import decoratorParameter from 'decorator'; @classDeclaration((parameter) => parameter) @classDeclaration(decoratorParameter) @classDeclaration export class TextareaAutosize {} `), { "no-unused-vars": 1 }, [] ); }); it("method definition", () => { verifyAndAssertMessages( unpad(` import classMethodDeclarationA from 'decorator'; import decoratorParameter from 'decorator'; export class TextareaAutosize { @classMethodDeclarationA((parameter) => parameter) @classMethodDeclarationA(decoratorParameter) @classMethodDeclarationA methodDeclaration(e) { e(); } } `), { "no-unused-vars": 1 }, [] ); }); it("method definition get/set", () => { verifyAndAssertMessages( unpad(` import classMethodDeclarationA from 'decorator'; import decoratorParameter from 'decorator'; export class TextareaAutosize { @classMethodDeclarationA((parameter) => parameter) @classMethodDeclarationA(decoratorParameter) @classMethodDeclarationA get bar() { } @classMethodDeclarationA((parameter) => parameter) @classMethodDeclarationA(decoratorParameter) @classMethodDeclarationA set bar(val) { val; } } `), { "no-unused-vars": 1 }, [] ); }); it("object property", () => { verifyAndAssertMessages( unpad(` import classMethodDeclarationA from 'decorator'; import decoratorParameter from 'decorator'; var obj = { @classMethodDeclarationA((parameter) => parameter) @classMethodDeclarationA(decoratorParameter) @classMethodDeclarationA methodDeclaration(e) { e(); } }; obj; `), { "no-unused-vars": 1 }, [] ); }); it("object property get/set", () => { verifyAndAssertMessages( unpad(` import classMethodDeclarationA from 'decorator'; import decoratorParameter from 'decorator'; var obj = { @classMethodDeclarationA((parameter) => parameter) @classMethodDeclarationA(decoratorParameter) @classMethodDeclarationA get bar() { }, @classMethodDeclarationA((parameter) => parameter) @classMethodDeclarationA(decoratorParameter) @classMethodDeclarationA set bar(val) { val; } }; obj; `), { "no-unused-vars": 1 }, [] ); }); }); it("detects minimal no-unused-vars case #120", () => { verifyAndAssertMessages( "var unused;", { "no-unused-vars": 1 }, [ "1:5 'unused' is defined but never used. no-unused-vars" ] ); }); // This two tests are disabled, as the feature to visit properties when // there is a spread/rest operator has been removed as it caused problems // with other rules #249 it.skip("visits excluded properties left of spread #95", () => { verifyAndAssertMessages( "var originalObject = {}; var {field1, field2, ...clone} = originalObject;", { "no-unused-vars": 1 }, [] ); }); it.skip("visits excluded properties left of spread #210", () => { verifyAndAssertMessages( "const props = { yo: 'yo' }; const { ...otherProps } = props;", { "no-unused-vars": 1 }, [] ); }); it("does not mark spread variables false-positive", () => { verifyAndAssertMessages( "var originalObject = {}; var {field1, field2, ...clone} = originalObject;", { "no-undef": 1, "no-redeclare": 1 }, [] ); }); it("does not mark spread variables false-positive", () => { verifyAndAssertMessages( "const props = { yo: 'yo' }; const { ...otherProps } = props;", { "no-undef": 1, "no-redeclare": 1 }, [] ); }); it("does not mark spread variables as use-before-define #249", () => { verifyAndAssertMessages( "var originalObject = {}; var {field1, field2, ...clone} = originalObject;", { "no-use-before-define": 1 }, [] ); }); it("detects no-unused-vars with object destructuring #142", () => { verifyAndAssertMessages( "const {Bacona} = require('baconjs')", { "no-undef": 1, "no-unused-vars": 1 }, [ "1:8 'Bacona' is assigned a value but never used. no-unused-vars" ] ); }); it("don't warn no-unused-vars with spread #142", () => { verifyAndAssertMessages( unpad(` export default function test(data) { return { foo: 'bar', ...data }; } `), { "no-undef": 1, "no-unused-vars": 1 }, [] ); }); it("excludes comment tokens #153", () => { verifyAndAssertMessages( unpad(` var a = [ 1, 2, // a trailing comment makes this line fail comma-dangle (always-multiline) ]; `), { "comma-dangle": [2, "always-multiline"] }, [] ); verifyAndAssertMessages( unpad(` switch (a) { // A comment here makes the above line fail brace-style case 1: console.log(a); } `), { "brace-style": 2 }, [] ); }); it("ternary and parens #149", () => { verifyAndAssertMessages( "true ? (true) : false;", { "space-infix-ops": 1 }, [] ); }); it("line comment space-in-parens #124", () => { verifyAndAssertMessages( unpad(` React.createClass({ render() { // return ( //
// ); // <-- this is the line that is reported } }); `), { "space-in-parens": 1 }, [ ] ); }); it("block comment space-in-parens #124", () => { verifyAndAssertMessages( unpad(` React.createClass({ render() { /* return (
); // <-- this is the line that is reported */ } }); `), { "space-in-parens": 1 }, [ ] ); }); it("no no-undef error with rest #11", () => { verifyAndAssertMessages("const [a, ...rest] = ['1', '2', '3']; a; rest;", { "no-undef": 1, "no-unused-vars": 1 }, [ ] ); }); it("async function with space-before-function-paren #168", () => { verifyAndAssertMessages("it('handles updates', async function() {});", { "space-before-function-paren": [1, "never"] }, [ ] ); }); it("default param flow type no-unused-vars #184", () => { verifyAndAssertMessages( unpad(` type ResolveOptionType = { depth?: number, identifier?: string }; export default function resolve( options: ResolveOptionType = {} ): Object { options; } `), { "no-unused-vars": 1, "no-undef": 1 }, [ ] ); }); it("no-use-before-define #192", () => { verifyAndAssertMessages( unpad(` console.log(x); var x = 1; `), { "no-use-before-define": 1 }, [ "1:13 'x' was used before it was defined. no-use-before-define" ] ); }); it("jsx and stringliteral #216", () => { verifyAndAssertMessages( "
", {}, [] ); }); it("getter/setter #218", () => { verifyAndAssertMessages( unpad(` class Person { set a (v) { } } `), { "space-before-function-paren": 1, "keyword-spacing": [1, { "before": true }], "indent": 1 }, [] ); }); it("getter/setter #220", () => { verifyAndAssertMessages( unpad(` var B = { get x () { return this.ecks; }, set x (ecks) { this.ecks = ecks; } }; `), { "no-dupe-keys": 1 }, [] ); }); it("fixes issues with flow types and ObjectPattern", () => { verifyAndAssertMessages( unpad(` import type Foo from 'bar'; export default class Foobar { foo({ bar }: Foo) { bar; } bar({ foo }: Foo) { foo; } } `), { "no-unused-vars": 1, "no-shadow": 1 }, [] ); }); it("correctly detects redeclares if in script mode #217", () => { verifyAndAssertMessages( unpad(` var a = 321; var a = 123; `), { "no-redeclare": 1 }, [ "2:5 'a' is already defined. no-redeclare" ], "script" ); }); it("correctly detects redeclares if in module mode #217", () => { verifyAndAssertMessages( unpad(` var a = 321; var a = 123; `), { "no-redeclare": 1 }, [ "2:5 'a' is already defined. no-redeclare" ], "module" ); }); it("no-implicit-globals in script", () => { verifyAndAssertMessages( "var leakedGlobal = 1;", { "no-implicit-globals": 1 }, [ "1:5 Implicit global variable, assign as global property instead. no-implicit-globals" ], "script", { env: {}, parserOptions: { ecmaVersion: 6, sourceType: "script" } } ); }); it("no-implicit-globals in module", () => { verifyAndAssertMessages( "var leakedGlobal = 1;", { "no-implicit-globals": 1 }, [], "module", { env: {}, parserOptions: { ecmaVersion: 6, sourceType: "module" } } ); }); it("no-implicit-globals in default", () => { verifyAndAssertMessages( "var leakedGlobal = 1;", { "no-implicit-globals": 1 }, [], null, { env: {}, parserOptions: { ecmaVersion: 6 } } ); }); it("allowImportExportEverywhere option (#327)", () => { verifyAndAssertMessages( unpad(` if (true) { import Foo from 'foo'; } function foo() { import Bar from 'bar'; } switch (a) { case 1: import FooBar from 'foobar'; } `), {}, [], "module", { env: {}, parserOptions: { ecmaVersion: 6, sourceType: "module", allowImportExportEverywhere: true } } ); }); it("with does not crash parsing in script mode (strict off) #171", () => { verifyAndAssertMessages( "with (arguments) { length; }", {}, [], "script" ); }); xit("with does crash parsing in module mode (strict on) #171", () => { verifyAndAssertMessages( "with (arguments) { length; }", {}, [ "1:1 Parsing error: 'with' in strict mode" ] ); }); it("new.target is not reported as undef #235", () => { verifyAndAssertMessages( "function foo () { return new.target }", { "no-undef": 1 }, [] ); }); it("decorator does not create TypeError #229", () => { verifyAndAssertMessages( unpad(` class A { @test f() {} } `), { "no-undef": 1 }, [ "2:4 'test' is not defined. no-undef" ] ); }); it("Flow definition does not trigger warnings #223", () => { verifyAndAssertMessages( unpad(` import { Map as $Map } from 'immutable'; function myFunction($state: $Map, { a, b, c } : { a: ?Object, b: ?Object, c: $Map }) {} `), { "no-dupe-args": 1, "no-redeclare": 1, "no-shadow": 1 }, [] ); }); it("newline-before-return with comments #289", () => { verifyAndAssertMessages( unpad(` function a() { if (b) { /* eslint-disable no-console */ console.log('test'); /* eslint-enable no-console */ } return hasGlobal; } `), { "newline-before-return": 1 }, [] ); }); it("spaced-comment with shebang #163", () => { verifyAndAssertMessages( unpad(` #!/usr/bin/env babel-node import {spawn} from 'foobar'; `), { "spaced-comment": 1 }, [] ); }); describe("Class Property Declarations", () => { it("no-redeclare false positive 1", () => { verifyAndAssertMessages( unpad(` class Group { static propTypes = {}; } class TypicalForm { static propTypes = {}; } `), { "no-redeclare": 1 }, [] ); }); it("no-redeclare false positive 2", () => { verifyAndAssertMessages( unpad(` function validate() {} class MyComponent { static validate = validate; } `), { "no-redeclare": 1 }, [] ); }); it("check references", () => { verifyAndAssertMessages( unpad(` var a; class A { prop1; prop2 = a; prop3 = b; } new A `), { "no-undef": 1, "no-unused-vars": 1, "no-redeclare": 1 }, [ "5:11 'b' is not defined. no-undef" ] ); }); }); it("dynamic import support", () => { verifyAndAssertMessages( "import('test-module').then(() => {})", {}, [] ); }); // it("regex with es6 unicodeCodePointEscapes", function () { // verifyAndAssertMessages( // "string.replace(/[\u{0000A0}-\u{10FFFF}<>\&]/gmiu, (char) => `&#x${char.codePointAt(0).toString(16)};`);", // {}, // [] // ); // }); }); babel-eslint-7.2.3/yarn.lock000066400000000000000000001043401307647305300157210ustar00rootroot00000000000000# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. # yarn lockfile v1 acorn-jsx@^3.0.0: version "3.0.1" resolved "https://registry.yarnpkg.com/acorn-jsx/-/acorn-jsx-3.0.1.tgz#afdf9488fb1ecefc8348f6fb22f464e32a58b36b" dependencies: acorn "^3.0.4" acorn@4.0.4: version "4.0.4" resolved "https://registry.yarnpkg.com/acorn/-/acorn-4.0.4.tgz#17a8d6a7a6c4ef538b814ec9abac2779293bf30a" acorn@^3.0.4: version "3.3.0" resolved "https://registry.yarnpkg.com/acorn/-/acorn-3.3.0.tgz#45e37fb39e8da3f25baee3ff5369e2bb5f22017a" ajv-keywords@^1.0.0: version "1.5.1" resolved "https://registry.yarnpkg.com/ajv-keywords/-/ajv-keywords-1.5.1.tgz#314dd0a4b3368fad3dfcdc54ede6171b886daf3c" ajv@^4.7.0: version "4.11.5" resolved "https://registry.yarnpkg.com/ajv/-/ajv-4.11.5.tgz#b6ee74657b993a01dce44b7944d56f485828d5bd" dependencies: co "^4.6.0" json-stable-stringify "^1.0.1" ansi-escapes@^1.1.0: version "1.4.0" resolved "https://registry.yarnpkg.com/ansi-escapes/-/ansi-escapes-1.4.0.tgz#d3a8a83b319aa67793662b13e761c7911422306e" ansi-regex@^2.0.0: version "2.1.1" resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-2.1.1.tgz#c3b33ab5ee360d86e0e628f0468ae7ef27d654df" ansi-styles@^2.2.1: version "2.2.1" resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-2.2.1.tgz#b432dd3358b634cf75e1e4664368240533c1ddbe" argparse@^1.0.7: version "1.0.9" resolved "https://registry.yarnpkg.com/argparse/-/argparse-1.0.9.tgz#73d83bc263f86e97f8cc4f6bae1b0e90a7d22c86" dependencies: sprintf-js "~1.0.2" array-union@^1.0.1: version "1.0.2" resolved "https://registry.yarnpkg.com/array-union/-/array-union-1.0.2.tgz#9a34410e4f4e3da23dea375be5be70f24778ec39" dependencies: array-uniq "^1.0.1" array-uniq@^1.0.1: version "1.0.3" resolved "https://registry.yarnpkg.com/array-uniq/-/array-uniq-1.0.3.tgz#af6ac877a25cc7f74e058894753858dfdb24fdb6" arrify@^1.0.0: version "1.0.1" resolved "https://registry.yarnpkg.com/arrify/-/arrify-1.0.1.tgz#898508da2226f380df904728456849c1501a4b0d" babel-code-frame@^6.16.0, babel-code-frame@^6.22.0: version "6.22.0" resolved "https://registry.yarnpkg.com/babel-code-frame/-/babel-code-frame-6.22.0.tgz#027620bee567a88c32561574e7fd0801d33118e4" dependencies: chalk "^1.1.0" esutils "^2.0.2" js-tokens "^3.0.0" babel-eslint@^7.0.0: version "7.1.1" resolved "https://registry.yarnpkg.com/babel-eslint/-/babel-eslint-7.1.1.tgz#8a6a884f085aa7060af69cfc77341c2f99370fb2" dependencies: babel-code-frame "^6.16.0" babel-traverse "^6.15.0" babel-types "^6.15.0" babylon "^6.13.0" lodash.pickby "^4.6.0" babel-messages@^6.23.0: version "6.23.0" resolved "https://registry.yarnpkg.com/babel-messages/-/babel-messages-6.23.0.tgz#f3cdf4703858035b2a2951c6ec5edf6c62f2630e" dependencies: babel-runtime "^6.22.0" babel-runtime@^6.22.0: version "6.23.0" resolved "https://registry.yarnpkg.com/babel-runtime/-/babel-runtime-6.23.0.tgz#0a9489f144de70efb3ce4300accdb329e2fc543b" dependencies: core-js "^2.4.0" regenerator-runtime "^0.10.0" babel-traverse@^6.15.0, babel-traverse@^6.23.1: version "6.23.1" resolved "https://registry.yarnpkg.com/babel-traverse/-/babel-traverse-6.23.1.tgz#d3cb59010ecd06a97d81310065f966b699e14f48" dependencies: babel-code-frame "^6.22.0" babel-messages "^6.23.0" babel-runtime "^6.22.0" babel-types "^6.23.0" babylon "^6.15.0" debug "^2.2.0" globals "^9.0.0" invariant "^2.2.0" lodash "^4.2.0" babel-types@^6.15.0, babel-types@^6.23.0: version "6.23.0" resolved "https://registry.yarnpkg.com/babel-types/-/babel-types-6.23.0.tgz#bb17179d7538bad38cd0c9e115d340f77e7e9acf" dependencies: babel-runtime "^6.22.0" esutils "^2.0.2" lodash "^4.2.0" to-fast-properties "^1.0.1" babylon@^6.13.0, babylon@^6.15.0, babylon@^6.17.0: version "6.17.0" resolved "https://registry.yarnpkg.com/babylon/-/babylon-6.17.0.tgz#37da948878488b9c4e3c4038893fa3314b3fc932" balanced-match@^0.4.1: version "0.4.2" resolved "https://registry.yarnpkg.com/balanced-match/-/balanced-match-0.4.2.tgz#cb3f3e3c732dc0f01ee70b403f302e61d7709838" brace-expansion@^1.0.0: version "1.1.6" resolved "https://registry.yarnpkg.com/brace-expansion/-/brace-expansion-1.1.6.tgz#7197d7eaa9b87e648390ea61fc66c84427420df9" dependencies: balanced-match "^0.4.1" concat-map "0.0.1" browser-stdout@1.3.0: version "1.3.0" resolved "https://registry.yarnpkg.com/browser-stdout/-/browser-stdout-1.3.0.tgz#f351d32969d32fa5d7a5567154263d928ae3bd1f" buffer-shims@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/buffer-shims/-/buffer-shims-1.0.0.tgz#9978ce317388c649ad8793028c3477ef044a8b51" caller-path@^0.1.0: version "0.1.0" resolved "https://registry.yarnpkg.com/caller-path/-/caller-path-0.1.0.tgz#94085ef63581ecd3daa92444a8fe94e82577751f" dependencies: callsites "^0.2.0" callsites@^0.2.0: version "0.2.0" resolved "https://registry.yarnpkg.com/callsites/-/callsites-0.2.0.tgz#afab96262910a7f33c19a5775825c69f34e350ca" chalk@^1.0.0, chalk@^1.1.0, chalk@^1.1.1, chalk@^1.1.3: version "1.1.3" resolved "https://registry.yarnpkg.com/chalk/-/chalk-1.1.3.tgz#a8115c55e4a702fe4d150abd3872822a7e09fc98" dependencies: ansi-styles "^2.2.1" escape-string-regexp "^1.0.2" has-ansi "^2.0.0" strip-ansi "^3.0.0" supports-color "^2.0.0" circular-json@^0.3.1: version "0.3.1" resolved "https://registry.yarnpkg.com/circular-json/-/circular-json-0.3.1.tgz#be8b36aefccde8b3ca7aa2d6afc07a37242c0d2d" cli-cursor@^1.0.1: version "1.0.2" resolved "https://registry.yarnpkg.com/cli-cursor/-/cli-cursor-1.0.2.tgz#64da3f7d56a54412e59794bd62dc35295e8f2987" dependencies: restore-cursor "^1.0.1" cli-width@^2.0.0: version "2.1.0" resolved "https://registry.yarnpkg.com/cli-width/-/cli-width-2.1.0.tgz#b234ca209b29ef66fc518d9b98d5847b00edf00a" co@^4.6.0: version "4.6.0" resolved "https://registry.yarnpkg.com/co/-/co-4.6.0.tgz#6ea6bdf3d853ae54ccb8e47bfa0bf3f9031fb184" code-point-at@^1.0.0: version "1.1.0" resolved "https://registry.yarnpkg.com/code-point-at/-/code-point-at-1.1.0.tgz#0d070b4d043a5bea33a2f1a40e2edb3d9a4ccf77" commander@2.9.0: version "2.9.0" resolved "https://registry.yarnpkg.com/commander/-/commander-2.9.0.tgz#9c99094176e12240cb22d6c5146098400fe0f7d4" dependencies: graceful-readlink ">= 1.0.0" concat-map@0.0.1: version "0.0.1" resolved "https://registry.yarnpkg.com/concat-map/-/concat-map-0.0.1.tgz#d8a96bd77fd68df7793a73036a3ba0d5405d477b" concat-stream@^1.5.2: version "1.6.0" resolved "https://registry.yarnpkg.com/concat-stream/-/concat-stream-1.6.0.tgz#0aac662fd52be78964d5532f694784e70110acf7" dependencies: inherits "^2.0.3" readable-stream "^2.2.2" typedarray "^0.0.6" core-js@^2.4.0: version "2.4.1" resolved "https://registry.yarnpkg.com/core-js/-/core-js-2.4.1.tgz#4de911e667b0eae9124e34254b53aea6fc618d3e" core-util-is@~1.0.0: version "1.0.2" resolved "https://registry.yarnpkg.com/core-util-is/-/core-util-is-1.0.2.tgz#b5fd54220aa2bc5ab57aab7140c940754503c1a7" d@1: version "1.0.0" resolved "https://registry.yarnpkg.com/d/-/d-1.0.0.tgz#754bb5bfe55451da69a58b94d45f4c5b0462d58f" dependencies: es5-ext "^0.10.9" debug@2.2.0: version "2.2.0" resolved "https://registry.yarnpkg.com/debug/-/debug-2.2.0.tgz#f87057e995b1a1f6ae6a4960664137bc56f039da" dependencies: ms "0.7.1" debug@^2.1.1, debug@^2.2.0: version "2.6.3" resolved "https://registry.yarnpkg.com/debug/-/debug-2.6.3.tgz#0f7eb8c30965ec08c72accfa0130c8b79984141d" dependencies: ms "0.7.2" dedent@^0.7.0: version "0.7.0" resolved "https://registry.yarnpkg.com/dedent/-/dedent-0.7.0.tgz#2495ddbaf6eb874abb0e1be9df22d2e5a544326c" deep-is@~0.1.3: version "0.1.3" resolved "https://registry.yarnpkg.com/deep-is/-/deep-is-0.1.3.tgz#b369d6fb5dbc13eecf524f91b070feedc357cf34" del@^2.0.2: version "2.2.2" resolved "https://registry.yarnpkg.com/del/-/del-2.2.2.tgz#c12c981d067846c84bcaf862cff930d907ffd1a8" dependencies: globby "^5.0.0" is-path-cwd "^1.0.0" is-path-in-cwd "^1.0.0" object-assign "^4.0.1" pify "^2.0.0" pinkie-promise "^2.0.0" rimraf "^2.2.8" diff@1.4.0: version "1.4.0" resolved "https://registry.yarnpkg.com/diff/-/diff-1.4.0.tgz#7f28d2eb9ee7b15a97efd89ce63dcfdaa3ccbabf" doctrine@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/doctrine/-/doctrine-2.0.0.tgz#c73d8d2909d22291e1a007a395804da8b665fe63" dependencies: esutils "^2.0.2" isarray "^1.0.0" es5-ext@^0.10.14, es5-ext@^0.10.9, es5-ext@~0.10.14: version "0.10.15" resolved "https://registry.yarnpkg.com/es5-ext/-/es5-ext-0.10.15.tgz#c330a5934c1ee21284a7c081a86e5fd937c91ea6" dependencies: es6-iterator "2" es6-symbol "~3.1" es6-iterator@2, es6-iterator@^2.0.1, es6-iterator@~2.0.1: version "2.0.1" resolved "https://registry.yarnpkg.com/es6-iterator/-/es6-iterator-2.0.1.tgz#8e319c9f0453bf575d374940a655920e59ca5512" dependencies: d "1" es5-ext "^0.10.14" es6-symbol "^3.1" es6-map@^0.1.3: version "0.1.5" resolved "https://registry.yarnpkg.com/es6-map/-/es6-map-0.1.5.tgz#9136e0503dcc06a301690f0bb14ff4e364e949f0" dependencies: d "1" es5-ext "~0.10.14" es6-iterator "~2.0.1" es6-set "~0.1.5" es6-symbol "~3.1.1" event-emitter "~0.3.5" es6-set@~0.1.5: version "0.1.5" resolved "https://registry.yarnpkg.com/es6-set/-/es6-set-0.1.5.tgz#d2b3ec5d4d800ced818db538d28974db0a73ccb1" dependencies: d "1" es5-ext "~0.10.14" es6-iterator "~2.0.1" es6-symbol "3.1.1" event-emitter "~0.3.5" es6-symbol@3.1.1, es6-symbol@^3.1, es6-symbol@^3.1.1, es6-symbol@~3.1, es6-symbol@~3.1.1: version "3.1.1" resolved "https://registry.yarnpkg.com/es6-symbol/-/es6-symbol-3.1.1.tgz#bf00ef4fdab6ba1b46ecb7b629b4c7ed5715cc77" dependencies: d "1" es5-ext "~0.10.14" es6-weak-map@^2.0.1: version "2.0.2" resolved "https://registry.yarnpkg.com/es6-weak-map/-/es6-weak-map-2.0.2.tgz#5e3ab32251ffd1538a1f8e5ffa1357772f92d96f" dependencies: d "1" es5-ext "^0.10.14" es6-iterator "^2.0.1" es6-symbol "^3.1.1" escape-string-regexp@1.0.5, escape-string-regexp@^1.0.2, escape-string-regexp@^1.0.5: version "1.0.5" resolved "https://registry.yarnpkg.com/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz#1b61c0562190a8dff6ae3bb2cf0200ca130b86d4" escope@^3.6.0: version "3.6.0" resolved "https://registry.yarnpkg.com/escope/-/escope-3.6.0.tgz#e01975e812781a163a6dadfdd80398dc64c889c3" dependencies: es6-map "^0.1.3" es6-weak-map "^2.0.1" esrecurse "^4.1.0" estraverse "^4.1.1" eslint-config-babel@^6.0.0: version "6.0.0" resolved "https://registry.yarnpkg.com/eslint-config-babel/-/eslint-config-babel-6.0.0.tgz#66feedf6ce6e04abe585cec1a65b5bcc96bed50a" eslint-plugin-flowtype@^2.30.3: version "2.30.3" resolved "https://registry.yarnpkg.com/eslint-plugin-flowtype/-/eslint-plugin-flowtype-2.30.3.tgz#57835d2c0ed388da7a2725803ec32af2f437c301" dependencies: lodash "^4.15.0" eslint@^3.18.0: version "3.18.0" resolved "https://registry.yarnpkg.com/eslint/-/eslint-3.18.0.tgz#647e985c4ae71502d20ac62c109f66d5104c8a4b" dependencies: babel-code-frame "^6.16.0" chalk "^1.1.3" concat-stream "^1.5.2" debug "^2.1.1" doctrine "^2.0.0" escope "^3.6.0" espree "^3.4.0" esquery "^1.0.0" estraverse "^4.2.0" esutils "^2.0.2" file-entry-cache "^2.0.0" glob "^7.0.3" globals "^9.14.0" ignore "^3.2.0" imurmurhash "^0.1.4" inquirer "^0.12.0" is-my-json-valid "^2.10.0" is-resolvable "^1.0.0" js-yaml "^3.5.1" json-stable-stringify "^1.0.0" levn "^0.3.0" lodash "^4.0.0" mkdirp "^0.5.0" natural-compare "^1.4.0" optionator "^0.8.2" path-is-inside "^1.0.1" pluralize "^1.2.1" progress "^1.1.8" require-uncached "^1.0.2" shelljs "^0.7.5" strip-bom "^3.0.0" strip-json-comments "~2.0.1" table "^3.7.8" text-table "~0.2.0" user-home "^2.0.0" espree@^3.4.0: version "3.4.0" resolved "https://registry.yarnpkg.com/espree/-/espree-3.4.0.tgz#41656fa5628e042878025ef467e78f125cb86e1d" dependencies: acorn "4.0.4" acorn-jsx "^3.0.0" esprima@^3.1.1: version "3.1.3" resolved "https://registry.yarnpkg.com/esprima/-/esprima-3.1.3.tgz#fdca51cee6133895e3c88d535ce49dbff62a4633" esquery@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/esquery/-/esquery-1.0.0.tgz#cfba8b57d7fba93f17298a8a006a04cda13d80fa" dependencies: estraverse "^4.0.0" esrecurse@^4.1.0: version "4.1.0" resolved "https://registry.yarnpkg.com/esrecurse/-/esrecurse-4.1.0.tgz#4713b6536adf7f2ac4f327d559e7756bff648220" dependencies: estraverse "~4.1.0" object-assign "^4.0.1" estraverse@^4.0.0, estraverse@^4.1.1, estraverse@^4.2.0: version "4.2.0" resolved "https://registry.yarnpkg.com/estraverse/-/estraverse-4.2.0.tgz#0dee3fed31fcd469618ce7342099fc1afa0bdb13" estraverse@~4.1.0: version "4.1.1" resolved "https://registry.yarnpkg.com/estraverse/-/estraverse-4.1.1.tgz#f6caca728933a850ef90661d0e17982ba47111a2" esutils@^2.0.2: version "2.0.2" resolved "https://registry.yarnpkg.com/esutils/-/esutils-2.0.2.tgz#0abf4f1caa5bcb1f7a9d8acc6dea4faaa04bac9b" event-emitter@~0.3.5: version "0.3.5" resolved "https://registry.yarnpkg.com/event-emitter/-/event-emitter-0.3.5.tgz#df8c69eef1647923c7157b9ce83840610b02cc39" dependencies: d "1" es5-ext "~0.10.14" exit-hook@^1.0.0: version "1.1.1" resolved "https://registry.yarnpkg.com/exit-hook/-/exit-hook-1.1.1.tgz#f05ca233b48c05d54fff07765df8507e95c02ff8" fast-levenshtein@~2.0.4: version "2.0.6" resolved "https://registry.yarnpkg.com/fast-levenshtein/-/fast-levenshtein-2.0.6.tgz#3d8a5c66883a16a30ca8643e851f19baa7797917" figures@^1.3.5: version "1.7.0" resolved "https://registry.yarnpkg.com/figures/-/figures-1.7.0.tgz#cbe1e3affcf1cd44b80cadfed28dc793a9701d2e" dependencies: escape-string-regexp "^1.0.5" object-assign "^4.1.0" file-entry-cache@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/file-entry-cache/-/file-entry-cache-2.0.0.tgz#c392990c3e684783d838b8c84a45d8a048458361" dependencies: flat-cache "^1.2.1" object-assign "^4.0.1" flat-cache@^1.2.1: version "1.2.2" resolved "https://registry.yarnpkg.com/flat-cache/-/flat-cache-1.2.2.tgz#fa86714e72c21db88601761ecf2f555d1abc6b96" dependencies: circular-json "^0.3.1" del "^2.0.2" graceful-fs "^4.1.2" write "^0.2.1" fs.realpath@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/fs.realpath/-/fs.realpath-1.0.0.tgz#1504ad2523158caa40db4a2787cb01411994ea4f" generate-function@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/generate-function/-/generate-function-2.0.0.tgz#6858fe7c0969b7d4e9093337647ac79f60dfbe74" generate-object-property@^1.1.0: version "1.2.0" resolved "https://registry.yarnpkg.com/generate-object-property/-/generate-object-property-1.2.0.tgz#9c0e1c40308ce804f4783618b937fa88f99d50d0" dependencies: is-property "^1.0.0" glob@7.0.5: version "7.0.5" resolved "https://registry.yarnpkg.com/glob/-/glob-7.0.5.tgz#b4202a69099bbb4d292a7c1b95b6682b67ebdc95" dependencies: fs.realpath "^1.0.0" inflight "^1.0.4" inherits "2" minimatch "^3.0.2" once "^1.3.0" path-is-absolute "^1.0.0" glob@^7.0.0, glob@^7.0.3, glob@^7.0.5: version "7.1.1" resolved "https://registry.yarnpkg.com/glob/-/glob-7.1.1.tgz#805211df04faaf1c63a3600306cdf5ade50b2ec8" dependencies: fs.realpath "^1.0.0" inflight "^1.0.4" inherits "2" minimatch "^3.0.2" once "^1.3.0" path-is-absolute "^1.0.0" globals@^9.0.0, globals@^9.14.0: version "9.16.0" resolved "https://registry.yarnpkg.com/globals/-/globals-9.16.0.tgz#63e903658171ec2d9f51b1d31de5e2b8dc01fb80" globby@^5.0.0: version "5.0.0" resolved "https://registry.yarnpkg.com/globby/-/globby-5.0.0.tgz#ebd84667ca0dbb330b99bcfc68eac2bc54370e0d" dependencies: array-union "^1.0.1" arrify "^1.0.0" glob "^7.0.3" object-assign "^4.0.1" pify "^2.0.0" pinkie-promise "^2.0.0" graceful-fs@^4.1.2: version "4.1.11" resolved "https://registry.yarnpkg.com/graceful-fs/-/graceful-fs-4.1.11.tgz#0e8bdfe4d1ddb8854d64e04ea7c00e2a026e5658" "graceful-readlink@>= 1.0.0": version "1.0.1" resolved "https://registry.yarnpkg.com/graceful-readlink/-/graceful-readlink-1.0.1.tgz#4cafad76bc62f02fa039b2f94e9a3dd3a391a725" growl@1.9.2: version "1.9.2" resolved "https://registry.yarnpkg.com/growl/-/growl-1.9.2.tgz#0ea7743715db8d8de2c5ede1775e1b45ac85c02f" has-ansi@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/has-ansi/-/has-ansi-2.0.0.tgz#34f5049ce1ecdf2b0649af3ef24e45ed35416d91" dependencies: ansi-regex "^2.0.0" has-flag@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/has-flag/-/has-flag-1.0.0.tgz#9d9e793165ce017a00f00418c43f942a7b1d11fa" ignore@^3.2.0: version "3.2.6" resolved "https://registry.yarnpkg.com/ignore/-/ignore-3.2.6.tgz#26e8da0644be0bb4cb39516f6c79f0e0f4ffe48c" imurmurhash@^0.1.4: version "0.1.4" resolved "https://registry.yarnpkg.com/imurmurhash/-/imurmurhash-0.1.4.tgz#9218b9b2b928a238b13dc4fb6b6d576f231453ea" inflight@^1.0.4: version "1.0.6" resolved "https://registry.yarnpkg.com/inflight/-/inflight-1.0.6.tgz#49bd6331d7d02d0c09bc910a1075ba8165b56df9" dependencies: once "^1.3.0" wrappy "1" inherits@2, inherits@^2.0.3, inherits@~2.0.1: version "2.0.3" resolved "https://registry.yarnpkg.com/inherits/-/inherits-2.0.3.tgz#633c2c83e3da42a502f52466022480f4208261de" inquirer@^0.12.0: version "0.12.0" resolved "https://registry.yarnpkg.com/inquirer/-/inquirer-0.12.0.tgz#1ef2bfd63504df0bc75785fff8c2c41df12f077e" dependencies: ansi-escapes "^1.1.0" ansi-regex "^2.0.0" chalk "^1.0.0" cli-cursor "^1.0.1" cli-width "^2.0.0" figures "^1.3.5" lodash "^4.3.0" readline2 "^1.0.1" run-async "^0.1.0" rx-lite "^3.1.2" string-width "^1.0.1" strip-ansi "^3.0.0" through "^2.3.6" interpret@^1.0.0: version "1.0.1" resolved "https://registry.yarnpkg.com/interpret/-/interpret-1.0.1.tgz#d579fb7f693b858004947af39fa0db49f795602c" invariant@^2.2.0: version "2.2.2" resolved "https://registry.yarnpkg.com/invariant/-/invariant-2.2.2.tgz#9e1f56ac0acdb6bf303306f338be3b204ae60360" dependencies: loose-envify "^1.0.0" is-fullwidth-code-point@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/is-fullwidth-code-point/-/is-fullwidth-code-point-1.0.0.tgz#ef9e31386f031a7f0d643af82fde50c457ef00cb" dependencies: number-is-nan "^1.0.0" is-fullwidth-code-point@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz#a3b30a5c4f199183167aaab93beefae3ddfb654f" is-my-json-valid@^2.10.0: version "2.16.0" resolved "https://registry.yarnpkg.com/is-my-json-valid/-/is-my-json-valid-2.16.0.tgz#f079dd9bfdae65ee2038aae8acbc86ab109e3693" dependencies: generate-function "^2.0.0" generate-object-property "^1.1.0" jsonpointer "^4.0.0" xtend "^4.0.0" is-path-cwd@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/is-path-cwd/-/is-path-cwd-1.0.0.tgz#d225ec23132e89edd38fda767472e62e65f1106d" is-path-in-cwd@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/is-path-in-cwd/-/is-path-in-cwd-1.0.0.tgz#6477582b8214d602346094567003be8a9eac04dc" dependencies: is-path-inside "^1.0.0" is-path-inside@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/is-path-inside/-/is-path-inside-1.0.0.tgz#fc06e5a1683fbda13de667aff717bbc10a48f37f" dependencies: path-is-inside "^1.0.1" is-property@^1.0.0: version "1.0.2" resolved "https://registry.yarnpkg.com/is-property/-/is-property-1.0.2.tgz#57fe1c4e48474edd65b09911f26b1cd4095dda84" is-resolvable@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/is-resolvable/-/is-resolvable-1.0.0.tgz#8df57c61ea2e3c501408d100fb013cf8d6e0cc62" dependencies: tryit "^1.0.1" isarray@^1.0.0, isarray@~1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/isarray/-/isarray-1.0.0.tgz#bb935d48582cba168c06834957a54a3e07124f11" js-tokens@^3.0.0: version "3.0.1" resolved "https://registry.yarnpkg.com/js-tokens/-/js-tokens-3.0.1.tgz#08e9f132484a2c45a30907e9dc4d5567b7f114d7" js-yaml@^3.5.1: version "3.8.2" resolved "https://registry.yarnpkg.com/js-yaml/-/js-yaml-3.8.2.tgz#02d3e2c0f6beab20248d412c352203827d786721" dependencies: argparse "^1.0.7" esprima "^3.1.1" json-stable-stringify@^1.0.0, json-stable-stringify@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/json-stable-stringify/-/json-stable-stringify-1.0.1.tgz#9a759d39c5f2ff503fd5300646ed445f88c4f9af" dependencies: jsonify "~0.0.0" json3@3.3.2: version "3.3.2" resolved "https://registry.yarnpkg.com/json3/-/json3-3.3.2.tgz#3c0434743df93e2f5c42aee7b19bcb483575f4e1" jsonify@~0.0.0: version "0.0.0" resolved "https://registry.yarnpkg.com/jsonify/-/jsonify-0.0.0.tgz#2c74b6ee41d93ca51b7b5aaee8f503631d252a73" jsonpointer@^4.0.0: version "4.0.1" resolved "https://registry.yarnpkg.com/jsonpointer/-/jsonpointer-4.0.1.tgz#4fd92cb34e0e9db3c89c8622ecf51f9b978c6cb9" levn@^0.3.0, levn@~0.3.0: version "0.3.0" resolved "https://registry.yarnpkg.com/levn/-/levn-0.3.0.tgz#3b09924edf9f083c0490fdd4c0bc4421e04764ee" dependencies: prelude-ls "~1.1.2" type-check "~0.3.2" lodash._baseassign@^3.0.0: version "3.2.0" resolved "https://registry.yarnpkg.com/lodash._baseassign/-/lodash._baseassign-3.2.0.tgz#8c38a099500f215ad09e59f1722fd0c52bfe0a4e" dependencies: lodash._basecopy "^3.0.0" lodash.keys "^3.0.0" lodash._basecopy@^3.0.0: version "3.0.1" resolved "https://registry.yarnpkg.com/lodash._basecopy/-/lodash._basecopy-3.0.1.tgz#8da0e6a876cf344c0ad8a54882111dd3c5c7ca36" lodash._basecreate@^3.0.0: version "3.0.3" resolved "https://registry.yarnpkg.com/lodash._basecreate/-/lodash._basecreate-3.0.3.tgz#1bc661614daa7fc311b7d03bf16806a0213cf821" lodash._getnative@^3.0.0: version "3.9.1" resolved "https://registry.yarnpkg.com/lodash._getnative/-/lodash._getnative-3.9.1.tgz#570bc7dede46d61cdcde687d65d3eecbaa3aaff5" lodash._isiterateecall@^3.0.0: version "3.0.9" resolved "https://registry.yarnpkg.com/lodash._isiterateecall/-/lodash._isiterateecall-3.0.9.tgz#5203ad7ba425fae842460e696db9cf3e6aac057c" lodash.create@3.1.1: version "3.1.1" resolved "https://registry.yarnpkg.com/lodash.create/-/lodash.create-3.1.1.tgz#d7f2849f0dbda7e04682bb8cd72ab022461debe7" dependencies: lodash._baseassign "^3.0.0" lodash._basecreate "^3.0.0" lodash._isiterateecall "^3.0.0" lodash.isarguments@^3.0.0: version "3.1.0" resolved "https://registry.yarnpkg.com/lodash.isarguments/-/lodash.isarguments-3.1.0.tgz#2f573d85c6a24289ff00663b491c1d338ff3458a" lodash.isarray@^3.0.0: version "3.0.4" resolved "https://registry.yarnpkg.com/lodash.isarray/-/lodash.isarray-3.0.4.tgz#79e4eb88c36a8122af86f844aa9bcd851b5fbb55" lodash.keys@^3.0.0: version "3.1.2" resolved "https://registry.yarnpkg.com/lodash.keys/-/lodash.keys-3.1.2.tgz#4dbc0472b156be50a0b286855d1bd0b0c656098a" dependencies: lodash._getnative "^3.0.0" lodash.isarguments "^3.0.0" lodash.isarray "^3.0.0" lodash.pickby@^4.6.0: version "4.6.0" resolved "https://registry.yarnpkg.com/lodash.pickby/-/lodash.pickby-4.6.0.tgz#7dea21d8c18d7703a27c704c15d3b84a67e33aff" lodash@^4.0.0, lodash@^4.15.0, lodash@^4.2.0, lodash@^4.3.0: version "4.17.4" resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.4.tgz#78203a4d1c328ae1d86dca6460e369b57f4055ae" loose-envify@^1.0.0: version "1.3.1" resolved "https://registry.yarnpkg.com/loose-envify/-/loose-envify-1.3.1.tgz#d1a8ad33fa9ce0e713d65fdd0ac8b748d478c848" dependencies: js-tokens "^3.0.0" minimatch@^3.0.2: version "3.0.3" resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-3.0.3.tgz#2a4e4090b96b2db06a9d7df01055a62a77c9b774" dependencies: brace-expansion "^1.0.0" minimist@0.0.8: version "0.0.8" resolved "https://registry.yarnpkg.com/minimist/-/minimist-0.0.8.tgz#857fcabfc3397d2625b8228262e86aa7a011b05d" mkdirp@0.5.1, mkdirp@^0.5.0, mkdirp@^0.5.1: version "0.5.1" resolved "https://registry.yarnpkg.com/mkdirp/-/mkdirp-0.5.1.tgz#30057438eac6cf7f8c4767f38648d6697d75c903" dependencies: minimist "0.0.8" mocha@^3.0.0: version "3.2.0" resolved "https://registry.yarnpkg.com/mocha/-/mocha-3.2.0.tgz#7dc4f45e5088075171a68896814e6ae9eb7a85e3" dependencies: browser-stdout "1.3.0" commander "2.9.0" debug "2.2.0" diff "1.4.0" escape-string-regexp "1.0.5" glob "7.0.5" growl "1.9.2" json3 "3.3.2" lodash.create "3.1.1" mkdirp "0.5.1" supports-color "3.1.2" ms@0.7.1: version "0.7.1" resolved "https://registry.yarnpkg.com/ms/-/ms-0.7.1.tgz#9cd13c03adbff25b65effde7ce864ee952017098" ms@0.7.2: version "0.7.2" resolved "https://registry.yarnpkg.com/ms/-/ms-0.7.2.tgz#ae25cf2512b3885a1d95d7f037868d8431124765" mute-stream@0.0.5: version "0.0.5" resolved "https://registry.yarnpkg.com/mute-stream/-/mute-stream-0.0.5.tgz#8fbfabb0a98a253d3184331f9e8deb7372fac6c0" natural-compare@^1.4.0: version "1.4.0" resolved "https://registry.yarnpkg.com/natural-compare/-/natural-compare-1.4.0.tgz#4abebfeed7541f2c27acfb29bdbbd15c8d5ba4f7" number-is-nan@^1.0.0: version "1.0.1" resolved "https://registry.yarnpkg.com/number-is-nan/-/number-is-nan-1.0.1.tgz#097b602b53422a522c1afb8790318336941a011d" object-assign@^4.0.1, object-assign@^4.1.0: version "4.1.1" resolved "https://registry.yarnpkg.com/object-assign/-/object-assign-4.1.1.tgz#2109adc7965887cfc05cbbd442cac8bfbb360863" once@^1.3.0: version "1.4.0" resolved "https://registry.yarnpkg.com/once/-/once-1.4.0.tgz#583b1aa775961d4b113ac17d9c50baef9dd76bd1" dependencies: wrappy "1" onetime@^1.0.0: version "1.1.0" resolved "https://registry.yarnpkg.com/onetime/-/onetime-1.1.0.tgz#a1f7838f8314c516f05ecefcbc4ccfe04b4ed789" optionator@^0.8.2: version "0.8.2" resolved "https://registry.yarnpkg.com/optionator/-/optionator-0.8.2.tgz#364c5e409d3f4d6301d6c0b4c05bba50180aeb64" dependencies: deep-is "~0.1.3" fast-levenshtein "~2.0.4" levn "~0.3.0" prelude-ls "~1.1.2" type-check "~0.3.2" wordwrap "~1.0.0" os-homedir@^1.0.0: version "1.0.2" resolved "https://registry.yarnpkg.com/os-homedir/-/os-homedir-1.0.2.tgz#ffbc4988336e0e833de0c168c7ef152121aa7fb3" path-is-absolute@^1.0.0: version "1.0.1" resolved "https://registry.yarnpkg.com/path-is-absolute/-/path-is-absolute-1.0.1.tgz#174b9268735534ffbc7ace6bf53a5a9e1b5c5f5f" path-is-inside@^1.0.1: version "1.0.2" resolved "https://registry.yarnpkg.com/path-is-inside/-/path-is-inside-1.0.2.tgz#365417dede44430d1c11af61027facf074bdfc53" path-parse@^1.0.5: version "1.0.5" resolved "https://registry.yarnpkg.com/path-parse/-/path-parse-1.0.5.tgz#3c1adf871ea9cd6c9431b6ea2bd74a0ff055c4c1" pify@^2.0.0: version "2.3.0" resolved "https://registry.yarnpkg.com/pify/-/pify-2.3.0.tgz#ed141a6ac043a849ea588498e7dca8b15330e90c" pinkie-promise@^2.0.0: version "2.0.1" resolved "https://registry.yarnpkg.com/pinkie-promise/-/pinkie-promise-2.0.1.tgz#2135d6dfa7a358c069ac9b178776288228450ffa" dependencies: pinkie "^2.0.0" pinkie@^2.0.0: version "2.0.4" resolved "https://registry.yarnpkg.com/pinkie/-/pinkie-2.0.4.tgz#72556b80cfa0d48a974e80e77248e80ed4f7f870" pluralize@^1.2.1: version "1.2.1" resolved "https://registry.yarnpkg.com/pluralize/-/pluralize-1.2.1.tgz#d1a21483fd22bb41e58a12fa3421823140897c45" prelude-ls@~1.1.2: version "1.1.2" resolved "https://registry.yarnpkg.com/prelude-ls/-/prelude-ls-1.1.2.tgz#21932a549f5e52ffd9a827f570e04be62a97da54" process-nextick-args@~1.0.6: version "1.0.7" resolved "https://registry.yarnpkg.com/process-nextick-args/-/process-nextick-args-1.0.7.tgz#150e20b756590ad3f91093f25a4f2ad8bff30ba3" progress@^1.1.8: version "1.1.8" resolved "https://registry.yarnpkg.com/progress/-/progress-1.1.8.tgz#e260c78f6161cdd9b0e56cc3e0a85de17c7a57be" readable-stream@^2.2.2: version "2.2.6" resolved "https://registry.yarnpkg.com/readable-stream/-/readable-stream-2.2.6.tgz#8b43aed76e71483938d12a8d46c6cf1a00b1f816" dependencies: buffer-shims "^1.0.0" core-util-is "~1.0.0" inherits "~2.0.1" isarray "~1.0.0" process-nextick-args "~1.0.6" string_decoder "~0.10.x" util-deprecate "~1.0.1" readline2@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/readline2/-/readline2-1.0.1.tgz#41059608ffc154757b715d9989d199ffbf372e35" dependencies: code-point-at "^1.0.0" is-fullwidth-code-point "^1.0.0" mute-stream "0.0.5" rechoir@^0.6.2: version "0.6.2" resolved "https://registry.yarnpkg.com/rechoir/-/rechoir-0.6.2.tgz#85204b54dba82d5742e28c96756ef43af50e3384" dependencies: resolve "^1.1.6" regenerator-runtime@^0.10.0: version "0.10.3" resolved "https://registry.yarnpkg.com/regenerator-runtime/-/regenerator-runtime-0.10.3.tgz#8c4367a904b51ea62a908ac310bf99ff90a82a3e" require-uncached@^1.0.2: version "1.0.3" resolved "https://registry.yarnpkg.com/require-uncached/-/require-uncached-1.0.3.tgz#4e0d56d6c9662fd31e43011c4b95aa49955421d3" dependencies: caller-path "^0.1.0" resolve-from "^1.0.0" resolve-from@^1.0.0: version "1.0.1" resolved "https://registry.yarnpkg.com/resolve-from/-/resolve-from-1.0.1.tgz#26cbfe935d1aeeeabb29bc3fe5aeb01e93d44226" resolve@^1.1.6: version "1.3.2" resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.3.2.tgz#1f0442c9e0cbb8136e87b9305f932f46c7f28235" dependencies: path-parse "^1.0.5" restore-cursor@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/restore-cursor/-/restore-cursor-1.0.1.tgz#34661f46886327fed2991479152252df92daa541" dependencies: exit-hook "^1.0.0" onetime "^1.0.0" rimraf@^2.2.8: version "2.6.1" resolved "https://registry.yarnpkg.com/rimraf/-/rimraf-2.6.1.tgz#c2338ec643df7a1b7fe5c54fa86f57428a55f33d" dependencies: glob "^7.0.5" run-async@^0.1.0: version "0.1.0" resolved "https://registry.yarnpkg.com/run-async/-/run-async-0.1.0.tgz#c8ad4a5e110661e402a7d21b530e009f25f8e389" dependencies: once "^1.3.0" rx-lite@^3.1.2: version "3.1.2" resolved "https://registry.yarnpkg.com/rx-lite/-/rx-lite-3.1.2.tgz#19ce502ca572665f3b647b10939f97fd1615f102" shelljs@^0.7.5: version "0.7.7" resolved "https://registry.yarnpkg.com/shelljs/-/shelljs-0.7.7.tgz#b2f5c77ef97148f4b4f6e22682e10bba8667cff1" dependencies: glob "^7.0.0" interpret "^1.0.0" rechoir "^0.6.2" slice-ansi@0.0.4: version "0.0.4" resolved "https://registry.yarnpkg.com/slice-ansi/-/slice-ansi-0.0.4.tgz#edbf8903f66f7ce2f8eafd6ceed65e264c831b35" sprintf-js@~1.0.2: version "1.0.3" resolved "https://registry.yarnpkg.com/sprintf-js/-/sprintf-js-1.0.3.tgz#04e6926f662895354f3dd015203633b857297e2c" string-width@^1.0.1: version "1.0.2" resolved "https://registry.yarnpkg.com/string-width/-/string-width-1.0.2.tgz#118bdf5b8cdc51a2a7e70d211e07e2b0b9b107d3" dependencies: code-point-at "^1.0.0" is-fullwidth-code-point "^1.0.0" strip-ansi "^3.0.0" string-width@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/string-width/-/string-width-2.0.0.tgz#635c5436cc72a6e0c387ceca278d4e2eec52687e" dependencies: is-fullwidth-code-point "^2.0.0" strip-ansi "^3.0.0" string_decoder@~0.10.x: version "0.10.31" resolved "https://registry.yarnpkg.com/string_decoder/-/string_decoder-0.10.31.tgz#62e203bc41766c6c28c9fc84301dab1c5310fa94" strip-ansi@^3.0.0: version "3.0.1" resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-3.0.1.tgz#6a385fb8853d952d5ff05d0e8aaf94278dc63dcf" dependencies: ansi-regex "^2.0.0" strip-bom@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/strip-bom/-/strip-bom-3.0.0.tgz#2334c18e9c759f7bdd56fdef7e9ae3d588e68ed3" strip-json-comments@~2.0.1: version "2.0.1" resolved "https://registry.yarnpkg.com/strip-json-comments/-/strip-json-comments-2.0.1.tgz#3c531942e908c2697c0ec344858c286c7ca0a60a" supports-color@3.1.2: version "3.1.2" resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-3.1.2.tgz#72a262894d9d408b956ca05ff37b2ed8a6e2a2d5" dependencies: has-flag "^1.0.0" supports-color@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-2.0.0.tgz#535d045ce6b6363fa40117084629995e9df324c7" table@^3.7.8: version "3.8.3" resolved "https://registry.yarnpkg.com/table/-/table-3.8.3.tgz#2bbc542f0fda9861a755d3947fefd8b3f513855f" dependencies: ajv "^4.7.0" ajv-keywords "^1.0.0" chalk "^1.1.1" lodash "^4.0.0" slice-ansi "0.0.4" string-width "^2.0.0" text-table@~0.2.0: version "0.2.0" resolved "https://registry.yarnpkg.com/text-table/-/text-table-0.2.0.tgz#7f5ee823ae805207c00af2df4a84ec3fcfa570b4" through@^2.3.6: version "2.3.8" resolved "https://registry.yarnpkg.com/through/-/through-2.3.8.tgz#0dd4c9ffaabc357960b1b724115d7e0e86a2e1f5" to-fast-properties@^1.0.1: version "1.0.2" resolved "https://registry.yarnpkg.com/to-fast-properties/-/to-fast-properties-1.0.2.tgz#f3f5c0c3ba7299a7ef99427e44633257ade43320" tryit@^1.0.1: version "1.0.3" resolved "https://registry.yarnpkg.com/tryit/-/tryit-1.0.3.tgz#393be730a9446fd1ead6da59a014308f36c289cb" type-check@~0.3.2: version "0.3.2" resolved "https://registry.yarnpkg.com/type-check/-/type-check-0.3.2.tgz#5884cab512cf1d355e3fb784f30804b2b520db72" dependencies: prelude-ls "~1.1.2" typedarray@^0.0.6: version "0.0.6" resolved "https://registry.yarnpkg.com/typedarray/-/typedarray-0.0.6.tgz#867ac74e3864187b1d3d47d996a78ec5c8830777" user-home@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/user-home/-/user-home-2.0.0.tgz#9c70bfd8169bc1dcbf48604e0f04b8b49cde9e9f" dependencies: os-homedir "^1.0.0" util-deprecate@~1.0.1: version "1.0.2" resolved "https://registry.yarnpkg.com/util-deprecate/-/util-deprecate-1.0.2.tgz#450d4dc9fa70de732762fbd2d4a28981419a0ccf" wordwrap@~1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/wordwrap/-/wordwrap-1.0.0.tgz#27584810891456a4171c8d0226441ade90cbcaeb" wrappy@1: version "1.0.2" resolved "https://registry.yarnpkg.com/wrappy/-/wrappy-1.0.2.tgz#b5243d8f3ec1aa35f1364605bc0d1036e30ab69f" write@^0.2.1: version "0.2.1" resolved "https://registry.yarnpkg.com/write/-/write-0.2.1.tgz#5fc03828e264cea3fe91455476f7a3c566cb0757" dependencies: mkdirp "^0.5.1" xtend@^4.0.0: version "4.0.1" resolved "https://registry.yarnpkg.com/xtend/-/xtend-4.0.1.tgz#a5c6d532be656e23db820efb943a1f04998d63af"