diff --git a/node_modules/doctrine/LICENSE.BSD b/node_modules/doctrine/LICENSE.BSD new file mode 100644 index 000000000..3e580c355 --- /dev/null +++ b/node_modules/doctrine/LICENSE.BSD @@ -0,0 +1,19 @@ +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +ARE DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY +DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF +THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/node_modules/doctrine/LICENSE.closure-compiler b/node_modules/doctrine/LICENSE.closure-compiler new file mode 100644 index 000000000..d64569567 --- /dev/null +++ b/node_modules/doctrine/LICENSE.closure-compiler @@ -0,0 +1,202 @@ + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/node_modules/doctrine/LICENSE.esprima b/node_modules/doctrine/LICENSE.esprima new file mode 100644 index 000000000..3e580c355 --- /dev/null +++ b/node_modules/doctrine/LICENSE.esprima @@ -0,0 +1,19 @@ +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +ARE DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY +DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF +THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/node_modules/doctrine/README.md b/node_modules/doctrine/README.md new file mode 100644 index 000000000..14e3dfe68 --- /dev/null +++ b/node_modules/doctrine/README.md @@ -0,0 +1,174 @@ +[![NPM version][npm-image]][npm-url] +[![build status][travis-image]][travis-url] +[![Test coverage][coveralls-image]][coveralls-url] +[![Downloads][downloads-image]][downloads-url] +[![Join the chat at https://gitter.im/eslint/doctrine](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/eslint/doctrine?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) + +# Doctrine + +Doctrine is a [JSDoc](http://usejsdoc.org) parser that parses documentation comments from JavaScript (you need to pass in the comment, not a whole JavaScript file). + +## Installation + +You can install Doctrine using [npm](https://npmjs.com): + +``` +$ npm install doctrine --save-dev +``` + +Doctrine can also be used in web browsers using [Browserify](http://browserify.org). + +## Usage + +Require doctrine inside of your JavaScript: + +```js +var doctrine = require("doctrine"); +``` + +### parse() + +The primary method is `parse()`, which accepts two arguments: the JSDoc comment to parse and an optional options object. The available options are: + +* `unwrap` - set to `true` to delete the leading `/**`, any `*` that begins a line, and the trailing `*/` from the source text. Default: `false`. +* `tags` - an array of tags to return. When specified, Doctrine returns only tags in this array. For example, if `tags` is `["param"]`, then only `@param` tags will be returned. Default: `null`. +* `recoverable` - set to `true` to keep parsing even when syntax errors occur. Default: `false`. +* `sloppy` - set to `true` to allow optional parameters to be specified in brackets (`@param {string} [foo]`). Default: `false`. +* `lineNumberes` - set to `true` to add `lineNumber` to each node, specifying the line on which the node is found in the source. Default: `false`. + +Here's a simple example: + +```js +var ast = doctrine.parse( + [ + "/**", + " * This function comment is parsed by doctrine", + " * @param {{ok:String}} userName", + "*/" + ].join('\n'), { unwrap: true }); +``` + +This example returns the following AST: + + { + "description": "This function comment is parsed by doctrine", + "tags": [ + { + "title": "param", + "description": null, + "type": { + "type": "RecordType", + "fields": [ + { + "type": "FieldType", + "key": "ok", + "value": { + "type": "NameExpression", + "name": "String" + } + } + ] + }, + "name": "userName" + } + ] + } + +See the [demo page](http://eslint.org/doctrine/demo/) more detail. + +## Team + +These folks keep the project moving and are resources for help: + +* Nicholas C. Zakas ([@nzakas](https://github.com/nzakas)) - project lead +* Yusuke Suzuki ([@constellation](https://github.com/constellation)) - reviewer + +## Contributing + +Issues and pull requests will be triaged and responded to as quickly as possible. We operate under the [ESLint Contributor Guidelines](http://eslint.org/docs/developer-guide/contributing), so please be sure to read them before contributing. If you're not sure where to dig in, check out the [issues](https://github.com/eslint/doctrine/issues). + +## Frequently Asked Questions + +### Can I pass a whole JavaScript file to Doctrine? + +No. Doctrine can only parse JSDoc comments, so you'll need to pass just the JSDoc comment to Doctrine in order to work. + + +### License + +#### doctrine + +Copyright (C) 2012 [Yusuke Suzuki](http://github.com/Constellation) + (twitter: [@Constellation](http://twitter.com/Constellation)) and other contributors. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +ARE DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY +DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF +THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +#### esprima + +some of functions is derived from esprima + +Copyright (C) 2012, 2011 [Ariya Hidayat](http://ariya.ofilabs.com/about) + (twitter: [@ariyahidayat](http://twitter.com/ariyahidayat)) and other contributors. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +ARE DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY +DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF +THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + + +#### closure-compiler + +some of extensions is derived from closure-compiler + +Apache License +Version 2.0, January 2004 +http://www.apache.org/licenses/ + + +### Where to ask for help? + +Join our [Chatroom](https://gitter.im/eslint/doctrine) + +[npm-image]: https://img.shields.io/npm/v/doctrine.svg?style=flat-square +[npm-url]: https://www.npmjs.com/package/doctrine +[travis-image]: https://img.shields.io/travis/eslint/doctrine/master.svg?style=flat-square +[travis-url]: https://travis-ci.org/eslint/doctrine +[coveralls-image]: https://img.shields.io/coveralls/eslint/doctrine/master.svg?style=flat-square +[coveralls-url]: https://coveralls.io/r/eslint/doctrine?branch=master +[downloads-image]: http://img.shields.io/npm/dm/doctrine.svg?style=flat-square +[downloads-url]: https://www.npmjs.com/package/doctrine diff --git a/node_modules/doctrine/lib/doctrine.js b/node_modules/doctrine/lib/doctrine.js new file mode 100644 index 000000000..d7ba412a8 --- /dev/null +++ b/node_modules/doctrine/lib/doctrine.js @@ -0,0 +1,833 @@ +/* + Copyright (C) 2012-2014 Yusuke Suzuki + Copyright (C) 2014 Dan Tao + Copyright (C) 2013 Andrew Eisenberg + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +(function () { + 'use strict'; + + var typed, + utility, + isArray, + jsdoc, + esutils, + hasOwnProperty; + + esutils = require('esutils'); + isArray = require('isarray'); + typed = require('./typed'); + utility = require('./utility'); + + function sliceSource(source, index, last) { + return source.slice(index, last); + } + + hasOwnProperty = (function () { + var func = Object.prototype.hasOwnProperty; + return function hasOwnProperty(obj, name) { + return func.call(obj, name); + }; + }()); + + function shallowCopy(obj) { + var ret = {}, key; + for (key in obj) { + if (obj.hasOwnProperty(key)) { + ret[key] = obj[key]; + } + } + return ret; + } + + function isASCIIAlphanumeric(ch) { + return (ch >= 0x61 /* 'a' */ && ch <= 0x7A /* 'z' */) || + (ch >= 0x41 /* 'A' */ && ch <= 0x5A /* 'Z' */) || + (ch >= 0x30 /* '0' */ && ch <= 0x39 /* '9' */); + } + + function isParamTitle(title) { + return title === 'param' || title === 'argument' || title === 'arg'; + } + + function isReturnTitle(title) { + return title === 'return' || title === 'returns'; + } + + function isProperty(title) { + return title === 'property' || title === 'prop'; + } + + function isNameParameterRequired(title) { + return isParamTitle(title) || isProperty(title) || + title === 'alias' || title === 'this' || title === 'mixes' || title === 'requires'; + } + + function isAllowedName(title) { + return isNameParameterRequired(title) || title === 'const' || title === 'constant'; + } + + function isAllowedNested(title) { + return isProperty(title) || isParamTitle(title); + } + + function isTypeParameterRequired(title) { + return isParamTitle(title) || isReturnTitle(title) || + title === 'define' || title === 'enum' || + title === 'implements' || title === 'this' || + title === 'type' || title === 'typedef' || isProperty(title); + } + + // Consider deprecation instead using 'isTypeParameterRequired' and 'Rules' declaration to pick when a type is optional/required + // This would require changes to 'parseType' + function isAllowedType(title) { + return isTypeParameterRequired(title) || title === 'throws' || title === 'const' || title === 'constant' || + title === 'namespace' || title === 'member' || title === 'var' || title === 'module' || + title === 'constructor' || title === 'class' || title === 'extends' || title === 'augments' || + title === 'public' || title === 'private' || title === 'protected'; + } + + function trim(str) { + return str.replace(/^\s+/, '').replace(/\s+$/, ''); + } + + function unwrapComment(doc) { + // JSDoc comment is following form + // /** + // * ....... + // */ + // remove /**, */ and * + var BEFORE_STAR = 0, + STAR = 1, + AFTER_STAR = 2, + index, + len, + mode, + result, + ch; + + doc = doc.replace(/^\/\*\*?/, '').replace(/\*\/$/, ''); + index = 0; + len = doc.length; + mode = BEFORE_STAR; + result = ''; + + while (index < len) { + ch = doc.charCodeAt(index); + switch (mode) { + case BEFORE_STAR: + if (esutils.code.isLineTerminator(ch)) { + result += String.fromCharCode(ch); + } else if (ch === 0x2A /* '*' */) { + mode = STAR; + } else if (!esutils.code.isWhiteSpace(ch)) { + result += String.fromCharCode(ch); + mode = AFTER_STAR; + } + break; + + case STAR: + if (!esutils.code.isWhiteSpace(ch)) { + result += String.fromCharCode(ch); + } + mode = esutils.code.isLineTerminator(ch) ? BEFORE_STAR : AFTER_STAR; + break; + + case AFTER_STAR: + result += String.fromCharCode(ch); + if (esutils.code.isLineTerminator(ch)) { + mode = BEFORE_STAR; + } + break; + } + index += 1; + } + + return result.replace(/\s+$/, ''); + } + + // JSDoc Tag Parser + + (function (exports) { + var Rules, + index, + lineNumber, + length, + source, + recoverable, + sloppy, + strict; + + function advance() { + var ch = source.charCodeAt(index); + index += 1; + if (esutils.code.isLineTerminator(ch) && !(ch === 0x0D /* '\r' */ && source.charCodeAt(index) === 0x0A /* '\n' */)) { + lineNumber += 1; + } + return String.fromCharCode(ch); + } + + function scanTitle() { + var title = ''; + // waste '@' + advance(); + + while (index < length && isASCIIAlphanumeric(source.charCodeAt(index))) { + title += advance(); + } + + return title; + } + + function seekContent() { + var ch, waiting, last = index; + + waiting = false; + while (last < length) { + ch = source.charCodeAt(last); + if (esutils.code.isLineTerminator(ch) && !(ch === 0x0D /* '\r' */ && source.charCodeAt(last + 1) === 0x0A /* '\n' */)) { + waiting = true; + } else if (waiting) { + if (ch === 0x40 /* '@' */) { + break; + } + if (!esutils.code.isWhiteSpace(ch)) { + waiting = false; + } + } + last += 1; + } + return last; + } + + // type expression may have nest brace, such as, + // { { ok: string } } + // + // therefore, scanning type expression with balancing braces. + function parseType(title, last) { + var ch, brace, type, direct = false; + + + // search '{' + while (index < last) { + ch = source.charCodeAt(index); + if (esutils.code.isWhiteSpace(ch)) { + advance(); + } else if (ch === 0x7B /* '{' */) { + advance(); + break; + } else { + // this is direct pattern + direct = true; + break; + } + } + + + if (direct) { + return null; + } + + // type expression { is found + brace = 1; + type = ''; + while (index < last) { + ch = source.charCodeAt(index); + if (esutils.code.isLineTerminator(ch)) { + advance(); + } else { + if (ch === 0x7D /* '}' */) { + brace -= 1; + if (brace === 0) { + advance(); + break; + } + } else if (ch === 0x7B /* '{' */) { + brace += 1; + } + type += advance(); + } + } + + if (brace !== 0) { + // braces is not balanced + return utility.throwError('Braces are not balanced'); + } + + if (isParamTitle(title)) { + return typed.parseParamType(type); + } + return typed.parseType(type); + } + + function scanIdentifier(last) { + var identifier; + if (!esutils.code.isIdentifierStart(source.charCodeAt(index))) { + return null; + } + identifier = advance(); + while (index < last && esutils.code.isIdentifierPart(source.charCodeAt(index))) { + identifier += advance(); + } + return identifier; + } + + function skipWhiteSpace(last) { + while (index < last && (esutils.code.isWhiteSpace(source.charCodeAt(index)) || esutils.code.isLineTerminator(source.charCodeAt(index)))) { + advance(); + } + } + + function parseName(last, allowBrackets, allowNestedParams) { + var name = '', useBrackets; + + skipWhiteSpace(last); + + if (index >= last) { + return null; + } + + if (allowBrackets && source.charCodeAt(index) === 0x5B /* '[' */) { + useBrackets = true; + name = advance(); + } + + if (!esutils.code.isIdentifierStart(source.charCodeAt(index))) { + return null; + } + + name += scanIdentifier(last); + + if (allowNestedParams) { + if (source.charCodeAt(index) === 0x3A /* ':' */ && ( + name === 'module' || + name === 'external' || + name === 'event')) { + name += advance(); + name += scanIdentifier(last); + + } + if(source.charCodeAt(index) === 0x5B /* '[' */ && source.charCodeAt(index + 1) === 0x5D /* ']' */){ + name += advance(); + name += advance(); + } + while (source.charCodeAt(index) === 0x2E /* '.' */ || + source.charCodeAt(index) === 0x23 /* '#' */ || + source.charCodeAt(index) === 0x7E /* '~' */) { + name += advance(); + name += scanIdentifier(last); + } + } + + if (useBrackets) { + + + // do we have a default value for this? + if (source.charCodeAt(index) === 0x3D /* '=' */) { + // consume the '='' symbol + name += advance(); + var bracketDepth = 1; + // scan in the default value + while (index < last) { + if (source.charCodeAt(index) === 0x5B /* '[' */) { + bracketDepth++; + } else if (source.charCodeAt(index) === 0x5D /* ']' */ && + --bracketDepth === 0) { + break; + } + name += advance(); + } + } + + if (index >= last || source.charCodeAt(index) !== 0x5D /* ']' */) { + // we never found a closing ']' + return null; + } + + // collect the last ']' + name += advance(); + } + + return name; + } + + function skipToTag() { + while (index < length && source.charCodeAt(index) !== 0x40 /* '@' */) { + advance(); + } + if (index >= length) { + return false; + } + utility.assert(source.charCodeAt(index) === 0x40 /* '@' */); + return true; + } + + function TagParser(options, title) { + this._options = options; + this._title = title; + this._tag = { + title: title, + description: null + }; + if (this._options.lineNumbers) { + this._tag.lineNumber = lineNumber; + } + this._last = 0; + // space to save special information for title parsers. + this._extra = { }; + } + + // addError(err, ...) + TagParser.prototype.addError = function addError(errorText) { + var args = Array.prototype.slice.call(arguments, 1), + msg = errorText.replace( + /%(\d)/g, + function (whole, index) { + utility.assert(index < args.length, 'Message reference must be in range'); + return args[index]; + } + ); + + if (!this._tag.errors) { + this._tag.errors = []; + } + if (strict) { + utility.throwError(msg); + } + this._tag.errors.push(msg); + return recoverable; + }; + + TagParser.prototype.parseType = function () { + // type required titles + if (isTypeParameterRequired(this._title)) { + try { + this._tag.type = parseType(this._title, this._last); + if (!this._tag.type) { + if (!isParamTitle(this._title) && !isReturnTitle(this._title)) { + if (!this.addError('Missing or invalid tag type')) { + return false; + } + } + } + } catch (error) { + this._tag.type = null; + if (!this.addError(error.message)) { + return false; + } + } + } else if (isAllowedType(this._title)) { + // optional types + try { + this._tag.type = parseType(this._title, this._last); + } catch (e) { + //For optional types, lets drop the thrown error when we hit the end of the file + } + } + return true; + }; + + TagParser.prototype._parseNamePath = function (optional) { + var name; + name = parseName(this._last, sloppy && isParamTitle(this._title), true); + if (!name) { + if (!optional) { + if (!this.addError('Missing or invalid tag name')) { + return false; + } + } + } + this._tag.name = name; + return true; + }; + + TagParser.prototype.parseNamePath = function () { + return this._parseNamePath(false); + }; + + TagParser.prototype.parseNamePathOptional = function () { + return this._parseNamePath(true); + }; + + + TagParser.prototype.parseName = function () { + var assign, name; + + // param, property requires name + if (isAllowedName(this._title)) { + this._tag.name = parseName(this._last, sloppy && isParamTitle(this._title), isAllowedNested(this._title)); + if (!this._tag.name) { + if (!isNameParameterRequired(this._title)) { + return true; + } + + // it's possible the name has already been parsed but interpreted as a type + // it's also possible this is a sloppy declaration, in which case it will be + // fixed at the end + if (isParamTitle(this._title) && this._tag.type && this._tag.type.name) { + this._extra.name = this._tag.type; + this._tag.name = this._tag.type.name; + this._tag.type = null; + } else { + if (!this.addError('Missing or invalid tag name')) { + return false; + } + } + } else { + name = this._tag.name; + if (name.charAt(0) === '[' && name.charAt(name.length - 1) === ']') { + // extract the default value if there is one + // example: @param {string} [somebody=John Doe] description + assign = name.substring(1, name.length - 1).split('='); + if (assign[1]) { + this._tag['default'] = assign[1]; + } + this._tag.name = assign[0]; + + // convert to an optional type + if (this._tag.type && this._tag.type.type !== 'OptionalType') { + this._tag.type = { + type: 'OptionalType', + expression: this._tag.type + }; + } + } + } + } + + return true; + }; + + TagParser.prototype.parseDescription = function parseDescription() { + var description = trim(sliceSource(source, index, this._last)); + if (description) { + if ((/^-\s+/).test(description)) { + description = description.substring(2); + } + this._tag.description = description; + } + return true; + }; + + TagParser.prototype.parseKind = function parseKind() { + var kind, kinds; + kinds = { + 'class': true, + 'constant': true, + 'event': true, + 'external': true, + 'file': true, + 'function': true, + 'member': true, + 'mixin': true, + 'module': true, + 'namespace': true, + 'typedef': true + }; + kind = trim(sliceSource(source, index, this._last)); + this._tag.kind = kind; + if (!hasOwnProperty(kinds, kind)) { + if (!this.addError('Invalid kind name \'%0\'', kind)) { + return false; + } + } + return true; + }; + + TagParser.prototype.parseAccess = function parseAccess() { + var access; + access = trim(sliceSource(source, index, this._last)); + this._tag.access = access; + if (access !== 'private' && access !== 'protected' && access !== 'public') { + if (!this.addError('Invalid access name \'%0\'', access)) { + return false; + } + } + return true; + }; + + TagParser.prototype.parseVariation = function parseVariation() { + var variation, text; + text = trim(sliceSource(source, index, this._last)); + variation = parseFloat(text, 10); + this._tag.variation = variation; + if (isNaN(variation)) { + if (!this.addError('Invalid variation \'%0\'', text)) { + return false; + } + } + return true; + }; + + TagParser.prototype.ensureEnd = function () { + var shouldBeEmpty = trim(sliceSource(source, index, this._last)); + if (shouldBeEmpty) { + if (!this.addError('Unknown content \'%0\'', shouldBeEmpty)) { + return false; + } + } + return true; + }; + + TagParser.prototype.epilogue = function epilogue() { + var description; + + description = this._tag.description; + // un-fix potentially sloppy declaration + if (isParamTitle(this._title) && !this._tag.type && description && description.charAt(0) === '[') { + this._tag.type = this._extra.name; + if (!this._tag.name) { + this._tag.name = undefined; + } + + if (!sloppy) { + if (!this.addError('Missing or invalid tag name')) { + return false; + } + } + } + + return true; + }; + + Rules = { + // http://usejsdoc.org/tags-access.html + 'access': ['parseAccess'], + // http://usejsdoc.org/tags-alias.html + 'alias': ['parseNamePath', 'ensureEnd'], + // http://usejsdoc.org/tags-augments.html + 'augments': ['parseType', 'parseNamePathOptional', 'ensureEnd'], + // http://usejsdoc.org/tags-constructor.html + 'constructor': ['parseType', 'parseNamePathOptional', 'ensureEnd'], + // Synonym: http://usejsdoc.org/tags-constructor.html + 'class': ['parseType', 'parseNamePathOptional', 'ensureEnd'], + // Synonym: http://usejsdoc.org/tags-extends.html + 'extends': ['parseType', 'parseNamePathOptional', 'ensureEnd'], + // http://usejsdoc.org/tags-deprecated.html + 'deprecated': ['parseDescription'], + // http://usejsdoc.org/tags-global.html + 'global': ['ensureEnd'], + // http://usejsdoc.org/tags-inner.html + 'inner': ['ensureEnd'], + // http://usejsdoc.org/tags-instance.html + 'instance': ['ensureEnd'], + // http://usejsdoc.org/tags-kind.html + 'kind': ['parseKind'], + // http://usejsdoc.org/tags-mixes.html + 'mixes': ['parseNamePath', 'ensureEnd'], + // http://usejsdoc.org/tags-mixin.html + 'mixin': ['parseNamePathOptional', 'ensureEnd'], + // http://usejsdoc.org/tags-member.html + 'member': ['parseType', 'parseNamePathOptional', 'ensureEnd'], + // http://usejsdoc.org/tags-method.html + 'method': ['parseNamePathOptional', 'ensureEnd'], + // http://usejsdoc.org/tags-module.html + 'module': ['parseType', 'parseNamePathOptional', 'ensureEnd'], + // Synonym: http://usejsdoc.org/tags-method.html + 'func': ['parseNamePathOptional', 'ensureEnd'], + // Synonym: http://usejsdoc.org/tags-method.html + 'function': ['parseNamePathOptional', 'ensureEnd'], + // Synonym: http://usejsdoc.org/tags-member.html + 'var': ['parseType', 'parseNamePathOptional', 'ensureEnd'], + // http://usejsdoc.org/tags-name.html + 'name': ['parseNamePath', 'ensureEnd'], + // http://usejsdoc.org/tags-namespace.html + 'namespace': ['parseType', 'parseNamePathOptional', 'ensureEnd'], + // http://usejsdoc.org/tags-private.html + 'private': ['parseType', 'parseDescription'], + // http://usejsdoc.org/tags-protected.html + 'protected': ['parseType', 'parseDescription'], + // http://usejsdoc.org/tags-public.html + 'public': ['parseType', 'parseDescription'], + // http://usejsdoc.org/tags-readonly.html + 'readonly': ['ensureEnd'], + // http://usejsdoc.org/tags-requires.html + 'requires': ['parseNamePath', 'ensureEnd'], + // http://usejsdoc.org/tags-since.html + 'since': ['parseDescription'], + // http://usejsdoc.org/tags-static.html + 'static': ['ensureEnd'], + // http://usejsdoc.org/tags-summary.html + 'summary': ['parseDescription'], + // http://usejsdoc.org/tags-this.html + 'this': ['parseNamePath', 'ensureEnd'], + // http://usejsdoc.org/tags-todo.html + 'todo': ['parseDescription'], + // http://usejsdoc.org/tags-typedef.html + 'typedef': ['parseType', 'parseNamePathOptional'], + // http://usejsdoc.org/tags-variation.html + 'variation': ['parseVariation'], + // http://usejsdoc.org/tags-version.html + 'version': ['parseDescription'] + }; + + TagParser.prototype.parse = function parse() { + var i, iz, sequences, method; + + // empty title + if (!this._title) { + if (!this.addError('Missing or invalid title')) { + return null; + } + } + + // Seek to content last index. + this._last = seekContent(this._title); + + if (hasOwnProperty(Rules, this._title)) { + sequences = Rules[this._title]; + } else { + // default sequences + sequences = ['parseType', 'parseName', 'parseDescription', 'epilogue']; + } + + for (i = 0, iz = sequences.length; i < iz; ++i) { + method = sequences[i]; + if (!this[method]()) { + return null; + } + } + + return this._tag; + }; + + function parseTag(options) { + var title, parser, tag; + + // skip to tag + if (!skipToTag()) { + return null; + } + + // scan title + title = scanTitle(); + + // construct tag parser + parser = new TagParser(options, title); + tag = parser.parse(); + + // Seek global index to end of this tag. + while (index < parser._last) { + advance(); + } + return tag; + } + + // + // Parse JSDoc + // + + function scanJSDocDescription(preserveWhitespace) { + var description = '', ch, atAllowed; + + atAllowed = true; + while (index < length) { + ch = source.charCodeAt(index); + + if (atAllowed && ch === 0x40 /* '@' */) { + break; + } + + if (esutils.code.isLineTerminator(ch)) { + atAllowed = true; + } else if (atAllowed && !esutils.code.isWhiteSpace(ch)) { + atAllowed = false; + } + + description += advance(); + } + + return preserveWhitespace ? description : trim(description); + } + + function parse(comment, options) { + var tags = [], tag, description, interestingTags, i, iz; + + if (options === undefined) { + options = {}; + } + + if (typeof options.unwrap === 'boolean' && options.unwrap) { + source = unwrapComment(comment); + } else { + source = comment; + } + + // array of relevant tags + if (options.tags) { + if (isArray(options.tags)) { + interestingTags = { }; + for (i = 0, iz = options.tags.length; i < iz; i++) { + if (typeof options.tags[i] === 'string') { + interestingTags[options.tags[i]] = true; + } else { + utility.throwError('Invalid "tags" parameter: ' + options.tags); + } + } + } else { + utility.throwError('Invalid "tags" parameter: ' + options.tags); + } + } + + length = source.length; + index = 0; + lineNumber = 0; + recoverable = options.recoverable; + sloppy = options.sloppy; + strict = options.strict; + + description = scanJSDocDescription(options.preserveWhitespace); + + while (true) { + tag = parseTag(options); + if (!tag) { + break; + } + if (!interestingTags || interestingTags.hasOwnProperty(tag.title)) { + tags.push(tag); + } + } + + return { + description: description, + tags: tags + }; + } + exports.parse = parse; + }(jsdoc = {})); + + exports.version = utility.VERSION; + exports.parse = jsdoc.parse; + exports.parseType = typed.parseType; + exports.parseParamType = typed.parseParamType; + exports.unwrapComment = unwrapComment; + exports.Syntax = shallowCopy(typed.Syntax); + exports.Error = utility.DoctrineError; + exports.type = { + Syntax: exports.Syntax, + parseType: typed.parseType, + parseParamType: typed.parseParamType, + stringify: typed.stringify + }; +}()); +/* vim: set sw=4 ts=4 et tw=80 : */ diff --git a/node_modules/doctrine/lib/typed.js b/node_modules/doctrine/lib/typed.js new file mode 100644 index 000000000..2b02000e6 --- /dev/null +++ b/node_modules/doctrine/lib/typed.js @@ -0,0 +1,1261 @@ +/* + Copyright (C) 2012-2014 Yusuke Suzuki + Copyright (C) 2014 Dan Tao + Copyright (C) 2013 Andrew Eisenberg + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +// "typed", the Type Expression Parser for doctrine. + +(function () { + 'use strict'; + + var Syntax, + Token, + source, + length, + index, + previous, + token, + value, + esutils, + utility; + + esutils = require('esutils'); + utility = require('./utility'); + + Syntax = { + NullableLiteral: 'NullableLiteral', + AllLiteral: 'AllLiteral', + NullLiteral: 'NullLiteral', + UndefinedLiteral: 'UndefinedLiteral', + VoidLiteral: 'VoidLiteral', + UnionType: 'UnionType', + ArrayType: 'ArrayType', + RecordType: 'RecordType', + FieldType: 'FieldType', + FunctionType: 'FunctionType', + ParameterType: 'ParameterType', + RestType: 'RestType', + NonNullableType: 'NonNullableType', + OptionalType: 'OptionalType', + NullableType: 'NullableType', + NameExpression: 'NameExpression', + TypeApplication: 'TypeApplication' + }; + + Token = { + ILLEGAL: 0, // ILLEGAL + DOT_LT: 1, // .< + REST: 2, // ... + LT: 3, // < + GT: 4, // > + LPAREN: 5, // ( + RPAREN: 6, // ) + LBRACE: 7, // { + RBRACE: 8, // } + LBRACK: 9, // [ + RBRACK: 10, // ] + COMMA: 11, // , + COLON: 12, // : + STAR: 13, // * + PIPE: 14, // | + QUESTION: 15, // ? + BANG: 16, // ! + EQUAL: 17, // = + NAME: 18, // name token + STRING: 19, // string + NUMBER: 20, // number + EOF: 21 + }; + + function isTypeName(ch) { + return '><(){}[],:*|?!='.indexOf(String.fromCharCode(ch)) === -1 && !esutils.code.isWhiteSpace(ch) && !esutils.code.isLineTerminator(ch); + } + + function Context(previous, index, token, value) { + this._previous = previous; + this._index = index; + this._token = token; + this._value = value; + } + + Context.prototype.restore = function () { + previous = this._previous; + index = this._index; + token = this._token; + value = this._value; + }; + + Context.save = function () { + return new Context(previous, index, token, value); + }; + + function advance() { + var ch = source.charAt(index); + index += 1; + return ch; + } + + function scanHexEscape(prefix) { + var i, len, ch, code = 0; + + len = (prefix === 'u') ? 4 : 2; + for (i = 0; i < len; ++i) { + if (index < length && esutils.code.isHexDigit(source.charCodeAt(index))) { + ch = advance(); + code = code * 16 + '0123456789abcdef'.indexOf(ch.toLowerCase()); + } else { + return ''; + } + } + return String.fromCharCode(code); + } + + function scanString() { + var str = '', quote, ch, code, unescaped, restore; //TODO review removal octal = false + quote = source.charAt(index); + ++index; + + while (index < length) { + ch = advance(); + + if (ch === quote) { + quote = ''; + break; + } else if (ch === '\\') { + ch = advance(); + if (!esutils.code.isLineTerminator(ch.charCodeAt(0))) { + switch (ch) { + case 'n': + str += '\n'; + break; + case 'r': + str += '\r'; + break; + case 't': + str += '\t'; + break; + case 'u': + case 'x': + restore = index; + unescaped = scanHexEscape(ch); + if (unescaped) { + str += unescaped; + } else { + index = restore; + str += ch; + } + break; + case 'b': + str += '\b'; + break; + case 'f': + str += '\f'; + break; + case 'v': + str += '\v'; + break; + + default: + if (esutils.code.isOctalDigit(ch.charCodeAt(0))) { + code = '01234567'.indexOf(ch); + + // \0 is not octal escape sequence + // Deprecating unused code. TODO review removal + //if (code !== 0) { + // octal = true; + //} + + if (index < length && esutils.code.isOctalDigit(source.charCodeAt(index))) { + //TODO Review Removal octal = true; + code = code * 8 + '01234567'.indexOf(advance()); + + // 3 digits are only allowed when string starts + // with 0, 1, 2, 3 + if ('0123'.indexOf(ch) >= 0 && + index < length && + esutils.code.isOctalDigit(source.charCodeAt(index))) { + code = code * 8 + '01234567'.indexOf(advance()); + } + } + str += String.fromCharCode(code); + } else { + str += ch; + } + break; + } + } else { + if (ch === '\r' && source.charCodeAt(index) === 0x0A /* '\n' */) { + ++index; + } + } + } else if (esutils.code.isLineTerminator(ch.charCodeAt(0))) { + break; + } else { + str += ch; + } + } + + if (quote !== '') { + utility.throwError('unexpected quote'); + } + + value = str; + return Token.STRING; + } + + function scanNumber() { + var number, ch; + + number = ''; + ch = source.charCodeAt(index); + + if (ch !== 0x2E /* '.' */) { + number = advance(); + ch = source.charCodeAt(index); + + if (number === '0') { + if (ch === 0x78 /* 'x' */ || ch === 0x58 /* 'X' */) { + number += advance(); + while (index < length) { + ch = source.charCodeAt(index); + if (!esutils.code.isHexDigit(ch)) { + break; + } + number += advance(); + } + + if (number.length <= 2) { + // only 0x + utility.throwError('unexpected token'); + } + + if (index < length) { + ch = source.charCodeAt(index); + if (esutils.code.isIdentifierStart(ch)) { + utility.throwError('unexpected token'); + } + } + value = parseInt(number, 16); + return Token.NUMBER; + } + + if (esutils.code.isOctalDigit(ch)) { + number += advance(); + while (index < length) { + ch = source.charCodeAt(index); + if (!esutils.code.isOctalDigit(ch)) { + break; + } + number += advance(); + } + + if (index < length) { + ch = source.charCodeAt(index); + if (esutils.code.isIdentifierStart(ch) || esutils.code.isDecimalDigit(ch)) { + utility.throwError('unexpected token'); + } + } + value = parseInt(number, 8); + return Token.NUMBER; + } + + if (esutils.code.isDecimalDigit(ch)) { + utility.throwError('unexpected token'); + } + } + + while (index < length) { + ch = source.charCodeAt(index); + if (!esutils.code.isDecimalDigit(ch)) { + break; + } + number += advance(); + } + } + + if (ch === 0x2E /* '.' */) { + number += advance(); + while (index < length) { + ch = source.charCodeAt(index); + if (!esutils.code.isDecimalDigit(ch)) { + break; + } + number += advance(); + } + } + + if (ch === 0x65 /* 'e' */ || ch === 0x45 /* 'E' */) { + number += advance(); + + ch = source.charCodeAt(index); + if (ch === 0x2B /* '+' */ || ch === 0x2D /* '-' */) { + number += advance(); + } + + ch = source.charCodeAt(index); + if (esutils.code.isDecimalDigit(ch)) { + number += advance(); + while (index < length) { + ch = source.charCodeAt(index); + if (!esutils.code.isDecimalDigit(ch)) { + break; + } + number += advance(); + } + } else { + utility.throwError('unexpected token'); + } + } + + if (index < length) { + ch = source.charCodeAt(index); + if (esutils.code.isIdentifierStart(ch)) { + utility.throwError('unexpected token'); + } + } + + value = parseFloat(number); + return Token.NUMBER; + } + + + function scanTypeName() { + var ch, ch2; + + value = advance(); + while (index < length && isTypeName(source.charCodeAt(index))) { + ch = source.charCodeAt(index); + if (ch === 0x2E /* '.' */) { + if ((index + 1) >= length) { + return Token.ILLEGAL; + } + ch2 = source.charCodeAt(index + 1); + if (ch2 === 0x3C /* '<' */) { + break; + } + } + value += advance(); + } + return Token.NAME; + } + + function next() { + var ch; + + previous = index; + + while (index < length && esutils.code.isWhiteSpace(source.charCodeAt(index))) { + advance(); + } + if (index >= length) { + token = Token.EOF; + return token; + } + + ch = source.charCodeAt(index); + switch (ch) { + case 0x27: /* ''' */ + case 0x22: /* '"' */ + token = scanString(); + return token; + + case 0x3A: /* ':' */ + advance(); + token = Token.COLON; + return token; + + case 0x2C: /* ',' */ + advance(); + token = Token.COMMA; + return token; + + case 0x28: /* '(' */ + advance(); + token = Token.LPAREN; + return token; + + case 0x29: /* ')' */ + advance(); + token = Token.RPAREN; + return token; + + case 0x5B: /* '[' */ + advance(); + token = Token.LBRACK; + return token; + + case 0x5D: /* ']' */ + advance(); + token = Token.RBRACK; + return token; + + case 0x7B: /* '{' */ + advance(); + token = Token.LBRACE; + return token; + + case 0x7D: /* '}' */ + advance(); + token = Token.RBRACE; + return token; + + case 0x2E: /* '.' */ + if (index + 1 < length) { + ch = source.charCodeAt(index + 1); + if (ch === 0x3C /* '<' */) { + advance(); // '.' + advance(); // '<' + token = Token.DOT_LT; + return token; + } + + if (ch === 0x2E /* '.' */ && index + 2 < length && source.charCodeAt(index + 2) === 0x2E /* '.' */) { + advance(); // '.' + advance(); // '.' + advance(); // '.' + token = Token.REST; + return token; + } + + if (esutils.code.isDecimalDigit(ch)) { + token = scanNumber(); + return token; + } + } + token = Token.ILLEGAL; + return token; + + case 0x3C: /* '<' */ + advance(); + token = Token.LT; + return token; + + case 0x3E: /* '>' */ + advance(); + token = Token.GT; + return token; + + case 0x2A: /* '*' */ + advance(); + token = Token.STAR; + return token; + + case 0x7C: /* '|' */ + advance(); + token = Token.PIPE; + return token; + + case 0x3F: /* '?' */ + advance(); + token = Token.QUESTION; + return token; + + case 0x21: /* '!' */ + advance(); + token = Token.BANG; + return token; + + case 0x3D: /* '=' */ + advance(); + token = Token.EQUAL; + return token; + + default: + if (esutils.code.isDecimalDigit(ch)) { + token = scanNumber(); + return token; + } + + // type string permits following case, + // + // namespace.module.MyClass + // + // this reduced 1 token TK_NAME + utility.assert(isTypeName(ch)); + token = scanTypeName(); + return token; + } + } + + function consume(target, text) { + utility.assert(token === target, text || 'consumed token not matched'); + next(); + } + + function expect(target, message) { + if (token !== target) { + utility.throwError(message || 'unexpected token'); + } + next(); + } + + // UnionType := '(' TypeUnionList ')' + // + // TypeUnionList := + // <> + // | NonemptyTypeUnionList + // + // NonemptyTypeUnionList := + // TypeExpression + // | TypeExpression '|' NonemptyTypeUnionList + function parseUnionType() { + var elements; + consume(Token.LPAREN, 'UnionType should start with ('); + elements = []; + if (token !== Token.RPAREN) { + while (true) { + elements.push(parseTypeExpression()); + if (token === Token.RPAREN) { + break; + } + expect(Token.PIPE); + } + } + consume(Token.RPAREN, 'UnionType should end with )'); + return { + type: Syntax.UnionType, + elements: elements + }; + } + + // ArrayType := '[' ElementTypeList ']' + // + // ElementTypeList := + // <> + // | TypeExpression + // | '...' TypeExpression + // | TypeExpression ',' ElementTypeList + function parseArrayType() { + var elements; + consume(Token.LBRACK, 'ArrayType should start with ['); + elements = []; + while (token !== Token.RBRACK) { + if (token === Token.REST) { + consume(Token.REST); + elements.push({ + type: Syntax.RestType, + expression: parseTypeExpression() + }); + break; + } else { + elements.push(parseTypeExpression()); + } + if (token !== Token.RBRACK) { + expect(Token.COMMA); + } + } + expect(Token.RBRACK); + return { + type: Syntax.ArrayType, + elements: elements + }; + } + + function parseFieldName() { + var v = value; + if (token === Token.NAME || token === Token.STRING) { + next(); + return v; + } + + if (token === Token.NUMBER) { + consume(Token.NUMBER); + return String(v); + } + + utility.throwError('unexpected token'); + } + + // FieldType := + // FieldName + // | FieldName ':' TypeExpression + // + // FieldName := + // NameExpression + // | StringLiteral + // | NumberLiteral + // | ReservedIdentifier + function parseFieldType() { + var key; + + key = parseFieldName(); + if (token === Token.COLON) { + consume(Token.COLON); + return { + type: Syntax.FieldType, + key: key, + value: parseTypeExpression() + }; + } + return { + type: Syntax.FieldType, + key: key, + value: null + }; + } + + // RecordType := '{' FieldTypeList '}' + // + // FieldTypeList := + // <> + // | FieldType + // | FieldType ',' FieldTypeList + function parseRecordType() { + var fields; + + consume(Token.LBRACE, 'RecordType should start with {'); + fields = []; + if (token === Token.COMMA) { + consume(Token.COMMA); + } else { + while (token !== Token.RBRACE) { + fields.push(parseFieldType()); + if (token !== Token.RBRACE) { + expect(Token.COMMA); + } + } + } + expect(Token.RBRACE); + return { + type: Syntax.RecordType, + fields: fields + }; + } + + // NameExpression := + // Identifier + // | TagIdentifier ':' Identifier + // + // Tag identifier is one of "module", "external" or "event" + // Identifier is the same as Token.NAME, including any dots, something like + // namespace.module.MyClass + function parseNameExpression() { + var name = value; + expect(Token.NAME); + + if (token === Token.COLON && ( + name === 'module' || + name === 'external' || + name === 'event')) { + consume(Token.COLON); + name += ':' + value; + expect(Token.NAME); + } + + return { + type: Syntax.NameExpression, + name: name + }; + } + + // TypeExpressionList := + // TopLevelTypeExpression + // | TopLevelTypeExpression ',' TypeExpressionList + function parseTypeExpressionList() { + var elements = []; + + elements.push(parseTop()); + while (token === Token.COMMA) { + consume(Token.COMMA); + elements.push(parseTop()); + } + return elements; + } + + // TypeName := + // NameExpression + // | NameExpression TypeApplication + // + // TypeApplication := + // '.<' TypeExpressionList '>' + // | '<' TypeExpressionList '>' // this is extension of doctrine + function parseTypeName() { + var expr, applications; + + expr = parseNameExpression(); + if (token === Token.DOT_LT || token === Token.LT) { + next(); + applications = parseTypeExpressionList(); + expect(Token.GT); + return { + type: Syntax.TypeApplication, + expression: expr, + applications: applications + }; + } + return expr; + } + + // ResultType := + // <> + // | ':' void + // | ':' TypeExpression + // + // BNF is above + // but, we remove <> pattern, so token is always TypeToken::COLON + function parseResultType() { + consume(Token.COLON, 'ResultType should start with :'); + if (token === Token.NAME && value === 'void') { + consume(Token.NAME); + return { + type: Syntax.VoidLiteral + }; + } + return parseTypeExpression(); + } + + // ParametersType := + // RestParameterType + // | NonRestParametersType + // | NonRestParametersType ',' RestParameterType + // + // RestParameterType := + // '...' + // '...' Identifier + // + // NonRestParametersType := + // ParameterType ',' NonRestParametersType + // | ParameterType + // | OptionalParametersType + // + // OptionalParametersType := + // OptionalParameterType + // | OptionalParameterType, OptionalParametersType + // + // OptionalParameterType := ParameterType= + // + // ParameterType := TypeExpression | Identifier ':' TypeExpression + // + // Identifier is "new" or "this" + function parseParametersType() { + var params = [], optionalSequence = false, expr, rest = false; + + while (token !== Token.RPAREN) { + if (token === Token.REST) { + // RestParameterType + consume(Token.REST); + rest = true; + } + + expr = parseTypeExpression(); + if (expr.type === Syntax.NameExpression && token === Token.COLON) { + // Identifier ':' TypeExpression + consume(Token.COLON); + expr = { + type: Syntax.ParameterType, + name: expr.name, + expression: parseTypeExpression() + }; + } + if (token === Token.EQUAL) { + consume(Token.EQUAL); + expr = { + type: Syntax.OptionalType, + expression: expr + }; + optionalSequence = true; + } else { + if (optionalSequence) { + utility.throwError('unexpected token'); + } + } + if (rest) { + expr = { + type: Syntax.RestType, + expression: expr + }; + } + params.push(expr); + if (token !== Token.RPAREN) { + expect(Token.COMMA); + } + } + return params; + } + + // FunctionType := 'function' FunctionSignatureType + // + // FunctionSignatureType := + // | TypeParameters '(' ')' ResultType + // | TypeParameters '(' ParametersType ')' ResultType + // | TypeParameters '(' 'this' ':' TypeName ')' ResultType + // | TypeParameters '(' 'this' ':' TypeName ',' ParametersType ')' ResultType + function parseFunctionType() { + var isNew, thisBinding, params, result, fnType; + utility.assert(token === Token.NAME && value === 'function', 'FunctionType should start with \'function\''); + consume(Token.NAME); + + // Google Closure Compiler is not implementing TypeParameters. + // So we do not. if we don't get '(', we see it as error. + expect(Token.LPAREN); + + isNew = false; + params = []; + thisBinding = null; + if (token !== Token.RPAREN) { + // ParametersType or 'this' + if (token === Token.NAME && + (value === 'this' || value === 'new')) { + // 'this' or 'new' + // 'new' is Closure Compiler extension + isNew = value === 'new'; + consume(Token.NAME); + expect(Token.COLON); + thisBinding = parseTypeName(); + if (token === Token.COMMA) { + consume(Token.COMMA); + params = parseParametersType(); + } + } else { + params = parseParametersType(); + } + } + + expect(Token.RPAREN); + + result = null; + if (token === Token.COLON) { + result = parseResultType(); + } + + fnType = { + type: Syntax.FunctionType, + params: params, + result: result + }; + if (thisBinding) { + // avoid adding null 'new' and 'this' properties + fnType['this'] = thisBinding; + if (isNew) { + fnType['new'] = true; + } + } + return fnType; + } + + // BasicTypeExpression := + // '*' + // | 'null' + // | 'undefined' + // | TypeName + // | FunctionType + // | UnionType + // | RecordType + // | ArrayType + function parseBasicTypeExpression() { + var context; + switch (token) { + case Token.STAR: + consume(Token.STAR); + return { + type: Syntax.AllLiteral + }; + + case Token.LPAREN: + return parseUnionType(); + + case Token.LBRACK: + return parseArrayType(); + + case Token.LBRACE: + return parseRecordType(); + + case Token.NAME: + if (value === 'null') { + consume(Token.NAME); + return { + type: Syntax.NullLiteral + }; + } + + if (value === 'undefined') { + consume(Token.NAME); + return { + type: Syntax.UndefinedLiteral + }; + } + + context = Context.save(); + if (value === 'function') { + try { + return parseFunctionType(); + } catch (e) { + context.restore(); + } + } + + return parseTypeName(); + + default: + utility.throwError('unexpected token'); + } + } + + // TypeExpression := + // BasicTypeExpression + // | '?' BasicTypeExpression + // | '!' BasicTypeExpression + // | BasicTypeExpression '?' + // | BasicTypeExpression '!' + // | '?' + // | BasicTypeExpression '[]' + function parseTypeExpression() { + var expr; + + if (token === Token.QUESTION) { + consume(Token.QUESTION); + if (token === Token.COMMA || token === Token.EQUAL || token === Token.RBRACE || + token === Token.RPAREN || token === Token.PIPE || token === Token.EOF || + token === Token.RBRACK || token === Token.GT) { + return { + type: Syntax.NullableLiteral + }; + } + return { + type: Syntax.NullableType, + expression: parseBasicTypeExpression(), + prefix: true + }; + } + + if (token === Token.BANG) { + consume(Token.BANG); + return { + type: Syntax.NonNullableType, + expression: parseBasicTypeExpression(), + prefix: true + }; + } + + expr = parseBasicTypeExpression(); + if (token === Token.BANG) { + consume(Token.BANG); + return { + type: Syntax.NonNullableType, + expression: expr, + prefix: false + }; + } + + if (token === Token.QUESTION) { + consume(Token.QUESTION); + return { + type: Syntax.NullableType, + expression: expr, + prefix: false + }; + } + + if (token === Token.LBRACK) { + consume(Token.LBRACK); + expect(Token.RBRACK, 'expected an array-style type declaration (' + value + '[])'); + return { + type: Syntax.TypeApplication, + expression: { + type: Syntax.NameExpression, + name: 'Array' + }, + applications: [expr] + }; + } + + return expr; + } + + // TopLevelTypeExpression := + // TypeExpression + // | TypeUnionList + // + // This rule is Google Closure Compiler extension, not ES4 + // like, + // { number | string } + // If strict to ES4, we should write it as + // { (number|string) } + function parseTop() { + var expr, elements; + + expr = parseTypeExpression(); + if (token !== Token.PIPE) { + return expr; + } + + elements = [ expr ]; + consume(Token.PIPE); + while (true) { + elements.push(parseTypeExpression()); + if (token !== Token.PIPE) { + break; + } + consume(Token.PIPE); + } + + return { + type: Syntax.UnionType, + elements: elements + }; + } + + function parseTopParamType() { + var expr; + + if (token === Token.REST) { + consume(Token.REST); + return { + type: Syntax.RestType, + expression: parseTop() + }; + } + + expr = parseTop(); + if (token === Token.EQUAL) { + consume(Token.EQUAL); + return { + type: Syntax.OptionalType, + expression: expr + }; + } + + return expr; + } + + function parseType(src, opt) { + var expr; + + source = src; + length = source.length; + index = 0; + previous = 0; + + next(); + expr = parseTop(); + + if (opt && opt.midstream) { + return { + expression: expr, + index: previous + }; + } + + if (token !== Token.EOF) { + utility.throwError('not reach to EOF'); + } + + return expr; + } + + function parseParamType(src, opt) { + var expr; + + source = src; + length = source.length; + index = 0; + previous = 0; + + next(); + expr = parseTopParamType(); + + if (opt && opt.midstream) { + return { + expression: expr, + index: previous + }; + } + + if (token !== Token.EOF) { + utility.throwError('not reach to EOF'); + } + + return expr; + } + + function stringifyImpl(node, compact, topLevel) { + var result, i, iz; + + switch (node.type) { + case Syntax.NullableLiteral: + result = '?'; + break; + + case Syntax.AllLiteral: + result = '*'; + break; + + case Syntax.NullLiteral: + result = 'null'; + break; + + case Syntax.UndefinedLiteral: + result = 'undefined'; + break; + + case Syntax.VoidLiteral: + result = 'void'; + break; + + case Syntax.UnionType: + if (!topLevel) { + result = '('; + } else { + result = ''; + } + + for (i = 0, iz = node.elements.length; i < iz; ++i) { + result += stringifyImpl(node.elements[i], compact); + if ((i + 1) !== iz) { + result += '|'; + } + } + + if (!topLevel) { + result += ')'; + } + break; + + case Syntax.ArrayType: + result = '['; + for (i = 0, iz = node.elements.length; i < iz; ++i) { + result += stringifyImpl(node.elements[i], compact); + if ((i + 1) !== iz) { + result += compact ? ',' : ', '; + } + } + result += ']'; + break; + + case Syntax.RecordType: + result = '{'; + for (i = 0, iz = node.fields.length; i < iz; ++i) { + result += stringifyImpl(node.fields[i], compact); + if ((i + 1) !== iz) { + result += compact ? ',' : ', '; + } + } + result += '}'; + break; + + case Syntax.FieldType: + if (node.value) { + result = node.key + (compact ? ':' : ': ') + stringifyImpl(node.value, compact); + } else { + result = node.key; + } + break; + + case Syntax.FunctionType: + result = compact ? 'function(' : 'function ('; + + if (node['this']) { + if (node['new']) { + result += (compact ? 'new:' : 'new: '); + } else { + result += (compact ? 'this:' : 'this: '); + } + + result += stringifyImpl(node['this'], compact); + + if (node.params.length !== 0) { + result += compact ? ',' : ', '; + } + } + + for (i = 0, iz = node.params.length; i < iz; ++i) { + result += stringifyImpl(node.params[i], compact); + if ((i + 1) !== iz) { + result += compact ? ',' : ', '; + } + } + + result += ')'; + + if (node.result) { + result += (compact ? ':' : ': ') + stringifyImpl(node.result, compact); + } + break; + + case Syntax.ParameterType: + result = node.name + (compact ? ':' : ': ') + stringifyImpl(node.expression, compact); + break; + + case Syntax.RestType: + result = '...'; + if (node.expression) { + result += stringifyImpl(node.expression, compact); + } + break; + + case Syntax.NonNullableType: + if (node.prefix) { + result = '!' + stringifyImpl(node.expression, compact); + } else { + result = stringifyImpl(node.expression, compact) + '!'; + } + break; + + case Syntax.OptionalType: + result = stringifyImpl(node.expression, compact) + '='; + break; + + case Syntax.NullableType: + if (node.prefix) { + result = '?' + stringifyImpl(node.expression, compact); + } else { + result = stringifyImpl(node.expression, compact) + '?'; + } + break; + + case Syntax.NameExpression: + result = node.name; + break; + + case Syntax.TypeApplication: + result = stringifyImpl(node.expression, compact) + '.<'; + for (i = 0, iz = node.applications.length; i < iz; ++i) { + result += stringifyImpl(node.applications[i], compact); + if ((i + 1) !== iz) { + result += compact ? ',' : ', '; + } + } + result += '>'; + break; + + default: + utility.throwError('Unknown type ' + node.type); + } + + return result; + } + + function stringify(node, options) { + if (options == null) { + options = {}; + } + return stringifyImpl(node, options.compact, options.topLevel); + } + + exports.parseType = parseType; + exports.parseParamType = parseParamType; + exports.stringify = stringify; + exports.Syntax = Syntax; +}()); +/* vim: set sw=4 ts=4 et tw=80 : */ diff --git a/node_modules/doctrine/lib/utility.js b/node_modules/doctrine/lib/utility.js new file mode 100644 index 000000000..bb4412584 --- /dev/null +++ b/node_modules/doctrine/lib/utility.js @@ -0,0 +1,54 @@ +/* + Copyright (C) 2014 Yusuke Suzuki + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + + +(function () { + 'use strict'; + + var VERSION; + + VERSION = require('../package.json').version; + exports.VERSION = VERSION; + + function DoctrineError(message) { + this.name = 'DoctrineError'; + this.message = message; + } + DoctrineError.prototype = (function () { + var Middle = function () { }; + Middle.prototype = Error.prototype; + return new Middle(); + }()); + DoctrineError.prototype.constructor = DoctrineError; + exports.DoctrineError = DoctrineError; + + function throwError(message) { + throw new DoctrineError(message); + } + exports.throwError = throwError; + + exports.assert = require('assert'); +}()); + +/* vim: set sw=4 ts=4 et tw=80 : */ diff --git a/node_modules/doctrine/node_modules/esutils/LICENSE.BSD b/node_modules/doctrine/node_modules/esutils/LICENSE.BSD new file mode 100644 index 000000000..3e580c355 --- /dev/null +++ b/node_modules/doctrine/node_modules/esutils/LICENSE.BSD @@ -0,0 +1,19 @@ +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +ARE DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY +DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF +THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/node_modules/doctrine/node_modules/esutils/README.md b/node_modules/doctrine/node_modules/esutils/README.md new file mode 100644 index 000000000..494fac5ed --- /dev/null +++ b/node_modules/doctrine/node_modules/esutils/README.md @@ -0,0 +1,169 @@ +### esutils [![Build Status](https://secure.travis-ci.org/Constellation/esutils.svg)](http://travis-ci.org/Constellation/esutils) +esutils ([esutils](http://github.com/Constellation/esutils)) is +utility box for ECMAScript language tools. + +### API + +### ast + +#### ast.isExpression(node) + +Returns true if `node` is an Expression as defined in ECMA262 edition 5.1 section +[11](https://es5.github.io/#x11). + +#### ast.isStatement(node) + +Returns true if `node` is a Statement as defined in ECMA262 edition 5.1 section +[12](https://es5.github.io/#x12). + +#### ast.isIterationStatement(node) + +Returns true if `node` is an IterationStatement as defined in ECMA262 edition +5.1 section [12.6](https://es5.github.io/#x12.6). + +#### ast.isSourceElement(node) + +Returns true if `node` is a SourceElement as defined in ECMA262 edition 5.1 +section [14](https://es5.github.io/#x14). + +#### ast.trailingStatement(node) + +Returns `Statement?` if `node` has trailing `Statement`. +```js +if (cond) + consequent; +``` +When taking this `IfStatement`, returns `consequent;` statement. + +#### ast.isProblematicIfStatement(node) + +Returns true if `node` is a problematic IfStatement. If `node` is a problematic `IfStatement`, `node` cannot be represented as an one on one JavaScript code. +```js +{ + type: 'IfStatement', + consequent: { + type: 'WithStatement', + body: { + type: 'IfStatement', + consequent: {type: 'EmptyStatement'} + } + }, + alternate: {type: 'EmptyStatement'} +} +``` +The above node cannot be represented as a JavaScript code, since the top level `else` alternate belongs to an inner `IfStatement`. + + +### code + +#### code.isDecimalDigit(code) + +Return true if provided code is decimal digit. + +#### code.isHexDigit(code) + +Return true if provided code is hexadecimal digit. + +#### code.isOctalDigit(code) + +Return true if provided code is octal digit. + +#### code.isWhiteSpace(code) + +Return true if provided code is white space. White space characters are formally defined in ECMA262. + +#### code.isLineTerminator(code) + +Return true if provided code is line terminator. Line terminator characters are formally defined in ECMA262. + +#### code.isIdentifierStart(code) + +Return true if provided code can be the first character of ECMA262 Identifier. They are formally defined in ECMA262. + +#### code.isIdentifierPart(code) + +Return true if provided code can be the trailing character of ECMA262 Identifier. They are formally defined in ECMA262. + +### keyword + +#### keyword.isKeywordES5(id, strict) + +Returns `true` if provided identifier string is a Keyword or Future Reserved Word +in ECMA262 edition 5.1. They are formally defined in ECMA262 sections +[7.6.1.1](http://es5.github.io/#x7.6.1.1) and [7.6.1.2](http://es5.github.io/#x7.6.1.2), +respectively. If the `strict` flag is truthy, this function additionally checks whether +`id` is a Keyword or Future Reserved Word under strict mode. + +#### keyword.isKeywordES6(id, strict) + +Returns `true` if provided identifier string is a Keyword or Future Reserved Word +in ECMA262 edition 6. They are formally defined in ECMA262 sections +[11.6.2.1](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-keywords) and +[11.6.2.2](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-future-reserved-words), +respectively. If the `strict` flag is truthy, this function additionally checks whether +`id` is a Keyword or Future Reserved Word under strict mode. + +#### keyword.isReservedWordES5(id, strict) + +Returns `true` if provided identifier string is a Reserved Word in ECMA262 edition 5.1. +They are formally defined in ECMA262 section [7.6.1](http://es5.github.io/#x7.6.1). +If the `strict` flag is truthy, this function additionally checks whether `id` +is a Reserved Word under strict mode. + +#### keyword.isReservedWordES6(id, strict) + +Returns `true` if provided identifier string is a Reserved Word in ECMA262 edition 6. +They are formally defined in ECMA262 section [11.6.2](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-reserved-words). +If the `strict` flag is truthy, this function additionally checks whether `id` +is a Reserved Word under strict mode. + +#### keyword.isRestrictedWord(id) + +Returns `true` if provided identifier string is one of `eval` or `arguments`. +They are restricted in strict mode code throughout ECMA262 edition 5.1 and +in ECMA262 edition 6 section [12.1.1](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-identifiers-static-semantics-early-errors). + +#### keyword.isIdentifierName(id) + +Return true if provided identifier string is an IdentifierName as specified in +ECMA262 edition 5.1 section [7.6](https://es5.github.io/#x7.6). + +#### keyword.isIdentifierES5(id, strict) + +Return true if provided identifier string is an Identifier as specified in +ECMA262 edition 5.1 section [7.6](https://es5.github.io/#x7.6). If the `strict` +flag is truthy, this function additionally checks whether `id` is an Identifier +under strict mode. + +#### keyword.isIdentifierES6(id, strict) + +Return true if provided identifier string is an Identifier as specified in +ECMA262 edition 6 section [12.1](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-identifiers). +If the `strict` flag is truthy, this function additionally checks whether `id` +is an Identifier under strict mode. + +### License + +Copyright (C) 2013 [Yusuke Suzuki](http://github.com/Constellation) + (twitter: [@Constellation](http://twitter.com/Constellation)) and other contributors. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +ARE DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY +DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF +THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/node_modules/doctrine/node_modules/esutils/lib/ast.js b/node_modules/doctrine/node_modules/esutils/lib/ast.js new file mode 100644 index 000000000..8faadae1c --- /dev/null +++ b/node_modules/doctrine/node_modules/esutils/lib/ast.js @@ -0,0 +1,144 @@ +/* + Copyright (C) 2013 Yusuke Suzuki + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 'AS IS' + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +(function () { + 'use strict'; + + function isExpression(node) { + if (node == null) { return false; } + switch (node.type) { + case 'ArrayExpression': + case 'AssignmentExpression': + case 'BinaryExpression': + case 'CallExpression': + case 'ConditionalExpression': + case 'FunctionExpression': + case 'Identifier': + case 'Literal': + case 'LogicalExpression': + case 'MemberExpression': + case 'NewExpression': + case 'ObjectExpression': + case 'SequenceExpression': + case 'ThisExpression': + case 'UnaryExpression': + case 'UpdateExpression': + return true; + } + return false; + } + + function isIterationStatement(node) { + if (node == null) { return false; } + switch (node.type) { + case 'DoWhileStatement': + case 'ForInStatement': + case 'ForStatement': + case 'WhileStatement': + return true; + } + return false; + } + + function isStatement(node) { + if (node == null) { return false; } + switch (node.type) { + case 'BlockStatement': + case 'BreakStatement': + case 'ContinueStatement': + case 'DebuggerStatement': + case 'DoWhileStatement': + case 'EmptyStatement': + case 'ExpressionStatement': + case 'ForInStatement': + case 'ForStatement': + case 'IfStatement': + case 'LabeledStatement': + case 'ReturnStatement': + case 'SwitchStatement': + case 'ThrowStatement': + case 'TryStatement': + case 'VariableDeclaration': + case 'WhileStatement': + case 'WithStatement': + return true; + } + return false; + } + + function isSourceElement(node) { + return isStatement(node) || node != null && node.type === 'FunctionDeclaration'; + } + + function trailingStatement(node) { + switch (node.type) { + case 'IfStatement': + if (node.alternate != null) { + return node.alternate; + } + return node.consequent; + + case 'LabeledStatement': + case 'ForStatement': + case 'ForInStatement': + case 'WhileStatement': + case 'WithStatement': + return node.body; + } + return null; + } + + function isProblematicIfStatement(node) { + var current; + + if (node.type !== 'IfStatement') { + return false; + } + if (node.alternate == null) { + return false; + } + current = node.consequent; + do { + if (current.type === 'IfStatement') { + if (current.alternate == null) { + return true; + } + } + current = trailingStatement(current); + } while (current); + + return false; + } + + module.exports = { + isExpression: isExpression, + isStatement: isStatement, + isIterationStatement: isIterationStatement, + isSourceElement: isSourceElement, + isProblematicIfStatement: isProblematicIfStatement, + + trailingStatement: trailingStatement + }; +}()); +/* vim: set sw=4 ts=4 et tw=80 : */ diff --git a/node_modules/doctrine/node_modules/esutils/lib/code.js b/node_modules/doctrine/node_modules/esutils/lib/code.js new file mode 100644 index 000000000..730292a34 --- /dev/null +++ b/node_modules/doctrine/node_modules/esutils/lib/code.js @@ -0,0 +1,101 @@ +/* + Copyright (C) 2013-2014 Yusuke Suzuki + Copyright (C) 2014 Ivan Nikulin + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +(function () { + 'use strict'; + + var Regex, NON_ASCII_WHITESPACES; + + // See `tools/generate-identifier-regex.js`. + Regex = { + NonAsciiIdentifierStart: new RegExp('[\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u0527\u0531-\u0556\u0559\u0561-\u0587\u05D0-\u05EA\u05F0-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u08A0\u08A2-\u08AC\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0977\u0979-\u097F\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C33\u0C35-\u0C39\u0C3D\u0C58\u0C59\u0C60\u0C61\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D60\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F4\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F0\u1700-\u170C\u170E-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1877\u1880-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191C\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19C1-\u19C7\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4B\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1CE9-\u1CEC\u1CEE-\u1CF1\u1CF5\u1CF6\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2E2F\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303C\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312D\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FCC\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA697\uA6A0-\uA6EF\uA717-\uA71F\uA722-\uA788\uA78B-\uA78E\uA790-\uA793\uA7A0-\uA7AA\uA7F8-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA80-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uABC0-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]'), + NonAsciiIdentifierPart: new RegExp('[\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0300-\u0374\u0376\u0377\u037A-\u037D\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u0483-\u0487\u048A-\u0527\u0531-\u0556\u0559\u0561-\u0587\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u05D0-\u05EA\u05F0-\u05F2\u0610-\u061A\u0620-\u0669\u066E-\u06D3\u06D5-\u06DC\u06DF-\u06E8\u06EA-\u06FC\u06FF\u0710-\u074A\u074D-\u07B1\u07C0-\u07F5\u07FA\u0800-\u082D\u0840-\u085B\u08A0\u08A2-\u08AC\u08E4-\u08FE\u0900-\u0963\u0966-\u096F\u0971-\u0977\u0979-\u097F\u0981-\u0983\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BC-\u09C4\u09C7\u09C8\u09CB-\u09CE\u09D7\u09DC\u09DD\u09DF-\u09E3\u09E6-\u09F1\u0A01-\u0A03\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A59-\u0A5C\u0A5E\u0A66-\u0A75\u0A81-\u0A83\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8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E4E\u0E50-\u0E59\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB9\u0EBB-\u0EBD\u0EC0-\u0EC4\u0EC6\u0EC8-\u0ECD\u0ED0-\u0ED9\u0EDC-\u0EDF\u0F00\u0F18\u0F19\u0F20-\u0F29\u0F35\u0F37\u0F39\u0F3E-\u0F47\u0F49-\u0F6C\u0F71-\u0F84\u0F86-\u0F97\u0F99-\u0FBC\u0FC6\u1000-\u1049\u1050-\u109D\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u135D-\u135F\u1380-\u138F\u13A0-\u13F4\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F0\u1700-\u170C\u170E-\u1714\u1720-\u1734\u1740-\u1753\u1760-\u176C\u176E-\u1770\u1772\u1773\u1780-\u17D3\u17D7\u17DC\u17DD\u17E0-\u17E9\u180B-\u180D\u1810-\u1819\u1820-\u1877\u1880-\u18AA\u18B0-\u18F5\u1900-\u191C\u1920-\u192B\u1930-\u193B\u1946-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u19D0-\u19D9\u1A00-\u1A1B\u1A20-\u1A5E\u1A60-\u1A7C\u1A7F-\u1A89\u1A90-\u1A99\u1AA7\u1B00-\u1B4B\u1B50-\u1B59\u1B6B-\u1B73\u1B80-\u1BF3\u1C00-\u1C37\u1C40-\u1C49\u1C4D-\u1C7D\u1CD0-\u1CD2\u1CD4-\u1CF6\u1D00-\u1DE6\u1DFC-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u200C\u200D\u203F\u2040\u2054\u2071\u207F\u2090-\u209C\u20D0-\u20DC\u20E1\u20E5-\u20F0\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D7F-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2DE0-\u2DFF\u2E2F\u3005-\u3007\u3021-\u302F\u3031-\u3035\u3038-\u303C\u3041-\u3096\u3099\u309A\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312D\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FCC\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA62B\uA640-\uA66F\uA674-\uA67D\uA67F-\uA697\uA69F-\uA6F1\uA717-\uA71F\uA722-\uA788\uA78B-\uA78E\uA790-\uA793\uA7A0-\uA7AA\uA7F8-\uA827\uA840-\uA873\uA880-\uA8C4\uA8D0-\uA8D9\uA8E0-\uA8F7\uA8FB\uA900-\uA92D\uA930-\uA953\uA960-\uA97C\uA980-\uA9C0\uA9CF-\uA9D9\uAA00-\uAA36\uAA40-\uAA4D\uAA50-\uAA59\uAA60-\uAA76\uAA7A\uAA7B\uAA80-\uAAC2\uAADB-\uAADD\uAAE0-\uAAEF\uAAF2-\uAAF6\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uABC0-\uABEA\uABEC\uABED\uABF0-\uABF9\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE00-\uFE0F\uFE20-\uFE26\uFE33\uFE34\uFE4D-\uFE4F\uFE70-\uFE74\uFE76-\uFEFC\uFF10-\uFF19\uFF21-\uFF3A\uFF3F\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]') + }; + + function isDecimalDigit(ch) { + return (ch >= 48 && ch <= 57); // 0..9 + } + + function isHexDigit(ch) { + return isDecimalDigit(ch) || // 0..9 + (97 <= ch && ch <= 102) || // a..f + (65 <= ch && ch <= 70); // A..F + } + + function isOctalDigit(ch) { + return (ch >= 48 && ch <= 55); // 0..7 + } + + // 7.2 White Space + + NON_ASCII_WHITESPACES = [ + 0x1680, 0x180E, + 0x2000, 0x2001, 0x2002, 0x2003, 0x2004, 0x2005, 0x2006, 0x2007, 0x2008, 0x2009, 0x200A, + 0x202F, 0x205F, + 0x3000, + 0xFEFF + ]; + + function isWhiteSpace(ch) { + return (ch === 0x20) || (ch === 0x09) || (ch === 0x0B) || (ch === 0x0C) || (ch === 0xA0) || + (ch >= 0x1680 && NON_ASCII_WHITESPACES.indexOf(ch) >= 0); + } + + // 7.3 Line Terminators + + function isLineTerminator(ch) { + return (ch === 0x0A) || (ch === 0x0D) || (ch === 0x2028) || (ch === 0x2029); + } + + // 7.6 Identifier Names and Identifiers + + function isIdentifierStart(ch) { + return (ch >= 97 && ch <= 122) || // a..z + (ch >= 65 && ch <= 90) || // A..Z + (ch === 36) || (ch === 95) || // $ (dollar) and _ (underscore) + (ch === 92) || // \ (backslash) + ((ch >= 0x80) && Regex.NonAsciiIdentifierStart.test(String.fromCharCode(ch))); + } + + function isIdentifierPart(ch) { + return (ch >= 97 && ch <= 122) || // a..z + (ch >= 65 && ch <= 90) || // A..Z + (ch >= 48 && ch <= 57) || // 0..9 + (ch === 36) || (ch === 95) || // $ (dollar) and _ (underscore) + (ch === 92) || // \ (backslash) + ((ch >= 0x80) && Regex.NonAsciiIdentifierPart.test(String.fromCharCode(ch))); + } + + module.exports = { + isDecimalDigit: isDecimalDigit, + isHexDigit: isHexDigit, + isOctalDigit: isOctalDigit, + isWhiteSpace: isWhiteSpace, + isLineTerminator: isLineTerminator, + isIdentifierStart: isIdentifierStart, + isIdentifierPart: isIdentifierPart + }; +}()); +/* vim: set sw=4 ts=4 et tw=80 : */ diff --git a/node_modules/doctrine/node_modules/esutils/lib/keyword.js b/node_modules/doctrine/node_modules/esutils/lib/keyword.js new file mode 100644 index 000000000..884be72fb --- /dev/null +++ b/node_modules/doctrine/node_modules/esutils/lib/keyword.js @@ -0,0 +1,137 @@ +/* + Copyright (C) 2013 Yusuke Suzuki + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +(function () { + 'use strict'; + + var code = require('./code'); + + function isStrictModeReservedWordES6(id) { + switch (id) { + case 'implements': + case 'interface': + case 'package': + case 'private': + case 'protected': + case 'public': + case 'static': + case 'let': + return true; + default: + return false; + } + } + + function isKeywordES5(id, strict) { + // yield should not be treated as keyword under non-strict mode. + if (!strict && id === 'yield') { + return false; + } + return isKeywordES6(id, strict); + } + + function isKeywordES6(id, strict) { + if (strict && isStrictModeReservedWordES6(id)) { + return true; + } + + switch (id.length) { + case 2: + return (id === 'if') || (id === 'in') || (id === 'do'); + case 3: + return (id === 'var') || (id === 'for') || (id === 'new') || (id === 'try'); + case 4: + return (id === 'this') || (id === 'else') || (id === 'case') || + (id === 'void') || (id === 'with') || (id === 'enum'); + case 5: + return (id === 'while') || (id === 'break') || (id === 'catch') || + (id === 'throw') || (id === 'const') || (id === 'yield') || + (id === 'class') || (id === 'super'); + case 6: + return (id === 'return') || (id === 'typeof') || (id === 'delete') || + (id === 'switch') || (id === 'export') || (id === 'import'); + case 7: + return (id === 'default') || (id === 'finally') || (id === 'extends'); + case 8: + return (id === 'function') || (id === 'continue') || (id === 'debugger'); + case 10: + return (id === 'instanceof'); + default: + return false; + } + } + + function isReservedWordES5(id, strict) { + return id === 'null' || id === 'true' || id === 'false' || isKeywordES5(id, strict); + } + + function isReservedWordES6(id, strict) { + return id === 'null' || id === 'true' || id === 'false' || isKeywordES6(id, strict); + } + + function isRestrictedWord(id) { + return id === 'eval' || id === 'arguments'; + } + + function isIdentifierName(id) { + var i, iz, ch; + + if (id.length === 0) { + return false; + } + + ch = id.charCodeAt(0); + if (!code.isIdentifierStart(ch) || ch === 92) { // \ (backslash) + return false; + } + + for (i = 1, iz = id.length; i < iz; ++i) { + ch = id.charCodeAt(i); + if (!code.isIdentifierPart(ch) || ch === 92) { // \ (backslash) + return false; + } + } + return true; + } + + function isIdentifierES5(id, strict) { + return isIdentifierName(id) && !isReservedWordES5(id, strict); + } + + function isIdentifierES6(id, strict) { + return isIdentifierName(id) && !isReservedWordES6(id, strict); + } + + module.exports = { + isKeywordES5: isKeywordES5, + isKeywordES6: isKeywordES6, + isReservedWordES5: isReservedWordES5, + isReservedWordES6: isReservedWordES6, + isRestrictedWord: isRestrictedWord, + isIdentifierName: isIdentifierName, + isIdentifierES5: isIdentifierES5, + isIdentifierES6: isIdentifierES6 + }; +}()); +/* vim: set sw=4 ts=4 et tw=80 : */ diff --git a/node_modules/doctrine/node_modules/esutils/lib/utils.js b/node_modules/doctrine/node_modules/esutils/lib/utils.js new file mode 100644 index 000000000..ce18faa6b --- /dev/null +++ b/node_modules/doctrine/node_modules/esutils/lib/utils.js @@ -0,0 +1,33 @@ +/* + Copyright (C) 2013 Yusuke Suzuki + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + + +(function () { + 'use strict'; + + exports.ast = require('./ast'); + exports.code = require('./code'); + exports.keyword = require('./keyword'); +}()); +/* vim: set sw=4 ts=4 et tw=80 : */ diff --git a/node_modules/doctrine/node_modules/esutils/package.json b/node_modules/doctrine/node_modules/esutils/package.json new file mode 100644 index 000000000..70b22072a --- /dev/null +++ b/node_modules/doctrine/node_modules/esutils/package.json @@ -0,0 +1,49 @@ +{ + "name": "esutils", + "description": "utility box for ECMAScript language tools", + "homepage": "https://github.com/Constellation/esutils", + "main": "lib/utils.js", + "version": "1.1.6", + "engines": { + "node": ">=0.10.0" + }, + "directories": { + "lib": "./lib" + }, + "files": [ + "LICENSE.BSD", + "README.md", + "lib" + ], + "maintainers": [ + { + "name": "Yusuke Suzuki", + "email": "utatane.tea@gmail.com", + "web": "http://github.com/Constellation" + } + ], + "repository": { + "type": "git", + "url": "http://github.com/Constellation/esutils.git" + }, + "devDependencies": { + "mocha": "~1.12.0", + "chai": "~1.7.2", + "jshint": "2.1.5", + "coffee-script": "~1.6.3", + "unicode-6.3.0": "~0.1.1", + "regenerate": "~0.5.4" + }, + "licenses": [ + { + "type": "BSD", + "url": "http://github.com/Constellation/esutils/raw/master/LICENSE.BSD" + } + ], + "scripts": { + "test": "npm run-script lint && npm run-script unit-test", + "lint": "jshint lib/*.js", + "unit-test": "mocha --compilers coffee:coffee-script -R spec", + "generate-regex": "node tools/generate-identifier-regex.js" + } +} \ No newline at end of file diff --git a/node_modules/doctrine/package.json b/node_modules/doctrine/package.json new file mode 100644 index 000000000..09b0d3fa7 --- /dev/null +++ b/node_modules/doctrine/package.json @@ -0,0 +1,69 @@ +{ + "name": "doctrine", + "description": "JSDoc parser", + "homepage": "https://github.com/eslint/doctrine", + "main": "lib/doctrine.js", + "version": "0.7.2", + "engines": { + "node": ">=0.10.0" + }, + "directories": { + "lib": "./lib" + }, + "files": [ + "lib", + "LICENSE.BSD", + "LICENSE.closure-compiler", + "LICENSE.esprima", + "README.md" + ], + "maintainers": [ + { + "name": "Yusuke Suzuki", + "email": "utatane.tea@gmail.com", + "web": "http://github.com/Constellation" + } + ], + "repository": { + "type": "git", + "url": "http://github.com/eslint/doctrine.git" + }, + "devDependencies": { + "coveralls": "^2.11.2", + "dateformat": "^1.0.11", + "eslint": "^1.9.0", + "gulp": "^3.8.10", + "gulp-bump": "^0.1.13", + "gulp-eslint": "^0.5.0", + "gulp-filter": "^2.0.2", + "gulp-git": "^1.0.0", + "gulp-istanbul": "^0.6.0", + "gulp-jshint": "^1.9.0", + "gulp-mocha": "^2.0.0", + "gulp-tag-version": "^1.2.1", + "jshint-stylish": "^1.0.0", + "linefix": "^0.1.1", + "mocha": "^2.3.3", + "npm-license": "^0.3.1", + "semver": "^5.0.3", + "shelljs": "^0.5.3", + "shelljs-nodecli": "^0.1.1", + "should": "^5.0.1" + }, + "licenses": [ + { + "type": "BSD", + "url": "http://github.com/eslint/doctrine/raw/master/LICENSE.BSD" + } + ], + "scripts": { + "test": "gulp", + "unit-test": "gulp test", + "lint": "gulp lint", + "coveralls": "cat ./coverage/lcov.info | coveralls && rm -rf ./coverage" + }, + "dependencies": { + "esutils": "^1.1.6", + "isarray": "0.0.1" + } +} \ No newline at end of file diff --git a/node_modules/isarray/README.md b/node_modules/isarray/README.md new file mode 100644 index 000000000..052a62b8d --- /dev/null +++ b/node_modules/isarray/README.md @@ -0,0 +1,54 @@ + +# isarray + +`Array#isArray` for older browsers. + +## Usage + +```js +var isArray = require('isarray'); + +console.log(isArray([])); // => true +console.log(isArray({})); // => false +``` + +## Installation + +With [npm](http://npmjs.org) do + +```bash +$ npm install isarray +``` + +Then bundle for the browser with +[browserify](https://github.com/substack/browserify). + +With [component](http://component.io) do + +```bash +$ component install juliangruber/isarray +``` + +## License + +(MIT) + +Copyright (c) 2013 Julian Gruber <julian@juliangruber.com> + +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. diff --git a/node_modules/isarray/build/build.js b/node_modules/isarray/build/build.js new file mode 100644 index 000000000..ec58596ae --- /dev/null +++ b/node_modules/isarray/build/build.js @@ -0,0 +1,209 @@ + +/** + * Require the given path. + * + * @param {String} path + * @return {Object} exports + * @api public + */ + +function require(path, parent, orig) { + var resolved = require.resolve(path); + + // lookup failed + if (null == resolved) { + orig = orig || path; + parent = parent || 'root'; + var err = new Error('Failed to require "' + orig + '" from "' + parent + '"'); + err.path = orig; + err.parent = parent; + err.require = true; + throw err; + } + + var module = require.modules[resolved]; + + // perform real require() + // by invoking the module's + // registered function + if (!module.exports) { + module.exports = {}; + module.client = module.component = true; + module.call(this, module.exports, require.relative(resolved), module); + } + + return module.exports; +} + +/** + * Registered modules. + */ + +require.modules = {}; + +/** + * Registered aliases. + */ + +require.aliases = {}; + +/** + * Resolve `path`. + * + * Lookup: + * + * - PATH/index.js + * - PATH.js + * - PATH + * + * @param {String} path + * @return {String} path or null + * @api private + */ + +require.resolve = function(path) { + if (path.charAt(0) === '/') path = path.slice(1); + var index = path + '/index.js'; + + var paths = [ + path, + path + '.js', + path + '.json', + path + '/index.js', + path + '/index.json' + ]; + + for (var i = 0; i < paths.length; i++) { + var path = paths[i]; + if (require.modules.hasOwnProperty(path)) return path; + } + + if (require.aliases.hasOwnProperty(index)) { + return require.aliases[index]; + } +}; + +/** + * Normalize `path` relative to the current path. + * + * @param {String} curr + * @param {String} path + * @return {String} + * @api private + */ + +require.normalize = function(curr, path) { + var segs = []; + + if ('.' != path.charAt(0)) return path; + + curr = curr.split('/'); + path = path.split('/'); + + for (var i = 0; i < path.length; ++i) { + if ('..' == path[i]) { + curr.pop(); + } else if ('.' != path[i] && '' != path[i]) { + segs.push(path[i]); + } + } + + return curr.concat(segs).join('/'); +}; + +/** + * Register module at `path` with callback `definition`. + * + * @param {String} path + * @param {Function} definition + * @api private + */ + +require.register = function(path, definition) { + require.modules[path] = definition; +}; + +/** + * Alias a module definition. + * + * @param {String} from + * @param {String} to + * @api private + */ + +require.alias = function(from, to) { + if (!require.modules.hasOwnProperty(from)) { + throw new Error('Failed to alias "' + from + '", it does not exist'); + } + require.aliases[to] = from; +}; + +/** + * Return a require function relative to the `parent` path. + * + * @param {String} parent + * @return {Function} + * @api private + */ + +require.relative = function(parent) { + var p = require.normalize(parent, '..'); + + /** + * lastIndexOf helper. + */ + + function lastIndexOf(arr, obj) { + var i = arr.length; + while (i--) { + if (arr[i] === obj) return i; + } + return -1; + } + + /** + * The relative require() itself. + */ + + function localRequire(path) { + var resolved = localRequire.resolve(path); + return require(resolved, parent, path); + } + + /** + * Resolve relative to the parent. + */ + + localRequire.resolve = function(path) { + var c = path.charAt(0); + if ('/' == c) return path.slice(1); + if ('.' == c) return require.normalize(p, path); + + // resolve deps by returning + // the dep in the nearest "deps" + // directory + var segs = parent.split('/'); + var i = lastIndexOf(segs, 'deps') + 1; + if (!i) i = 0; + path = segs.slice(0, i + 1).join('/') + '/deps/' + path; + return path; + }; + + /** + * Check if module is defined at `path`. + */ + + localRequire.exists = function(path) { + return require.modules.hasOwnProperty(localRequire.resolve(path)); + }; + + return localRequire; +}; +require.register("isarray/index.js", function(exports, require, module){ +module.exports = Array.isArray || function (arr) { + return Object.prototype.toString.call(arr) == '[object Array]'; +}; + +}); +require.alias("isarray/index.js", "isarray/index.js"); + diff --git a/node_modules/isarray/component.json b/node_modules/isarray/component.json new file mode 100644 index 000000000..9e31b6838 --- /dev/null +++ b/node_modules/isarray/component.json @@ -0,0 +1,19 @@ +{ + "name" : "isarray", + "description" : "Array#isArray for older browsers", + "version" : "0.0.1", + "repository" : "juliangruber/isarray", + "homepage": "https://github.com/juliangruber/isarray", + "main" : "index.js", + "scripts" : [ + "index.js" + ], + "dependencies" : {}, + "keywords": ["browser","isarray","array"], + "author": { + "name": "Julian Gruber", + "email": "mail@juliangruber.com", + "url": "http://juliangruber.com" + }, + "license": "MIT" +} diff --git a/node_modules/isarray/index.js b/node_modules/isarray/index.js new file mode 100644 index 000000000..5f5ad45d4 --- /dev/null +++ b/node_modules/isarray/index.js @@ -0,0 +1,3 @@ +module.exports = Array.isArray || function (arr) { + return Object.prototype.toString.call(arr) == '[object Array]'; +}; diff --git a/node_modules/isarray/package.json b/node_modules/isarray/package.json new file mode 100644 index 000000000..615e6c214 --- /dev/null +++ b/node_modules/isarray/package.json @@ -0,0 +1,29 @@ +{ + "name": "isarray", + "description": "Array#isArray for older browsers", + "version": "0.0.1", + "repository": { + "type": "git", + "url": "git://github.com/juliangruber/isarray.git" + }, + "homepage": "https://github.com/juliangruber/isarray", + "main": "index.js", + "scripts": { + "test": "tap test/*.js" + }, + "dependencies": {}, + "devDependencies": { + "tap": "*" + }, + "keywords": [ + "browser", + "isarray", + "array" + ], + "author": { + "name": "Julian Gruber", + "email": "mail@juliangruber.com", + "url": "http://juliangruber.com" + }, + "license": "MIT" +} \ No newline at end of file diff --git a/node_modules/tslint-eslint-rules/CHANGELOG.md b/node_modules/tslint-eslint-rules/CHANGELOG.md new file mode 100644 index 000000000..d819e6aa4 --- /dev/null +++ b/node_modules/tslint-eslint-rules/CHANGELOG.md @@ -0,0 +1,398 @@ +# Change Log + +## [Unreleased] + +## [v5.4.0] - August 14, 2018 +*Rules* +- `ter-padded-blocks` + +*Updates* +- `object-curly-spacing`: supports `arraysInObjects/objectsInObjects` options. +- Support for typescript 3.0 + + +## [v5.3.1] - May 15, 2018 +#### Features +- `valid-jsdoc` recognizes `@inheritDoc` tag + +#### Bug fixes +- `sort-imports` rule reads imports correctly (Issue #319) +- `space-in-parens` bugfix when using default options (Issue #305) +- `no-multi-spaces` bugfix in string literals. + +NOTE: The Github tag v5.3.0 was deleted since it the NPM package +missed a bugfix due to not syncing the branches locally. + + +## [v5.2.0] - May 08, 2018 +### Rules +- `ter-no-proto` +- `ter-no-script-url` +- `ter-no-self-compare` + +### Fixes +- `ter-newline-after-var` - issue 302 + + +## [v5.1.0] - Feb 24, 2018 +### Rules +- `ter-padded-blocks` + +### Fixes +- `ter-indent`: failed when missing `VariableDeclarator` options ([bfff0e6]) +- `ter-newline-after-var`: incorrectly fixing code and within try catch block ([d930c6c]) + +[bfff0e6]: https://github.com/buzinas/tslint-eslint-rules/commit/bfff0e60263ff4fa38280739566e99c523d9fd4d +[d930c6c]: https://github.com/buzinas/tslint-eslint-rules/commit/d930c6c76de65f9f94d95624a65f5cfd537fe571 + +## [v5.0.0] - Feb 14, 2018 +### Upgraded to TSLint 5.9 and Typescript 2.6 +- NOTE: Another release will come soon that uses 2.7 + +#### Rules Added +- `ter-no-tabs` + +See the differences in [v5.0.0] for more information on the changes. + + +## [v4.1.1] - May 26, 2017 +#### Fixes +- valid-jsdoc reported missing return with abstract methods ([3bd2dafb]) + +[3bd2dafb]: https://github.com/buzinas/tslint-eslint-rules/commit/3bd2dafb22174d2912f1a9b73ca917abe52107fc + + +## [v4.1.0] - May 21, 2017 +#### Fixes +- valid-jsdoc reported at wrong location ([82a3ca75]) + +#### Rules Added +- [ter-func-call-spacing](https://github.com/buzinas/tslint-eslint-rules/blob/master/src/docs/rules/terFuncCallSpacingRule.md) + +#### Name Change +The following rule names have been renamed since they are no longer accessible with TSLint 5.0. + +- `no-irregular-whitespace` changed to `ter-no-irregular-whitespace` +- `no-sparse-arrays` changed to `ter-no-sparse-arrays` + +#### Removed +- `use-isnan`: This rule is now provided by TSLint. + +[82a3ca75]: https://github.com/buzinas/tslint-eslint-rules/commit/82a3ca75678240976d868498407b3763ff57419c + + +## [v4.0.0] - April 4, 2017 +### Upgraded to [TSLint 5.0](https://github.com/palantir/tslint/releases/tag/5.0.0) + + +## [v3.5.1] - 2017/03/17 23:00 GMT-0600 +#### Fixes +- sort-imports bug in simple type imports ([3d57149]) + +[3d57149]: https://github.com/buzinas/tslint-eslint-rules/commit/3d571494aa5642f19f856fc361d5723a1b792e4a + + +## [v3.5.0] - 2017/03/16 15:20 GMT-0600 +#### Fixes +- valid-jsdoc crashed with missing return type ([de16445]) + +#### Features +- valid-jsdoc added option to omitt return and parameters type ([b81e671]) + +#### Rules Added +- [sort-imports](https://github.com/buzinas/tslint-eslint-rules/blob/master/src/docs/rules/sortImportsRule.md) + +#### Fixers Added +- ter-indent ([b76ee05]) + +#### Other Changes + +`tslint` peer dependency updated to 4.5.0 + +[de16445]: https://github.com/buzinas/tslint-eslint-rules/commit/de164458164116b1743d0cdc57fcfbcd6a4109c4 +[b76ee05]: https://github.com/buzinas/tslint-eslint-rules/commit/b76ee05033a273bdf61b6ee7465290ad8c4a73f1 +[b81e671]: https://github.com/buzinas/tslint-eslint-rules/commit/b81e67141abf76f976ab399a0f16f50e971891b8 + + +## [v3.4.0] - 2017/02/16 15:40 GMT-0600 +#### Fixes +- array-bracket-spacing handles comments ([9c551d7]) + +#### Rules Added +- [space-in-parens](https://github.com/buzinas/tslint-eslint-rules/blob/master/src/docs/rules/spaceInParensRule.md) + +#### Fixers Added +- object-curly-spacing ([ec81eb4]) +- array-bracket-spacing ([3c689ff]) +- space-in-parens ([cd50170]) + +#### Other Changes + +`tslint` is no longer a `dependency`. Instead it is a `peerDependency` and `devDependency`. + +[ec81eb4]: https://github.com/buzinas/tslint-eslint-rules/commit/ec81eb457aa1758dbc35fd4ea01519fc934e1259 +[3c689ff]: https://github.com/buzinas/tslint-eslint-rules/commit/3c689ffa23b36870e9fae8bb04ccdbe51cbf04c7 +[cd50170]: https://github.com/buzinas/tslint-eslint-rules/commit/cd50170f658c62062dff3fa60d501cebccd98d9e +[9c551d7]: https://github.com/buzinas/tslint-eslint-rules/commit/9c551d7eaaa55289cc326e16e804d702c36cc3a1 + + +## [v3.3.0] - 2017/02/04 04:45 GMT-0600 +#### Changes +- Build errors fixed ([d163eb5]) +- TSLint extends support ([18902f1]) + +[d163eb5]: https://github.com/buzinas/tslint-eslint-rules/commit/d163eb5aa438cce25da2624cf43c478544e7889b +[18902f1]: https://github.com/buzinas/tslint-eslint-rules/commit/18902f10939aeb4dedbcb7334be42d462846457c + + +## [v3.2.3] - 2016/12/24 22:52 GMT-0600 +#### Fixes +- handle-callback-err ([0a9a882]) + +[0a9a882]: https://github.com/buzinas/tslint-eslint-rules/commit/0a9a88284f199ec292bcea0534b4323f10a5bc50 + + +## [v3.2.2] - 2016/12/24 12:10 GMT-0600 +#### Fixes +- ter-indent + - JSDocs no longer break variable declarations [cb01358] + - Interfaces are also checked for indentation [5be6774] +- handle-callback-err: [Issue 153](https://github.com/buzinas/tslint-eslint-rules/issues/153) + - Added `allowProperties` option to make the rule more strict. + +Note that the npm release `v3.2.1` only contains this hotfix [cb01358]. + +[5be6774]: https://github.com/buzinas/tslint-eslint-rules/commit/5be67747d4a74e216be14fc332e3871546609cdd +[cb01358]: https://github.com/buzinas/tslint-eslint-rules/commit/cb013580a74a2eb6781a6a0701a7bfafc0818c75 + + +## [v3.2.0] - 2016/12/14 00:50 GMT-0600 +#### Rules Added +- [ter-arrow-body-style](https://github.com/buzinas/tslint-eslint-rules/blob/master/src/docs/rules/terArrowBodyStyleRule.md) +- [ter-arrow-parens](https://github.com/buzinas/tslint-eslint-rules/blob/master/src/docs/rules/terArrowParensRule.md) +- [ter-arrow-spacing](https://github.com/buzinas/tslint-eslint-rules/blob/master/src/docs/rules/terArrowSpacingRule.md) + +#### Fixes +- handle-callback-err: [Issue 146](https://github.com/buzinas/tslint-eslint-rules/issues/146) + +#### Changes +- Added contributing file detailing how to use the current gulp tasks +- Added links to the rule and test source in each of the rule documentation + +## [v3.1.0] - 2016/11/29 23:20 GTM-0600 +#### Rules Added +- ter-prefer-arrow-callback + +#### Fixes +- ter-indent: + - issues with try/catch statements + - issues with return statements + - issues with method declarations + - A `CallExpression` option has been added. + + +## [v3.0.0] - 2016/11/21 12:36 GTM-0600 +### Upgraded to [TSLint 4.0](https://palantir.github.io/tslint/2016/11/17/new-for-4.0.html) +- Several rules are no longer applicable + - no-duplicate-key + - no-unreachable + - no-unused-variable + - use-strict + +#### Developer Tools +- Added RuleTester to help writing tests, see [max-len-rule](https://github.com/buzinas/tslint-eslint-rules/blob/master/src/test/rules/terMaxLenRuleTests.ts) and [no-multi-spaces](https://github.com/buzinas/tslint-eslint-rules/blob/master/src/test/rules/noMultiSpacesRuleTests.ts) for usage examples. + + +## [v2.2.1] - 2016/11/17 21:50 GMT-0600 +#### Fixes +- ter-max-len ([539b3c2](https://github.com/buzinas/tslint-eslint-rules/commit/539b3c210d1fd157d27a9fb61e123c28249e7690)) + + +## [v2.2.0] - 2016/11/17 02:30 GMT-0600 +#### Rules Added +- ter-indent ([b0334d4](https://github.com/buzinas/tslint-eslint-rules/commit/b0334d4fbf7286e07521cbffc5fa90f96e536224)) +- ter-max-len ([5938feb](https://github.com/buzinas/tslint-eslint-rules/commit/5938feb4c290de54e80ddd4bfdd3259441124279)) + +#### Fixes +- no-constant-condition ([b0456a4](https://github.com/buzinas/tslint-eslint-rules/commit/b0456a45b25dd7df488880a61027cf485329fe91)) + +#### Changes +- Rule documentation can be generated from its metadata ([d6ea71e](https://github.com/buzinas/tslint-eslint-rules/commit/d6ea71ee398c26e55d9bc86f01bbe2beca08b350)) + + +## [v2.1.0] - 2016/10/03 19:29 +00:00 +#### Fixes +- handle-callback-err ([caf6ec6](https://github.com/buzinas/tslint-eslint-rules/commit/caf6ec62be772297c18a9dd56d280d9b2dac076a)) + +#### Changes +- Added support for node 4 ([4785e36](https://github.com/buzinas/tslint-eslint-rules/commit/4785e3637166072d10fec61c9bf8a3350aa05733)) +- Added support for node 0.10 ([adc290c](https://github.com/buzinas/tslint-eslint-rules/commit/adc290c02f1299251637ce5d448a3c152b58dc56)) +- Using `es5` as the TypeScript target ([83ad6e3](https://github.com/buzinas/tslint-eslint-rules/commit/83ad6e3c89eb88a55707502c1251255771805e4a)) + + +## [v2.0.0] - 2016/10/01 06:12 +00:00 +### Upgraded to [TypeScript 2.0](https://www.typescriptlang.org/docs/release-notes/typescript-2.0.html) +- Using `es6` as the TypeScript target. +- Dropped support for node 4 + + +## [v1.6.1] - 2016/10/01 05:41 +00:00 +#### Fixes +- no-ex-assign ([31afa69](https://github.com/buzinas/tslint-eslint-rules/commit/31afa69d1718bda1b6d7b9f16c77ef1eb157bb37)) + + +## [v1.6.0] - 2016/09/27 05:56 +00:00 +#### Rules Added +- no-multi-spaces ([7972712](https://github.com/buzinas/tslint-eslint-rules/commit/79727121b64c383bc3c66f8bf2d5feaab3f2ad02)) + +#### Fixes +- no-constant-condition ([3f8dcc5](https://github.com/buzinas/tslint-eslint-rules/commit/3f8dcc5a2f5804243c86a47ba6dbfb4a2241d771)) +- no-ex-assign ([93de74b](https://github.com/buzinas/tslint-eslint-rules/commit/93de74b4d33bb4d6c32c047ac995dd57eb92648d)) +- no-extra-boolean-cast ([8a98530](https://github.com/buzinas/tslint-eslint-rules/commit/8a985309a3c2c645fdd143ae893b026710fa8c01)) + +#### Changes +- README rules documentation replaced for a table ([1c86880](https://github.com/buzinas/tslint-eslint-rules/commit/1c868803f270ec664a1199dc6df2844bae097ea8)) +- Added markdown files for each of the existing rules ([9617910](https://github.com/buzinas/tslint-eslint-rules/commit/961791020bb7947c1c4e942b5f7875165a693b2a)) + +## [v1.5.0] - 2016/09/05 15:10 +00:00 +#### Rules Added +- object-curly-spacing ([28c5727](https://github.com/buzinas/tslint-eslint-rules/commit/28c57275aeb62d83e5df7d6f75dfd9c52b05d2bc)) + +#### Changes +- Updated Contribution section in README to mention new gulp options + + +## [v1.4.0] - 2016/09/05 13:47 +00:00 +#### Fixes +- block-spacing ([3ad19dd](https://github.com/buzinas/tslint-eslint-rules/commit/3ad19dd4f6aab0cf744880998db3066f2ad99a11)) +- brace-style ([874440f](https://github.com/buzinas/tslint-eslint-rules/commit/874440f99f2a37a3acf42939bdcd0212ec0dd148)) +- handle-callback-err ([c6b2b40](https://github.com/buzinas/tslint-eslint-rules/commit/c6b2b4088023381895f94abf53037c89c75bdace)) +- no-inner-declarations ([debb0f7](https://github.com/buzinas/tslint-eslint-rules/commit/debb0f7d3fb4939242f5f0207d9ab31a30c6087a)) +- valid-js-doc ([951a64c](https://github.com/buzinas/tslint-eslint-rules/commit/951a64cbb0c11070ab0fa26c2672cc0bed08e0e3)) + + +## [v1.3.0] - 2016/04/28 22:05 +00:00 +#### Rules Added +- handle-callback-err ([8f6f4c3](https://github.com/buzinas/tslint-eslint-rules/commit/8f6f4c3bf147647ed66de5bf5baf37e96e7886f7)) +- brace-style ([34b97dc](https://github.com/buzinas/tslint-eslint-rules/commit/34b97dc92f6fa9ff0d5115b8493322e0c90811ab)) +- block-spacing ([d0de347](https://github.com/buzinas/tslint-eslint-rules/commit/d0de34796ac0953113f52eee32c74101efb2fb12)) + +#### Fixes +- no-inner-declarations ([49f410c](https://github.com/buzinas/tslint-eslint-rules/commit/49f410caefe92a34c81aba425712758a4ac723af)) + + +## [v1.2.0] - 2016/04/04 17:28 +00:00 +#### Rules Added +- array-bracket-spacing ([2ed91e2](https://github.com/buzinas/tslint-eslint-rules/commit/2ed91e2d6c3691ada63ae855bdfb73d4315174de)) + +#### Changes +- Updated README to fit current ESLint rules ([aa5c342](https://github.com/buzinas/tslint-eslint-rules/commit/aa5c342)) + +#### Fixes +- no-unexpected-multiline issue ([bdca78a](https://github.com/buzinas/tslint-eslint-rules/commit/bdca78ae91cca963e9b93c3bdcb18e661378f55a)) +- no-constant-condition issue ([4904bec](https://github.com/buzinas/tslint-eslint-rules/commit/4904bec6846d96275901d2570a314f4441f937fe)) + + +## [v1.1.1] - 2016/03/21 18:29 +00:00 +#### Added +- index.js ([cd376d0](https://github.com/buzinas/tslint-eslint-rules/commit/cd376d0877aaec62acc7a4dd4d17e66d0807c3a4)) + + +## [v1.1.0] - 2016/03/18 17:05 +00:00 +#### Changes +- Updated npm dependencies + +#### Fixes +- no-ex-assign: updated failure string and added test for false positive ([9da7ba8](https://github.com/buzinas/tslint-eslint-rules/commit/9da7ba8a45d172c5f5c04733da210a2b0a59d272)) + + +## [v1.0.0] - 2015/12/14 17:14 +00:00 +### First stable version +- Improved documentation +- Updated dependencies + +## [v0.3.0] - 2015/11/19 14:47 +00:00 +#### Rules Added +- valid-jsdoc ([3deb2a3](https://github.com/buzinas/tslint-eslint-rules/commit/3deb2a35789142ca58741c134b158d7ff66b4a20)) + + +## [v0.2.7] - 2015/11/17 14:00 +00:00 +#### Rules Added +- no-irregular-whitespace ([15056f0](https://github.com/buzinas/tslint-eslint-rules/commit/15056f0722bee86c4fad44156622af4473261c47)) + + +## [v0.2.6] - 2015/11/17 12:07 +00:00 +#### Rules Added +- no-regex-spaces ([c92f89e](https://github.com/buzinas/tslint-eslint-rules/commit/c92f89e31a10eb97660fd2310ec6718fcab3b3b4)) +- no-empty-character ([1eb3425](https://github.com/buzinas/tslint-eslint-rules/commit/1eb34253bc16ceb05c061fa5de0dd5d2d8f9054b)) +- no-control-regex ([17c66cf](https://github.com/buzinas/tslint-eslint-rules/commit/17c66cf8bf0590d1a138326ef54c0c10a8cbd71d)) + + +## [v0.2.5] - 2015/11/17 11:11 +00:00 +#### Rules Added +- no-inner-declarations ([97a0e63](https://github.com/buzinas/tslint-eslint-rules/commit/97a0e637e919d741df56f9872057b9d902f4d4f2)) + + +## [v0.2.4] - 2015/11/17 01:01 +00:00 +#### Rules Added +- no-invalid-regexp ([7c2f010](https://github.com/buzinas/tslint-eslint-rules/commit/7c2f0104696f85b03ead14f771406c4845cec819)) + +#### Changes +- Improved README with commit conventions ([63b0536](https://github.com/buzinas/tslint-eslint-rules/commit/63b053653c2234b531ee233185fdb07d3bd04545)) + + +## [v0.2.3] - 2015/11/14 15:02 +00:00 +#### Rules Added +- no-constant-condition ([d5b7f38](https://github.com/buzinas/tslint-eslint-rules/commit/d5b7f38a82abb86bd7503b20dc47b06b07c59211)) +- no-duplicate-case ([ac1bb70](https://github.com/buzinas/tslint-eslint-rules/commit/ac1bb700f4f04639cdef40996b2c0c6d42231a23)) +- no-sparse-arrays ([55f8481](https://github.com/buzinas/tslint-eslint-rules/commit/55f84818d7c2d031699fbd1f98ee97e33a755cb7)) +- no-extra-semi ([4b886d3](https://github.com/buzinas/tslint-eslint-rules/commit/4b886d340890f5aaf035cee18b8993de67a234ee)) +- no-extra-boolean-cast ([a5882da](https://github.com/buzinas/tslint-eslint-rules/commit/a5882daf7221aa7c0b6032ed67830f2762704c86)) +- no-ex-assign ([9292423](https://github.com/buzinas/tslint-eslint-rules/commit/9292423a033abb75ddcd5ade48f5026861273e05)) +- no-unexpected-multiline ([2ad0d8b](https://github.com/buzinas/tslint-eslint-rules/commit/2ad0d8b0c464d23ed4d2a0735368341df0def496)) +- valid-typeof ([c2f242e](https://github.com/buzinas/tslint-eslint-rules/commit/c2f242ead01b7467a239398964d7f7543f395200)) +- use-isnan ([b07e3d7](https://github.com/buzinas/tslint-eslint-rules/commit/b07e3d757b6c15058e5110a39229fd617440064d)) + +#### Enhancements +- Added tslint as a dependency ([0fb030a](https://github.com/buzinas/tslint-eslint-rules/commit/0fb030a98fc47af7cb51843336c5c27e9c661ec5)) +- Added Travis CI integration ([2a4f9a2](https://github.com/buzinas/tslint-eslint-rules/commit/2a4f9a2c8c1cc024be51775d9be20444f947edb5)) +- Added and made lots of improvements in README.md + + +[Unreleased]: https://github.com/buzinas/tslint-eslint-rules/compare/v5.4.0...HEAD +[v5.4.0]: https://github.com/buzinas/tslint-eslint-rules/compare/v5.3.1...v5.4.0 +[v5.3.1]: https://github.com/buzinas/tslint-eslint-rules/compare/v5.2.0...v5.3.1 +[v5.2.0]: https://github.com/buzinas/tslint-eslint-rules/compare/v5.1.0...v5.2.0 +[v5.1.0]: https://github.com/buzinas/tslint-eslint-rules/compare/v5.0.0...v5.1.0 +[v5.0.0]: https://github.com/buzinas/tslint-eslint-rules/compare/v4.1.1...v5.0.0 +[v4.1.1]: https://github.com/buzinas/tslint-eslint-rules/compare/v4.1.0...v4.1.1 +[v4.1.0]: https://github.com/buzinas/tslint-eslint-rules/compare/v4.0.0...v4.1.0 +[v4.0.0]: https://github.com/buzinas/tslint-eslint-rules/compare/v3.5.1...v4.0.0 +[v3.5.1]: https://github.com/buzinas/tslint-eslint-rules/compare/v3.5.0...v3.5.1 +[v3.5.0]: https://github.com/buzinas/tslint-eslint-rules/compare/v3.4.0...v3.5.0 +[v3.4.0]: https://github.com/buzinas/tslint-eslint-rules/compare/v3.3.0...v3.4.0 +[v3.3.0]: https://github.com/buzinas/tslint-eslint-rules/compare/v3.2.3...v3.3.0 +[v3.2.3]: https://github.com/buzinas/tslint-eslint-rules/compare/v3.2.2...v3.2.3 +[v3.2.2]: https://github.com/buzinas/tslint-eslint-rules/compare/v3.2.0...v3.2.2 +[v3.2.0]: https://github.com/buzinas/tslint-eslint-rules/compare/v3.1.0...v3.2.0 +[v3.1.0]: https://github.com/buzinas/tslint-eslint-rules/compare/v3.0.0...v3.1.0 +[v3.0.0]: https://github.com/buzinas/tslint-eslint-rules/compare/v2.2.1...v3.0.0 +[v2.2.1]: https://github.com/buzinas/tslint-eslint-rules/compare/v2.2.0...v2.2.1 +[v2.2.0]: https://github.com/buzinas/tslint-eslint-rules/compare/v2.1.0...v2.2.0 +[v2.1.0]: https://github.com/buzinas/tslint-eslint-rules/compare/v2.0.0...v2.1.0 +[v2.0.0]: https://github.com/buzinas/tslint-eslint-rules/compare/v1.6.1...v2.0.0 +[v1.6.1]: https://github.com/buzinas/tslint-eslint-rules/compare/v1.6.0...v1.6.1 +[v1.6.0]: https://github.com/buzinas/tslint-eslint-rules/compare/v1.5.0...v1.6.0 +[v1.5.0]: https://github.com/buzinas/tslint-eslint-rules/compare/v1.4.0...v1.5.0 +[v1.4.0]: https://github.com/buzinas/tslint-eslint-rules/compare/v1.3.0...v1.4.0 +[v1.3.0]: https://github.com/buzinas/tslint-eslint-rules/compare/v1.2.0...v1.3.0 +[v1.2.0]: https://github.com/buzinas/tslint-eslint-rules/compare/v1.1.1...v1.2.0 +[v1.1.1]: https://github.com/buzinas/tslint-eslint-rules/compare/v1.1.0...v1.1.1 +[v1.1.0]: https://github.com/buzinas/tslint-eslint-rules/compare/v1.0.0...v1.1.0 +[v1.0.0]: https://github.com/buzinas/tslint-eslint-rules/compare/v0.3.0...v1.0.0 +[v0.3.0]: https://github.com/buzinas/tslint-eslint-rules/compare/v0.2.7...v0.3.0 +[v0.2.7]: https://github.com/buzinas/tslint-eslint-rules/compare/v0.2.6...v0.2.7 +[v0.2.6]: https://github.com/buzinas/tslint-eslint-rules/compare/v0.2.5...v0.2.6 +[v0.2.5]: https://github.com/buzinas/tslint-eslint-rules/compare/v0.2.4...v0.2.5 +[v0.2.4]: https://github.com/buzinas/tslint-eslint-rules/compare/v0.2.3...v0.2.4 +[v0.2.3]: https://github.com/buzinas/tslint-eslint-rules/compare/2601ba448c8e8d639539dc461d8b2dc43bb908fa...v0.2.3 diff --git a/node_modules/tslint-eslint-rules/LICENSE b/node_modules/tslint-eslint-rules/LICENSE new file mode 100644 index 000000000..a4d736372 --- /dev/null +++ b/node_modules/tslint-eslint-rules/LICENSE @@ -0,0 +1,22 @@ +Copyright (c) 2015 Vitor Buzinaro, Victor Schiavi + + +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. diff --git a/node_modules/tslint-eslint-rules/README.md b/node_modules/tslint-eslint-rules/README.md new file mode 100644 index 000000000..f1073b2a3 --- /dev/null +++ b/node_modules/tslint-eslint-rules/README.md @@ -0,0 +1,345 @@ +[![Build Status](https://travis-ci.org/buzinas/tslint-eslint-rules.svg)](https://travis-ci.org/buzinas/tslint-eslint-rules) +[![Downloads per Month](https://img.shields.io/npm/dm/tslint-eslint-rules.svg)](https://www.npmjs.com/package/tslint-eslint-rules) +[![NPM Version](https://img.shields.io/npm/v/tslint-eslint-rules.svg)](https://www.npmjs.com/package/tslint-eslint-rules) +[![ZenHub](https://img.shields.io/badge/supercharged%20by-ZenHub.io-3F4D9C.svg)](https://zenhub.io/) +[![Shields.io](https://img.shields.io/badge/badges%20by-shields.io-ff69b4.svg)](https://shields.io/) +[![License](https://img.shields.io/npm/l/tslint-eslint-rules.svg)](LICENSE) + + +# ESLint rules for TSLint + +## Improve your TSLint with the missing ESLint Rules + +You want to code in TypeScript but miss all the rules available in ESLint? + +Now you can combine both worlds by using this TSLint plugin! + + +## Usage + +### Install from NPM to your Dev Dependencies + +```console +npm install --save-dev tslint-eslint-rules +``` + +### Or install from Yarn to your Dev Dependencies + +```console +yarn add tslint-eslint-rules --dev +``` + +### Configure TSLint to use `tslint-eslint-rules`: + +In your `tslint.json` file, extend this package, e.g: + +```json +{ + "extends": [ + "tslint-eslint-rules" + ], + "rules": { + "no-constant-condition": true + } +} +``` + +You can also extend other tslint config packages to combine this plugin with other community custom rules. + + +### Configure your rules + +In your `tslint.json` file, insert the rules as described below. + + +## Rules (copied from the [ESLint website](http://eslint.org/docs/rules/)) + +The following tables shows all the existing ESLint rules and the similar rules available in TSLint. +Please refer to the following icons as they provide the status of the rule. + +| Icon | Description | +| :--- | :-- | +| :no_entry_sign: | The rule is not applicable to Typescript. | +| :ballot_box_with_check: | The rule is provided natively by [TSLint](http://palantir.github.io/tslint/rules/). | +| :white_check_mark: | The rule is available via tslint-eslint-rules. | +| :x: | The rule is currently unavailable. | + + + + +### Possible Errors + +The following rules point out areas where you might have made mistakes. + +| :grey_question: | ESLint | TSLint | Description | +| :--- | :---: | :---: | :--- | +|:ballot_box_with_check:|[comma-dangle](http://eslint.org/docs/rules/comma-dangle)|[trailing-comma](http://palantir.github.io/tslint/rules/trailing-comma)|disallow or enforce trailing commas (recommended)| +|:ballot_box_with_check:|[no-cond-assign](http://eslint.org/docs/rules/no-cond-assign)|[no-conditional-assignment](http://palantir.github.io/tslint/rules/no-conditional-assignment)|disallow assignment in conditional expressions (recommended)| +|:ballot_box_with_check:|[no-console](http:/eslint.org/docs/rules/no-console)|[no-console](http://palantir.github.io/tslint/rules/no-console)|disallow use of `console` in the node environment (recommended)| +|:white_check_mark:|[no-constant-condition](http://eslint.org/docs/rules/no-constant-condition)|[no-constant-condition](https://github.com/buzinas/tslint-eslint-rules/blob/master/src/docs/rules/noConstantConditionRule.md)|disallow use of constant expressions in conditions (recommended)| +|:white_check_mark:|[no-control-regex](http://eslint.org/docs/rules/no-control-regex)|[no-control-regex](https://github.com/buzinas/tslint-eslint-rules/blob/master/src/docs/rules/noControlRegexRule.md)|disallow control characters in regular expressions (recommended)| +|:ballot_box_with_check:|[no-debugger](http://eslint.org/docs/rules/no-debugger)|[no-debugger](http://palantir.github.io/tslint/rules/no-debugger)|disallow use of `debugger` (recommended)| +|:no_entry_sign:|[no-dupe-args](http://eslint.org/docs/rules/no-dupe-args)|Not applicable|disallow duplicate arguments in functions (recommended)| +|:no_entry_sign:|[no-dupe-keys](http://eslint.org/docs/rules/no-dupe-keys)|Not applicable|disallow duplicate keys when creating object literals (recommended)| +|:white_check_mark:|[no-duplicate-case](http://eslint.org/docs/rules/no-duplicate-case)|[no-duplicate-case](https://github.com/buzinas/tslint-eslint-rules/blob/master/src/docs/rules/noDuplicateCaseRule.md)|disallow a duplicate case label. (recommended)| +|:ballot_box_with_check:|[no-empty](http://eslint.org/docs/rules/no-empty)|[no-empty](http://palantir.github.io/tslint/rules/no-empty)|disallow empty statements (recommended)| +|:white_check_mark:|[no-empty-character-class](http://eslint.org/docs/rules/no-empty-character-class)|[no-empty-character-class](https://github.com/buzinas/tslint-eslint-rules/blob/master/src/docs/rules/noEmptyCharacterClassRule.md)|disallow the use of empty character classes in regular expressions (recommended)| +|:white_check_mark:|[no-ex-assign](http://eslint.org/docs/rules/no-ex-assign)|[no-ex-assign](https://github.com/buzinas/tslint-eslint-rules/blob/master/src/docs/rules/noExAssignRule.md)|disallow assigning to the exception in a `catch` block (recommended)| +|:white_check_mark:|[no-extra-boolean-cast](http://eslint.org/docs/rules/no-extra-boolean-cast)|[no-extra-boolean-cast](https://github.com/buzinas/tslint-eslint-rules/blob/master/src/docs/rules/noExtraBooleanCastRule.md)|disallow double-negation boolean casts in a boolean context (recommended)| +|:x:|[no-extra-parens](http://eslint.org/docs/rules/no-extra-parens)|no-extra-parens|disallow unnecessary parentheses| +|:white_check_mark:|[no-extra-semi](http://eslint.org/docs/rules/no-extra-semi)|[no-extra-semi](https://github.com/buzinas/tslint-eslint-rules/blob/master/src/docs/rules/noExtraSemiRule.md)|disallow unnecessary semicolons (recommended)| +|:no_entry_sign:|[no-func-assign](http://eslint.org/docs/rules/no-func-assign)|Not applicable|disallow overwriting functions written as function declarations (recommended)| +|:white_check_mark:|[no-inner-declarations](http://eslint.org/docs/rules/no-inner-declarations)|[no-inner-declarations](https://github.com/buzinas/tslint-eslint-rules/blob/master/src/docs/rules/noInnerDeclarationsRule.md)|disallow function or variable declarations in nested blocks (recommended)| +|:white_check_mark:|[no-invalid-regexp](http://eslint.org/docs/rules/no-invalid-regexp)|[no-invalid-regexp](https://github.com/buzinas/tslint-eslint-rules/blob/master/src/docs/rules/noInvalidRegexpRule.md)|disallow invalid regular expression strings in the `RegExp` constructor (recommended)| +|:white_check_mark:|[no-irregular-whitespace](http://eslint.org/docs/rules/no-irregular-whitespace)|[ter-no-irregular-whitespace](https://github.com/buzinas/tslint-eslint-rules/blob/master/src/docs/rules/terNoIrregularWhitespaceRule.md)|disallow irregular whitespace (recommended)| +|:no_entry_sign:|[no-negated-in-lhs](http://eslint.org/docs/rules/no-negated-in-lhs)|Not applicable|disallow negation of the left operand of an `in` expression (recommended)| +|:no_entry_sign:|[no-obj-calls](http://eslint.org/docs/rules/no-obj-calls)|Not applicable|disallow the use of object properties of the global object (`Math` and `JSON`) as functions (recommended)| +|:white_check_mark:|[no-regex-spaces](http://eslint.org/docs/rules/no-regex-spaces)|[no-regex-spaces](https://github.com/buzinas/tslint-eslint-rules/blob/master/src/docs/rules/noRegexSpacesRule.md)|disallow multiple spaces in a regular expression literal (recommended)| +|:white_check_mark:|[no-sparse-arrays](http://eslint.org/docs/rules/no-sparse-arrays)|[ter-no-sparse-arrays](https://github.com/buzinas/tslint-eslint-rules/blob/master/src/docs/rules/terNoSparseArraysRule.md)|disallow sparse arrays (recommended)| +|:white_check_mark:|[no-unexpected-multiline](http://eslint.org/docs/rules/no-unexpected-multiline)|[no-unexpected-multiline](https://github.com/buzinas/tslint-eslint-rules/blob/master/src/docs/rules/noUnexpectedMultilineRule.md)|Avoid code that looks like two expressions but is actually one| +|:no_entry_sign:|[no-unreachable](http://eslint.org/docs/rules/no-unreachable)|Not applicable|disallow unreachable statements after a return, throw, continue, or break statement (recommended)| +|:ballot_box_with_check:|[no-unsafe-finally](http://eslint.org/docs/rules/no-unsafe-finally)|[no-unsafe-finally](https://palantir.github.io/tslint/rules/no-unsafe-finally)|disallow control flow statements in finally blocks (recommended)| +|:ballot_box_with_check:|[use-isnan](http://eslint.org/docs/rules/use-isnan)|[use-isnan](https://palantir.github.io/tslint/rules/use-isnan)|disallow comparisons with the value `NaN` (recommended)| +|:white_check_mark:|[valid-jsdoc](http://eslint.org/docs/rules/valid-jsdoc)|[valid-jsdoc](https://github.com/buzinas/tslint-eslint-rules/blob/master/src/docs/rules/validJsdocRule.md)|enforce valid JSDoc comments| +|:white_check_mark:|[valid-typeof](http://eslint.org/docs/rules/valid-typeof)|[valid-typeof](https://github.com/buzinas/tslint-eslint-rules/blob/master/src/docs/rules/validTypeofRule.md)|Ensure that the results of typeof are compared against a valid string (recommended)| + +### Best Practices + +These are rules designed to prevent you from making mistakes. They either + prescribe a better way of doing something or help you avoid footguns. + +| :grey_question: | ESLint | TSLint | Description | +| :--- | :---: | :---: | :--- | +|:x:|[accessor-pairs](http://eslint.org/docs/rules/accessor-pairs)|accessor-pairs|Enforces getter/setter pairs in objects| +|:x:|[array-callback-return](http://eslint.org/docs/rules/array-callback-return)|array-callback-return|Enforce return statements in callbacks of array’s methods| +|:x:|[block-scoped-var](http://eslint.org/docs/rules/block-scoped-var)|accessor-pairs|treat `var` statements as if they were block scoped| +|:ballot_box_with_check:|[complexity](http://eslint.org/docs/rules/complexity)|[cyclomatic-complexity](https://palantir.github.io/tslint/rules/cyclomatic-complexity)|specify the maximum cyclomatic complexity allowed in a program| +|:x:|[consistent-return](http://eslint.org/docs/rules/consistent-return)|consistent-return|require `return` statements to either always or never specify values| +|:ballot_box_with_check:|[curly](http://eslint.org/docs/rules/curly)|[curly](http://palantir.github.io/tslint/rules/curly)|specify curly brace conventions for all control statements| +|:ballot_box_with_check:|[default-case](http://eslint.org/docs/rules/default-case)|[switch-default](http://palantir.github.io/tslint/rules/switch-default)|require `default` case in `switch` statements| +|:x:|[dot-location](http://eslint.org/docs/rules/dot-location)|dot-location|enforces consistent newlines before or after dots| +|:x:|[dot-notation](http://eslint.org/docs/rules/dot-notation)|dot-notation|encourages use of dot notation whenever possible| +|:ballot_box_with_check:|[eqeqeq](http://eslint.org/docs/rules/eqeqeq)|[triple-equals](http://palantir.github.io/tslint/rules/triple-equals)|require the use of `===` and `!==`| +|:ballot_box_with_check:|[guard-for-in](http://eslint.org/docs/rules/guard-for-in)|[forin](http://palantir.github.io/tslint/rules/forin)|make sure `for-in` loops have an `if` statement| +|:ballot_box_with_check:|[no-alert](http://eslint.org/docs/rules/no-alert)|[ban](https://palantir.github.io/tslint/rules/ban)|disallow the use of `alert`, `confirm`, and `prompt`
can be achieved using the `"ban": [true, ["alert"]]` tslint rule| +|:ballot_box_with_check:|[no-caller](http://eslint.org/docs/rules/no-caller)|[no-arg](http://palantir.github.io/tslint/rules/no-arg)|disallow use of `arguments.caller` or `arguments.callee`| +|:x:|[no-case-declarations](http://eslint.org/docs/rules/no-case-declarations)|no-case-declarations|disallow lexical declarations in case clauses| +|:x:|[no-div-regex](http://eslint.org/docs/rules/no-div-regex)|no-div-regex|disallow division operators explicitly at beginning of regular expression| +|:x:|[no-else-return](http://eslint.org/docs/rules/no-else-return)|no-else-return|disallow `else` after a `return` in an `if`| +|:ballot_box_with_check:|[no-empty-function](http://eslint.org/docs/rules/no-empty-function)|[no-empty](http://palantir.github.io/tslint/rules/no-empty)|disallow use of empty functions| +|:x:|[no-empty-pattern](http://eslint.org/docs/rules/no-empty-pattern)|no-empty-pattern|disallow use of empty destructuring patterns| +|:x:|[no-eq-null](http://eslint.org/docs/rules/no-eq-null)|no-eq-null|disallow comparisons to null without a type-checking operator| +|:ballot_box_with_check:|[no-eval](http://eslint.org/docs/rules/no-eval)|[no-eval](http://palantir.github.io/tslint/rules/no-eval)|disallow use of `eval()`| +|:x:|[no-extend-native](http://eslint.org/docs/rules/no-extend-native)|no-extend-native|disallow adding to native types| +|:x:|[no-extra-bind](http://eslint.org/docs/rules/no-extra-bind)|no-extra-bind|disallow unnecessary function binding| +|:x:|[no-extra-label](http://eslint.org/docs/rules/no-extra-label)|no-extra-label|disallow unnecessary labels| +|:ballot_box_with_check:|[no-fallthrough](http://eslint.org/docs/rules/no-fallthrough)|[no-switch-case-fall-through](http://palantir.github.io/tslint/rules/no-switch-case-fall-through)|disallow fallthrough of `case` statements (recommended)| +|:x:|[no-floating-decimal](http://eslint.org/docs/rules/no-floating-decimal)|no-floating-decimal|disallow the use of leading or trailing decimal points in numeric literals| +|:x:|[no-implicit-coercion](http://eslint.org/docs/rules/no-implicit-coercion)|no-implicit-coercion|disallow the type conversions with shorter notations| +|:x:|[no-implicit-globals](http://eslint.org/docs/rules/no-implicit-globals)|no-implicit-globals|disallow var and named functions in global scope| +|:x:|[no-implied-eval](http://eslint.org/docs/rules/no-implied-eval)|no-implied-eval|disallow use of `eval()`-like methods| +|:ballot_box_with_check:|[no-invalid-this](http://eslint.org/docs/rules/no-invalid-this)|[no-invalid-this](https://palantir.github.io/tslint/rules/no-invalid-this)|disallow `this` keywords outside of classes or class-like objects| +|:x:|[no-iterator](http://eslint.org/docs/rules/no-iterator)|no-iterator|disallow Usage of `__iterator__` property| +|:ballot_box_with_check:|[no-labels](http://eslint.org/docs/rules/no-labels)|[label-position](https://palantir.github.io/tslint/rules/label-position)|disallow use of labeled statements| +|:x:|[no-lone-blocks](http://eslint.org/docs/rules/no-lone-blocks)|no-lone-blocks|disallow unnecessary nested blocks| +|:x:|[no-loop-func](http://eslint.org/docs/rules/no-loop-func)|no-loop-func|disallow creation of functions within loops| +|:ballot_box_with_check:|[no-magic-numbers](http://eslint.org/docs/rules/no-magic-numbers)|[no-magic-numbers](https://palantir.github.io/tslint/rules/no-magic-numbers)|disallow the use of magic numbers| +|:white_check_mark:|[no-multi-spaces](http://eslint.org/docs/rules/no-multi-spaces)|[no-multi-spaces](https://github.com/buzinas/tslint-eslint-rules/blob/master/src/docs/rules/noMultiSpacesRule.md)|disallow use of multiple spaces| +|:x:|[no-multi-str](http://eslint.org/docs/rules/no-multi-str)|no-multi-str|disallow use of multiline strings| +|:no_entry_sign:|[no-native-reassign](http://eslint.org/docs/rules/no-native-reassign)|Not applicable|disallow reassignments of native objects| +|:ballot_box_with_check:|[no-new](http://eslint.org/docs/rules/no-new)|[no-unused-expression](https://palantir.github.io/tslint/rules/no-unused-expression)|disallow use of the `new` operator when not part of an assignment or comparison| +|:x:|[no-new-func](http://eslint.org/docs/rules/no-new-func)|no-new-func|disallow use of new operator for `Function` object| +|:ballot_box_with_check:|[no-new-wrappers](http://eslint.org/docs/rules/no-new-wrappers)|[no-construct](https://palantir.github.io/tslint/rules/no-construct)|disallows creating new instances of `String`,`Number`, and `Boolean`| +|:no_entry_sign:|[no-octal](http://eslint.org/docs/rules/no-octal)|Not applicable|disallow use of octal literals (recommended)| +|:x:|[no-octal-escape](http://eslint.org/docs/rules/no-octal-escape)|no-octal-escape|disallow use of octal escape sequences in string literals, such as `var foo = "Copyright \251";`| +|:x:|[no-param-reassign](http://eslint.org/docs/rules/no-param-reassign)|no-param-reassign|disallow reassignment of function parameters| +|:white_check_mark:|[no-proto](http://eslint.org/docs/rules/no-proto)|[ter-no-proto](https://github.com/buzinas/tslint-eslint-rules/blob/master/src/docs/rules/terNoProtoRule.md)|disallow the use of `__proto__` property| +|:ballot_box_with_check:|[no-redeclare](http://eslint.org/docs/rules/no-redeclare)|[no-duplicate-variable](http://palantir.github.io/tslint/rules/no-duplicate-variable)|disallow declaring the same variable more than once (http://eslint.org/docs/rules/recommended)| +|:x:|[no-return-assign](http://eslint.org/docs/rules/no-return-assign)|no-return-assign|disallow use of assignment in `return` statement| +|:white_check_mark:|[no-script-url](http://eslint.org/docs/rules/no-script-url)|[ter-no-script-url](https://github.com/buzinas/tslint-eslint-rules/blob/master/src/docs/rules/terNoScriptUrlRule.md)|disallow use of `javascript:` urls.| +|:x:|[no-self-assign](http://eslint.org/docs/rules/no-self-assign)|no-self-assign|disallow assignments where both sides are exactly the same| +|:white_check_mark:|[no-self-compare](http://eslint.org/docs/rules/no-self-compare)|[ter-no-self-compare](https://github.com/buzinas/tslint-eslint-rules/blob/master/src/docs/rules/terNoSelfCompareRule.md)|disallow comparisons where both sides are exactly the same| +|:x:|[no-sequences](http://eslint.org/docs/rules/no-sequences)|no-sequences|disallow use of the comma operator| +|:ballot_box_with_check:|[no-throw-literal](http://eslint.org/docs/rules/no-throw-literal)|[no-string-throw](https://palantir.github.io/tslint/rules/no-string-throw)|restrict what can be thrown as an exception| +|:x:|[no-unmodified-loop-condition](http://eslint.org/docs/rules/no-unmodified-loop-condition)|no-unmodified-loop-condition|disallow unmodified conditions of loops| +|:ballot_box_with_check:|[no-unused-expressions](http://eslint.org/docs/rules/no-unused-expressions)|[no-unused-expression](http://palantir.github.io/tslint/rules/no-unused-expression)|disallow Usage of expressions in statement position| +|:x:|[no-unused-labels](http://eslint.org/docs/rules/no-unused-labels)|no-unused-labels|disallow unused labels| +|:x:|[no-useless-call](http://eslint.org/docs/rules/no-useless-call)|no-useless-call|disallow unnecessary `.call()` and `.apply()`| +|:x:|[no-useless-concat](http://eslint.org/docs/rules/no-useless-concat)|no-useless-concat|disallow unnecessary concatenation of literals or template literals| +|:x:|[no-useless-escape](http://eslint.org/docs/rules/no-useless-escape)|no-useless-escape|disallow unnecessary usage of escape character| +|:x:|[no-void](http://eslint.org/docs/rules/no-void)|no-void|disallow use of the `void` operator| +|:x:|[no-warning-comments](http://eslint.org/docs/rules/no-warning-comments)|no-warning-comments|disallow Usage of configurable warning terms in comments e.g. `TODO` or `FIXME`| +|:x:|[no-with](http://eslint.org/docs/rules/no-with)|no-with|disallow use of the `with` statement| +|:ballot_box_with_check:|[radix](http://eslint.org/docs/rules/radix)|[radix](http://palantir.github.io/tslint/rules/radix)|require use of the second argument for `parseInt()`| +|:x:|[vars-on-top](http://eslint.org/docs/rules/vars-on-top)|vars-on-top|require declaration of all vars at the top of their containing scope| +|:x:|[wrap-iife](http://eslint.org/docs/rules/wrap-iife)|wrap-iife|require immediate function invocation to be wrapped in parentheses| +|:x:|[yoda](http://eslint.org/docs/rules/yoda)|yoda|require or disallow Yoda conditions| + +### Strict Mode + +These rules relate to using strict mode. + +| :grey_question: | ESLint | TSLint | Description | +| :--- | :---: | :---: | :--- | +|:no_entry_sign:|[strict](http://eslint.org/docs/rules/strict)|Not applicable|require effective use of strict mode directives| + +### Variables + +These rules have to do with variable declarations. + +| :grey_question: | ESLint | TSLint | Description | +| :--- | :---: | :---: | :--- | +|:x:|[init-declarations](http://eslint.org/docs/rules/init-declarations)|init-declarations|enforce or disallow variable initializations at definition| +|:x:|[no-catch-shadow](http://eslint.org/docs/rules/no-catch-shadow)|no-catch-shadow|disallow the catch clause parameter name being the same as a variable in the outer scope| +|:no_entry_sign:|[no-delete-var](http://eslint.org/docs/rules/no-delete-var)|Not applicable|disallow deletion of variables (recommended)| +|:x:|[no-label-var](http://eslint.org/docs/rules/no-label-var)|no-label-var|disallow labels that share a name with a variable| +|:ballot_box_with_check:|[no-shadow](http://eslint.org/docs/rules/no-shadow)|[no-shadowed-variable](http://palantir.github.io/tslint/rules/no-shadowed-variable)|disallow declaration of variables already declared in the outer scope| +|:x:|[no-shadow-restricted-names](http://eslint.org/docs/rules/no-shadow-restricted-names)|no-shadow-restricted-names|disallow shadowing of names such as `arguments`| +|:no_entry_sign:|[no-undef](http://eslint.org/docs/rules/no-undef)|Not applicable|disallow use of undeclared variables unless mentioned in a `/*global */` block (recommended)| +|:x:|[no-undef-init](http://eslint.org/docs/rules/no-undef-init)|no-undef-init|disallow use of undefined when initializing variables| +|:x:|[no-undefined](http://eslint.org/docs/rules/no-undefined)|no-undefined|disallow use of `undefined` variable| +|:ballot_box_with_check:|[no-unused-vars](http://eslint.org/docs/rules/no-unused-vars)|[no-unused-variable](https://palantir.github.io/tslint/rules/no-unused-variable/)|disallow unused variables (recommended).| +|:ballot_box_with_check:|[no-use-before-define](http://eslint.org/docs/rules/no-use-before-define)|[no-use-before-declare](http://palantir.github.io/tslint/rules/no-use-before-declare)|disallow use of variables before they are defined| + +### Node.js and CommonJS + +These rules are specific to JavaScript running on Node.js or using CommonJS in the browser. + +| :grey_question: | ESLint | TSLint | Description | +| :--- | :---: | :---: | :--- | +|:x:|[callback-return](http://eslint.org/docs/rules/callback-return)|callback-return|enforce `return` after a callback| +|:x:|[global-require](http://eslint.org/docs/rules/global-require)|global-require|enforce `require()` on top-level module scope| +|:white_check_mark:|[handle-callback-err](http://eslint.org/docs/rules/handle-callback-err)|[handle-callback-err](https://github.com/buzinas/tslint-eslint-rules/blob/master/src/docs/rules/handleCallbackErrRule.md)|enforce error handling in callbacks| +|:x:|[no-mixed-requires](http://eslint.org/docs/rules/no-mixed-requires)|no-mixed-requires|disallow mixing regular variable and require declarations| +|:x:|[no-new-require](http://eslint.org/docs/rules/no-new-require)|no-new-require|disallow use of `new` operator with the `require` function| +|:x:|[no-path-concat](http://eslint.org/docs/rules/no-path-concat)|no-path-concat|disallow string concatenation with `__dirname` and `__filename`| +|:x:|[no-process-env](http://eslint.org/docs/rules/no-process-env)|no-process-env|disallow use of `process.env`| +|:x:|[no-process-exit](http://eslint.org/docs/rules/no-process-exit)|no-process-exit|disallow `process.exit()`| +|:x:|[no-restricted-modules](http://eslint.org/docs/rules/no-restricted-modules)|no-restricted-modules|restrict Usage of specified node modules| +|:x:|[no-sync](http://eslint.org/docs/rules/no-sync)|no-sync|disallow use of synchronous methods| + +### Stylistic Issues + +These rules are purely matters of style and are quite subjective. + +| :grey_question: | ESLint | TSLint | Description | +| :--- | :---: | :---: | :--- | +|:white_check_mark:|[array-bracket-spacing](http://eslint.org/docs/rules/array-bracket-spacing)|[array-bracket-spacing](https://github.com/buzinas/tslint-eslint-rules/blob/master/src/docs/rules/arrayBracketSpacingRule.md)|enforce consistent spacing inside array brackets| +|:white_check_mark:|[block-spacing](http://eslint.org/docs/rules/block-spacing)|[block-spacing](https://github.com/buzinas/tslint-eslint-rules/blob/master/src/docs/rules/blockSpacingRule.md)|disallow or enforce spaces inside of single line blocks| +|:white_check_mark:|[brace-style](http://eslint.org/docs/rules/brace-style)|[brace-style](https://github.com/buzinas/tslint-eslint-rules/blob/master/src/docs/rules/braceStyleRule.md)|enforce one true brace style| +|:ballot_box_with_check:|[camelcase](http://eslint.org/docs/rules/camelcase)|[variable-name](http://palantir.github.io/tslint/rules/variable-name)|require camel case names| +|:x:|[comma-spacing](http://eslint.org/docs/rules/comma-spacing)|comma-spacing|enforce spacing before and after comma| +|:x:|[comma-style](http://eslint.org/docs/rules/comma-style)|comma-style|enforce one true comma style| +|:white_check_mark:|[computed-property-spacing](http://eslint.org/docs/rules/computed-property-spacing)|[ter-computed-property-spacing](https://github.com/buzinas/tslint-eslint-rules/blob/master/src/docs/rules/terComputedPropertySpacingRule.md)|require or disallow padding inside computed properties| +|:x:|[consistent-this](http://eslint.org/docs/rules/consistent-this)|consistent-this|enforce consistent naming when capturing the current execution context| +|:ballot_box_with_check:|[eol-last](http://eslint.org/docs/rules/eol-last)|[eofline](https://palantir.github.io/tslint/rules/eofline)|enforce newline at the end of file, with no multiple empty lines| +|:white_check_mark:|[func-call-spacing](http://eslint.org/docs/rules/func-call-spacing)|[ter-func-call-spacing](https://github.com/buzinas/tslint-eslint-rules/blob/master/src/docs/rules/terFuncCallSpacingRule.md)|require or disallow spacing between function identifiers and their invocations| +|:x:|[func-names](http://eslint.org/docs/rules/func-names)|func-names|require function expressions to have a name| +|:x:|[func-style](http://eslint.org/docs/rules/func-style)|func-style|enforce use of function declarations or expressions| +|:x:|[id-blacklist](http://eslint.org/docs/rules/id-blacklist)|id-blacklist|disallow certain identifiers to prevent them being used| +|:x:|[id-length](http://eslint.org/docs/rules/id-length)|id-length|this option enforces minimum and maximum identifier lengths (variable names, property names etc.)| +|:x:|[id-match](http://eslint.org/docs/rules/id-match)|id-match|require identifiers to match the provided regular expression| +|:white_check_mark:|[indent](http://eslint.org/docs/rules/indent)|[ter-indent](https://github.com/buzinas/tslint-eslint-rules/blob/master/src/docs/rules/terIndentRule.md)|enforce consistent indentation| +|:x:|[jsx-quotes](http://eslint.org/docs/rules/jsx-quotes)|jsx-quotes|specify whether double or single quotes should be used in JSX attributes| +|:x:|[key-spacing](http://eslint.org/docs/rules/key-spacing)|key-spacing|enforce spacing between keys and values in object literal properties
Tslint's [whitespace](https://palantir.github.io/tslint/rules/whitespace/) can partially be used| +|:x:|[keyword-spacing](http://eslint.org/docs/rules/keyword-spacing)|keyword-spacing|enforce spacing before and after keywords
Tslint's [whitespace](https://palantir.github.io/tslint/rules/whitespace/) can partially be used| +|:ballot_box_with_check:|[linebreak-style](http://eslint.org/docs/rules/linebreak-style)|[linebreak-style](https://palantir.github.io/tslint/rules/linebreak-style)|disallow mixed 'LF' and 'CRLF' as linebreaks| +|:x:|[lines-around-comment](http://eslint.org/docs/rules/lines-around-comment)|lines-around-comment|enforce empty lines around comments| +|:x:|[max-depth](http://eslint.org/docs/rules/max-depth)|max-depth|specify the maximum depth that blocks can be nested| +|:white_check_mark:|[max-len](http://eslint.org/docs/rules/max-len)|[ter-max-len](https://github.com/buzinas/tslint-eslint-rules/blob/master/src/docs/rules/terMaxLenRule.md)|enforce a maximum line length| +|:ballot_box_with_check:|[max-lines](http://eslint.org/docs/rules/max-lines)|[max-file-line-count](http://palantir.github.io/tslint/rules/max-file-line-count)|enforce a maximum number of lines per file| +|:x:|[max-nested-callbacks](http://eslint.org/docs/rules/max-nested-callbacks)|max-nested-callbacks|specify the maximum depth callbacks can be nested| +|:x:|[max-params](http://eslint.org/docs/rules/max-params)|max-params|specify the number of parameters that can be used in the function declaration| +|:x:|[max-statements](http://eslint.org/docs/rulesmax-statements)|max-statements|specify the maximum number of statement allowed in a function| +|:x:|[max-statements-per-line](http://eslint.org/docs/max-statements-per-line)|max-statements-per-line|specify the maximum number of statements allowed per line| +|:no_entry_sign:|[new-cap](http://eslint.org/docs/rules/new-cap)|Not applicable|require a capital letter for constructors| +|:ballot_box_with_check:|[new-parens](http://eslint.org/docs/rules/new-parens)|[new-parens](https://palantir.github.io/tslint/rules/new-parens)|disallow the omission of parentheses when invoking a constructor with no arguments| +|:white_check_mark:|[newline-after-var](http://eslint.org/docs/rules/newline-after-var)|[ter-newline-after-var](https://github.com/buzinas/tslint-eslint-rules/blob/master/src/docs/rules/terNewlineAfterVarRule.md)|require or disallow an empty newline after variable declarations| +|:x:|[newline-before-return](http://eslint.org/docs/rules/newline-before-return)|newline-before-return|require newline before return statement| +|:x:|[newline-per-chained-call](http://eslint.org/docs/rules/newline-per-chained-call)|newline-per-chained-call|enforce newline after each call when chaining the calls| +|:x:|[no-array-constructor](http://eslint.org/docs/rules/no-array-constructor)|no-array-constructor|disallow use of the `Array` constructor| +|:ballot_box_with_check:|[no-bitwise](http://eslint.org/docs/rules/no-bitwise)|[no-bitwise](https://palantir.github.io/tslint/rules/no-bitwise)|disallows bitwise operators| +|:x:|[no-continue](http://eslint.org/docs/rules/no-continue)|no-continue|disallow use of the `continue` statement| +|:x:|[no-inline-comments](http://eslint.org/docs/rules/no-inline-comments)|no-inline-comments|disallow comments inline after code| +|:x:|[no-lonely-if](http://eslint.org/docs/rules/no-lonely-if)|no-lonely-if|disallow `if` as the only statement in an `else` block| +|:white_check_mark:|[no-mixed-spaces-and-tabs](http://eslint.org/docs/rules/no-mixed-spaces-and-tabs)|[ter-no-mixed-spaces-and-tabs](https://github.com/buzinas/tslint-eslint-rules/blob/master/src/docs/rules/terNoMixedSpacesAndTabsRule.md)|disallow mixed spaces and tabs for indentation (recommended)| +|:ballot_box_with_check:|[no-multiple-empty-lines](http://eslint.org/docs/rules/no-multiple-empty-lines)|[no-consecutive-blank-lines](http://palantir.github.io/tslint/rules/no-consecutive-blank-lines)|disallow multiple empty lines| +|:x:|[no-negated-condition](http://eslint.org/docs/rules/no-negated-condition)|no-negated-condition|disallow negated conditions| +|:x:|[no-nested-ternary](http://eslint.org/docs/rules/no-nested-ternary)|no-nested-ternary|disallow nested ternary expressions| +|:x:|[no-new-object](http://eslint.org/docs/rules/no-new-object)|no-new-object|disallow the use of the `Object` constructor| +|:x:|[no-restricted-syntax](http://eslint.org/docs/rules/no-restricted-syntax)|no-restricted-syntax|disallow use of certain syntax in code| +|:x:|[no-spaced-func](http://eslint.org/docs/rules/no-spaced-func)|no-spaced-func|disallow space between function identifier and application| +|:x:|[no-ternary](http://eslint.org/docs/rules/no-ternary)|no-ternary|disallow the use of ternary operators| +|:ballot_box_with_check:|[no-trailing-spaces](http://eslint.org/docs/rules/no-trailing-spaces)|[no-trailing-whitespace](http://palantir.github.io/tslint/rules/no-trailing-whitespace)|disallow trailing whitespace at the end of lines| +|:x:|[no-underscore-dangle](http://eslint.org/docs/rules/no-underscore-dangle)|no-underscore-dangle|disallow dangling underscores in identifiers| +|:x:|[no-unneeded-ternary](http://eslint.org/docs/rules/no-unneeded-ternary)|no-unneeded-ternary|disallow the use of ternary operators when a simpler alternative exists| +|:x:|[no-whitespace-before-property](http://eslint.org/docs/rules/no-whitespace-before-property)|no-whitespace-before-property|disallow whitespace before properties| +|:white_check_mark:|[object-curly-spacing](http://eslint.org/docs/rules/object-curly-spacing)|[object-curly-spacing](https://github.com/buzinas/tslint-eslint-rules/blob/master/src/docs/rules/objectCurlySpacingRule.md)|require or disallow padding inside curly braces| +|:ballot_box_with_check:|[one-var](http://eslint.org/docs/rules/one-var)|[one-variable-per-declaration](http://palantir.github.io/tslint/rules/one-variable-per-declaration/)|require or disallow one variable declaration per function| +|:x:|[one-var-declaration-per-line](http://eslint.org/docs/rules/one-var-declaration-per-line)|one-var-declaration-per-line|require or disallow a newline around variable declarations| +|:x:|[operator-assignment](http://eslint.org/docs/rules/operator-assignment)|operator-assignment|require assignment operator shorthand where possible or prohibit it entirely| +|:x:|[operator-linebreak](http://eslint.org/docs/rules/operator-linebreak)|operator-linebreak|enforce operators to be placed before or after line breaks| +|:white_check_mark:|[padded-blocks](http://eslint.org/docs/rules/padded-blocks)|ter-padded-blocks|enforce padding within blocks| +|:ballot_box_with_check:|[quote-props](http://eslint.org/docs/rules/quote-props)|[object-literal-key-quotes](https://palantir.github.io/tslint/rules/object-literal-key-quotes)|require quotes around object literal property names| +|:ballot_box_with_check:|[quotes](http://eslint.org/docs/rules/quotes)|[quotemark](http://palantir.github.io/tslint/rules/quotemark/)|specify whether backticks, double or single quotes should be used| +|:x:|[require-jsdoc](http://eslint.org/docs/rules/require-jsdoc)|require-jsdoc|Require JSDoc comment| +|:ballot_box_with_check:|[semi](http://eslint.org/docs/rules/semi)|[semicolon](http://palantir.github.io/tslint/rules/semicolon)|require or disallow use of semicolons instead of ASI| +|:x:|[semi-spacing](http://eslint.org/docs/rules/semi-spacing)|semi-spacing|enforce spacing before and after semicolons| +|:white_check_mark:|[sort-imports](http://eslint.org/docs/rules/sort-imports)|[sort-imports](https://github.com/buzinas/tslint-eslint-rules/blob/master/src/docs/rules/sortImportsRule.md)|enforce sorting import declarations within module| +|:x:|[sort-vars](http://eslint.org/docs/rules/sort-vars)|sort-vars|sort variables within the same declaration block| +|:x:|[space-before-blocks](http://eslint.org/docs/rules/space-before-blocks)|space-before-blocks|require or disallow a space before blocks| +|:x:|[space-before-function-paren](http://eslint.org/docs/rules/space-before-function-paren)|space-before-function-paren|require or disallow a space before function opening parenthesis| +|:white_check_mark:|[space-in-parens](http://eslint.org/docs/rules/space-in-parens)|[space-in-parens](https://github.com/buzinas/tslint-eslint-rules/blob/master/src/docs/rules/spaceInParensRule.md)|require or disallow spaces inside parentheses| +|:x:|[space-infix-ops](http://eslint.org/docs/rules/space-infix-ops)|space-infix-ops|require spaces around operators
Tslint's [whitespace](https://palantir.github.io/tslint/rules/whitespace/) can partially be used| +|:x:|[space-unary-ops](http://eslint.org/docs/rules/space-unary-ops)|space-unary-ops|require or disallow spaces before/after unary operators| +|:ballot_box_with_check:|[spaced-comment](http://eslint.org/docs/rules/spaced-comment)|[comment-format](https://palantir.github.io/tslint/rules/comment-format)|require or disallow a space immediately following the `//` or `/*` in a comment| +|:x:|[wrap-regex](http://eslint.org/docs/rules/wrap-regex)|wrap-regex|require regex literals to be wrapped in parentheses| +|:white_check_mark:|[no-tabs](https://eslint.org/docs/rules/no-tabs)|[ter-no-tabs](https://github.com/buzinas/tslint-eslint-rules/blob/master/src/docs/rules/terNoTabsRule.md)|disallow all tabs| + +### ECMAScript 6 + +These rules are only relevant to ES6 environments. + +| :grey_question: | ESLint | TSLint | Description | +| :--- | :---: | :---: | :--- | +|:white_check_mark:|[arrow-body-style](http://eslint.org/docs/rules/arrow-body-style)|[ter-arrow-body-style](https://github.com/buzinas/tslint-eslint-rules/blob/master/src/docs/rules/terArrowBodyStyleRule.md)|require braces in arrow function body| +|:white_check_mark:|[arrow-parens](http://eslint.org/docs/rules/arrow-parens)|[ter-arrow-parens](https://github.com/buzinas/tslint-eslint-rules/blob/master/src/docs/rules/terArrowParensRule.md)|require parens in arrow function arguments| +|:white_check_mark:|[arrow-spacing](http://eslint.org/docs/rules/arrow-spacing)|[ter-arrow-spacing](https://github.com/buzinas/tslint-eslint-rules/blob/master/src/docs/rules/terArrowSpacingRule.md)|require space before/after arrow function's arrow| +|:no_entry_sign:|[constructor-super](http://eslint.org/docs/rules/constructor-super)|Not applicable|verify calls of `super()` in constructors| +|:x:|[generator-star-spacing](http://eslint.org/docs/rules/generator-star-spacing)|generator-star-spacing|enforce spacing around the `*` in generator functions| +|:x:|[no-class-assign](http://eslint.org/docs/rules/no-class-assign)|no-class-assign|disallow modifying variables of class declarations| +|:x:|[no-confusing-arrow](http://eslint.org/docs/rules/no-confusing-arrow)|no-confusing-arrow|disallow arrow functions where they could be confused with comparisons| +|:no_entry_sign:|[no-const-assign](http://eslint.org/docs/rules/no-const-assign)|Not applicable|disallow modifying variables that are declared using `const`| +|:no_entry_sign:|[no-dupe-class-members](http://eslint.org/docs/rules/no-dupe-class-members)|Not applicable|disallow duplicate name in class members| +|:x:|[no-duplicate-imports](http://eslint.org/docs/rules/no-duplicate-imports)|no-duplicate-imports|disallow duplicate module imports| +|:x:|[no-new-symbol](http://eslint.org/docs/rules/no-new-symbol)|no-new-symbol|disallow use of the `new` operator with the `Symbol` object| +|:x:|[no-restricted-imports](http://eslint.org/docs/rules/no-restricted-imports)|no-restricted-imports|restrict usage of specified modules when loaded by `import` declaration| +|:no_entry_sign:|[no-this-before-super](http://eslint.org/docs/rules/no-this-before-super)|Not applicable|disallow use of `this`/`super` before calling `super()` in constructors.| +|:x:|[no-useless-constructor](http://eslint.org/docs/rules/no-useless-constructor)|no-useless-constructor|disallow unnecessary constructor| +|:ballot_box_with_check:|[no-var](http://eslint.org/docs/rules/no-var)|[no-var-keyword](http://palantir.github.io/tslint/rules/no-var-keyword)|require `let` or `const` instead of `var`| +|:ballot_box_with_check:|[object-shorthand](http://eslint.org/docs/rules/object-shorthand)|[object-literal-shorthand](https://palantir.github.io/tslint/rules/object-literal-shorthand)|require method and property shorthand syntax for object literals| +|:white_check_mark:|[prefer-arrow-callback](http://eslint.org/docs/rules/prefer-arrow-callback)|[ter-prefer-arrow-callback](https://github.com/buzinas/tslint-eslint-rules/blob/master/src/docs/rules/terPreferArrowCallbackRule.md)|require arrow functions as callbacks| +|:ballot_box_with_check:|[prefer-const](http://eslint.org/docs/rules/prefer-const)|[prefer-const](https://palantir.github.io/tslint/rules/prefer-const)|suggest using `const` declaration for variables that are never modified after declared| +|:x:|[prefer-destructuring](http://eslint.org/docs/rules/prefer-destructuring)|prefer-destructuring|require using destructuring when assigning to variables from arrays and objects| +|:x:|[prefer-reflect](http://eslint.org/docs/rules/prefer-reflect)|prefer-reflect|suggest using Reflect methods where applicable| +|:x:|[prefer-rest-params](http://eslint.org/docs/rules/prefer-rest-params)|prefer-rest-params|suggest using the rest parameters instead of `arguments`| +|:x:|[prefer-spread](http://eslint.org/docs/rules/prefer-spread)|prefer-spread|suggest using the spread operator instead of `.apply()`.| +|:x:|[prefer-template](http://eslint.org/docs/rules/prefer-template)|prefer-template|suggest using template literals instead of strings concatenation| +|:x:|[require-yield](http://eslint.org/docs/rules/require-yield)|require-yield|disallow generator functions that do not have `yield`| +|:x:|[template-curly-spacing](http://eslint.org/docs/rules/template-curly-spacing)|template-curly-spacing|enforce spacing around embedded expressions of template strings| +|:x:|[yield-star-spacing](http://eslint.org/docs/rules/yield-star-spacing)|yield-star-spacing|enforce spacing around the `*` in `yield*` expressions| + + +## Contributing + +Bugs, rules requests, doubts etc., open a Github [Issue]. If you want to create one of the missing +rules or fix/improve some existing rule please check out the [contribution guide]. + +## LICENSE + +MIT + +[Issue]: https://github.com/buzinas/tslint-eslint-rules/issues/new +[contribution guide]: https://github.com/buzinas/tslint-eslint-rules/blob/master/CONTRIBUTING.md diff --git a/node_modules/tslint-eslint-rules/dist/rules/arrayBracketSpacingRule.js b/node_modules/tslint-eslint-rules/dist/rules/arrayBracketSpacingRule.js new file mode 100644 index 000000000..beee959ad --- /dev/null +++ b/node_modules/tslint-eslint-rules/dist/rules/arrayBracketSpacingRule.js @@ -0,0 +1,196 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +var tslib_1 = require("tslib"); +var ts = require("typescript"); +var Lint = require("tslint"); +var OPTION_ALWAYS = 'always'; +var RULE_NAME = 'array-bracket-spacing'; +var Rule = (function (_super) { + tslib_1.__extends(Rule, _super); + function Rule() { + return _super !== null && _super.apply(this, arguments) || this; + } + Rule.prototype.apply = function (sourceFile) { + var walker = new ArrayBracketSpacingWalker(sourceFile, this.getOptions()); + return this.applyWithWalker(walker); + }; + Rule.metadata = { + ruleName: RULE_NAME, + description: 'enforce consistent spacing inside array brackets', + rationale: Lint.Utils.dedent(templateObject_1 || (templateObject_1 = tslib_1.__makeTemplateObject(["\n A number of style guides require or disallow spaces between array brackets and other tokens.\n This rule applies to both array literals and destructuring assignments (ECMAScript 6).\n "], ["\n A number of style guides require or disallow spaces between array brackets and other tokens.\n This rule applies to both array literals and destructuring assignments (ECMAScript 6).\n "]))), + optionsDescription: Lint.Utils.dedent(templateObject_2 || (templateObject_2 = tslib_1.__makeTemplateObject(["\n The rule takes one or two options. The first is a string, which can be:\n\n - `\"never\"` (default) disallows spaces inside array brackets\n - `\"always\"`requires one or more spaces or newlines inside array brackets\n\n The second option is an object for exceptions to the `\"never\"` option:\n\n - `\"singleValue\": true` requires one or more spaces or newlines inside brackets of array\n literals that contain a single element\n - `\"objectsInArrays\": true` requires one or more spaces or newlines between brackets of\n array literals and braces of their object literal elements\n `[ {` or `} ]`\n - `\"arraysInArrays\": true` requires one or more spaces or newlines between brackets of\n array literals and brackets of their array literal elements\n `[ [` or `] ]`\n\n When using the `\"always\"` option the second option takes on these exceptions:\n\n - `\"singleValue\": false` disallows spaces inside brackets of array literals that contain a\n single element\n - `\"objectsInArrays\": false` disallows spaces between brackets of array literals and braces\n of their object literal elements `[ {` or `} ]`\n - `\"arraysInArrays\": false` disallows spaces between brackets of array literals and brackets\n of their array literal elements `[ [` or `] ]`\n\n This rule has build-in exceptions:\n\n - `\"never\"` (and also the exceptions to the `\"always\"` option) allows newlines inside\n array brackets, because this is a common pattern\n - `\"always\"` does not require spaces or newlines in empty array literals `[]`\n "], ["\n The rule takes one or two options. The first is a string, which can be:\n\n - \\`\"never\"\\` (default) disallows spaces inside array brackets\n - \\`\"always\"\\`requires one or more spaces or newlines inside array brackets\n\n The second option is an object for exceptions to the \\`\"never\"\\` option:\n\n - \\`\"singleValue\": true\\` requires one or more spaces or newlines inside brackets of array\n literals that contain a single element\n - \\`\"objectsInArrays\": true\\` requires one or more spaces or newlines between brackets of\n array literals and braces of their object literal elements\n \\`[ {\\` or \\`} ]\\`\n - \\`\"arraysInArrays\": true\\` requires one or more spaces or newlines between brackets of\n array literals and brackets of their array literal elements\n \\`[ [\\` or \\`] ]\\`\n\n When using the \\`\"always\"\\` option the second option takes on these exceptions:\n\n - \\`\"singleValue\": false\\` disallows spaces inside brackets of array literals that contain a\n single element\n - \\`\"objectsInArrays\": false\\` disallows spaces between brackets of array literals and braces\n of their object literal elements \\`[ {\\` or \\`} ]\\`\n - \\`\"arraysInArrays\": false\\` disallows spaces between brackets of array literals and brackets\n of their array literal elements \\`[ [\\` or \\`] ]\\`\n\n This rule has build-in exceptions:\n\n - \\`\"never\"\\` (and also the exceptions to the \\`\"always\"\\` option) allows newlines inside\n array brackets, because this is a common pattern\n - \\`\"always\"\\` does not require spaces or newlines in empty array literals \\`[]\\`\n "]))), + options: { + anyOf: [ + { + type: 'array', + items: [ + { + enum: ['always', 'never'] + } + ], + minItems: 0, + maxItems: 1 + }, + { + type: 'object', + properties: { + singleValue: { + type: 'boolean' + }, + objectsInArrays: { + type: 'boolean' + }, + arraysInArrays: { + type: 'boolean' + } + }, + additionalProperties: false + } + ] + }, + optionExamples: [ + Lint.Utils.dedent(templateObject_3 || (templateObject_3 = tslib_1.__makeTemplateObject(["\n \"", "\": [true, \"always\"]\n "], ["\n \"", "\": [true, \"always\"]\n "])), RULE_NAME), + Lint.Utils.dedent(templateObject_4 || (templateObject_4 = tslib_1.__makeTemplateObject(["\n \"", "\": [true, \"never\"]\n "], ["\n \"", "\": [true, \"never\"]\n "])), RULE_NAME), + Lint.Utils.dedent(templateObject_5 || (templateObject_5 = tslib_1.__makeTemplateObject(["\n \"", "\": [true, \"never\", {\n \"arraysInArrays\": true\n }]\n "], ["\n \"", "\": [true, \"never\", {\n \"arraysInArrays\": true\n }]\n "])), RULE_NAME) + ], + typescriptOnly: false, + type: 'style' + }; + return Rule; +}(Lint.Rules.AbstractRule)); +exports.Rule = Rule; +var ArrayBracketSpacingWalker = (function (_super) { + tslib_1.__extends(ArrayBracketSpacingWalker, _super); + function ArrayBracketSpacingWalker(sourceFile, options) { + var _this = _super.call(this, sourceFile, options) || this; + _this.singleValueException = false; + _this.objectsInArraysException = false; + _this.arraysInArraysException = false; + var ruleOptions = _this.getOptions(); + _this.spaced = _this.hasOption(OPTION_ALWAYS) || (ruleOptions && ruleOptions.length === 0); + var opt = ruleOptions[1]; + var isDef = function (x) { return typeof x !== 'undefined'; }; + if (opt) { + _this.singleValueException = isDef(opt.singleValue) && opt.singleValue !== _this.spaced; + _this.objectsInArraysException = isDef(opt.objectsInArrays) && opt.objectsInArrays !== _this.spaced; + _this.arraysInArraysException = isDef(opt.arraysInArrays) && opt.arraysInArrays !== _this.spaced; + } + return _this; + } + ArrayBracketSpacingWalker.prototype.report = function (start, msg, fix) { + this.addFailure(this.createFailure(start, 1, msg, fix)); + }; + ArrayBracketSpacingWalker.prototype.reportNoBeginningSpace = function (token, space) { + var start = token.getStart(this.getSourceFile()); + var fix = Lint.Replacement.deleteText(start + 1, space); + this.report(start, 'There should be no space after "["', fix); + }; + ArrayBracketSpacingWalker.prototype.reportRequiredBeginningSpace = function (token) { + var start = token.getStart(this.getSourceFile()); + var fix = Lint.Replacement.appendText(start + 1, ' '); + this.report(start, 'A space is required after "["', fix); + }; + ArrayBracketSpacingWalker.prototype.reportRequiredEndingSpace = function (token) { + var start = token.getStart(this.getSourceFile()); + var fix = Lint.Replacement.appendText(start, ' '); + this.report(start, 'A space is required before "]"', fix); + }; + ArrayBracketSpacingWalker.prototype.reportNoEndingSpace = function (token, space) { + var start = token.getStart(this.getSourceFile()); + var fix = Lint.Replacement.deleteText(start - space, space); + this.report(start, 'There should be no space before "]"', fix); + }; + ArrayBracketSpacingWalker.prototype.visitNode = function (node) { + if (node.kind === ts.SyntaxKind.ArrayBindingPattern) { + this.validateArraySpacing(node, node.elements); + } + _super.prototype.visitNode.call(this, node); + }; + ArrayBracketSpacingWalker.prototype.visitArrayLiteralExpression = function (node) { + this.validateArraySpacing(node, node.elements); + _super.prototype.visitArrayLiteralExpression.call(this, node); + }; + ArrayBracketSpacingWalker.prototype.isObjectType = function (node) { + return node && node.kind === ts.SyntaxKind.ObjectLiteralExpression; + }; + ArrayBracketSpacingWalker.prototype.isArrayType = function (node) { + if (node) { + if (node.kind === ts.SyntaxKind.ArrayLiteralExpression) { + return true; + } + var firstChild = node.getChildAt(0); + if (firstChild && firstChild.kind === ts.SyntaxKind.ArrayBindingPattern) { + return true; + } + } + return false; + }; + ArrayBracketSpacingWalker.prototype.validateArraySpacing = function (node, elements) { + var _this = this; + if (this.spaced && elements.length === 0) { + return; + } + var first = node.getChildAt(0); + var last = node.getChildAt(2); + var firstElement = elements[0]; + var lastElement = elements[elements.length - 1]; + var second = firstElement || last; + var penultimate = lastElement || first; + if (second.pos === second.end) { + second = node.getChildAt(1).getChildAt(1); + } + if (elements.hasTrailingComma) { + penultimate = elements; + } + var mustBeSpaced = function (token) { return (_this.singleValueException && elements.length === 1 || + _this.objectsInArraysException && _this.isObjectType(token) || + _this.arraysInArraysException && _this.isArrayType(token)) ? !_this.spaced : _this.spaced; }; + var openingBracketMustBeSpaced = mustBeSpaced(firstElement); + var closingBracketMustBeSpaced = mustBeSpaced(lastElement); + var spaceAfterOpeningBracket = this.getSpaceBetween(first, second, false); + var isBreakAfterOpeningBracket = this.isLineBreakBetween(first, second); + var spaceBeforeClosingBracket = this.getSpaceBetween(penultimate, last, true); + var isBreakBeforeClosingBracket = this.isLineBreakBetween(penultimate, last); + if (!isBreakAfterOpeningBracket) { + if (openingBracketMustBeSpaced && !spaceAfterOpeningBracket) { + this.reportRequiredBeginningSpace(first); + } + else if (!openingBracketMustBeSpaced && spaceAfterOpeningBracket) { + this.reportNoBeginningSpace(first, spaceAfterOpeningBracket); + } + } + if (first !== penultimate && !isBreakBeforeClosingBracket) { + if (closingBracketMustBeSpaced && !spaceBeforeClosingBracket) { + this.reportRequiredEndingSpace(last); + } + else if (!closingBracketMustBeSpaced && spaceBeforeClosingBracket) { + this.reportNoEndingSpace(last, spaceBeforeClosingBracket); + } + } + }; + ArrayBracketSpacingWalker.prototype.getSpaceBetween = function (node, nextNode, trailing) { + var end = nextNode.getStart(this.getSourceFile()); + var start = node.end; + var text = this.getSourceFile().text.substring(start, end); + var m = text.match(/\/\*.*\*\//); + if (m && typeof m.index === 'number') { + var len = m[0].length; + return trailing ? end - (start + m.index + len) : m.index; + } + return end - start; + }; + ArrayBracketSpacingWalker.prototype.isLineBreakBetween = function (node, nextNode) { + return this.getEndPosition(node).line !== this.getStartPosition(nextNode).line; + }; + ArrayBracketSpacingWalker.prototype.getStartPosition = function (node) { + var srcFile = this.getSourceFile(); + return srcFile.getLineAndCharacterOfPosition(node.getStart(srcFile)); + }; + ArrayBracketSpacingWalker.prototype.getEndPosition = function (node) { + return this.getSourceFile().getLineAndCharacterOfPosition(node.end); + }; + return ArrayBracketSpacingWalker; +}(Lint.RuleWalker)); +var templateObject_1, templateObject_2, templateObject_3, templateObject_4, templateObject_5; + +//# sourceMappingURL=data:application/json;charset=utf8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInJ1bGVzL2FycmF5QnJhY2tldFNwYWNpbmdSdWxlLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7OztBQUFBLCtCQUFpQztBQUNqQyw2QkFBK0I7QUFFL0IsSUFBTSxhQUFhLEdBQUcsUUFBUSxDQUFDO0FBQy9CLElBQU0sU0FBUyxHQUFHLHVCQUF1QixDQUFDO0FBRTFDO0lBQTBCLGdDQUF1QjtJQUFqRDs7SUEyRkEsQ0FBQztJQUpRLG9CQUFLLEdBQVosVUFBYSxVQUF5QjtRQUNwQyxJQUFNLE1BQU0sR0FBRyxJQUFJLHlCQUF5QixDQUFDLFVBQVUsRUFBRSxJQUFJLENBQUMsVUFBVSxFQUFFLENBQUMsQ0FBQztRQUM1RSxPQUFPLElBQUksQ0FBQyxlQUFlLENBQUMsTUFBTSxDQUFDLENBQUM7SUFDdEMsQ0FBQztJQXpGYSxhQUFRLEdBQXVCO1FBQzNDLFFBQVEsRUFBRSxTQUFTO1FBQ25CLFd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FBRSxDQUFDO1FBQ3JDLE9BQU8sT0FBTyxDQUFDLDZCQUE2QixDQUFDLElBQUksQ0FBQyxRQUFRLENBQUMsT0FBTyxDQUFDLENBQUMsQ0FBQztJQUN2RSxDQUFDO0lBRU8sa0RBQWMsR0FBdEIsVUFBdUIsSUFBa0I7UUFDdkMsT0FBTyxJQUFJLENBQUMsYUFBYSxFQUFFLENBQUMsNkJBQTZCLENBQUMsSUFBSSxDQUFDLEdBQUcsQ0FBQyxDQUFDO0lBQ3RFLENBQUM7SUFDSCxnQ0FBQztBQUFELENBOUpBLEFBOEpDLENBOUp1QyxJQUFJLENBQUMsVUFBVSxHQThKdEQiLCJmaWxlIjoicnVsZXMvYXJyYXlCcmFja2V0U3BhY2luZ1J1bGUuanMiLCJzb3VyY2VSb290IjoiL1VzZXJzL2ptbG9wZXovdHNsaW50LWVzbGludC1ydWxlcy9zcmMifQ== diff --git a/node_modules/tslint-eslint-rules/dist/rules/blockSpacingRule.js b/node_modules/tslint-eslint-rules/dist/rules/blockSpacingRule.js new file mode 100644 index 000000000..808f21897 --- /dev/null +++ b/node_modules/tslint-eslint-rules/dist/rules/blockSpacingRule.js @@ -0,0 +1,58 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +var tslib_1 = require("tslib"); +var ts = require("typescript"); +var Lint = require("tslint"); +var OPTION_ALWAYS = 'always'; +var Rule = (function (_super) { + tslib_1.__extends(Rule, _super); + function Rule() { + return _super !== null && _super.apply(this, arguments) || this; + } + Rule.prototype.apply = function (sourceFile) { + var walker = new BlockSpacingWalker(sourceFile, this.getOptions()); + return this.applyWithWalker(walker); + }; + Rule.FAILURE_STRING = { + always: 'Requires a space', + never: 'Unexpected space(s)' + }; + return Rule; +}(Lint.Rules.AbstractRule)); +exports.Rule = Rule; +var BlockSpacingWalker = (function (_super) { + tslib_1.__extends(BlockSpacingWalker, _super); + function BlockSpacingWalker(sourceFile, options) { + var _this = _super.call(this, sourceFile, options) || this; + _this.always = _this.hasOption(OPTION_ALWAYS) || (_this.getOptions() && _this.getOptions().length === 0); + return _this; + } + BlockSpacingWalker.prototype.visitNode = function (node) { + if (node.kind === ts.SyntaxKind.Block || node.kind === ts.SyntaxKind.CaseBlock) { + this.checkSpacingInsideBraces(node); + } + _super.prototype.visitNode.call(this, node); + }; + BlockSpacingWalker.prototype.checkSpacingInsideBraces = function (node) { + var blockChildren = node.getChildren(); + var syntaxList = blockChildren[1]; + var openBraceLocation = this.getStartPosition(blockChildren[0]); + var closeBraceLocation = this.getStartPosition(blockChildren[blockChildren.length - 1]); + if (syntaxList && syntaxList.getChildCount() > 0 && openBraceLocation.line === closeBraceLocation.line) { + if (this.isSpaceBetween(blockChildren[0], blockChildren[1]) !== this.always + || this.isSpaceBetween(blockChildren[blockChildren.length - 2], blockChildren[blockChildren.length - 1]) !== this.always) { + var failureString = this.always ? Rule.FAILURE_STRING.always : Rule.FAILURE_STRING.never; + this.addFailure(this.createFailure(node.getStart(), node.getWidth(), failureString)); + } + } + }; + BlockSpacingWalker.prototype.isSpaceBetween = function (node, nextNode) { + return nextNode.getStart() - node.getEnd() > 0; + }; + BlockSpacingWalker.prototype.getStartPosition = function (node) { + return node.getSourceFile().getLineAndCharacterOfPosition(node.getStart()); + }; + return BlockSpacingWalker; +}(Lint.RuleWalker)); + +//# sourceMappingURL=data:application/json;charset=utf8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInJ1bGVzL2Jsb2NrU3BhY2luZ1J1bGUudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7O0FBQUEsK0JBQWlDO0FBQ2pDLDZCQUErQjtBQUUvQixJQUFNLGFBQWEsR0FBRyxRQUFRLENBQUM7QUFFL0I7SUFBMEIsZ0NBQXVCO0lBQWpEOztJQVVBLENBQUM7SUFKUSxvQkFBSyxHQUFaLFVBQWEsVUFBeUI7UUFDcEMsSUFBTSxNQUFNLEdBQUcsSUFBSSxrQkFBa0IsQ0FBQyxVQUFVLEVBQUUsSU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Q0FBQyxDQUFDLENBQUM7YUFDdEY7U0FDRjtJQUNILENBQUM7SUFFTywyQ0FBYyxHQUF0QixVQUF1QixJQUFhLEVBQUUsUUFBaUI7UUFDckQsT0FBTyxRQUFRLENBQUMsUUFBUSxFQUFFLEdBQUcsSUFBSSxDQUFDLE1BQU0sRUFBRSxHQUFHLENBQUMsQ0FBQztJQUNqRCxDQUFDO0lBRU8sNkNBQWdCLEdBQXhCLFVBQXlCLElBQWE7UUFDcEMsT0FBTyxJQUFJLENBQUMsYUFBYSxFQUFFLENBQUMsNkJBQTZCLENBQUMsSUFBSSxDQUFDLFFBQVEsRUFBRSxDQUFDLENBQUM7SUFDN0UsQ0FBQztJQUNILHlCQUFDO0FBQUQsQ0F2Q0EsQUF1Q0MsQ0F2Q2dDLElBQUksQ0FBQyxVQUFVLEdBdUMvQyIsImZpbGUiOiJydWxlcy9ibG9ja1NwYWNpbmdSdWxlLmpzIiwic291cmNlUm9vdCI6Ii9Vc2Vycy9qbWxvcGV6L3RzbGludC1lc2xpbnQtcnVsZXMvc3JjIn0= diff --git a/node_modules/tslint-eslint-rules/dist/rules/braceStyleRule.js b/node_modules/tslint-eslint-rules/dist/rules/braceStyleRule.js new file mode 100644 index 000000000..5d4806534 --- /dev/null +++ b/node_modules/tslint-eslint-rules/dist/rules/braceStyleRule.js @@ -0,0 +1,149 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +var tslib_1 = require("tslib"); +var ts = require("typescript"); +var Lint = require("tslint"); +var OPTION_1TBS = '1tbs'; +var OPTION_ALLMAN = 'allman'; +var OPTION_STROUSTRUP = 'stroustrup'; +var BraceStyle; +(function (BraceStyle) { + BraceStyle[BraceStyle["OneTBS"] = 0] = "OneTBS"; + BraceStyle[BraceStyle["Allman"] = 1] = "Allman"; + BraceStyle[BraceStyle["Stroustrup"] = 2] = "Stroustrup"; +})(BraceStyle || (BraceStyle = {})); +var Rule = (function (_super) { + tslib_1.__extends(Rule, _super); + function Rule() { + return _super !== null && _super.apply(this, arguments) || this; + } + Rule.prototype.apply = function (sourceFile) { + var walker = new BraceStyleWalker(sourceFile, this.getOptions()); + return this.applyWithWalker(walker); + }; + Rule.FAILURE_STRING = { + open: 'Opening curly brace does not appear on the same line as controlling statement.', + openAllman: 'Opening curly brace appears on the same line as controlling statement.', + body: 'Statement inside of curly braces should be on next line.', + close: 'Closing curly brace does not appear on the same line as the subsequent block.', + closeSingle: 'Closing curly brace should be on the same line as opening curly brace or on the line after the previous block.', + closeStroustrupAllman: 'Closing curly brace appears on the same line as the subsequent block.' + }; + return Rule; +}(Lint.Rules.AbstractRule)); +exports.Rule = Rule; +var BraceStyleWalker = (function (_super) { + tslib_1.__extends(BraceStyleWalker, _super); + function BraceStyleWalker(sourceFile, options) { + var _this = _super.call(this, sourceFile, options) || this; + _this.allowSingleLine = false; + if (_this.hasOption(OPTION_1TBS)) { + _this.braceStyle = BraceStyle.OneTBS; + } + else if (_this.hasOption(OPTION_ALLMAN)) { + _this.braceStyle = BraceStyle.Allman; + } + else if (_this.hasOption(OPTION_STROUSTRUP)) { + _this.braceStyle = BraceStyle.Stroustrup; + } + else { + } + _this.allowSingleLine = _this.getOptions()[1] && _this.getOptions()[1].allowSingleLine; + return _this; + } + BraceStyleWalker.prototype.visitTryStatement = function (tryStatement) { + var _this = this; + _super.prototype.visitTryStatement.call(this, tryStatement); + var checkTryStatementError = function (node) { + var previousNode = _this.getPreviousNode(tryStatement.getChildren(), node); + var openingBracketError = _this.areOnSameLine(previousNode, node) !== (_this.braceStyle === BraceStyle.OneTBS); + if (_this.allowSingleLine && _this.getStartPosition(node).line === _this.getEndPosition(tryStatement).line) { + return; + } + if (openingBracketError) { + var failureString = _this.braceStyle === BraceStyle.OneTBS ? Rule.FAILURE_STRING.open : Rule.FAILURE_STRING.openAllman; + _this.addFailure(_this.createFailure(node.getStart(), node.getWidth(), failureString)); + } + }; + var catchClause = tryStatement.catchClause; + if (catchClause) { + checkTryStatementError(catchClause); + } + var finallyBlock = tryStatement.finallyBlock; + if (finallyBlock) { + checkTryStatementError(finallyBlock); + } + }; + BraceStyleWalker.prototype.visitIfStatement = function (ifStatement) { + _super.prototype.visitIfStatement.call(this, ifStatement); + var elseKeyword = ifStatement.getChildren().filter(function (ch) { return ch.kind === ts.SyntaxKind.ElseKeyword; }).shift(); + if (!elseKeyword) { + return; + } + var previousNode = ifStatement.getChildren()[ifStatement.getChildren().indexOf(elseKeyword) - 1]; + var openingBracketError = this.areOnSameLine(previousNode, elseKeyword) !== (this.braceStyle === BraceStyle.OneTBS); + if (this.allowSingleLine && this.getStartPosition(elseKeyword).line === this.getEndPosition(ifStatement).line) { + return; + } + if (!ifStatement.getChildren().some(function (ch) { return ch.kind === ts.SyntaxKind.Block; })) { + return; + } + if (openingBracketError) { + var failureString = this.braceStyle === BraceStyle.OneTBS ? Rule.FAILURE_STRING.open : Rule.FAILURE_STRING.openAllman; + this.addFailure(this.createFailure(elseKeyword.getStart(), elseKeyword.getWidth(), failureString)); + } + }; + BraceStyleWalker.prototype.visitBlock = function (block) { + _super.prototype.visitBlock.call(this, block); + if (this.allowSingleLine && this.getStartPosition(block).line === this.getEndPosition(block).line) { + return; + } + var blockChildren = block.getChildren(); + var openingCurlyBrace = blockChildren.filter(function (ch) { return ch.kind === ts.SyntaxKind.OpenBraceToken; }).shift(); + var closingCurlyBrace = blockChildren.filter(function (ch) { return ch.kind === ts.SyntaxKind.CloseBraceToken; }).pop(); + var syntaxList = blockChildren.filter(function (ch) { return ch.kind === ts.SyntaxKind.SyntaxList; }).shift(); + var parentChildren = block.parent ? block.parent.getChildren() : []; + var blockPreviousNode = parentChildren[parentChildren.indexOf(block) - 1]; + if (!openingCurlyBrace || !closingCurlyBrace || !syntaxList || !blockPreviousNode) { + return; + } + var openingBracketError = this.areOnSameLine(blockPreviousNode, block) === (this.braceStyle === BraceStyle.Allman); + if (openingBracketError) { + var failureString = this.braceStyle === BraceStyle.Allman ? Rule.FAILURE_STRING.openAllman : Rule.FAILURE_STRING.open; + this.addFailure(this.createFailure(openingCurlyBrace.getStart(), openingCurlyBrace.getWidth(), failureString)); + } + if (syntaxList.getChildCount() > 0) { + var bodyError = this.areOnSameLine(openingCurlyBrace, syntaxList); + if (bodyError) { + this.addFailure(this.createFailure(syntaxList.getStart(), syntaxList.getWidth(), Rule.FAILURE_STRING.body)); + } + var nodeBeforeClosingBracket = syntaxList.getChildren()[syntaxList.getChildren().length - 1]; + var closingBracketError = this.areOnSameLine(nodeBeforeClosingBracket, closingCurlyBrace); + if (closingBracketError) { + this.addFailure(this.createFailure(closingCurlyBrace.getStart(), closingCurlyBrace.getWidth(), Rule.FAILURE_STRING.closeSingle)); + } + } + }; + BraceStyleWalker.prototype.areOnSameLine = function (node, nextNode) { + return this.getEndPosition(node).line === this.getStartPosition(nextNode).line; + }; + BraceStyleWalker.prototype.getStartPosition = function (node) { + return node.getSourceFile().getLineAndCharacterOfPosition(node.getStart()); + }; + BraceStyleWalker.prototype.getEndPosition = function (node) { + return node.getSourceFile().getLineAndCharacterOfPosition(node.getEnd()); + }; + BraceStyleWalker.prototype.getPreviousNode = function (children, node) { + var position = children.indexOf(node) - 1; + while (position >= 0) { + if (children[position].kind === ts.SyntaxKind.Block || children[position].kind === ts.SyntaxKind.CatchClause) { + break; + } + position -= 1; + } + return children[position]; + }; + return BraceStyleWalker; +}(Lint.RuleWalker)); + +//# sourceMappingURL=data:application/json;charset=utf8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInJ1bGVzL2JyYWNlU3R5bGVSdWxlLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7OztBQUFBLCtCQUFpQztBQUNqQyw2QkFBK0I7QUFFL0IsSUFBTSxXQUFXLEdBQUcsTUFBTSxDQUFDO0FBQzNCLElBQU0sYUFBYSxHQUFHLFFBQVEsQ0FBQztBQUMvQixJQUFNLGlCQUFpQixHQUFHLFlBQVksQ0FBQztBQUV2QyxJQUFLLFVBSUo7QUFKRCxXQUFLLFVBQV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xDQUFDLENBQUM7SUFDM0UsQ0FBQztJQUdPLDBDQUFlLEdBQXZCLFVBQXdCLFFBQW1CLEVBQUUsSUFBYTtRQUN4RCxJQUFJLFFBQVEsR0FBRyxRQUFRLENBQUMsT0FBTyxDQUFDLElBQUksQ0FBQyxHQUFHLENBQUMsQ0FBQztRQUMxQyxPQUFPLFFBQVEsSUFBSSxDQUFDLEVBQUU7WUFDcEIsSUFBSSxRQUFRLENBQUMsUUFBUSxDQUFDLENBQUMsSUFBSSxLQUFLLEVBQUUsQ0FBQyxVQUFVLENBQUMsS0FBSyxJQUFJLFFBQVEsQ0FBQyxRQUFRLENBQUMsQ0FBQyxJQUFJLEtBQUssRUFBRSxDQUFDLFVBQVUsQ0FBQyxXQUFXLEVBQUU7Z0JBQzVHLE1BQU07YUFDUDtZQUNELFFBQVEsSUFBSSxDQUFDLENBQUM7U0FDZjtRQUNELE9BQU8sUUFBUSxDQUFDLFFBQVEsQ0FBQyxDQUFDO0lBQzVCLENBQUM7SUFFSCx1QkFBQztBQUFELENBbEpBLEFBa0pDLENBbEo4QixJQUFJLENBQUMsVUFBVSxHQWtKN0MiLCJmaWxlIjoicnVsZXMvYnJhY2VTdHlsZVJ1bGUuanMiLCJzb3VyY2VSb290IjoiL1VzZXJzL2ptbG9wZXovdHNsaW50LWVzbGludC1ydWxlcy9zcmMifQ== diff --git a/node_modules/tslint-eslint-rules/dist/rules/handleCallbackErrRule.js b/node_modules/tslint-eslint-rules/dist/rules/handleCallbackErrRule.js new file mode 100644 index 000000000..0c73c5011 --- /dev/null +++ b/node_modules/tslint-eslint-rules/dist/rules/handleCallbackErrRule.js @@ -0,0 +1,155 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +var tslib_1 = require("tslib"); +var ts = require("typescript"); +var Lint = require("tslint"); +var RULE_NAME = 'handle-callback-err'; +var Rule = (function (_super) { + tslib_1.__extends(Rule, _super); + function Rule() { + return _super !== null && _super.apply(this, arguments) || this; + } + Rule.prototype.apply = function (sourceFile) { + return this.applyWithWalker(new ErrCallbackHandlerWalker(sourceFile, this.getOptions())); + }; + Rule.metadata = { + ruleName: RULE_NAME, + description: 'enforce error handling in callbacks', + rationale: Lint.Utils.dedent(templateObject_1 || (templateObject_1 = tslib_1.__makeTemplateObject(["\n In Node.js, a common pattern for dealing with asynchronous behavior is called the callback\n pattern. This pattern expects an Error object or null as the first argument of the callback.\n Forgetting to handle these errors can lead to some really strange behavior in your\n application.\n "], ["\n In Node.js, a common pattern for dealing with asynchronous behavior is called the callback\n pattern. This pattern expects an Error object or null as the first argument of the callback.\n Forgetting to handle these errors can lead to some really strange behavior in your\n application.\n "]))), + optionsDescription: Lint.Utils.dedent(templateObject_2 || (templateObject_2 = tslib_1.__makeTemplateObject(["\n The rule takes a string option: the name of the error parameter. The default is\n `\"err\"`.\n\n Sometimes the name of the error variable is not consistent across the project, so you need a\n more flexible configuration to ensure that the rule reports all unhandled errors.\n\n If the configured name of the error variable begins with a `^` it is considered to be a\n regexp pattern.\n\n - If the option is `\"^(err|error|anySpecificError)$\"`, the rule reports unhandled errors\n where the parameter name can be `err`, `error` or `anySpecificError`.\n - If the option is `\"^.+Error$\"`, the rule reports unhandled errors where the parameter\n name ends with `Error` (for example, `connectionError` or `validationError` will\n match).\n - If the option is `\"^.*(e|E)rr\"`, the rule reports unhandled errors where the parameter\n name matches any string that contains `err` or `Err` (for example, `err`, `error`,\n `anyError`, `some_err` will match).\n\n In addition to the string we may specify an options object with the following property:\n\n - `allowProperties`: (`true` by default) When this is set to `false` the rule will not\n report unhandled errors as long as the error object is handled without accessing any of its\n properties at least once. For instance, `(err) => console.log(err.stack)` would report an\n issue when `allowProperties` is set to `false` because `err` is not handled on its\n own.\n "], ["\n The rule takes a string option: the name of the error parameter. The default is\n \\`\"err\"\\`.\n\n Sometimes the name of the error variable is not consistent across the project, so you need a\n more flexible configuration to ensure that the rule reports all unhandled errors.\n\n If the configured name of the error variable begins with a \\`^\\` it is considered to be a\n regexp pattern.\n\n - If the option is \\`\"^(err|error|anySpecificError)$\"\\`, the rule reports unhandled errors\n where the parameter name can be \\`err\\`, \\`error\\` or \\`anySpecificError\\`.\n - If the option is \\`\"^.+Error$\"\\`, the rule reports unhandled errors where the parameter\n name ends with \\`Error\\` (for example, \\`connectionError\\` or \\`validationError\\` will\n match).\n - If the option is \\`\"^.*(e|E)rr\"\\`, the rule reports unhandled errors where the parameter\n name matches any string that contains \\`err\\` or \\`Err\\` (for example, \\`err\\`, \\`error\\`,\n \\`anyError\\`, \\`some_err\\` will match).\n\n In addition to the string we may specify an options object with the following property:\n\n - \\`allowProperties\\`: (\\`true\\` by default) When this is set to \\`false\\` the rule will not\n report unhandled errors as long as the error object is handled without accessing any of its\n properties at least once. For instance, \\`(err) => console.log(err.stack)\\` would report an\n issue when \\`allowProperties\\` is set to \\`false\\` because \\`err\\` is not handled on its\n own.\n "]))), + options: { + type: 'array', + items: [{ + type: 'string' + }, { + type: 'object', + properties: { + allowProperties: 'boolean' + }, + additionalProperties: false + }], + minLength: 0, + maxLength: 2 + }, + optionExamples: [ + Lint.Utils.dedent(templateObject_3 || (templateObject_3 = tslib_1.__makeTemplateObject(["\n \"", "\": [true, \"error\"]\n "], ["\n \"", "\": [true, \"error\"]\n "])), RULE_NAME), + Lint.Utils.dedent(templateObject_4 || (templateObject_4 = tslib_1.__makeTemplateObject(["\n \"", "\": [true, \"^(err|error|anySpecificError)$\"]\n "], ["\n \"", "\": [true, \"^(err|error|anySpecificError)$\"]\n "])), RULE_NAME), + Lint.Utils.dedent(templateObject_5 || (templateObject_5 = tslib_1.__makeTemplateObject(["\n \"", "\": [true, { \"allowProperties\": false }]\n "], ["\n \"", "\": [true, { \"allowProperties\": false }]\n "])), RULE_NAME), + Lint.Utils.dedent(templateObject_6 || (templateObject_6 = tslib_1.__makeTemplateObject(["\n \"", "\": [true, \"^(err|error|anySpecificError)$\", { \"allowProperties\": false }]\n "], ["\n \"", "\": [true, \"^(err|error|anySpecificError)$\", { \"allowProperties\": false }]\n "])), RULE_NAME) + ], + typescriptOnly: false, + type: 'maintainability' + }; + return Rule; +}(Lint.Rules.AbstractRule)); +exports.Rule = Rule; +var ErrCallbackHandlerWalker = (function (_super) { + tslib_1.__extends(ErrCallbackHandlerWalker, _super); + function ErrCallbackHandlerWalker(sourceFile, options) { + var _this = _super.call(this, sourceFile, options) || this; + _this.stack = []; + _this.allowProperties = true; + var opt = _this.getOptions(); + var errorArgument = 'err'; + var optObj = opt[0]; + if (typeof opt[0] === 'string') { + errorArgument = opt[0]; + optObj = opt[1]; + } + if (optObj) { + _this.allowProperties = optObj.allowProperties !== false; + } + if (errorArgument.charAt(0) === '^') { + _this.errorCheck = RegExp.prototype.test.bind(new RegExp(errorArgument)); + } + else { + _this.errorCheck = (function (name) { return name === errorArgument; }); + } + _this.firstParameterName = function (node) { + var param = node.parameters[0]; + return param ? param.name.getText(sourceFile) : undefined; + }; + return _this; + } + ErrCallbackHandlerWalker.prototype.enterScope = function (firstParamName) { + this.stack.push({ + firstParamName: firstParamName, + hasFirstParam: false + }); + }; + ErrCallbackHandlerWalker.prototype.exitScope = function () { + return this.stack.pop(); + }; + ErrCallbackHandlerWalker.prototype.visitSourceFile = function (node) { + this.stack = []; + _super.prototype.visitSourceFile.call(this, node); + }; + ErrCallbackHandlerWalker.prototype.visitFunctionDeclaration = function (node) { + this.enterScope(this.firstParameterName(node)); + _super.prototype.visitFunctionDeclaration.call(this, node); + this.exitFunction(node); + }; + ErrCallbackHandlerWalker.prototype.visitFunctionExpression = function (node) { + this.enterScope(this.firstParameterName(node)); + _super.prototype.visitFunctionExpression.call(this, node); + this.exitFunction(node); + }; + ErrCallbackHandlerWalker.prototype.visitArrowFunction = function (node) { + this.enterScope(this.firstParameterName(node)); + _super.prototype.visitArrowFunction.call(this, node); + this.exitFunction(node); + }; + ErrCallbackHandlerWalker.prototype.visitCatchClause = function (node) { + this.enterScope(node.variableDeclaration ? node.variableDeclaration.name.getText() : undefined); + _super.prototype.visitCatchClause.call(this, node); + this.exitScope(); + }; + ErrCallbackHandlerWalker.prototype.exitFunction = function (node) { + var scopeInfo = this.exitScope(); + var param = scopeInfo.firstParamName; + if (param && this.errorCheck(param) && !scopeInfo.hasFirstParam) { + var name = node.parameters[0].name; + var strictMsg = !this.allowProperties ? ' without property access at least once' : ''; + var msg = "Expected error to be handled" + strictMsg; + var failure = this.createFailure(name.getStart(this.getSourceFile()), name.getWidth(this.getSourceFile()), msg); + this.addFailure(failure); + } + }; + ErrCallbackHandlerWalker.prototype.isPropAccess = function (node) { + return node.kind === ts.SyntaxKind.PropertyAccessExpression; + }; + ErrCallbackHandlerWalker.prototype.visitNode = function (node) { + if (this.stack.length > 0 && + node.kind === ts.SyntaxKind.Identifier && + node.parent && + node.parent.kind !== ts.SyntaxKind.Parameter) { + var doCheck = false; + var inPropertyAccess = this.isPropAccess(node.parent); + if (!this.allowProperties) { + doCheck = !inPropertyAccess; + } + else if (inPropertyAccess) { + doCheck = node.parent.expression === node; + } + else { + doCheck = true; + } + if (doCheck) { + var text = node.text; + var i = this.stack.length; + while (i--) { + var info = this.stack[i]; + if (text === info.firstParamName) { + info.hasFirstParam = true; + break; + } + } + } + } + _super.prototype.visitNode.call(this, node); + }; + return ErrCallbackHandlerWalker; +}(Lint.RuleWalker)); +var templateObject_1, templateObject_2, templateObject_3, templateObject_4, templateObject_5, templateObject_6; + +//# sourceMappingURL=data:application/json;charset=utf8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInJ1bGVzL2hhbmRsZUNhbGxiYWNrRXJyUnVsZS50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7QUFBQSwrQkFBaUM7QUFDakMsNkJBQStCO0FBRS9CLElBQU0sU0FBUyxHQUFHLHFCQUFxQixDQUFDO0FBRXhDO0lBQTBCLGdDQUF1QjtJQUFqRDs7SUF3RUEsQ0FBQztJQUhRLG9CQUFLLEdBQVosVUFBYSxVQUF5QjtRQUNwQyxPQUFPLElBQUksQ0FBQyxl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ules/tslint-eslint-rules/dist/rules/noConstantConditionRule.js new file mode 100644 index 000000000..1fcd19441 --- /dev/null +++ b/node_modules/tslint-eslint-rules/dist/rules/noConstantConditionRule.js @@ -0,0 +1,116 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +var tslib_1 = require("tslib"); +var ts = require("typescript"); +var Lint = require("tslint"); +var token_1 = require("../support/token"); +var RULE_NAME = 'no-constant-condition'; +var Rule = (function (_super) { + tslib_1.__extends(Rule, _super); + function Rule() { + return _super !== null && _super.apply(this, arguments) || this; + } + Rule.prototype.apply = function (sourceFile) { + var walker = new NoConstantConditionWalker(sourceFile, this.getOptions()); + return this.applyWithWalker(walker); + }; + Rule.FAILURE_STRING = 'unexpected constant condition'; + Rule.metadata = { + ruleName: RULE_NAME, + description: 'disallow use of constant expressions in conditions (recommended)', + rationale: Lint.Utils.dedent(templateObject_1 || (templateObject_1 = tslib_1.__makeTemplateObject(["\n A constant expression (for example, a literal) as a test condition might be a typo or\n development trigger for a specific behavior. For example, the following code looks as if it is\n not ready for production.\n "], ["\n A constant expression (for example, a literal) as a test condition might be a typo or\n development trigger for a specific behavior. For example, the following code looks as if it is\n not ready for production.\n "]))), + optionsDescription: Lint.Utils.dedent(templateObject_2 || (templateObject_2 = tslib_1.__makeTemplateObject(["\n - `\"checkLoops\"` Setting this option to `false` allows constant expressions in loops (default: `true`).\n "], ["\n - \\`\"checkLoops\"\\` Setting this option to \\`false\\` allows constant expressions in loops (default: \\`true\\`).\n "]))), + options: { + type: 'object', + properties: { + checkLoops: { + type: 'boolean' + } + }, + additionalProperties: false + }, + optionExamples: [ + Lint.Utils.dedent(templateObject_3 || (templateObject_3 = tslib_1.__makeTemplateObject(["\n \"", "\": true\n "], ["\n \"", "\": true\n "])), RULE_NAME), + Lint.Utils.dedent(templateObject_4 || (templateObject_4 = tslib_1.__makeTemplateObject(["\n \"", "\": [true, { \"checkLoops\": false }]\n "], ["\n \"", "\": [true, { \"checkLoops\": false }]\n "])), RULE_NAME) + ], + typescriptOnly: false, + type: 'functionality' + }; + return Rule; +}(Lint.Rules.AbstractRule)); +exports.Rule = Rule; +var NoConstantConditionWalker = (function (_super) { + tslib_1.__extends(NoConstantConditionWalker, _super); + function NoConstantConditionWalker(sourceFile, options) { + var _this = _super.call(this, sourceFile, options) || this; + _this.checkLoops = true; + var opts = _this.getOptions(); + if (opts.length && opts[0].checkLoops === false) { + _this.checkLoops = false; + } + return _this; + } + NoConstantConditionWalker.prototype.visitIfStatement = function (node) { + this.validateCondition(node.expression); + _super.prototype.visitIfStatement.call(this, node); + }; + NoConstantConditionWalker.prototype.visitWhileStatement = function (node) { + if (this.checkLoops) { + this.validateCondition(node.expression); + } + _super.prototype.visitWhileStatement.call(this, node); + }; + NoConstantConditionWalker.prototype.visitDoStatement = function (node) { + if (this.checkLoops) { + this.validateCondition(node.expression); + } + _super.prototype.visitDoStatement.call(this, node); + }; + NoConstantConditionWalker.prototype.visitForStatement = function (node) { + if (this.checkLoops && node.condition) { + this.validateCondition(node.condition); + } + _super.prototype.visitForStatement.call(this, node); + }; + NoConstantConditionWalker.prototype.visitConditionalExpression = function (node) { + this.validateCondition(node.condition); + _super.prototype.visitConditionalExpression.call(this, node); + }; + NoConstantConditionWalker.prototype.validateCondition = function (expression) { + if (this.isConstant(expression)) { + this.addFailure(this.createFailure(expression.getStart(), expression.getWidth(), Rule.FAILURE_STRING)); + } + this.walkChildren(expression); + }; + NoConstantConditionWalker.prototype.isConstant = function (node) { + switch (node.kind) { + case ts.SyntaxKind.StringLiteral: + case ts.SyntaxKind.NumericLiteral: + case ts.SyntaxKind.TrueKeyword: + case ts.SyntaxKind.FalseKeyword: + case ts.SyntaxKind.ArrowFunction: + case ts.SyntaxKind.FunctionExpression: + case ts.SyntaxKind.ObjectLiteralExpression: + case ts.SyntaxKind.ArrayLiteralExpression: + return true; + case ts.SyntaxKind.PostfixUnaryExpression: + return this.isConstant(node.operand); + case ts.SyntaxKind.BinaryExpression: + if (token_1.isAssignmentToken(node.operatorToken)) { + return this.isConstant(node.right); + } + return this.isConstant(node.left) && this.isConstant(node.right); + case ts.SyntaxKind.ConditionalExpression: + return this.isConstant(node.condition); + case ts.SyntaxKind.PrefixUnaryExpression: + return this.isConstant(node.operand); + case ts.SyntaxKind.ParenthesizedExpression: + return this.isConstant(node.expression); + } + return false; + }; + return NoConstantConditionWalker; +}(Lint.RuleWalker)); +var templateObject_1, templateObject_2, templateObject_3, templateObject_4; + +//# sourceMappingURL=data:application/json;charset=utf8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInJ1bGVzL25vQ29uc3RhbnRDb25kaXRpb25SdWxlLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7OztBQUFBLCtCQUFpQztBQUNqQyw2QkFBK0I7QUFDL0IsMENBQXFEO0FBRXJELElBQU0sU0FBUyxHQUFHLHVCQUF1QixDQUFDO0FBRTFDO0lBQTBCLGdDQUF1QjtJQUFqRDs7SUF1Q0EsQ0FBQztJQUpRLG9CQUFLLEdBQVosVUFBYSxVQUF5QjtRQUNwQyxJQUFNLE1BQU0sR0FBRyxJQUFJLHlCQUF5QixDQUFDLFVBQVUsRUFBRSxJQUFJLENBQUMsVUFBVSxFQUFFLENBQUMsQ0FBQztRQUM1RSxPQUFPLElBQUksQ0FBQyxlQUFlLENBQUMsTUFBTSxDQUFDLENBQUM7SUFDdEMsQ0FBQztJQXJDYSxtQkFBYyxHQUFHLCtCQUErQixDQUFDO0lBRWpELGFBQVEsR0FBdUI7UUFDM0MsUUFBUSxFQUFFLFNBQVM7UUFDbkIsV0FBVyxFQUFFLGtFQUFrRTtRQUMvRSxTQUFTLEVBQUUsSUFBSSxDQUFDLEtBQUssQ0FBQyxNQUFNLHlUQUFBLDhPQUl6QixJQUFBO1FBQ0gsa0JBQWtCLEVBQUUsSUFBSSxDQUFDLEtBQUssQ0FBQyxNQUFNLHNNQUFBLHVJQUVsQyxJQUFBO1FBQ0gsT0FBTyxFQUFFO1lBQ1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QixDQUFDLEtBQUssQ0FBQyxDQUFDO2lCQUM3RDtnQkFDRCxPQUFPLElBQUksQ0FBQyxVQUFVLENBQUUsSUFBNEIsQ0FBQyxJQUFJLENBQUMsSUFBSSxJQUFJLENBQUMsVUFBVSxDQUFFLElBQTRCLENBQUMsS0FBSyxDQUFDLENBQUM7WUFDckgsS0FBSyxFQUFFLENBQUMsVUFBVSxDQUFDLHFCQUFxQjtnQkFDdEMsT0FBTyxJQUFJLENBQUMsVUFBVSxDQUFFLElBQWlDLENBQUMsU0FBUyxDQUFDLENBQUM7WUFDdkUsS0FBSyxFQUFFLENBQUMsVUFBVSxDQUFDLHFCQUFxQjtnQkFDdEMsT0FBTyxJQUFJLENBQUMsVUFBVSxDQUFFLElBQWlDLENBQUMsT0FBTyxDQUFDLENBQUM7WUFDckUsS0FBSyxFQUFFLENBQUMsVUFBVSxDQUFDLHVCQUF1QjtnQkFDeEMsT0FBTyxJQUFJLENBQUMsVUFBVSxDQUFFLElBQW1DLENBQUMsVUFBVSxDQUFDLENBQUM7U0FDM0U7UUFFRCxPQUFPLEtBQUssQ0FBQztJQUNmLENBQUM7SUFDSCxnQ0FBQztBQUFELENBeEZBLEFBd0ZDLENBeEZ1QyxJQUFJLENBQUMsVUFBVSxHQXdGdEQiLCJmaWxlIjoicnVsZXMvbm9Db25zdGFudENvbmRpdGlvblJ1bGUuanMiLCJzb3VyY2VSb290IjoiL1VzZXJzL2ptbG9wZXovdHNsaW50LWVzbGludC1ydWxlcy9zcmMifQ== diff --git a/node_modules/tslint-eslint-rules/dist/rules/noControlRegexRule.js b/node_modules/tslint-eslint-rules/dist/rules/noControlRegexRule.js new file mode 100644 index 000000000..60ed867da --- /dev/null +++ b/node_modules/tslint-eslint-rules/dist/rules/noControlRegexRule.js @@ -0,0 +1,53 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +var tslib_1 = require("tslib"); +var ts = require("typescript"); +var Lint = require("tslint"); +var Rule = (function (_super) { + tslib_1.__extends(Rule, _super); + function Rule() { + return _super !== null && _super.apply(this, arguments) || this; + } + Rule.prototype.apply = function (sourceFile) { + var walker = new NoControlRegexWalker(sourceFile, this.getOptions()); + return this.applyWithWalker(walker); + }; + Rule.FAILURE_STRING = 'unexpected control character in regular expression'; + return Rule; +}(Lint.Rules.AbstractRule)); +exports.Rule = Rule; +var NoControlRegexWalker = (function (_super) { + tslib_1.__extends(NoControlRegexWalker, _super); + function NoControlRegexWalker() { + return _super !== null && _super.apply(this, arguments) || this; + } + NoControlRegexWalker.prototype.visitRegularExpressionLiteral = function (node) { + this.validateControlRegex(node); + _super.prototype.visitRegularExpressionLiteral.call(this, node); + }; + NoControlRegexWalker.prototype.visitNewExpression = function (node) { + if (node.expression.getText() === 'RegExp') { + this.visitRegularExpressionFunction(node); + } + _super.prototype.visitNewExpression.call(this, node); + }; + NoControlRegexWalker.prototype.visitCallExpression = function (node) { + if (node.expression.getText() === 'RegExp') { + this.visitRegularExpressionFunction(node); + } + _super.prototype.visitCallExpression.call(this, node); + }; + NoControlRegexWalker.prototype.visitRegularExpressionFunction = function (node) { + if (node.arguments && node.arguments.length > 0 && node.arguments[0].kind === ts.SyntaxKind.StringLiteral) { + this.validateControlRegex(node.arguments[0]); + } + }; + NoControlRegexWalker.prototype.validateControlRegex = function (node) { + if (/[\x00-\x1f]/.test(node.text)) { + this.addFailure(this.createFailure(node.getStart(), node.getWidth(), Rule.FAILURE_STRING)); + } + }; + return NoControlRegexWalker; +}(Lint.RuleWalker)); + +//# sourceMappingURL=data:application/json;charset=utf8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInJ1bGVzL25vQ29udHJvbFJlZ2V4UnVsZS50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7QUFBQSwrQkFBaUM7QUFDakMsNkJBQStCO0FBRS9CO0lBQTBCLGdDQUF1QjtJQUFqRDs7SUFPQSxDQUFDO0lBSlEsb0JBQUssR0FBWixVQUFhLFVBQXlCO1FBQ3BD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SxJQUFJLElBQUksQ0FBQyxTQUFTLElBQUksSUFBSSxDQUFDLFNBQVMsQ0FBQyxNQUFNLEdBQUcsQ0FBQyxJQUFJLElBQUksQ0FBQyxTQUFTLENBQUMsQ0FBQyxDQUFDLENBQUMsSUFBSSxLQUFLLEVBQUUsQ0FBQyxVQUFVLENBQUMsYUFBYSxFQUFFO1lBQ3pHLElBQUksQ0FBQyxvQkFBb0IsQ0FBQyxJQUFJLENBQUMsU0FBUyxDQUFDLENBQUMsQ0FBcUIsQ0FBQyxDQUFDO1NBQ2xFO0lBQ0gsQ0FBQztJQUVPLG1EQUFvQixHQUE1QixVQUE2QixJQUEwQjtRQUNyRCxJQUFJLGFBQWEsQ0FBQyxJQUFJLENBQUMsSUFBSSxDQUFDLElBQUksQ0FBQyxFQUFFO1lBQ2pDLElBQUksQ0FBQyxVQUFVLENBQUMsSUFBSSxDQUFDLGFBQWEsQ0FBQyxJQUFJLENBQUMsUUFBUSxFQUFFLEVBQUUsSUFBSSxDQUFDLFFBQVEsRUFBRSxFQUFFLElBQUksQ0FBQyxjQUFjLENBQUMsQ0FBQyxDQUFDO1NBQzVGO0lBQ0gsQ0FBQztJQUNILDJCQUFDO0FBQUQsQ0EvQkEsQUErQkMsQ0EvQmtDLElBQUksQ0FBQyxVQUFVLEdBK0JqRCIsImZpbGUiOiJydWxlcy9ub0NvbnRyb2xSZWdleFJ1bGUuanMiLCJzb3VyY2VSb290IjoiL1VzZXJzL2ptbG9wZXovdHNsaW50LWVzbGludC1ydWxlcy9zcmMifQ== diff --git a/node_modules/tslint-eslint-rules/dist/rules/noDuplicateCaseRule.js b/node_modules/tslint-eslint-rules/dist/rules/noDuplicateCaseRule.js new file mode 100644 index 000000000..e9aa2f5f5 --- /dev/null +++ b/node_modules/tslint-eslint-rules/dist/rules/noDuplicateCaseRule.js @@ -0,0 +1,46 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +var tslib_1 = require("tslib"); +var ts = require("typescript"); +var Lint = require("tslint"); +var Rule = (function (_super) { + tslib_1.__extends(Rule, _super); + function Rule() { + return _super !== null && _super.apply(this, arguments) || this; + } + Rule.prototype.apply = function (sourceFile) { + var walker = new NoDuplicateCaseWalker(sourceFile, this.getOptions()); + return this.applyWithWalker(walker); + }; + Rule.FAILURE_STRING = 'duplicate case label'; + return Rule; +}(Lint.Rules.AbstractRule)); +exports.Rule = Rule; +var NoDuplicateCaseWalker = (function (_super) { + tslib_1.__extends(NoDuplicateCaseWalker, _super); + function NoDuplicateCaseWalker() { + return _super !== null && _super.apply(this, arguments) || this; + } + NoDuplicateCaseWalker.prototype.visitSwitchStatement = function (node) { + this.validateNoDupeCase(node); + _super.prototype.visitSwitchStatement.call(this, node); + }; + NoDuplicateCaseWalker.prototype.validateNoDupeCase = function (node) { + var _this = this; + var cases = Object.create(null); + node.caseBlock.clauses.forEach(function (clause) { + if (clause.kind === ts.SyntaxKind.CaseClause) { + var key = clause.getText(); + if (cases[key]) { + _this.addFailure(_this.createFailure(node.getStart(), node.getWidth(), Rule.FAILURE_STRING)); + } + else { + cases[key] = clause; + } + } + }); + }; + return NoDuplicateCaseWalker; +}(Lint.RuleWalker)); + +//# sourceMappingURL=data:application/json;charset=utf8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInJ1bGVzL25vRHVwbGljYXRlQ2FzZVJ1bGUudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7O0FBQUEsK0JBQWlDO0FBQ2pDLDZCQUErQjtBQUUvQjtJQUEwQixnQ0FBdUI7SUFBakQ7O0lBT0EsQ0FBQztJQUpRLG9CQUFLLEdBQVosVUFBYSxVQUF5QjtRQUNwQyxJQUFNLE1BQU0sR0FBRyxJQUFJLHFCQUFxQixDQUFDLFVBQVUsRUFBRSxJQUFJLENBQUMsVUFBVSxFQUFFLENBQUMsQ0FBQztRQUN4RSxPQUFPLElBQUksQ0FBQyxlQUFlLENBQUMsTUFBTSxDQUFDLENBQUM7SUFDdEMsQ0F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SCw0QkFBQztBQUFELENBckJBLEFBcUJDLENBckJtQyxJQUFJLENBQUMsVUFBVSxHQXFCbEQiLCJmaWxlIjoicnVsZXMvbm9EdXBsaWNhdGVDYXNlUnVsZS5qcyIsInNvdXJjZVJvb3QiOiIvVXNlcnMvam1sb3Blei90c2xpbnQtZXNsaW50LXJ1bGVzL3NyYyJ9 diff --git a/node_modules/tslint-eslint-rules/dist/rules/noEmptyCharacterClassRule.js b/node_modules/tslint-eslint-rules/dist/rules/noEmptyCharacterClassRule.js new file mode 100644 index 000000000..3fbeae63d --- /dev/null +++ b/node_modules/tslint-eslint-rules/dist/rules/noEmptyCharacterClassRule.js @@ -0,0 +1,35 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +var tslib_1 = require("tslib"); +var Lint = require("tslint"); +var Rule = (function (_super) { + tslib_1.__extends(Rule, _super); + function Rule() { + return _super !== null && _super.apply(this, arguments) || this; + } + Rule.prototype.apply = function (sourceFile) { + var walker = new NoEmptyCharacterClassWalker(sourceFile, this.getOptions()); + return this.applyWithWalker(walker); + }; + Rule.FAILURE_STRING = "don't use empty classes in regular expressions"; + return Rule; +}(Lint.Rules.AbstractRule)); +exports.Rule = Rule; +var NoEmptyCharacterClassWalker = (function (_super) { + tslib_1.__extends(NoEmptyCharacterClassWalker, _super); + function NoEmptyCharacterClassWalker() { + return _super !== null && _super.apply(this, arguments) || this; + } + NoEmptyCharacterClassWalker.prototype.visitRegularExpressionLiteral = function (node) { + this.validateEmptyCharacterClass(node); + _super.prototype.visitRegularExpressionLiteral.call(this, node); + }; + NoEmptyCharacterClassWalker.prototype.validateEmptyCharacterClass = function (node) { + if (!(/^\/([^\\[]|\\.|\[([^\\\]]|\\.)+\])*\/[gim]*$/.test(node.text))) { + this.addFailure(this.createFailure(node.getStart(), node.getWidth(), Rule.FAILURE_STRING)); + } + }; + return NoEmptyCharacterClassWalker; +}(Lint.RuleWalker)); + +//# sourceMappingURL=data:application/json;charset=utf8;base64,eyJ2ZX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QUM7SUFDSCxrQ0FBQztBQUFELENBWEEsQUFXQyxDQVh5QyxJQUFJLENBQUMsVUFBVSxHQVd4RCIsImZpbGUiOiJydWxlcy9ub0VtcHR5Q2hhcmFjdGVyQ2xhc3NSdWxlLmpzIiwic291cmNlUm9vdCI6Ii9Vc2Vycy9qbWxvcGV6L3RzbGludC1lc2xpbnQtcnVsZXMvc3JjIn0= diff --git a/node_modules/tslint-eslint-rules/dist/rules/noExAssignRule.js b/node_modules/tslint-eslint-rules/dist/rules/noExAssignRule.js new file mode 100644 index 000000000..d297c0452 --- /dev/null +++ b/node_modules/tslint-eslint-rules/dist/rules/noExAssignRule.js @@ -0,0 +1,57 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +var tslib_1 = require("tslib"); +var ts = require("typescript"); +var Lint = require("tslint"); +var token_1 = require("../support/token"); +var Rule = (function (_super) { + tslib_1.__extends(Rule, _super); + function Rule() { + return _super !== null && _super.apply(this, arguments) || this; + } + Rule.prototype.apply = function (sourceFile) { + var walker = new NoExAssignWalker(sourceFile, this.getOptions()); + return this.applyWithWalker(walker); + }; + Rule.FAILURE_STRING = 'do not assign to the exception parameter'; + return Rule; +}(Lint.Rules.AbstractRule)); +exports.Rule = Rule; +var NoExAssignWalker = (function (_super) { + tslib_1.__extends(NoExAssignWalker, _super); + function NoExAssignWalker() { + var _this = _super !== null && _super.apply(this, arguments) || this; + _this.isInCatchClause = false; + return _this; + } + NoExAssignWalker.prototype.visitCatchClause = function (node) { + this.variableNode = node.variableDeclaration; + this.isInCatchClause = true; + _super.prototype.visitCatchClause.call(this, node); + this.isInCatchClause = false; + delete this.variableNode; + }; + NoExAssignWalker.prototype.visitBinaryExpression = function (node) { + var _this = this; + if (this.isInCatchClause) { + if (!token_1.isAssignmentToken(node.operatorToken)) { + return; + } + if (this.variableNode && + this.variableNode.name.getText() === node.left.getText() && + node.left.kind === ts.SyntaxKind.Identifier) { + this.addFailure(this.createFailure(node.getStart(), node.getWidth(), Rule.FAILURE_STRING)); + } + else if (node.left.kind === ts.SyntaxKind.ArrayLiteralExpression) { + var els = node.left.elements; + if (els.some(function (el) { return !!_this.variableNode && el.getText() === _this.variableNode.getText(); })) { + this.addFailure(this.createFailure(node.getStart(), node.getWidth(), Rule.FAILURE_STRING)); + } + } + } + _super.prototype.visitBinaryExpression.call(this, node); + }; + return NoExAssignWalker; +}(Lint.RuleWalker)); + +//# sourceMappingURL=data:application/json;charset=utf8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInJ1bGVzL25vRXhBc3NpZ25SdWxlLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7OztBQUFBLCtCQUFpQztBQUNqQyw2QkFBK0I7QUFDL0IsMENBQXFEO0FBRXJEO0lBQTBCLGdDQUF1QjtJQUFqRDs7SUFPQSxDQUFDO0lBSlEsb0JBQUssR0FBWixVQUFhLFVBQXlCO1FBQ3BDLElBQU0sTUFBTSxHQUFHLElBQUksZ0JBQWdCLENBQUMsVUFBVSxFQUFFLElBQUksQ0FBQyxVQUFVLEVBQUUsQ0FBQyxDQUFDO1FBQ25FLE9BQU8sSUFBSSxDQUFDLGVBQWUsQ0FBQyxNQUFNLENBQUMsQ0FBQztJQUN0QyxDQUFDO0lBTGEsbUJBQWMsR0FBRywwQ0FBMEMsQ0FBQztJQU01RSxXQUFDO0NBUEQsQUFPQyxDQVB5QixJQUFJLENBQUMsS0FBSyxDQUFDLFlBQVksR0FPaEQ7QUFQWSxvQkFBSTtBQVNqQjtJQUErQiw0Q0FBZTtJQUE5QztRQUFBLHFFQWlDQztRQWhDUyxxQkFBZSxHQUFHLEtBQUssQ0FBQzs7SUFnQ2xDLENBQUM7SUE3QlcsMkNBQWdCLEdBQTFCLFVBQTJCLElBQW9CO1FBQzdDLElBQUksQ0FBQyxZQUFZLEdBQUcsSUFBSSxDQUFDLG1CQUFtQixDQUFDO1FBQzdDLElBQUksQ0FBQyxlQUFlLEdBQUcsSUFBSSxDQUFDO1FBQz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BRSxLQUFLLEtBQUksQ0FBQyxZQUFZLENBQUMsT0FBTyxFQUFFLEVBQW5FLENBQW1FLENBQUMsRUFBRTtvQkFDdkYsSUFBSSxDQUFDLFVBQVUsQ0FBQyxJQUFJLENBQUMsYUFBYSxDQUFDLElBQUksQ0FBQyxRQUFRLEVBQUUsRUFBRSxJQUFJLENBQUMsUUFBUSxFQUFFLEVBQUUsSUFBSSxDQUFDLGNBQWMsQ0FBQyxDQUFDLENBQUM7aUJBQzVGO2FBQ0Y7U0FDRjtRQUNELGlCQUFNLHFCQUFxQixZQUFDLElBQUksQ0FBQyxDQUFDO0lBQ3BDLENBQUM7SUFDSCx1QkFBQztBQUFELENBakNBLEFBaUNDLENBakM4QixJQUFJLENBQUMsVUFBVSxHQWlDN0MiLCJmaWxlIjoicnVsZXMvbm9FeEFzc2lnblJ1bGUuanMiLCJzb3VyY2VSb290IjoiL1VzZXJzL2ptbG9wZXovdHNsaW50LWVzbGludC1ydWxlcy9zcmMifQ== diff --git a/node_modules/tslint-eslint-rules/dist/rules/noExtraBooleanCastRule.js b/node_modules/tslint-eslint-rules/dist/rules/noExtraBooleanCastRule.js new file mode 100644 index 000000000..272286d6a --- /dev/null +++ b/node_modules/tslint-eslint-rules/dist/rules/noExtraBooleanCastRule.js @@ -0,0 +1,83 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +var tslib_1 = require("tslib"); +var ts = require("typescript"); +var Lint = require("tslint"); +var Rule = (function (_super) { + tslib_1.__extends(Rule, _super); + function Rule() { + return _super !== null && _super.apply(this, arguments) || this; + } + Rule.prototype.apply = function (sourceFile) { + var walker = new NoExtraBooleanCastWalker(sourceFile, this.getOptions()); + return this.applyWithWalker(walker); + }; + Rule.FAILURE_STRING = { + if: 'redundant double negation in an if statement condition', + do: 'redundant double negation in a do while loop condition', + while: 'redundant double negation in a while loop condition', + ternaryif: 'redundant double negation in a ternary condition', + for: 'redundant double negation in a for loop condition', + unaryCast: 'redundant multiple negation', + objectCast: 'redundant double negation in call to Boolean()', + newCast: 'redundant double negation in Boolean constructor call' + }; + return Rule; +}(Lint.Rules.AbstractRule)); +exports.Rule = Rule; +var NoExtraBooleanCastWalker = (function (_super) { + tslib_1.__extends(NoExtraBooleanCastWalker, _super); + function NoExtraBooleanCastWalker() { + return _super !== null && _super.apply(this, arguments) || this; + } + NoExtraBooleanCastWalker.prototype.visitPrefixUnaryExpression = function (node) { + this.validateNoExtraBoolean(node); + _super.prototype.visitPrefixUnaryExpression.call(this, node); + }; + NoExtraBooleanCastWalker.prototype.validateNoExtraBoolean = function (node) { + if (!node.parent || !node.parent.parent) { + return; + } + var parent = node.parent; + var grandparent = parent.parent; + if (node.operator !== ts.SyntaxKind.ExclamationToken || + parent.kind !== ts.SyntaxKind.PrefixUnaryExpression || + parent.operator !== ts.SyntaxKind.ExclamationToken || + !grandparent) { + return; + } + if (grandparent.kind === ts.SyntaxKind.BinaryExpression) { + grandparent = grandparent.parent; + } + if (!grandparent) { + return; + } + if (grandparent.kind === ts.SyntaxKind.IfStatement) { + this.addFailure(this.createFailure(node.getStart(), node.getWidth(), Rule.FAILURE_STRING.if)); + } + else if (grandparent.kind === ts.SyntaxKind.DoStatement) { + this.addFailure(this.createFailure(node.getStart(), node.getWidth(), Rule.FAILURE_STRING.do)); + } + else if (grandparent.kind === ts.SyntaxKind.WhileStatement) { + this.addFailure(this.createFailure(node.getStart(), node.getWidth(), Rule.FAILURE_STRING.while)); + } + else if (grandparent.kind === ts.SyntaxKind.ConditionalExpression && parent === grandparent.condition) { + this.addFailure(this.createFailure(node.getStart(), node.getWidth(), Rule.FAILURE_STRING.ternaryif)); + } + else if (grandparent.kind === ts.SyntaxKind.ForStatement && parent === grandparent.condition) { + this.addFailure(this.createFailure(node.getStart(), node.getWidth(), Rule.FAILURE_STRING.for)); + } + else if (grandparent.kind === ts.SyntaxKind.PrefixUnaryExpression && grandparent.operator === ts.SyntaxKind.ExclamationToken) { + this.addFailure(this.createFailure(node.getStart(), node.getWidth(), Rule.FAILURE_STRING.unaryCast)); + } + else if (grandparent.kind === ts.SyntaxKind.CallExpression && /^Boolean/.test(grandparent.getText())) { + this.addFailure(this.createFailure(node.getStart(), node.getWidth(), Rule.FAILURE_STRING.objectCast)); + } + else if (grandparent.kind === ts.SyntaxKind.NewExpression && /^new Boolean/.test(grandparent.getText())) { + this.addFailure(this.createFailure(node.getStart(), node.getWidth(), Rule.FAILURE_STRING.newCast)); + } + }; + return NoExtraBooleanCastWalker; +}(Lint.RuleWalker)); + +//# sourceMappingURL=data:application/json;charset=utf8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInJ1bGVzL25vRXh0cmFCb29sZWFuQ2FzdFJ1bGUudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7O0FBQUEsK0JBQWlDO0FBQ2pDLDZCQUErQjtBQUUvQjtJQUEwQixnQ0FBdUI7SUFBakQ7O0lBZ0JBLENBQUM7SUFKUSxvQkFBSyxHQUFaLFVBQWEsVUFBeUI7UUFDcEMsSUFBTSxNQUFNLEdBQUcsSUFBSSx3QkFBd0IsQ0FBQyxVQUFVLEVBQUUsSUFBSSxDQUFDLFVBQVUsRUFBRSxDQUFDLENBQUM7UUFDM0UsT0FBTyxJQUFJLENBQUMsZUFBZSxDQUFDLE1BQU0sQ0FBQyxDQUFDO0lBQ3RDLENBQUM7SUFkYSxtQkFBYyxHQUFHO1FBQzdCLEVBQUUsRUFBRSx3REFBd0Q7UUFDNUQsRUFBRSxFQUFFLHdEQUF3RDtRQUM1RCxLQUFLLEVBQUUscURBQXFEO1FBQzVELFNBQVMsRUFBRSxrREFBa0Q7UUFDN0QsR0FBRyxFQUFFLG1EQUFtRDtRQUN4RCxTQUFTLEVBQUUsNkJBQTZCO1FBQ3hDLFVBQVUsRUFBRSxnREFBZ0Q7UUFDNUQsT0FBTyxFQUFFLHVEQUF1RDtLQUNqRSxDQUFDO0lBTUosV0FBQztDQWhCRCxBQWdCQyxDQWhCeUIsSUFBSSx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UFLLEVBQUUsQ0FBQyxVQUFVLENBQUMsYUFBYSxJQUFJLGNBQWMsQ0FBQyxJQUFJLENBQUMsV0FBVyxDQUFDLE9BQU8sRUFBRSxDQUFDLEVBQUU7WUFDekcsSUFBSSxDQUFDLFVBQVUsQ0FBQyxJQUFJLENBQUMsYUFBYSxDQUFDLElBQUksQ0FBQyxRQUFRLEVBQUUsRUFBRSxJQUFJLENBQUMsUUFBUSxFQUFFLEVBQUUsSUFBSSxDQUFDLGNBQWMsQ0FBQyxPQUFPLENBQUMsQ0FBQyxDQUFDO1NBQ3BHO0lBQ0gsQ0FBQztJQUNILCtCQUFDO0FBQUQsQ0FwREEsQUFvREMsQ0FwRHNDLElBQUksQ0FBQyxVQUFVLEdBb0RyRCIsImZpbGUiOiJydWxlcy9ub0V4dHJhQm9vbGVhbkNhc3RSdWxlLmpzIiwic291cmNlUm9vdCI6Ii9Vc2Vycy9qbWxvcGV6L3RzbGludC1lc2xpbnQtcnVsZXMvc3JjIn0= diff --git a/node_modules/tslint-eslint-rules/dist/rules/noExtraSemiRule.js b/node_modules/tslint-eslint-rules/dist/rules/noExtraSemiRule.js new file mode 100644 index 000000000..e0ab5c0c3 --- /dev/null +++ b/node_modules/tslint-eslint-rules/dist/rules/noExtraSemiRule.js @@ -0,0 +1,69 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +var tslib_1 = require("tslib"); +var ts = require("typescript"); +var Lint = require("tslint"); +var Rule = (function (_super) { + tslib_1.__extends(Rule, _super); + function Rule() { + return _super !== null && _super.apply(this, arguments) || this; + } + Rule.prototype.apply = function (sourceFile) { + var walker = new NoExtraSemiWalker(sourceFile, this.getOptions()); + return this.applyWithWalker(walker); + }; + Rule.FAILURE_STRING = 'unnecessary semicolon'; + return Rule; +}(Lint.Rules.AbstractRule)); +exports.Rule = Rule; +var NoExtraSemiWalker = (function (_super) { + tslib_1.__extends(NoExtraSemiWalker, _super); + function NoExtraSemiWalker() { + var _this = _super !== null && _super.apply(this, arguments) || this; + _this.ALLOWED_PARENT_TYPES = [ + ts.SyntaxKind.ForStatement, + ts.SyntaxKind.ForInStatement, + ts.SyntaxKind.ForOfStatement, + ts.SyntaxKind.WhileStatement, + ts.SyntaxKind.DoStatement + ]; + return _this; + } + NoExtraSemiWalker.prototype.visitNode = function (node) { + if (node.kind === ts.SyntaxKind.EmptyStatement) { + this.visitEmptyStatement(node); + } + _super.prototype.visitNode.call(this, node); + }; + NoExtraSemiWalker.prototype.visitClassDeclaration = function (node) { + this.checkClass(node); + _super.prototype.visitClassDeclaration.call(this, node); + }; + NoExtraSemiWalker.prototype.visitEmptyStatement = function (node) { + if (node.parent && this.ALLOWED_PARENT_TYPES.indexOf(node.parent.kind) === -1) { + this.validateNoExtraSemi(node); + } + }; + NoExtraSemiWalker.prototype.checkClass = function (node) { + var indexOf = node.getChildren().map(function (child) { return child.kind; }).indexOf(ts.SyntaxKind.FirstPunctuation); + var children = node.getChildren().slice(indexOf); + this.checkClassChildren(children); + }; + NoExtraSemiWalker.prototype.checkClassChildren = function (children) { + for (var _i = 0, children_1 = children; _i < children_1.length; _i++) { + var child = children_1[_i]; + if ((child.kind === ts.SyntaxKind.SyntaxList || child.kind === ts.SyntaxKind.SemicolonClassElement) && child.getText() === ';') { + this.validateNoExtraSemi(child); + } + else if (child.kind === ts.SyntaxKind.SyntaxList && child.getText().indexOf(';') !== -1) { + this.checkClassChildren(child.getChildren()); + } + } + }; + NoExtraSemiWalker.prototype.validateNoExtraSemi = function (node) { + this.addFailure(this.createFailure(node.getStart(), node.getWidth(), Rule.FAILURE_STRING)); + }; + return NoExtraSemiWalker; +}(Lint.RuleWalker)); + +//# sourceMappingURL=data:application/json;charset=utf8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInJ1bGVzL25vRXh0cmFTZW1pUnVsZS50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7QUFBQSwrQkFBaUM7QUFDakMsNkJBQStCO0FBRS9CO0lBQTBC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QU8sRUFBRSxLQUFLLEdBQUcsRUFBRTtnQkFDOUgsSUFBSSxDQUFDLG1CQUFtQixDQUFDLEtBQUssQ0FBQyxDQUFDO2FBQ2pDO2lCQUNJLElBQUksS0FBSyxDQUFDLElBQUksS0FBSyxFQUFFLENBQUMsVUFBVSxDQUFDLFVBQVUsSUFBSSxLQUFLLENBQUMsT0FBTyxFQUFFLENBQUMsT0FBTyxDQUFDLEdBQUcsQ0FBQyxLQUFLLENBQUMsQ0FBQyxFQUFFO2dCQUN2RixJQUFJLENBQUMsa0JBQWtCLENBQUMsS0FBSyxDQUFDLFdBQVcsRUFBRSxDQUFDLENBQUM7YUFDOUM7U0FDRjtJQUNILENBQUM7SUFFTywrQ0FBbUIsR0FBM0IsVUFBNEIsSUFBYTtRQUN2QyxJQUFJLENBQUMsVUFBVSxDQUFDLElBQUksQ0FBQyxhQUFhLENBQUMsSUFBSSxDQUFDLFFBQVEsRUFBRSxFQUFFLElBQUksQ0FBQyxRQUFRLEVBQUUsRUFBRSxJQUFJLENBQUMsY0FBYyxDQUFDLENBQUMsQ0FBQztJQUM3RixDQUFDO0lBQ0gsd0JBQUM7QUFBRCxDQWhEQSxBQWdEQyxDQWhEK0IsSUFBSSxDQUFDLFVBQVUsR0FnRDlDIiwiZmlsZSI6InJ1bGVzL25vRXh0cmFTZW1pUnVsZS5qcyIsInNvdXJjZVJvb3QiOiIvVXNlcnMvam1sb3Blei90c2xpbnQtZXNsaW50LXJ1bGVzL3NyYyJ9 diff --git a/node_modules/tslint-eslint-rules/dist/rules/noInnerDeclarationsRule.js b/node_modules/tslint-eslint-rules/dist/rules/noInnerDeclarationsRule.js new file mode 100644 index 000000000..e745e4a2f --- /dev/null +++ b/node_modules/tslint-eslint-rules/dist/rules/noInnerDeclarationsRule.js @@ -0,0 +1,67 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +var tslib_1 = require("tslib"); +var ts = require("typescript"); +var Lint = require("tslint"); +var Rule = (function (_super) { + tslib_1.__extends(Rule, _super); + function Rule() { + return _super !== null && _super.apply(this, arguments) || this; + } + Rule.prototype.apply = function (sourceFile) { + var walker = new NoInnerDeclarationsWalker(sourceFile, this.getOptions()); + return this.applyWithWalker(walker); + }; + return Rule; +}(Lint.Rules.AbstractRule)); +exports.Rule = Rule; +var NoInnerDeclarationsWalker = (function (_super) { + tslib_1.__extends(NoInnerDeclarationsWalker, _super); + function NoInnerDeclarationsWalker() { + var _this = _super !== null && _super.apply(this, arguments) || this; + _this.VALID_PARENT_TYPES = [ + ts.SyntaxKind.SourceFile, + ts.SyntaxKind.FunctionDeclaration, + ts.SyntaxKind.FunctionExpression, + ts.SyntaxKind.ArrowFunction, + ts.SyntaxKind.MethodDeclaration, + ts.SyntaxKind.ModuleDeclaration, + ts.SyntaxKind.Constructor + ]; + return _this; + } + NoInnerDeclarationsWalker.prototype.visitFunctionDeclaration = function (node) { + this.validateInnerDeclaration(node); + _super.prototype.visitFunctionDeclaration.call(this, node); + }; + NoInnerDeclarationsWalker.prototype.visitVariableStatement = function (node) { + if (this.hasOption('both') && node.declarationList.getFirstToken().kind === ts.SyntaxKind.VarKeyword) { + this.validateInnerDeclaration(node); + } + _super.prototype.visitVariableStatement.call(this, node); + }; + NoInnerDeclarationsWalker.prototype.validateInnerDeclaration = function (node) { + var body = this.nearestBody(node); + var isValid = (body.isSourceFile && body.distance === 1) || body.distance === 2; + if (!isValid) { + var decl = node.kind === ts.SyntaxKind.FunctionDeclaration ? 'function' : 'variable'; + var root = body.isSourceFile ? 'program' : 'function body'; + this.addFailure(this.createFailure(node.getStart(), node.getWidth(), "move " + decl + " declaration to " + root + " root")); + } + }; + NoInnerDeclarationsWalker.prototype.nearestBody = function (node) { + var ancestor = node.parent; + var generation = 1; + while (ancestor && this.VALID_PARENT_TYPES.indexOf(ancestor.kind) === -1) { + generation++; + ancestor = ancestor.parent; + } + return { + isSourceFile: (ancestor && ancestor.kind === ts.SyntaxKind.SourceFile) || !ancestor, + distance: generation + }; + }; + return N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RUFBRSxFQUFFLElBQUksQ0FBQyxRQUFRLEVBQUUsRUFBRSxVQUFRLElBQUksd0JBQW1CLElBQUksVUFBTyxDQUFDLENBQUMsQ0FBQztTQUNuSDtJQUNILENBQUM7SUFFTywrQ0FBVyxHQUFuQixVQUFvQixJQUFhO1FBQy9CLElBQUksUUFBUSxHQUFHLElBQUksQ0FBQyxNQUFNLENBQUM7UUFDM0IsSUFBSSxVQUFVLEdBQUcsQ0FBQyxDQUFDO1FBRW5CLE9BQU8sUUFBUSxJQUFJLElBQUksQ0FBQyxrQkFBa0IsQ0FBQyxPQUFPLENBQUMsUUFBUSxDQUFDLElBQUksQ0FBQyxLQUFLLENBQUMsQ0FBQyxFQUFFO1lBQ3hFLFVBQVUsRUFBRSxDQUFDO1lBQ2IsUUFBUSxHQUFHLFFBQVEsQ0FBQyxNQUFNLENBQUM7U0FDNUI7UUFFRCxPQUFPO1lBQ0wsWUFBWSxFQUFFLENBQUMsUUFBUSxJQUFJLFFBQVEsQ0FBQyxJQUFJLEtBQUssRUFBRSxDQUFDLFVBQVUsQ0FBQyxVQUFVLENBQUMsSUFBSSxDQUFDLFFBQVE7WUFDbkYsUUFBUSxFQUFFLFVBQVU7U0FDckIsQ0FBQztJQUNKLENBQUM7SUFDSCxnQ0FBQztBQUFELENBbkRBLEFBbURDLENBbkR1QyxJQUFJLENBQUMsVUFBVSxHQW1EdEQiLCJmaWxlIjoicnVsZXMvbm9Jbm5lckRlY2xhcmF0aW9uc1J1bGUuanMiLCJzb3VyY2VSb290IjoiL1VzZXJzL2ptbG9wZXovdHNsaW50LWVzbGludC1ydWxlcy9zcmMifQ== diff --git a/node_modules/tslint-eslint-rules/dist/rules/noInvalidRegexpRule.js b/node_modules/tslint-eslint-rules/dist/rules/noInvalidRegexpRule.js new file mode 100644 index 000000000..72a4a4348 --- /dev/null +++ b/node_modules/tslint-eslint-rules/dist/rules/noInvalidRegexpRule.js @@ -0,0 +1,49 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +var tslib_1 = require("tslib"); +var ts = require("typescript"); +var Lint = require("tslint"); +var Rule = (function (_super) { + tslib_1.__extends(Rule, _super); + function Rule() { + return _super !== null && _super.apply(this, arguments) || this; + } + Rule.prototype.apply = function (sourceFile) { + var walker = new NoInvalidRegexpWalker(sourceFile, this.getOptions()); + return this.applyWithWalker(walker); + }; + return Rule; +}(Lint.Rules.AbstractRule)); +exports.Rule = Rule; +var NoInvalidRegexpWalker = (function (_super) { + tslib_1.__extends(NoInvalidRegexpWalker, _super); + function NoInvalidRegexpWalker() { + return _super !== null && _super.apply(this, arguments) || this; + } + NoInvalidRegexpWalker.prototype.visitNewExpression = function (node) { + this.validateInvalidRegExp(node); + _super.prototype.visitNewExpression.call(this, node); + }; + NoInvalidRegexpWalker.prototype.visitCallExpression = function (node) { + this.validateInvalidRegExp(node); + _super.prototype.visitCallExpression.call(this, node); + }; + NoInvalidRegexpWalker.prototype.validateInvalidRegExp = function (node) { + if (node.expression.getText() === 'RegExp') { + var args = node.arguments; + if (args && args.length > 0 && args[0].kind === ts.SyntaxKind.StringLiteral) { + var expr = args[0].text; + var flags = args.length > 1 && args[1].kind === ts.SyntaxKind.StringLiteral ? args[1].text : undefined; + try { + new RegExp(expr, flags); + } + catch (e) { + this.addFailure(this.createFailure(node.getStart(), node.getWidth(), e.message)); + } + } + } + }; + return NoInvalidRegexpWalker; +}(Lint.RuleWalker)); + +//# sourceMappingURL=data:application/json;charset=utf8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInJ1bGVzL25vSW52YWxpZFJlZ2V4cFJ1bGUudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7O0FBQUEsK0JBQWlDO0FBQ2pDLDZCQUErQjtBQUUvQjtJQUEwQixnQ0FBdUI7SUFBakQ7O0lBS0EsQ0FBQztJQUpRLG9CQUFLLEdBQVosVUFBYSxVQUF5QjtRQUNwQyxJQUFNLE1BQU0sR0FBRyxJQUFJLHFCQUFxQixD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BQU0sR0FBRyxDQUFDLElBQUksSUFBSSxDQUFDLENBQUMsQ0FBQyxDQUFDLElBQUksS0FBSyxFQUFFLENBQUMsVUFBVSxDQUFDLGFBQWEsQ0FBQyxDQUFDLENBQUUsSUFBSSxDQUFDLENBQUMsQ0FBc0IsQ0FBQyxJQUFJLENBQUMsQ0FBQyxDQUFDLFNBQVMsQ0FBQztnQkFFL0gsSUFBSTtvQkFFRixJQUFJLE1BQU0sQ0FBQyxJQUFJLEVBQUUsS0FBSyxDQUFDLENBQUM7aUJBQ3pCO2dCQUNELE9BQU8sQ0FBQyxFQUFFO29CQUNSLElBQUksQ0FBQyxVQUFVLENBQUMsSUFBSSxDQUFDLGFBQWEsQ0FBQyxJQUFJLENBQUMsUUFBUSxFQUFFLEVBQUUsSUFBSSxDQUFDLFFBQVEsRUFBRSxFQUFFLENBQUMsQ0FBQyxPQUFPLENBQUMsQ0FBQyxDQUFDO2lCQUNsRjthQUNGO1NBQ0Y7SUFDSCxDQUFDO0lBQ0gsNEJBQUM7QUFBRCxDQTVCQSxBQTRCQyxDQTVCbUMsSUFBSSxDQUFDLFVBQVUsR0E0QmxEIiwiZmlsZSI6InJ1bGVzL25vSW52YWxpZFJlZ2V4cFJ1bGUuanMiLCJzb3VyY2VSb290IjoiL1VzZXJzL2ptbG9wZXovdHNsaW50LWVzbGludC1ydWxlcy9zcmMifQ== diff --git a/node_modules/tslint-eslint-rules/dist/rules/noMultiSpacesRule.js b/node_modules/tslint-eslint-rules/dist/rules/noMultiSpacesRule.js new file mode 100644 index 000000000..281ece00b --- /dev/null +++ b/node_modules/tslint-eslint-rules/dist/rules/noMultiSpacesRule.js @@ -0,0 +1,119 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +var tslib_1 = require("tslib"); +var ts = require("typescript"); +var Lint = require("tslint"); +var Rule = (function (_super) { + tslib_1.__extends(Rule, _super); + function Rule() { + return _super !== null && _super.apply(this, arguments) || this; + } + Rule.prototype.apply = function (sourceFile) { + var walker = new NoMultiSpacesWalker(sourceFile, this.getOptions()); + return this.applyWithWalker(walker); + }; + return Rule; +}(Lint.Rules.AbstractRule)); +exports.Rule = Rule; +var NoMultiSpacesWalker = (function (_super) { + tslib_1.__extends(NoMultiSpacesWalker, _super); + function NoMultiSpacesWalker(sourceFile, options) { + var _a; + var _this = _super.call(this, sourceFile, options) || this; + _this.EXCEPTION_MAP = (_a = {}, + _a[ts.SyntaxKind.VariableDeclaration] = 'VariableDeclaration', + _a[ts.SyntaxKind.PropertyAssignment] = 'PropertyAssignment', + _a[ts.SyntaxKind.BinaryExpression] = 'BinaryExpression', + _a); + _this.STRING_TYPES = [ + ts.SyntaxKind.NoSubstitutionTemplateLiteral, + ts.SyntaxKind.LastTemplateToken, + ts.SyntaxKind.StringLiteral + ]; + _this.exceptions = {}; + _this.targets = []; + _this.targetNode = {}; + _this.targetIndex = 0; + var opt = _this.getOptions(); + _this.src = sourceFile.getFullText(); + if (opt.length) { + _this.exceptions = opt[0].exceptions || {}; + } + if (_this.exceptions['PropertyAssignment'] === undefined) { + _this.exceptions['PropertyAssignment'] = true; + } + var pattern = /[^\n\r\u2028\u2029\t ].? {2,}/g; + while (pattern.test(_this.src)) { + _this.targets.push(pattern.lastIndex); + _this.targetNode[pattern.lastIndex] = sourceFile; + } + _this.lastNode = sourceFile.getLastToken(); + return _this; + } + NoMultiSpacesWalker.prototype.inRange = function (x, range) { + return x >= range[0] && x <= range[1]; + }; + NoMultiSpacesWalker.prototype.warn = function (value, pos, node) { + var msg = "Multiple spaces found before '" + value + "'."; + var exceptionName = this.EXCEPTION_MAP[node.parent.kind]; + var report = true; + var start = node.getFullStart() - 1; + var previousChar = this.src.substring(start, start + 1); + if (exceptionName && this.exceptions[exceptionName]) { + if (previousChar !== ',') { + report = false; + } + } + if (previousChar === ':') { + var crt = node.parent; + while (crt.kind !== ts.SyntaxKind.SourceFile) { + crt = crt.parent; + if (crt.kind === ts.SyntaxKind.PropertyAssignment) { + if (this.exceptions['PropertyAssignment']) { + report = false; + } + break; + } + } + } + if (report) { + this.addFailure(this.createFailure(pos, value.length, msg)); + } + }; + NoMultiSpacesWalker.prototype.walkChildren = function (node) { + var _this = this; + var range = [node.getStart(), node.getEnd()]; + for (var i = this.targetIndex, len = this.targets.length, target = void 0; i < len; i++) { + target = this.targets[i]; + if (this.inRange(target, range)) { + this.targetNode[target] = node; + } + if (range[0] > this.targets[this.targetIndex]) { + this.targetIndex++; + } + } + if (node === this.lastNode) { + this.targets.forEach(function (target) { + var valid = _this.targetNode[target]; + if (target === valid.getStart()) { + _this.warn(valid.getText(), target, valid); + } + else if (target === valid.getEnd() - 1 && _this.STRING_TYPES.indexOf(valid.kind) === -1) { + var endChar = _this.src.substring(target, valid.getEnd()); + _this.warn(endChar, target, valid); + } + else { + if (_this.src.charAt(target) !== '\n' && valid.kind !== ts.SyntaxKind.SourceFile) { + } + } + }); + } + var children = node.getChildren(); + for (var index in children) { + this.visitNode(children[index]); + } + }; + return NoMultiSpacesWalker; +}(Lint.RuleWalker)); + +//# sourceMappingURL=data:application/json;charset=utf8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInJ1bGVzL25vTXVsdGlTcGFjZXNSdWxlLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7OztBQUFBLCtCQUFpQztBQUNqQyw2QkFBK0I7QUFFL0I7SUFBMEIsZ0NBQXVCO0lBQWpEOztJQUtBLENBQUM7SUFKUSxvQkFBSyxHQUFaLFVBQWEsVUFBeUI7UUFDcEMsSUFBTSxNQUFNLEdBQUcsSUFBSSxtQkFBbUIsQ0FBQyxVQUFVLEVBQUUsSUFBSSxDQUFDLFVBQVUsRUFBRSxDQUFDLENBQUM7UUFDdEUsT0FBTyxJQUFJLENBQUMsZUFBZSxDQUFDLE1BQU0sQ0FBQyxDQUFDO0lBQ3RDLENBQUM7SUFDSCxXQUFDO0FBQUQsQ0FMQSxBQUtDLENBTHlCLElBQUksQ0FBQyxLQUFLLENBQUMsWU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yxLQUFJLENBQUMsR0FBRyxDQUFDLFNBQVMsQ0FBQyxNQUFNLEVBQUUsS0FBSyxDQUFDLE1BQU0sRUFBRSxDQUFDLENBQUM7b0JBQzNELEtBQUksQ0FBQyxJQUFJLENBQUMsT0FBTyxFQUFFLE1BQU0sRUFBRSxLQUFLLENBQUMsQ0FBQztpQkFDbkM7cUJBQU07b0JBQ0wsSUFBSSxLQUFJLENBQUMsR0FBRyxDQUFDLE1BQU0sQ0FBQyxNQUFNLENBQUMsS0FBSyxJQUFJLElBQUksS0FBSyxDQUFDLElBQUksS0FBSyxFQUFFLENBQUMsVUFBVSxDQUFDLFVBQVUsRUFBRTtxQkFLaEY7aUJBQ0Y7WUFDSCxDQUFDLENBQUMsQ0FBQztTQUNKO1FBRUQsSUFBTSxRQUFRLEdBQWMsSUFBSSxDQUFDLFdBQVcsRUFBRSxDQUFDO1FBQy9DLEtBQUssSUFBSSxLQUFLLElBQUksUUFBUSxFQUFFO1lBQzFCLElBQUksQ0FBQyxTQUFTLENBQUMsUUFBUSxDQUFDLEtBQUssQ0FBQyxDQUFDLENBQUM7U0FDakM7SUFDSCxDQUFDO0lBQ0gsMEJBQUM7QUFBRCxDQXRIQSxBQXNIQyxDQXRIaUMsSUFBSSxDQUFDLFVBQVUsR0FzSGhEIiwiZmlsZSI6InJ1bGVzL25vTXVsdGlTcGFjZXNSdWxlLmpzIiwic291cmNlUm9vdCI6Ii9Vc2Vycy9qbWxvcGV6L3RzbGludC1lc2xpbnQtcnVsZXMvc3JjIn0= diff --git a/node_modules/tslint-eslint-rules/dist/rules/noRegexSpacesRule.js b/node_modules/tslint-eslint-rules/dist/rules/noRegexSpacesRule.js new file mode 100644 index 000000000..c069b7778 --- /dev/null +++ b/node_modules/tslint-eslint-rules/dist/rules/noRegexSpacesRule.js @@ -0,0 +1,35 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +var tslib_1 = require("tslib"); +var Lint = require("tslint"); +var Rule = (function (_super) { + tslib_1.__extends(Rule, _super); + function Rule() { + return _super !== null && _super.apply(this, arguments) || this; + } + Rule.prototype.apply = function (sourceFile) { + var walker = new NoRegexSpacesWalker(sourceFile, this.getOptions()); + return this.applyWithWalker(walker); + }; + return Rule; +}(Lint.Rules.AbstractRule)); +exports.Rule = Rule; +var NoRegexSpacesWalker = (function (_super) { + tslib_1.__extends(NoRegexSpacesWalker, _super); + function NoRegexSpacesWalker() { + return _super !== null && _super.apply(this, arguments) || this; + } + NoRegexSpacesWalker.prototype.visitRegularExpressionLiteral = function (node) { + this.validateMultipleSpaces(node); + _super.prototype.visitRegularExpressionLiteral.call(this, node); + }; + NoRegexSpacesWalker.prototype.validateMultipleSpaces = function (node) { + var res = /( {2,})+?/.exec(node.text); + if (res) { + this.addFailure(this.createFailure(node.getStart(), node.getWidth(), "spaces are hard to count - use {" + res[0].length + "}")); + } + }; + return NoRegexSpacesWalker; +}(Lint.RuleWalker)); + +//# sourceMappingURL=data:application/json;charset=utf8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInJ1bGVzL25vUmVnZXhTcGFjZXNSdWxlLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7OztBQUNBLDZCQUErQjtBQUUvQjtJQUEwQixnQ0FBdUI7SUFBakQ7O0lBS0EsQ0FBQztJQUpRLG9CQUFLLEdBQVosVUFBYSxVQUF5QjtRQUNwQyxJQUFNLE1BQU0sR0FBRyxJQUFJLG1CQUFtQixDQUFDLFVBQVUsRUFBRSxJQUFJLENBQUMsVUFBVSxFQUFFLENBQUMsQ0FBQztRQUN0RSxPQUFPLElBQUksQ0FBQyxlQUFlLENBQUMsTUFBTSxDQUFDLENBQUM7SUFDdEMsQ0FBQztJQUNILFdBQUM7QUFBRCxDQUxBLEFBS0MsQ0FMeUIsSUFBSSxDQUFDLEtBQUssQ0FBQyxZQUFZLEdBS2hEO0FBTFksb0JBQUk7QUFPakI7SUFBa0MsK0NBQWU7SUFBakQ7O0lBWUEsQ0FBQztJQVhXLDJEQUE2QixHQUF2QyxVQUF3QyxJQUEwQjtRQUNoRSxJQUFJLENBQUMsc0JBQXNCLENBQUMsSUFBSSxDQUFDLENBQUM7UUFDbEMsaUJBQU0sNkJBQTZCLFlBQUMsSUFBSSxDQUFDLENBQUM7SUFDNUMsQ0FBQztJQUVPLG9EQUFzQixHQUE5QixVQUErQixJQUEwQjtRQUN2RCxJQUFNLEdBQUcsR0FBRyxXQUFXLENBQUMsSUFBSSxDQUFDLElBQUksQ0FBQyxJQUFJLENBQUMsQ0FBQztRQUN4QyxJQUFJLEdBQUcsRUFBRTtZQUNQLElBQUksQ0FBQyxVQUFVLENBQUMsSUFBSSxDQUFDLGFBQWEsQ0FBQyxJQUFJLENBQUMsUUFBUSxFQUFFLEVBQUUsSUFBSSxDQUFDLFFBQVEsRUFBRSxFQUFFLHFDQUFtQyxHQUFHLENBQUMsQ0FBQyxDQUFDLENBQUMsTUFBTSxNQUFHLENBQUMsQ0FBQyxDQUFDO1NBQzVIO0lBQ0gsQ0FBQztJQUNILDBCQUFDO0FBQUQsQ0FaQSxBQVlDLENBWmlDLElBQUksQ0FBQyxVQUFVLEdBWWhEIiwiZmlsZSI6InJ1bGVzL25vUmVnZXhTcGFjZXNSdWxlLmpzIiwic291cmNlUm9vdCI6Ii9Vc2Vycy9qbWxvcGV6L3RzbGludC1lc2xpbnQtcnVsZXMvc3JjIn0= diff --git a/node_modules/tslint-eslint-rules/dist/rules/noUnexpectedMultilineRule.js b/node_modules/tslint-eslint-rules/dist/rules/noUnexpectedMultilineRule.js new file mode 100644 index 000000000..aa743442c --- /dev/null +++ b/node_modules/tslint-eslint-rules/dist/rules/noUnexpectedMultilineRule.js @@ -0,0 +1,91 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +var tslib_1 = require("tslib"); +var ts = require("typescript"); +var Lint = require("tslint"); +var Rule = (function (_super) { + tslib_1.__extends(Rule, _super); + function Rule() { + return _super !== null && _super.apply(this, arguments) || this; + } + Rule.prototype.apply = function (sourceFile) { + var walker = new NoUnexpectedMultilineWalker(sourceFile, this.getOptions()); + return this.applyWithWalker(walker); + }; + Rule.FAILURE_STRING = { + func: 'unexpected newline between function and ( of function call', + prop: 'unexpected newline between object and [ of property access', + template: 'unexpected newline between template tag and template literal' + }; + return Rule; +}(Lint.Rules.AbstractRule)); +exports.Rule = Rule; +var NoUnexpectedMultilineWalker = (function (_super) { + tslib_1.__extends(NoUnexpectedMultilineWalker, _super); + function NoUnexpectedMultilineWalker() { + return _super !== null && _super.apply(this, arguments) || this; + } + NoUnexpectedMultilineWalker.prototype.visitCallExpression = function (node) { + var firstLeftParen = node.getChildren().filter(function (ch) { return ch.kind === ts.SyntaxKind.OpenParenToken; })[0]; + if (this.isBreakBefore(firstLeftParen)) { + this.addFailure(this.createFailure(node.getStart(), node.getWidth(), this.getMessage(node))); + } + _super.prototype.visitCallExpression.call(this, node); + }; + NoUnexpectedMultilineWalker.prototype.visitElementAccessExpression = function (node) { + var firstLeftSquareBracket = node.getChildren().filter(function (ch) { return ch.kind === ts.SyntaxKind.OpenBracketToken; })[0]; + if (this.isBreakBefore(firstLeftSquareBracket)) { + this.addFailure(this.createFailure(node.getStart(), node.getWidth(), this.getMessage(node))); + } + _super.prototype.visitElementAccessExpression.call(this, node); + }; + NoUnexpectedMultilineWalker.prototype.visitNode = function (node) { + if (node.kind === ts.SyntaxKind.TaggedTemplateExpression) { + var children = node.getChildren(); + var tag = children.filter(function (ch) { return ch.kind === ts.SyntaxKind.Identifier; })[0]; + var tagIndex = children.indexOf(tag); + if (tag && children[tagIndex + 1]) { + var template = children[tagIndex + 1]; + if (this.isBreakBefore(template)) { + this.addFailure(this.createFailure(node.getStart(), node.getWidth(), this.getMessage(node))); + } + } + } + _super.prototype.visitNode.call(this, node); + }; + NoUnexpectedMultilineWalker.prototype.isBreakBefore = function (node) { + if (node.parent) { + var children = node.parent.getChildren(); + var nodeIndex = children.indexOf(node); + if (nodeIndex > 0) { + var nodeLine = this.getStartPosition(node).line; + var previousNodeLine = this.getEndPosition(children[nodeIndex - 1]).line; + if (nodeLine !== previousNodeLine) { + return true; + } + } + } + return false; + }; + NoUnexpectedMultilineWalker.prototype.getMessage = function (node) { + switch (node.kind) { + case ts.SyntaxKind.CallExpression: + return Rule.FAILURE_STRING.func; + case ts.SyntaxKind.ElementAccessExpression: + return Rule.FAILURE_STRING.prop; + case ts.SyntaxKind.TaggedTemplateExpression: + return Rule.FAILURE_STRING.template; + default: + throw 'Unexpected node type: ' + ts.SyntaxKind[node.kind]; + } + }; + NoUnexpectedMultilineWalker.prototype.getStartPosition = function (node) { + return node.getSourceFile().getLineAndCharacterOfPosition(node.getStart()); + }; + NoUnexpectedMultilineWalker.prototype.getEndPosition = function (node) { + return node.getSourceFile().getLineAndCharacterOfPosition(node.getEnd()); + }; + return NoUnexpectedMultilineWalker; +}(Lint.RuleWalker)); + +//# sourceMappingURL=data:application/json;charset=utf8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInJ1bGVzL25vVW5leHBlY3RlZE11bHRpbGluZVJ1bGUudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7O0FBQUEsK0JBQWlDO0FBQ2pDLDZCQUErQjtBQUUvQjtJQUEwQixnQ0FBdUI7SUFBakQ7O0lBV0EsQ0FBQztJQUpRLG9CQUFLLEdBQVosVUFBYSxVQUF5QjtRQUNwQyxJQUFNLE1BQU0sR0FBRyxJQUFJLDJCQUEyQixDQUFDLFVBQVUsRUFBRSxJQUFJLENBQUMsVUFBVSxFQUFFLENBQUMsQ0FBQztRQUM5RSxPQUFPLElBQUksQ0FBQyxlQUFlLENBQUMsTUFBTSxDQUFDLENBQUM7SUFDdEMsQ0FBQztJQVRhLG1CQUFjLEdBQUc7UUFDN0IsSUFBSSxFQUFFLDREQUE0RDtRQUNsRSxJQUFJLEVBQUUsNERBQTREO1FBQ2xFLFFBQVEsRUFBRSw4REFBOEQ7S0FDekUsQ0FBQztJQU1KLFdBQUM7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UM7WUFDbEMsS0FBSyxFQUFFLENBQUMsVUFBVSxDQUFDLHdCQUF3QjtnQkFDekMsT0FBTyxJQUFJLENBQUMsY0FBYyxDQUFDLFFBQVEsQ0FBQztZQUN0QztnQkFDRSxNQUFNLHdCQUF3QixHQUFHLEVBQUUsQ0FBQyxVQUFVLENBQUMsSUFBSSxDQUFDLElBQUksQ0FBQyxDQUFDO1NBQzdEO0lBQ0gsQ0FBQztJQUVPLHNEQUFnQixHQUF4QixVQUF5QixJQUFhO1FBQ3BDLE9BQU8sSUFBSSxDQUFDLGFBQWEsRUFBRSxDQUFDLDZCQUE2QixDQUFDLElBQUksQ0FBQyxRQUFRLEVBQUUsQ0FBQyxDQUFDO0lBQzdFLENBQUM7SUFFTyxvREFBYyxHQUF0QixVQUF1QixJQUFhO1FBQ2xDLE9BQU8sSUFBSSxDQUFDLGFBQWEsRUFBRSxDQUFDLDZCQUE2QixDQUFDLElBQUksQ0FBQyxNQUFNLEVBQUUsQ0FBQyxDQUFDO0lBQzNFLENBQUM7SUFDSCxrQ0FBQztBQUFELENBN0VBLEFBNkVDLENBN0V5QyxJQUFJLENBQUMsVUFBVSxHQTZFeEQiLCJmaWxlIjoicnVsZXMvbm9VbmV4cGVjdGVkTXVsdGlsaW5lUnVsZS5qcyIsInNvdXJjZVJvb3QiOiIvVXNlcnMvam1sb3Blei90c2xpbnQtZXNsaW50LXJ1bGVzL3NyYyJ9 diff --git a/node_modules/tslint-eslint-rules/dist/rules/objectCurlySpacingRule.js b/node_modules/tslint-eslint-rules/dist/rules/objectCurlySpacingRule.js new file mode 100644 index 000000000..e17b0e6f4 --- /dev/null +++ b/node_modules/tslint-eslint-rules/dist/rules/objectCurlySpacingRule.js @@ -0,0 +1,109 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +var tslib_1 = require("tslib"); +var ts = require("typescript"); +var Lint = require("tslint"); +var OPTION_ALWAYS = 'always'; +var Rule = (function (_super) { + tslib_1.__extends(Rule, _super); + function Rule() { + return _super !== null && _super.apply(this, arguments) || this; + } + Rule.prototype.apply = function (sourceFile) { + var walker = new ObjectCurlySpacingWalker(sourceFile, this.getOptions()); + return this.applyWithWalker(walker); + }; + Rule.FAILURE_STRING = { + always: { + start: "A space is required after '{'", + end: "A space is required before '}'" + }, + never: { + start: "There should be no space after '{'", + end: "There should be no space before '}'" + } + }; + return Rule; +}(Lint.Rules.AbstractRule)); +exports.Rule = Rule; +var ObjectCurlySpacingWalker = (function (_super) { + tslib_1.__extends(ObjectCurlySpacingWalker, _super); + function ObjectCurlySpacingWalker(sourceFile, options) { + var _this = _super.call(this, sourceFile, options) || this; + _this.always = _this.hasOption(OPTION_ALWAYS) || (_this.getOptions() && _this.getOptions().length === 0); + var opt = _this.getOptions(); + _this.exceptions = opt[1] || {}; + if (_this.exceptions.arraysInObjects === undefined) { + _this.exceptions.arraysInObjects = _this.always; + } + if (_this.exceptions.objectsInObjects === undefined) { + _this.exceptions.objectsInObjects = _this.always; + } + return _this; + } + ObjectCurlySpacingWalker.prototype.visitNode = function (node) { + var bracedKind = [ + ts.SyntaxKind.ObjectLiteralExpression, + ts.SyntaxKind.ObjectBindingPattern, + ts.SyntaxKind.NamedImports, + ts.SyntaxKind.NamedExports + ]; + if (bracedKind.indexOf(node.kind) > -1) { + this.checkSpacingInsideBraces(node); + } + _super.prototype.visitNode.call(this, node); + }; + ObjectCurlySpacingWalker.prototype.checkSpacingInsideBraces = function (node) { + var text = node.getText(); + if (text.indexOf('\n') !== -1 || /^\{\s*\}$/.test(text)) { + return; + } + var endsWithObjectLiteral = false; + var endsWithArrayLiteral = false; + if (node.getChildren().length === 3) { + var contents = node.getChildren()[1].getChildren(); + if (contents.length > 0) { + var lastElement = contents[contents.length - 1]; + if (lastElement.kind === ts.SyntaxKind.PropertyAssignment || lastElement.kind === ts.SyntaxKind.BindingElement) { + var value = lastElement.getChildren(); + if (value.length === 3) { + endsWithObjectLiteral = value[2].kind === ts.SyntaxKind.ObjectLiteralExpression || value[2].kind === ts.SyntaxKind.ObjectBindingPattern; + endsWithArrayLiteral = value[2].kind === ts.SyntaxKind.ArrayLiteralExpression; + } + } + } + } + var leadingSpace = text.match(/^\{(\s{0,2})/)[1].length; + if (this.always) { + if (leadingSpace === 0) { + var fix = Lint.Replacement.appendText(node.getStart() + 1, ' '); + this.addFailure(this.createFailure(node.getStart(), 1, Rule.FAILURE_STRING.always.start, fix)); + } + } + else { + if (leadingSpace > 0) { + var fix = Lint.Replacement.deleteText(node.getStart() + 1, leadingSpace); + this.addFailure(this.createFailure(node.getStart(), 1, Rule.FAILURE_STRING.never.start, fix)); + } + } + var trailingSpace = text.match(/(\s{0,2})}$/)[1].length; + var arrayExceptionApplies = this.always !== this.exceptions.arraysInObjects && endsWithArrayLiteral; + var objectExceptionApplies = this.always !== this.exceptions.objectsInObjects && endsWithObjectLiteral; + var spaceRequired = arrayExceptionApplies || objectExceptionApplies ? !this.always : this.always; + if (spaceRequired) { + if (trailingSpace === 0) { + var fix = Lint.Replacement.appendText(node.getEnd() - 1, ' '); + this.addFailure(this.createFailure(node.getEnd() - 1, 1, Rule.FAILURE_STRING.always.end, fix)); + } + } + else { + if (trailingSpace > 0) { + var fix = Lint.Replacement.deleteText(node.getEnd() - trailingSpace - 1, trailingSpace); + this.addFailure(this.createFailure(node.getEnd() - 1, 1, Rule.FAILURE_STRING.never.end, fix)); + } + } + }; + return ObjectCurlySpacingWalker; +}(Lint.RuleWalker)); + +//# sourceMappingURL=data:application/json;charset=utf8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInJ1bGVzL29iamVjdEN1cmx5U3BhY2luZ1J1bGUudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7O0FBQUEsK0JBQWlDO0FBQ2pDLDZCQUErQjtBQUUvQixJQUFNLGFBQWEsR0FBRyxRQUFRLENBQUM7QUFFL0I7SUFBMEIsZ0NBQXVCO0lBQWpEOztJQWdCQSxDQUFDO0lBSlEsb0JBQUssR0FBWixVQUF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UcsQ0FBQyxDQUFDLENBQUM7YUFDL0Y7U0FDRjtJQUNILENBQUM7SUFDSCwrQkFBQztBQUFELENBM0ZBLEFBMkZDLENBM0ZzQyxJQUFJLENBQUMsVUFBVSxHQTJGckQiLCJmaWxlIjoicnVsZXMvb2JqZWN0Q3VybHlTcGFjaW5nUnVsZS5qcyIsInNvdXJjZVJvb3QiOiIvVXNlcnMvam1sb3Blei90c2xpbnQtZXNsaW50LXJ1bGVzL3NyYyJ9 diff --git a/node_modules/tslint-eslint-rules/dist/rules/sortImportsRule.js b/node_modules/tslint-eslint-rules/dist/rules/sortImportsRule.js new file mode 100644 index 000000000..757551e66 --- /dev/null +++ b/node_modules/tslint-eslint-rules/dist/rules/sortImportsRule.js @@ -0,0 +1,215 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +var tslib_1 = require("tslib"); +var Lint = require("tslint"); +var ts = require("typescript"); +var RULE_NAME = 'sort-imports'; +var Rule = (function (_super) { + tslib_1.__extends(Rule, _super); + function Rule() { + return _super !== null && _super.apply(this, arguments) || this; + } + Rule.prototype.apply = function (sourceFile) { + var walker = new RuleWalker(sourceFile, this.getOptions()); + return this.applyWithWalker(walker); + }; + Rule.metadata = { + ruleName: RULE_NAME, + description: 'enforce sorting import declarations within module', + rationale: Lint.Utils.dedent(templateObject_1 || (templateObject_1 = tslib_1.__makeTemplateObject(["\n When declaring multiple imports, a sorted list of import declarations make it easier for developers to\n read the code and find necessary imports later. This rule is purely a matter of style.\n\n This rule checks all import declarations and verifies that all imports are first sorted by the used member\n syntax and then alphabetically by the first member or alias name.\n "], ["\n When declaring multiple imports, a sorted list of import declarations make it easier for developers to\n read the code and find necessary imports later. This rule is purely a matter of style.\n\n This rule checks all import declarations and verifies that all imports are first sorted by the used member\n syntax and then alphabetically by the first member or alias name.\n "]))), + optionsDescription: Lint.Utils.dedent(templateObject_2 || (templateObject_2 = tslib_1.__makeTemplateObject(["\n - `\"ignore-case\"` does case-insensitive comparisons (default: `false`)\n - `\"ignore-member-sort\"` allows members in multiple type imports to occur in any order (default: `false`)\n - `\"member-syntax-sort-order\"` (default: `[\"none\", \"all\", \"multiple\", \"single\", \"alias\"]`); all 5 items must be\n present in the array, but you can change the order:\n - `none` = import module without exported bindings.\n - `all` = import all members provided by exported bindings.\n - `multiple` = import multiple members.\n - `single` = import a single member.\n - `alias` = creates an alias for a member. This is unique to TER and not in ESLint's `sort-imports`.\n "], ["\n - \\`\"ignore-case\"\\` does case-insensitive comparisons (default: \\`false\\`)\n - \\`\"ignore-member-sort\"\\` allows members in multiple type imports to occur in any order (default: \\`false\\`)\n - \\`\"member-syntax-sort-order\"\\` (default: \\`[\"none\", \"all\", \"multiple\", \"single\", \"alias\"]\\`); all 5 items must be\n present in the array, but you can change the order:\n - \\`none\\` = import module without exported bindings.\n - \\`all\\` = import all members provided by exported bindings.\n - \\`multiple\\` = import multiple members.\n - \\`single\\` = import a single member.\n - \\`alias\\` = creates an alias for a member. This is unique to TER and not in ESLint's \\`sort-imports\\`.\n "]))), + options: { + type: 'object', + properties: { + 'member-syntax-sort-order': { + type: 'array', + items: { + type: 'string', + enum: ['none', 'all', 'multiple', 'single', 'alias'] + }, + minLength: 5, + maxLength: 5 + }, + 'ignore-case': { + type: 'boolean' + }, + 'ignore-member-sort': { + type: 'boolean' + } + } + }, + optionExamples: [ + Lint.Utils.dedent(templateObject_3 || (templateObject_3 = tslib_1.__makeTemplateObject(["\n \"", "\": [true]\n "], ["\n \"", "\": [true]\n "])), RULE_NAME), + Lint.Utils.dedent(templateObject_4 || (templateObject_4 = tslib_1.__makeTemplateObject(["\n \"", "\": [true, { \"ignore-case\" }]\n "], ["\n \"", "\": [true, { \"ignore-case\" }]\n "])), RULE_NAME), + Lint.Utils.dedent(templateObject_5 || (templateObject_5 = tslib_1.__makeTemplateObject(["\n \"", "\": [true, { \"ignore-member-sort\" }]\n "], ["\n \"", "\": [true, { \"ignore-member-sort\" }]\n "])), RULE_NAME), + Lint.Utils.dedent(templateObject_6 || (templateObject_6 = tslib_1.__makeTemplateObject(["\n \"", "\": [true, { \"member-syntax-sort-order\": [\"all\", \"single\", \"multiple\", \"none\", \"alias\"] }]\n "], ["\n \"", "\": [true, { \"member-syntax-sort-order\": [\"all\", \"single\", \"multiple\", \"none\", \"alias\"] }]\n "])), RULE_NAME) + ], + typescriptOnly: false, + type: 'style' + }; + return Rule; +}(Lint.Rules.AbstractRule)); +exports.Rule = Rule; +var MemberSyntaxType; +(function (MemberSyntaxType) { + MemberSyntaxType[MemberSyntaxType["None"] = 0] = "None"; + MemberSyntaxType[MemberSyntaxType["All"] = 1] = "All"; + MemberSyntaxType[MemberSyntaxType["Multiple"] = 2] = "Multiple"; + MemberSyntaxType[MemberSyntaxType["Single"] = 3] = "Single"; + MemberSyntaxType[MemberSyntaxType["Alias"] = 4] = "Alias"; +})(MemberSyntaxType || (MemberSyntaxType = {})); +var RuleWalker = (function (_super) { + tslib_1.__extends(RuleWalker, _super); + function RuleWalker(sourceFile, options) { + var _this = _super.call(this, sourceFile, options) || this; + _this.currentImportIndex = 0; + var optionSet = _this.getOptions()[0] || {}; + _this.ignoreCase = _this.hasOption('ignore-case'); + _this.ignoreMemberSort = _this.hasOption('ignore-member-sort'); + _this.expectedOrder = RuleWalker._processMemberSyntaxSortOrder(optionSet['member-syntax-sort-order']); + _this.currentSortValue = { sortValue: '', originalValue: '' }; + if (_this.ignoreCase) { + _this.caseConverter = function (s) { return s.toUpperCase(); }; + } + else { + _this.caseConverter = function (s) { return s; }; + } + return _this; + } + RuleWalker.prototype.visitNode = function (node) { + if (node.kind === ts.SyntaxKind.ImportDeclaration || + node.kind === ts.SyntaxKind.ImportEqualsDeclaration) { + this._validateOrder(node); + } + _super.prototype.visitNode.call(this, node); + }; + RuleWalker.prototype.visitNamedImports = function (node) { + if (!this.ignoreMemberSort) { + this._validateMemberSort(node); + } + _super.prototype.visitNamedImports.call(this, node); + }; + RuleWalker.prototype._validateMemberSort = function (node) { + var _this = this; + var imports = node.elements.map(function (e) { return _this.caseConverter(e.getText()); }); + var importReduction = imports.reduce(function (prev, current) { return prev + current; }); + var sortedImports = imports.sort(); + var sortedReduction = sortedImports.reduce(function (prev, current) { return prev + current; }); + if (importReduction !== sortedReduction) { + this.addFailureAtNode(node, 'Member imports must be sorted alphabetically.'); + } + }; + RuleWalker.prototype._validateOrder = function (node) { + var importData = this._determineImportType(node); + if (importData) { + var importName = importData.sortValue.trim(); + var index = this.expectedOrder.indexOf(importData.memberSyntaxType, this.currentImportIndex); + if (index !== -1) { + if (this.expectedOrder[this.currentImportIndex] !== importData.memberSyntaxType) { + this.currentImportIndex = index; + this.currentSortValue = { + sortValue: this.caseConverter(importName), + originalValue: importName + }; + } + else if (this.currentSortValue.sortValue > this.caseConverter(importName)) { + this.addFailureAtNode(node, "All imports of the same type must be sorted alphabetically. \"" + importName + "\" must come before \"" + this.currentSortValue.originalValue + "\""); + } + else { + this.currentSortValue = { + sortValue: this.caseConverter(importName), + originalValue: importName + }; + } + } + else { + var currentSyntaxType = MemberSyntaxType[importData.memberSyntaxType]; + var previousSyntaxType = MemberSyntaxType[this.expectedOrder[this.currentImportIndex]]; + this.addFailureAtNode(node, "All imports of type \"" + currentSyntaxType + "\" must occur before all imports of type \"" + previousSyntaxType + "\""); + } + } + else { + this.addFailureAtNode(node, 'Could not determine import type'); + } + }; + RuleWalker.prototype._determineImportType = function (node) { + var nodeText = node.getFullText(); + if (node.kind === ts.SyntaxKind.ImportEqualsDeclaration) { + var aliasMatch = /\bimport\s+(\w+)\s*=.+/g.exec(nodeText); + return { + memberSyntaxType: MemberSyntaxType.Alias, + sortValue: aliasMatch[1] + }; + } + else { + var singleMatch = /\bimport\s+(?:{?([^,{}\*]+?)}?)\s*from\s+[\'"](?:[^"\']+)["\']/g.exec(nodeText); + var multipleMatch = /\bimport\s*{?\s*([^{}\'",]+?)\s*,(?:\s*.+\s*,\s*)*\s*.+\s*}?\s*from\s+[\'"](?:[^"\']+)["\']/g.exec(nodeText); + var noneMatch = /\bimport\s+[\'"]([^"\']+)["\']/g.exec(nodeText); + var allMatch = /\bimport\s+\*\s+as\s+(.+)\s+from\s+[\'"](?:[^"\']+)["\']/g.exec(nodeText); + var result = void 0; + if (singleMatch !== null) { + result = { + memberSyntaxType: MemberSyntaxType.Single, + sortValue: singleMatch[1] + }; + } + else if (multipleMatch !== null) { + result = { + memberSyntaxType: MemberSyntaxType.Multiple, + sortValue: multipleMatch[1] + }; + } + else if (noneMatch !== null) { + result = { + memberSyntaxType: MemberSyntaxType.None, + sortValue: noneMatch[1] + }; + } + else if (allMatch !== null) { + result = { + memberSyntaxType: MemberSyntaxType.All, + sortValue: allMatch[1] + }; + } + else { + result = { + memberSyntaxType: MemberSyntaxType.None, + sortValue: '' + }; + } + return result; + } + }; + RuleWalker._processMemberSyntaxSortOrder = function (sortOption) { + var defaultOrder = [MemberSyntaxType.None, MemberSyntaxType.All, MemberSyntaxType.Multiple, MemberSyntaxType.Single, MemberSyntaxType.Alias]; + if (Array.isArray(sortOption) && typeof sortOption[0] === 'string' && sortOption.length === 5) { + var memberSyntaxTypeMap_1 = { + none: MemberSyntaxType.None, + all: MemberSyntaxType.All, + multiple: MemberSyntaxType.Multiple, + single: MemberSyntaxType.Single, + alias: MemberSyntaxType.Alias + }; + var order_1 = []; + var usedOptions_1 = {}; + sortOption.forEach(function (t) { + if (usedOptions_1[t] !== undefined) { + } + else { + usedOptions_1[t] = t; + if (memberSyntaxTypeMap_1[t]) { + order_1.push(memberSyntaxTypeMap_1[t]); + } + } + }); + return order_1; + } + else { + return defaultOrder; + } + }; + return RuleWalker; +}(Lint.RuleWalker)); +var templateObject_1, templateObject_2, templateObject_3, templateObject_4, templateObject_5, templateObject_6; + +//# sourceMappingURL=data:application/json;charset=utf8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInJ1bGVzL3NvcnRJbXBvcnRzUnVsZS50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7QUFBQSw2QkFBK0I7QU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0gsQ0FBQztJQUNILGlCQUFDO0FBQUQsQ0F0S0EsQUFzS0MsQ0F0S3dCLElBQUksQ0FBQyxVQUFVLEdBc0t2QyIsImZpbGUiOiJydWxlcy9zb3J0SW1wb3J0c1J1bGUuanMiLCJzb3VyY2VSb290IjoiL1VzZXJzL2ptbG9wZXovdHNsaW50LWVzbGludC1ydWxlcy9zcmMifQ== diff --git a/node_modules/tslint-eslint-rules/dist/rules/spaceInParensRule.js b/node_modules/tslint-eslint-rules/dist/rules/spaceInParensRule.js new file mode 100644 index 000000000..d197fe750 --- /dev/null +++ b/node_modules/tslint-eslint-rules/dist/rules/spaceInParensRule.js @@ -0,0 +1,215 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +var tslib_1 = require("tslib"); +var ts = require("typescript"); +var Lint = require("tslint"); +var RULE_NAME = 'space-in-parens'; +var Rule = (function (_super) { + tslib_1.__extends(Rule, _super); + function Rule() { + return _super !== null && _super.apply(this, arguments) || this; + } + Rule.prototype.apply = function (sourceFile) { + var walker = new SpaceInParensWalker(sourceFile, this.getOptions()); + return this.applyWithWalker(walker); + }; + Rule.metadata = { + ruleName: RULE_NAME, + description: 'require or disallow spaces inside parentheses', + rationale: Lint.Utils.dedent(templateObject_1 || (templateObject_1 = tslib_1.__makeTemplateObject(["\n This rule will enforce consistency of spacing directly inside of parentheses,\n by disallowing or requiring one or more spaces to the right of (and to the\n left of). In either case, () will still be allowed.\n "], ["\n This rule will enforce consistency of spacing directly inside of parentheses,\n by disallowing or requiring one or more spaces to the right of (and to the\n left of). In either case, () will still be allowed.\n "]))), + optionsDescription: Lint.Utils.dedent(templateObject_2 || (templateObject_2 = tslib_1.__makeTemplateObject(["\n There are two options for this rule:\n\n - `\"never\"` (default) enforces zero spaces inside of parentheses\n - `\"always\"` enforces a space inside of parentheses\n\n Depending on your coding conventions, you can choose either option by specifying\n it in your configuration.\n "], ["\n There are two options for this rule:\n\n - \\`\"never\"\\` (default) enforces zero spaces inside of parentheses\n - \\`\"always\"\\` enforces a space inside of parentheses\n\n Depending on your coding conventions, you can choose either option by specifying\n it in your configuration.\n "]))), + options: { + type: 'array', + items: [ + { + enum: ['always', 'never'] + }, + { + type: 'object', + properties: { + exceptions: { + type: 'array', + items: [ + { + enum: ['{}', '[]', '()', 'empty'] + } + ], + uniqueItems: true + } + }, + additionalProperties: false + } + ], + minItems: 0, + maxItems: 2 + }, + optionExamples: [ + Lint.Utils.dedent(templateObject_3 || (templateObject_3 = tslib_1.__makeTemplateObject(["\n \"", "\": [true, \"always\"]\n "], ["\n \"", "\": [true, \"always\"]\n "])), RULE_NAME), + Lint.Utils.dedent(templateObject_4 || (templateObject_4 = tslib_1.__makeTemplateObject(["\n \"", "\": [true, \"never\"]\n "], ["\n \"", "\": [true, \"never\"]\n "])), RULE_NAME), + Lint.Utils.dedent(templateObject_5 || (templateObject_5 = tslib_1.__makeTemplateObject(["\n \"", "\": [true, \"always\", { \"exceptions\": [ \"{}\", \"[]\", \"()\", \"empty\" ] }]\n "], ["\n \"", "\": [true, \"always\", { \"exceptions\": [ \"{}\", \"[]\", \"()\", \"empty\" ] }]\n "])), RULE_NAME) + ], + typescriptOnly: false, + type: 'style' + }; + Rule.MISSING_SPACE_MESSAGE = 'there must be a space inside this paren.'; + Rule.REJECTED_SPACE_MESSAGE = 'there should be no spaces inside this paren.'; + return Rule; +}(Lint.Rules.AbstractRule)); +exports.Rule = Rule; +var SpaceInParensWalker = (function (_super) { + tslib_1.__extends(SpaceInParensWalker, _super); + function SpaceInParensWalker(sourceFile, options) { + var _this = _super.call(this, sourceFile, options) || this; + _this.exceptionsArrayOptions = []; + var ruleOptions = _this.getOptions(); + _this.spaced = _this.hasOption('always'); + if (ruleOptions[1]) { + _this.exceptionsArrayOptions = (ruleOptions.length === 2) ? ruleOptions[1].exceptions : []; + if (_this.exceptionsArrayOptions.length) { + _this.braceException = _this.exceptionsArrayOptions.indexOf('{}') !== -1; + _this.bracketException = _this.exceptionsArrayOptions.indexOf('[]') !== -1; + _this.parenException = _this.exceptionsArrayOptions.indexOf('()') !== -1; + _this.empty = _this.exceptionsArrayOptions.indexOf('empty') !== -1; + } + } + return _this; + } + SpaceInParensWalker.prototype.getExceptions = function () { + var openers = []; + var closers = []; + if (this.braceException) { + openers.push(ts.SyntaxKind.OpenBraceToken); + closers.push(ts.SyntaxKind.CloseBraceToken); + } + if (this.bracketException) { + openers.push(ts.SyntaxKind.OpenBracketToken); + closers.push(ts.SyntaxKind.CloseBracketToken); + } + if (this.parenException) { + openers.push(ts.SyntaxKind.OpenParenToken); + closers.push(ts.SyntaxKind.CloseParenToken); + } + if (this.empty) { + openers.push(ts.SyntaxKind.CloseParenToken); + closers.push(ts.SyntaxKind.OpenParenToken); + } + return { + openers: openers, + closers: closers + }; + }; + SpaceInParensWalker.prototype.findParenNodes = function (node) { + var children = node.getChildren(); + var first; + var second; + var penultimate; + var last; + for (var i = 0; i < children.length; i++) { + if (children[i].kind === ts.SyntaxKind.OpenParenToken) { + first = children[i]; + second = children[i + 1]; + } + if (children[i].kind === ts.SyntaxKind.CloseParenToken) { + penultimate = children[i - 1]; + last = children[i]; + } + } + return [first, second, penultimate, last]; + }; + SpaceInParensWalker.prototype.visitNode = function (node) { + var parenNodes = this.findParenNodes(node); + this.checkParanSpace(parenNodes[0], parenNodes[1], parenNodes[2], parenNodes[3]); + _super.prototype.visitNode.call(this, node); + }; + SpaceInParensWalker.prototype.checkParanSpace = function (first, second, penultimate, last) { + if (first && second) { + if (this.shouldOpenerHaveSpace(first, second)) { + var fix = Lint.Replacement.appendText(first.getEnd(), ' '); + this.addFailure(this.createFailure(first.getEnd(), 0, Rule.MISSING_SPACE_MESSAGE, fix)); + } + if (this.shouldOpenerRejectSpace(first, second)) { + var width = second.getStart() - first.getEnd(); + var fix = Lint.Replacement.deleteText(first.getEnd(), width); + this.addFailure(this.createFailure(first.getEnd(), 0, Rule.REJECTED_SPACE_MESSAGE, fix)); + } + } + if (penultimate && last) { + if (this.shouldCloserHaveSpace(penultimate, last)) { + var fix = Lint.Replacement.appendText(penultimate.getEnd(), ' '); + this.addFailure(this.createFailure(last.getStart(), 0, Rule.MISSING_SPACE_MESSAGE, fix)); + } + if (this.shouldCloserRejectSpace(penultimate, last)) { + var width = last.getStart() - penultimate.getEnd(); + var fix = Lint.Replacement.deleteText(penultimate.getEnd(), width); + this.addFailure(this.createFailure(last.getStart(), 0, Rule.REJECTED_SPACE_MESSAGE, fix)); + } + } + }; + SpaceInParensWalker.prototype.shouldOpenerHaveSpace = function (left, right) { + if (this.isSpaceBetween(left, right)) + return false; + if (this.spaced) { + if (right.getText().trim() === '') + return false; + return !this.isOpenerException(right.getFirstToken()); + } + return this.isOpenerException(right.getFirstToken()); + }; + SpaceInParensWalker.prototype.shouldCloserHaveSpace = function (left, right) { + if (left.getText().trim() === '') + return false; + if (this.isSpaceBetween(left, right)) + return false; + if (this.spaced) + return !this.isCloserException(left.getLastToken()); + return this.isCloserException(left.getLastToken()); + }; + SpaceInParensWalker.prototype.shouldOpenerRejectSpace = function (left, right) { + if (right.getText().trim() === '') + return false; + if (this.isLineBreakBetween(left, right)) + return false; + if (!this.isSpaceBetween(left, right)) + return false; + if (this.spaced) + return this.isOpenerException(right.getFirstToken()); + return !this.isOpenerException(right.getFirstToken()); + }; + SpaceInParensWalker.prototype.shouldCloserRejectSpace = function (left, right) { + if (left.getText().trim() === '') + return false; + if (this.isLineBreakBetween(left, right)) + return false; + if (!this.isSpaceBetween(left, right)) + return false; + if (this.spaced) + return this.isCloserException(left.getLastToken()); + return !this.isCloserException(left.getLastToken()); + }; + SpaceInParensWalker.prototype.isOpenerException = function (token) { + if (!token) + return false; + return this.getExceptions().openers.indexOf(token.kind) >= 0; + }; + SpaceInParensWalker.prototype.isCloserException = function (token) { + if (!token) + return false; + return this.getExceptions().closers.indexOf(token.kind) >= 0; + }; + SpaceInParensWalker.prototype.isSpaceBetween = function (node, nextNode) { + return nextNode.getStart() - node.getEnd() > 0; + }; + SpaceInParensWalker.prototype.isLineBreakBetween = function (node, nextNode) { + return this.getEndPosition(node).line !== this.getStartPosition(nextNode).line; + }; + SpaceInParensWalker.prototype.getStartPosition = function (node) { + return node.getSourceFile().getLineAndCharacterOfPosition(node.getStart()); + }; + SpaceInParensWalker.prototype.getEndPosition = function (node) { + return node.getSourceFile().getLineAndCharacterOfPosition(node.getEnd()); + }; + return SpaceInParensWalker; +}(Lint.RuleWalker)); +var templateObject_1, templateObject_2, templateObject_3, templateObject_4, templateObject_5; + +//# sourceMappingURL=data:application/json;charset=utf8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInJ1bGVzL3NwYWNlSW5QYXJlbnNSdWxlLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7OztBQUFBLCtCQUFpQztBQUNqQyw2QkFBK0I7QUFFL0IsSUFBTSxTQUFTLEdBQUcsaUJBQWlCLENBQUM7QUFFcEM7SUFBMEIsZ0NBQXVCO0lBQWpEOztJQWlFQSxDQUFDO0lBSlEsb0JBQUssR0FBWixVQUFhLFVBQXlCO1FBQ3BDLElBQU0sTUFBTSxHQUFHLElBQUksbUJBQW1CLENBQUMsVUFBVSxFQUFFLElBQUksQ0FBQyxVQUFVLEVBQUUsQ0FBQyxDQUFDO1FBQ3RFLE9BQU8sSUFBSSxDQUFDLGVBQWUsQ0FBQyxNQUFNLENBQUMsQ0FBQztJQUN0QyxDQUFDO0lBL0RhLGFBQVEsR0FBdUI7UUFDM0MsUUFBUSxFQUFFLFNBQVM7UUFDbkIsV0FBVyxFQUFFLCtDQUErQztRQUM1RCxTQUFTLEVBQUUsSUFBSSxDQUFDLEtBQUssQ0FBQyxNQUFNLHVUQUFBLDRPQUl6QixJQUFBO1FBQ0gsa0JBQWtCLEVBQUUsSUFBSSxDQUFDLEtBQUssQ0FBQyxNQUFNLHFZQUFBLGtVQVFsQyxJQUFBO1FBQ0gsT0FBTyxFQUFFO1lBQ1AsSUFBSSxFQUFFLE9BQU87WUFDYixLQUFLLEVBQUU7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MsSUFBSSxDQUFDLE1BQU0sRUFBRSxDQUFDLENBQUM7SUFDM0UsQ0FBQztJQUVILDBCQUFDO0FBQUQsQ0FuS0EsQUFtS0MsQ0FuS2lDLElBQUksQ0FBQyxVQUFVLEdBbUtoRCIsImZpbGUiOiJydWxlcy9zcGFjZUluUGFyZW5zUnVsZS5qcyIsInNvdXJjZVJvb3QiOiIvVXNlcnMvam1sb3Blei90c2xpbnQtZXNsaW50LXJ1bGVzL3NyYyJ9 diff --git a/node_modules/tslint-eslint-rules/dist/rules/terArrowBodyStyleRule.js b/node_modules/tslint-eslint-rules/dist/rules/terArrowBodyStyleRule.js new file mode 100644 index 000000000..cddfe877e --- /dev/null +++ b/node_modules/tslint-eslint-rules/dist/rules/terArrowBodyStyleRule.js @@ -0,0 +1,117 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +var tslib_1 = require("tslib"); +var ts = require("typescript"); +var Lint = require("tslint"); +var RULE_NAME = 'ter-arrow-body-style'; +var Rule = (function (_super) { + tslib_1.__extends(Rule, _super); + function Rule() { + return _super !== null && _super.apply(this, arguments) || this; + } + Rule.prototype.apply = function (sourceFile) { + var walker = new RuleWalker(sourceFile, this.getOptions()); + return this.applyWithWalker(walker); + }; + Rule.metadata = { + ruleName: RULE_NAME, + description: 'require braces in arrow function body', + rationale: Lint.Utils.dedent(templateObject_1 || (templateObject_1 = tslib_1.__makeTemplateObject(["\n Arrow functions have two syntactic forms for their function bodies. They may be defined with\n a block body (denoted by curly braces) `() => { ... }` or with a single expression\n `() => ...`, whose value is implicitly returned.\n "], ["\n Arrow functions have two syntactic forms for their function bodies. They may be defined with\n a block body (denoted by curly braces) \\`() => { ... }\\` or with a single expression\n \\`() => ...\\`, whose value is implicitly returned.\n "]))), + optionsDescription: Lint.Utils.dedent(templateObject_2 || (templateObject_2 = tslib_1.__makeTemplateObject(["\n The rule takes one or two options. The first is a string, which can be:\n\n - `\"always\"` enforces braces around the function body\n - `\"as-needed\"` enforces no braces where they can be omitted (default)\n - `\"never\"` enforces no braces around the function body (constrains arrow functions to the\n role of returning an expression)\n\n The second one is an object for more fine-grained configuration when the first option is\n `\"as-needed\"`. Currently, the only available option is `requireReturnForObjectLiteral`, a\n boolean property. It\u2019s false by default. If set to true, it requires braces and an explicit\n return for object literals.\n "], ["\n The rule takes one or two options. The first is a string, which can be:\n\n - \\`\"always\"\\` enforces braces around the function body\n - \\`\"as-needed\"\\` enforces no braces where they can be omitted (default)\n - \\`\"never\"\\` enforces no braces around the function body (constrains arrow functions to the\n role of returning an expression)\n\n The second one is an object for more fine-grained configuration when the first option is\n \\`\"as-needed\"\\`. Currently, the only available option is \\`requireReturnForObjectLiteral\\`, a\n boolean property. It\u2019s false by default. If set to true, it requires braces and an explicit\n return for object literals.\n "]))), + options: { + anyOf: [ + { + type: 'array', + items: [ + { + enum: ['always', 'never'] + } + ], + minItems: 0, + maxItems: 1 + }, + { + type: 'array', + items: [ + { + enum: ['as-needed'] + }, + { + type: 'object', + properties: { + requireReturnForObjectLiteral: { type: 'boolean' } + }, + additionalProperties: false + } + ], + minItems: 0, + maxItems: 2 + } + ] + }, + optionExamples: [ + Lint.Utils.dedent(templateObject_3 || (templateObject_3 = tslib_1.__makeTemplateObject(["\n \"", "\": [true, \"always\"]\n "], ["\n \"", "\": [true, \"always\"]\n "])), RULE_NAME), + Lint.Utils.dedent(templateObject_4 || (templateObject_4 = tslib_1.__makeTemplateObject(["\n \"", "\": [true, \"never\"]\n "], ["\n \"", "\": [true, \"never\"]\n "])), RULE_NAME), + Lint.Utils.dedent(templateObject_5 || (templateObject_5 = tslib_1.__makeTemplateObject(["\n \"", "\": [true, \"as-needed\", {\n \"requireReturnForObjectLiteral\": true\n }]\n "], ["\n \"", "\": [true, \"as-needed\", {\n \"requireReturnForObjectLiteral\": true\n }]\n "])), RULE_NAME) + ], + typescriptOnly: false, + type: 'style' + }; + return Rule; +}(Lint.Rules.AbstractRule)); +exports.Rule = Rule; +var RuleWalker = (function (_super) { + tslib_1.__extends(RuleWalker, _super); + function RuleWalker(sourceFile, options) { + var _this = _super.call(this, sourceFile, options) || this; + var opt = _this.getOptions(); + _this.always = opt[0] === 'always'; + _this.asNeeded = !opt[0] || opt[0] === 'as-needed'; + _this.never = opt[0] === 'never'; + _this.requireReturnForObjectLiteral = opt[1] && opt[1].requireReturnForObjectLiteral; + return _this; + } + RuleWalker.prototype.visitArrowFunction = function (node) { + var arrowBody = node.body; + if (arrowBody.kind === ts.SyntaxKind.Block) { + var blockBody = arrowBody.statements; + if (blockBody.length !== 1 && !this.never) { + return; + } + var returnExpression = blockBody[0].expression; + if (this.asNeeded && + this.requireReturnForObjectLiteral && + blockBody[0].kind === ts.SyntaxKind.ReturnStatement && + (returnExpression && this.isObjectLiteral(returnExpression))) { + return; + } + if (this.never || this.asNeeded && blockBody[0].kind === ts.SyntaxKind.ReturnStatement) { + this.report(arrowBody, false); + } + } + else { + if (this.always || (this.asNeeded && + this.requireReturnForObjectLiteral && + this.isObjectLiteral(arrowBody))) { + this.report(arrowBody, true); + } + } + _super.prototype.visitArrowFunction.call(this, node); + }; + RuleWalker.prototype.isObjectLiteral = function (node) { + var obj = node; + while (obj.kind === ts.SyntaxKind.ParenthesizedExpression) { + obj = node.expression; + } + return obj.kind === ts.SyntaxKind.ObjectLiteralExpression; + }; + RuleWalker.prototype.report = function (arrowBody, expected) { + var val = expected ? 'Expected' : 'Unexpected'; + var failure = this.createFailure(arrowBody.getStart(), arrowBody.getWidth(), val + " block statement surrounding arrow body."); + this.addFailure(failure); + }; + return RuleWalker; +}(Lint.RuleWalker)); +var templateObject_1, templateObject_2, templateObject_3, templateObject_4, templateObject_5; + +//# sourceMappingURL=data:application/json;charset=utf8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInJ1bGVzL3RlckFycm93Qm9keVN0eWxlUnVsZS50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7QUFJQSwrQkFBaUM7QUFDakMsNkJBQStCO0FBRS9CLEl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LENBbkV3QixJQUFJLENBQUMsVUFBVSxHQW1FdkMiLCJmaWxlIjoicnVsZXMvdGVyQXJyb3dCb2R5U3R5bGVSdWxlLmpzIiwic291cmNlUm9vdCI6Ii9Vc2Vycy9qbWxvcGV6L3RzbGludC1lc2xpbnQtcnVsZXMvc3JjIn0= diff --git a/node_modules/tslint-eslint-rules/dist/rules/terArrowParensRule.js b/node_modules/tslint-eslint-rules/dist/rules/terArrowParensRule.js new file mode 100644 index 000000000..1d4127211 --- /dev/null +++ b/node_modules/tslint-eslint-rules/dist/rules/terArrowParensRule.js @@ -0,0 +1,115 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +var tslib_1 = require("tslib"); +var ts = require("typescript"); +var Lint = require("tslint"); +var RULE_NAME = 'ter-arrow-parens'; +var always = 'Expected parentheses around arrow function argument.'; +var asNeeded = 'Unexpected parentheses around single function argument.'; +var block = 'Unexpected parentheses around single function argument having a body with no curly braces.'; +var blockNoParens = 'Expected parentheses around arrow function argument having a body with curly braces.'; +var Rule = (function (_super) { + tslib_1.__extends(Rule, _super); + function Rule() { + return _super !== null && _super.apply(this, arguments) || this; + } + Rule.prototype.apply = function (sourceFile) { + var walker = new RuleWalker(sourceFile, this.getOptions()); + return this.applyWithWalker(walker); + }; + Rule.metadata = { + ruleName: RULE_NAME, + description: 'require parens in arrow function arguments', + rationale: Lint.Utils.dedent(templateObject_1 || (templateObject_1 = tslib_1.__makeTemplateObject(["\n Arrow functions can omit parentheses when they have exactly one parameter. In all other cases\n the parameter(s) must be wrapped in parentheses. This rule enforces the consistent use of\n parentheses in arrow functions.\n "], ["\n Arrow functions can omit parentheses when they have exactly one parameter. In all other cases\n the parameter(s) must be wrapped in parentheses. This rule enforces the consistent use of\n parentheses in arrow functions.\n "]))), + optionsDescription: Lint.Utils.dedent(templateObject_2 || (templateObject_2 = tslib_1.__makeTemplateObject(["\n This rule has a string option and an object one.\n\n String options are:\n\n - `\"always\"` (default) requires parentheses around arguments in all cases.\n - `\"as-needed\"` allows omitting parentheses when there is only one argument.\n\n Object properties for variants of the `\"as-needed\"` option:\n\n - `\"requireForBlockBody\": true` modifies the as-needed rule in order to require\n parentheses if the function body is in an instructions block (surrounded by braces).\n "], ["\n This rule has a string option and an object one.\n\n String options are:\n\n - \\`\"always\"\\` (default) requires parentheses around arguments in all cases.\n - \\`\"as-needed\"\\` allows omitting parentheses when there is only one argument.\n\n Object properties for variants of the \\`\"as-needed\"\\` option:\n\n - \\`\"requireForBlockBody\": true\\` modifies the as-needed rule in order to require\n parentheses if the function body is in an instructions block (surrounded by braces).\n "]))), + options: { + type: 'array', + items: [ + { + enum: ['always', 'as-needed'] + }, + { + type: 'object', + properties: { + requireForBlockBody: { + type: 'boolean' + } + }, + additionalProperties: false + } + ], + maxLength: 1 + }, + optionExamples: [ + Lint.Utils.dedent(templateObject_3 || (templateObject_3 = tslib_1.__makeTemplateObject(["\n \"", "\": [true]\n "], ["\n \"", "\": [true]\n "])), RULE_NAME), + Lint.Utils.dedent(templateObject_4 || (templateObject_4 = tslib_1.__makeTemplateObject(["\n \"", "\": [true, \"always\"]\n "], ["\n \"", "\": [true, \"always\"]\n "])), RULE_NAME), + Lint.Utils.dedent(templateObject_5 || (templateObject_5 = tslib_1.__makeTemplateObject(["\n \"", "\": [true, \"as-needed\"]\n "], ["\n \"", "\": [true, \"as-needed\"]\n "])), RULE_NAME), + Lint.Utils.dedent(templateObject_6 || (templateObject_6 = tslib_1.__makeTemplateObject(["\n \"", "\": [true, \"as-needed\", { \"requireForBlockBody\": true }]\n "], ["\n \"", "\": [true, \"as-needed\", { \"requireForBlockBody\": true }]\n "])), RULE_NAME) + ], + typescriptOnly: false, + type: 'style' + }; + return Rule; +}(Lint.Rules.AbstractRule)); +exports.Rule = Rule; +var RuleWalker = (function (_super) { + tslib_1.__extends(RuleWalker, _super); + function RuleWalker(sourceFile, options) { + var _this = _super.call(this, sourceFile, options) || this; + _this.srcFile = sourceFile; + var opt = _this.getOptions(); + _this.asNeeded = opt[0] === 'as-needed'; + _this.requireForBlockBody = _this.asNeeded && opt[1] && opt[1].requireForBlockBody === true; + return _this; + } + RuleWalker.prototype.visitArrowFunction = function (node) { + _super.prototype.visitArrowFunction.call(this, node); + if (node.parameters.length === 1) { + var skip = Lint.hasModifier(node.modifiers, ts.SyntaxKind.AsyncKeyword) ? 1 : 0; + var parameter = node.parameters[0]; + var text = parameter.getText(); + var firstToken = node.getChildAt(skip); + var lastToken = node.getChildAt(2 + skip); + var position = parameter.getStart(); + var paramWidth = text.length; + var parensWidth = lastToken.end - firstToken.getStart(this.srcFile); + var isGenerics = firstToken.kind === ts.SyntaxKind.LessThanToken; + var hasParens = firstToken.kind === ts.SyntaxKind.OpenParenToken; + var bodyIsBlock = node.body.kind === ts.SyntaxKind.Block; + var isIdentifier = parameter.name.kind === ts.SyntaxKind.Identifier; + var hasAnnotations = parameter.initializer || parameter.dotDotDotToken || parameter.type; + var isSingleIdentifier = isIdentifier && !hasAnnotations; + if (this.requireForBlockBody) { + if (isSingleIdentifier && !node.type && !bodyIsBlock) { + if (hasParens) { + this.report(position - 1, parensWidth, block); + } + return; + } + if (bodyIsBlock && !isGenerics) { + if (!hasParens) { + this.report(position, paramWidth, blockNoParens); + } + return; + } + } + if (this.asNeeded && isSingleIdentifier && !node.type) { + if (hasParens) { + this.report(position - 1, parensWidth, asNeeded); + } + return; + } + if (!hasParens && !isGenerics) { + this.report(position, paramWidth, always); + } + } + }; + RuleWalker.prototype.report = function (position, width, message) { + var failure = this.createFailure(position, width, message); + this.addFailure(failure); + }; + return RuleWalker; +}(Lint.RuleWalker)); +var templateObject_1, templateObject_2, templateObject_3, templateObject_4, templateObject_5, templateObject_6; + +//# sourceMappingURL=data:application/json;charset=utf8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInJ1bGVzL3RlckFycm93UGFyZW5zUnVsZS50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7QUFPQSwrQkFBaUM7QUFDakMsNk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FDLEVBQUUsV0FBVyxFQUFFLFFBQVEsQ0FBQyxDQUFDO2lCQUNsRDtnQkFDRCxPQUFPO2FBQ1I7WUFFRCxJQUFJLENBQUMsU0FBUyxJQUFJLENBQUMsVUFBVSxFQUFFO2dCQUM3QixJQUFJLENBQUMsTUFBTSxDQUFDLFFBQVEsRUFBRSxVQUFVLEVBQUUsTUFBTSxDQUFDLENBQUM7YUFDM0M7U0FDRjtJQUNILENBQUM7SUFFTywyQkFBTSxHQUFkLFVBQWUsUUFBZ0IsRUFBRSxLQUFhLEVBQUUsT0FBZTtRQUM3RCxJQUFNLE9BQU8sR0FBRyxJQUFJLENBQUMsYUFBYSxDQUFDLFFBQVEsRUFBRSxLQUFLLEVBQUUsT0FBTyxDQUFDLENBQUM7UUFDN0QsSUFBSSxDQUFDLFVBQVUsQ0FBQyxPQUFPLENBQUMsQ0FBQztJQUMzQixDQUFDO0lBQ0gsaUJBQUM7QUFBRCxDQWpFQSxBQWlFQyxDQWpFd0IsSUFBSSxDQUFDLFVBQVUsR0FpRXZDIiwiZmlsZSI6InJ1bGVzL3RlckFycm93UGFyZW5zUnVsZS5qcyIsInNvdXJjZVJvb3QiOiIvVXNlcnMvam1sb3Blei90c2xpbnQtZXNsaW50LXJ1bGVzL3NyYyJ9 diff --git a/node_modules/tslint-eslint-rules/dist/rules/terArrowSpacingRule.js b/node_modules/tslint-eslint-rules/dist/rules/terArrowSpacingRule.js new file mode 100644 index 000000000..072db5e60 --- /dev/null +++ b/node_modules/tslint-eslint-rules/dist/rules/terArrowSpacingRule.js @@ -0,0 +1,104 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +var tslib_1 = require("tslib"); +var Lint = require("tslint"); +var RULE_NAME = 'ter-arrow-spacing'; +var Rule = (function (_super) { + tslib_1.__extends(Rule, _super); + function Rule() { + return _super !== null && _super.apply(this, arguments) || this; + } + Rule.prototype.apply = function (sourceFile) { + var walker = new RuleWalker(sourceFile, this.getOptions()); + return this.applyWithWalker(walker); + }; + Rule.metadata = { + ruleName: RULE_NAME, + description: 'require space before/after arrow function\'s arrow', + rationale: Lint.Utils.dedent(templateObject_1 || (templateObject_1 = tslib_1.__makeTemplateObject(["\n This rule normalizes the style of spacing before/after an arrow function\u2019s arrow(`=>`).\n "], ["\n This rule normalizes the style of spacing before/after an arrow function\u2019s arrow(\\`=>\\`).\n "]))), + optionsDescription: Lint.Utils.dedent(templateObject_2 || (templateObject_2 = tslib_1.__makeTemplateObject(["\n This rule takes an object argument with `before` and `after` properties, each with a\n Boolean value.\n\n The default configuration is `{ \"before\": true, \"after\": true }`.\n\n `true` means there should be one or more spaces and `false` means no spaces.\n "], ["\n This rule takes an object argument with \\`before\\` and \\`after\\` properties, each with a\n Boolean value.\n\n The default configuration is \\`{ \"before\": true, \"after\": true }\\`.\n\n \\`true\\` means there should be one or more spaces and \\`false\\` means no spaces.\n "]))), + options: { + type: 'array', + items: [{ + type: 'object', + properties: { + before: { + type: 'boolean' + }, + after: { + type: 'boolean' + } + }, + additionalProperties: false + }], + maxLength: 1 + }, + optionExamples: [ + Lint.Utils.dedent(templateObject_3 || (templateObject_3 = tslib_1.__makeTemplateObject(["\n \"", "\": [true]\n "], ["\n \"", "\": [true]\n "])), RULE_NAME), + Lint.Utils.dedent(templateObject_4 || (templateObject_4 = tslib_1.__makeTemplateObject(["\n \"", "\": [true, {\n \"before\": false,\n \"after\": false\n }]\n "], ["\n \"", "\": [true, {\n \"before\": false,\n \"after\": false\n }]\n "])), RULE_NAME) + ], + typescriptOnly: false, + type: 'style' + }; + return Rule; +}(Lint.Rules.AbstractRule)); +exports.Rule = Rule; +var RuleWalker = (function (_super) { + tslib_1.__extends(RuleWalker, _super); + function RuleWalker(sourceFile, options) { + var _this = _super.call(this, sourceFile, options) || this; + _this.before = true; + _this.after = true; + var opt = _this.getOptions(); + if (opt[0]) { + _this.before = opt[0].before !== false; + _this.after = opt[0].after !== false; + } + _this.srcFile = sourceFile; + _this.srcText = sourceFile.getFullText(); + return _this; + } + RuleWalker.prototype.visitArrowFunction = function (node) { + var arrow = node.equalsGreaterThanToken; + var arrowStart = arrow.getStart(this.srcFile); + var bodyStart = node.body.getStart(this.srcFile); + var space = { + before: /\s/.test(this.srcText[arrowStart - 1]), + after: /\s/.test(this.srcText[arrow.end]) + }; + if (this.before) { + if (!space.before) { + var fix = Lint.Replacement.appendText(arrowStart, ' '); + this.report(arrow, 'Missing', 'before', fix); + } + } + else { + if (space.before) { + var spaces = arrowStart - arrow.getFullStart(); + var fix = Lint.Replacement.deleteText(arrowStart - spaces, spaces); + this.report(arrow, 'Unexpected', 'before', fix); + } + } + if (this.after) { + if (!space.after) { + var fix = Lint.Replacement.appendText(arrow.end, ' '); + this.report(arrow, 'Missing', 'after', fix); + } + } + else { + if (space.after) { + var fix = Lint.Replacement.deleteText(arrow.end, bodyStart - arrow.end); + this.report(arrow, 'Unexpected', 'after', fix); + } + } + _super.prototype.visitArrowFunction.call(this, node); + }; + RuleWalker.prototype.report = function (arrowToken, status, place, fix) { + var failure = this.createFailure(arrowToken.getStart(this.srcFile), arrowToken.getWidth(this.srcFile), status + " space " + place + " =>.", fix); + this.addFailure(failure); + }; + return RuleWalker; +}(Lint.RuleWalker)); +var templateObject_1, templateObject_2, templateObject_3, templateObject_4; + +//# sourceMappingURL=data:application/json;charset=utf8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInJ1bGVzL3RlckFycm93U3BhY2luZ1J1bGUudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7O0FBUUEsNkJBQStCO0FBRS9CLElBQU0sU0FBUyxHQUFHLG1CQUFtQixDQUFDO0FBRXRDO0lBQTBCLGdDQUF1QjtJQUFqRDs7SUFrREEsQ0FBQztJQUpRLG9CQUFLLEdBQVosVUFBYSxVQUF5QjtRQUNwQyxJQUFNLE1BQU0sR0FBRyxJQUFJLFVBQVUsQ0FBQyxVQUFVLEVBQUUsSUFBSSxDQUFDLFVBQVUsRUFBRSxDQUFDLENB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U07WUFDTCxJQUFJLEtBQUssQ0FBQyxLQUFLLEVBQUU7Z0JBQ2YsSUFBTSxHQUFHLEdBQUcsSUFBSSxDQUFDLFdBQVcsQ0FBQyxVQUFVLENBQUMsS0FBSyxDQUFDLEdBQUcsRUFBRSxTQUFTLEdBQUcsS0FBSyxDQUFDLEdBQUcsQ0FBQyxDQUFDO2dCQUMxRSxJQUFJLENBQUMsTUFBTSxDQUFDLEtBQUssRUFBRSxZQUFZLEVBQUUsT0FBTyxFQUFFLEdBQUcsQ0FBQyxDQUFDO2FBQ2hEO1NBQ0Y7UUFDRCxpQkFBTSxrQkFBa0IsWUFBQyxJQUFJLENBQUMsQ0FBQztJQUNqQyxDQUFDO0lBRU8sMkJBQU0sR0FBZCxVQUFlLFVBQW1CLEVBQUUsTUFBYyxFQUFFLEtBQWEsRUFBRSxHQUFhO1FBQzlFLElBQU0sT0FBTyxHQUFHLElBQUksQ0FBQyxhQUFhLENBQ2hDLFVBQVUsQ0FBQyxRQUFRLENBQUMsSUFBSSxDQUFDLE9BQU8sQ0FBQyxFQUNqQyxVQUFVLENBQUMsUUFBUSxDQUFDLElBQUksQ0FBQyxPQUFPLENBQUMsRUFDOUIsTUFBTSxlQUFVLEtBQUssU0FBTSxFQUM5QixHQUFHLENBQ0osQ0FBQztRQUNGLElBQUksQ0FBQyxVQUFVLENBQUMsT0FBTyxDQUFDLENBQUM7SUFDM0IsQ0FBQztJQUNILGlCQUFDO0FBQUQsQ0E1REEsQUE0REMsQ0E1RHdCLElBQUksQ0FBQyxVQUFVLEdBNER2QyIsImZpbGUiOiJydWxlcy90ZXJBcnJvd1NwYWNpbmdSdWxlLmpzIiwic291cmNlUm9vdCI6Ii9Vc2Vycy9qbWxvcGV6L3RzbGludC1lc2xpbnQtcnVsZXMvc3JjIn0= diff --git a/node_modules/tslint-eslint-rules/dist/rules/terComputedPropertySpacingRule.js b/node_modules/tslint-eslint-rules/dist/rules/terComputedPropertySpacingRule.js new file mode 100644 index 000000000..6fb0630fa --- /dev/null +++ b/node_modules/tslint-eslint-rules/dist/rules/terComputedPropertySpacingRule.js @@ -0,0 +1,123 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +var tslib_1 = require("tslib"); +var ts = require("typescript"); +var Lint = require("tslint"); +var RULE_NAME = 'ter-computed-property-spacing'; +var ALWAYS_BEFORE_MESSAGE = "A space is required before ']'."; +var ALWAYS_AFTER_MESSAGE = "A space is required after '['."; +var NEVER_BEFORE_MESSAGE = "There should be no space before ']'."; +var NEVER_AFTER_MESSAGE = "There should be no space after '['."; +var Rule = (function (_super) { + tslib_1.__extends(Rule, _super); + function Rule() { + return _super !== null && _super.apply(this, arguments) || this; + } + Rule.prototype.formatOptions = function (_a) { + var alwaysOrNever = _a[0]; + return { + always: alwaysOrNever === 'always' + }; + }; + Rule.prototype.apply = function (sourceFile) { + var opt = this.formatOptions(this.ruleArguments); + var walker = new RuleWalker(sourceFile, this.ruleName, opt); + return this.applyWithWalker(walker); + }; + Rule.metadata = { + ruleName: RULE_NAME, + hasFix: true, + description: 'require or disallow padding inside computed properties', + rationale: Lint.Utils.dedent(templateObject_1 || (templateObject_1 = tslib_1.__makeTemplateObject(["\n While formatting preferences are very personal, a number of style guides require or disallow spaces between computed properties in the following situations:\n "], ["\n While formatting preferences are very personal, a number of style guides require or disallow spaces between computed properties in the following situations:\n "]))), + optionsDescription: Lint.Utils.dedent(templateObject_2 || (templateObject_2 = tslib_1.__makeTemplateObject(["\n The rule takes in one option, which defines to require or forbid whitespace.\n\n * `\"never\"` (default) disallows spaces inside computed property brackets\n * `\"always\"` requires one or more spaces inside computed property brackets\n "], ["\n The rule takes in one option, which defines to require or forbid whitespace.\n\n * \\`\"never\"\\` (default) disallows spaces inside computed property brackets\n * \\`\"always\"\\` requires one or more spaces inside computed property brackets\n "]))), + options: { + type: 'array', + items: [{ + enum: ['always', 'never'] + }], + maxLength: 1 + }, + optionExamples: [ + Lint.Utils.dedent(templateObject_3 || (templateObject_3 = tslib_1.__makeTemplateObject(["\n \"", "\": [true]\n "], ["\n \"", "\": [true]\n "])), RULE_NAME), + Lint.Utils.dedent(templateObject_4 || (templateObject_4 = tslib_1.__makeTemplateObject(["\n \"", "\": [true, \"always\"]\n "], ["\n \"", "\": [true, \"always\"]\n "])), RULE_NAME), + Lint.Utils.dedent(templateObject_5 || (templateObject_5 = tslib_1.__makeTemplateObject(["\n \"", "\": [true, \"never\"]\n "], ["\n \"", "\": [true, \"never\"]\n "])), RULE_NAME) + ], + typescriptOnly: false, + type: 'style' + }; + return Rule; +}(Lint.Rules.AbstractRule)); +exports.Rule = Rule; +var RuleWalker = (function (_super) { + tslib_1.__extends(RuleWalker, _super); + function RuleWalker() { + return _super !== null && _super.apply(this, arguments) || this; + } + RuleWalker.prototype.walk = function (sourceFile) { + var _this = this; + var cb = function (node) { + if (node.kind === ts.SyntaxKind.ElementAccessExpression) { + _this.checkNode(node, node.getChildAt(1), node.getChildAt(3)); + } + else if (node.kind === ts.SyntaxKind.ComputedPropertyName) { + _this.checkNode(node, node.getChildAt(0), node.getChildAt(2)); + } + ts.forEachChild(node, cb); + }; + ts.forEachChild(sourceFile, cb); + }; + RuleWalker.prototype.checkNode = function (node, leftBracketNode, rightBracketNode) { + var nodeText = node.getText(); + var regex = /\[([\s\S]*)\]/; + var match = regex.exec(nodeText); + if (!match) { + return; + } + var contentWithinBrackets = match[1]; + if (this.options.always) { + var beforeWhitespaceLength = this.getBeforeWhitespaceLength(contentWithinBrackets, true); + var afterWhitespaceLength = this.getAfterWhitespaceLength(contentWithinBrackets, true); + if (beforeWhitespaceLength === 0) { + this.addFailureAtNode(leftBracketNode, ALWAYS_AFTER_MESSAGE, Lint.Replacement.appendText(leftBracketNode.getEnd(), ' ')); + } + if (afterWhitespaceLength === 0) { + this.addFailureAtNode(rightBracketNode, ALWAYS_BEFORE_MESSAGE, Lint.Replacement.appendText(rightBracketNode.getStart(), ' ')); + } + } + else { + var contentWithinBracketsNoNewlines = contentWithinBrackets.replace('\n', ''); + var beforeWhitespaceLength = this.getBeforeWhitespaceLength(contentWithinBracketsNoNewlines, false); + var afterWhitespaceLength = this.getAfterWhitespaceLength(contentWithinBracketsNoNewlines, false); + if (beforeWhitespaceLength !== 0) { + this.addFailureAtNode(leftBracketNode, NEVER_AFTER_MESSAGE, Lint.Replacement.deleteText(leftBracketNode.getEnd(), beforeWhitespaceLength)); + } + if (afterWhitespaceLength !== 0) { + this.addFailureAtNode(rightBracketNode, NEVER_BEFORE_MESSAGE, Lint.Replacement.deleteText(rightBracketNode.getStart() - afterWhitespaceLength, afterWhitespaceLength)); + } + } + }; + RuleWalker.prototype.getBeforeWhitespaceLength = function (content, newlinesCountAsWhitespace) { + var regex = newlinesCountAsWhitespace ? /^\s+/ : /^[^\S\n]+/; + var match = regex.exec(content); + if (match) { + return match[0].length; + } + else { + return 0; + } + }; + RuleWalker.prototype.getAfterWhitespaceLength = function (content, newlinesCountAsWhitespace) { + var regex = newlinesCountAsWhitespace ? /\s+$/ : /[^\S\n]+$/; + var match = regex.exec(content); + if (match) { + return match[0].length; + } + else { + return 0; + } + }; + return RuleWalker; +}(Lint.AbstractWalker)); +var templateObject_1, templateObject_2, templateObject_3, templateObject_4, templateObject_5; + +//# sourceMappingURL=data:application/json;charset=utf8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInJ1bGVzL3RlckNvbXB1dGVkUHJvcGVydHlTcGFjaW5nUnVsZS50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7QUFBQSwrQkFBaUM7QUFDakMsNkJBQStCO0FBRS9CLElBQU0sU0FBUyxHQUFHLCtCQUErQixDQUFDO0FBS2xELElBQU0scUJBQXFCLEdBQUcsaUNBQWlDLENBQUM7QUFDaEUsSUFBTSxvQkFBb0IsR0FBRyxnQ0FBZ0MsQ0FBQztBQUM5RCxJQUFNLG9CQUFvQixHQUFHLHNDQUFzQyxDQUFDO0FBQ3BFLElBQU0sbUJBQW1CLEdBQUcscUNBQXFDLENB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UUFDL0QsSUFBTSxLQUFLLEdBQUcsS0FBSyxDQUFDLElBQUksQ0FBQyxPQUFPLENBQUMsQ0FBQztRQUVsQyxJQUFJLEtBQUssRUFBRTtZQUNULE9BQU8sS0FBSyxDQUFDLENBQUMsQ0FBQyxDQUFDLE1BQU0sQ0FBQztTQUN4QjthQUFNO1lBQ0wsT0FBTyxDQUFDLENBQUM7U0FDVjtJQUNILENBQUM7SUFFTyw2Q0FBd0IsR0FBaEMsVUFBaUMsT0FBZSxFQUFFLHlCQUFrQztRQUNsRixJQUFNLEtBQUssR0FBRyx5QkFBeUIsQ0FBQyxDQUFDLENBQUMsTUFBTSxDQUFDLENBQUMsQ0FBQyxXQUFXLENBQUM7UUFDL0QsSUFBTSxLQUFLLEdBQUcsS0FBSyxDQUFDLElBQUksQ0FBQyxPQUFPLENBQUMsQ0FBQztRQUVsQyxJQUFJLEtBQUssRUFBRTtZQUNULE9BQU8sS0FBSyxDQUFDLENBQUMsQ0FBQyxDQUFDLE1BQU0sQ0FBQztTQUN4QjthQUFNO1lBQ0wsT0FBTyxDQUFDLENBQUM7U0FDVjtJQUNILENBQUM7SUFDSCxpQkFBQztBQUFELENBcEZBLEFBb0ZDLENBcEZ3QixJQUFJLENBQUMsY0FBYyxHQW9GM0MiLCJmaWxlIjoicnVsZXMvdGVyQ29tcHV0ZWRQcm9wZXJ0eVNwYWNpbmdSdWxlLmpzIiwic291cmNlUm9vdCI6Ii9Vc2Vycy9qbWxvcGV6L3RzbGludC1lc2xpbnQtcnVsZXMvc3JjIn0= diff --git a/node_modules/tslint-eslint-rules/dist/rules/terFuncCallSpacingRule.js b/node_modules/tslint-eslint-rules/dist/rules/terFuncCallSpacingRule.js new file mode 100644 index 000000000..4e8ff7145 --- /dev/null +++ b/node_modules/tslint-eslint-rules/dist/rules/terFuncCallSpacingRule.js @@ -0,0 +1,137 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +var tslib_1 = require("tslib"); +var ts = require("typescript"); +var Lint = require("tslint"); +var RULE_NAME = 'ter-func-call-spacing'; +var ALWAYS = 'always'; +var MISSING_SPACE = 'Missing space between function name and paren.'; +var UNEXPECTED_SPACE = 'Unexpected space between function name and paren.'; +var UNEXPECTED_NEWLINE = 'Unexpected newline between function name and paren.'; +var Rule = (function (_super) { + tslib_1.__extends(Rule, _super); + function Rule() { + return _super !== null && _super.apply(this, arguments) || this; + } + Rule.prototype.apply = function (sourceFile) { + var options = { + expectSpace: false, + spacePattern: /\s/ + }; + var userOptions = this.getOptions().ruleArguments; + if (userOptions[0] === ALWAYS) { + options.expectSpace = true; + if (userOptions[1] !== undefined && userOptions[1].allowNewlines) { + options.spacePattern = /[ \t\r\n\u2028\u2029]/; + } + else { + options.spacePattern = /[ \t]/; + } + } + var walker = new RuleWalker(sourceFile, RULE_NAME, options); + return this.applyWithWalker(walker); + }; + Rule.metadata = { + ruleName: RULE_NAME, + hasFix: true, + description: 'require or disallow spacing between function identifiers and their invocations', + rationale: Lint.Utils.dedent(templateObject_1 || (templateObject_1 = tslib_1.__makeTemplateObject(["\n This rule will enforce consistency of spacing in function calls,\n by disallowing or requiring one or more spaces before the open paren.\n "], ["\n This rule will enforce consistency of spacing in function calls,\n by disallowing or requiring one or more spaces before the open paren.\n "]))), + optionsDescription: Lint.Utils.dedent(templateObject_2 || (templateObject_2 = tslib_1.__makeTemplateObject(["\n This rule has a string option:\n\n * `\"never\"` (default) disallows space between the function name and the opening parenthesis.\n * `\"always\"` requires space between the function name and the opening parenthesis.\n\n Further, in `\"always\"` mode, a second object option is available that contains a single boolean `allowNewlines` property.\n "], ["\n This rule has a string option:\n\n * \\`\"never\"\\` (default) disallows space between the function name and the opening parenthesis.\n * \\`\"always\"\\` requires space between the function name and the opening parenthesis.\n\n Further, in \\`\"always\"\\` mode, a second object option is available that contains a single boolean \\`allowNewlines\\` property.\n "]))), + options: { + type: 'array', + items: [ + { + enum: ['always', 'never'] + }, + { + type: 'object', + properties: { + allowNewlines: { + type: 'boolean' + } + }, + additionalProperties: false + } + ], + minItems: 0, + maxItems: 2 + }, + optionExamples: [ + Lint.Utils.dedent(templateObject_3 || (templateObject_3 = tslib_1.__makeTemplateObject(["\n \"", "\": [true]\n "], ["\n \"", "\": [true]\n "])), RULE_NAME), + Lint.Utils.dedent(templateObject_4 || (templateObject_4 = tslib_1.__makeTemplateObject(["\n \"", "\": [true, \"always\"]\n "], ["\n \"", "\": [true, \"always\"]\n "])), RULE_NAME), + Lint.Utils.dedent(templateObject_5 || (templateObject_5 = tslib_1.__makeTemplateObject(["\n \"", "\": [true, \"always\", { allowNewlines: true }]\n "], ["\n \"", "\": [true, \"always\", { allowNewlines: true }]\n "])), RULE_NAME) + ], + typescriptOnly: false, + type: 'style' + }; + return Rule; +}(Lint.Rules.AbstractRule)); +exports.Rule = Rule; +var RuleWalker = (function (_super) { + tslib_1.__extends(RuleWalker, _super); + function RuleWalker(sourceFile, ruleName, options) { + var _this = _super.call(this, sourceFile, ruleName, options) || this; + _this.sourceText = sourceFile.getFullText(); + return _this; + } + RuleWalker.prototype.walk = function (sourceFile) { + var _this = this; + var cb = function (node) { + if (node.kind === ts.SyntaxKind.NewExpression) { + _this.visitNewExpression(node); + } + else if (node.kind === ts.SyntaxKind.CallExpression) { + _this.visitCallExpression(node); + } + else if (node.kind >= ts.SyntaxKind.FirstTypeNode && node.kind <= ts.SyntaxKind.LastTypeNode) { + return; + } + return ts.forEachChild(node, cb); + }; + return ts.forEachChild(sourceFile, cb); + }; + RuleWalker.prototype.visitNewExpression = function (node) { + this.checkWhitespaceAfterExpression(node.expression, node.typeArguments, node.arguments); + }; + RuleWalker.prototype.visitCallExpression = function (node) { + this.checkWhitespaceAfterExpression(node.expression, node.typeArguments, node.arguments); + }; + RuleWalker.prototype.checkWhitespaceAfterExpression = function (expression, typeArguments, funcArguments) { + if (funcArguments !== undefined) { + var start = void 0; + if (typeArguments !== undefined) { + start = typeArguments.end + 1; + } + else { + start = expression.getEnd(); + } + this.checkWhitespaceBetween(start, funcArguments.pos - 1); + } + }; + RuleWalker.prototype.checkWhitespaceBetween = function (start, end) { + var whitespace = this.sourceText.substring(start, end); + if (this.options.spacePattern.test(whitespace)) { + if (!this.options.expectSpace) { + var fix = Lint.Replacement.deleteText(start, whitespace.length); + var failureMessage = this.failureMessageForUnexpectedWhitespace(whitespace); + this.addFailureAt(start, whitespace.length, failureMessage, fix); + } + } + else if (this.options.expectSpace) { + var fix = Lint.Replacement.appendText(start, ' '); + this.addFailureAt(start, 1, MISSING_SPACE, fix); + } + }; + RuleWalker.prototype.failureMessageForUnexpectedWhitespace = function (whitespace) { + if (/[\r\n]/.test(whitespace)) { + return UNEXPECTED_NEWLINE; + } + else { + return UNEXPECTED_SPACE; + } + }; + return RuleWalker; +}(Lint.AbstractWalker)); +var templateObject_1, templateObject_2, templateObject_3, templateObject_4, templateObject_5; + +//# sourceMappingURL=data:application/json;charset=utf8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInJ1bGVzL3RlckZ1bmNDYWxsU3BhY2luZ1J1bGUudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7O0FBQUEsK0JBQWlDO0FBQ2pDLDZCQUErQjtBQUUvQixJQUFNLFNBQVMsR0FBRyx1QkFBdUIsQ0FBQztBQUMxQyxJQUFNLE1BQU0sR0FBRyxRQUFRLENBQUM7QUFFeEIsSUFBTSxhQUFhLEdBQUcsZ0RBQWdELENBQUM7QUFDdkUsSUFBTSxnQkFBZ0IsR0FBRyxtREFBbUQsQ0FBQztBQUM3RSxJQUFNLGtCQUFrQixHQUFHLHFEQUFxRCxDQUFDO0FBT2pGO0lBQTBCLGdDQUF1QjtJQUFqRDs7SUF1RUEsQ0FBQztJQXBCUSxvQkFBSyxHQUFaLFVBQWEsVUFBeUI7UUFDcEMsSUFBTSxPQUFPLEdBQUc7WUFDZCxXQUFXLEVBQUUsS0FBSztZQUNsQixZQUFZLEVBQUUsSUFBSTtTQUNuQixDQUFDO1FBRUYsSUFBSSxXQUF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BQyxDQUFDO1lBQ3BELElBQUksQ0FBQyxZQUFZLENBQUMsS0FBSyxFQUFFLENBQUMsRUFBRSxhQUFhLEVBQUUsR0FBRyxDQUFDLENBQUM7U0FDakQ7SUFDSCxDQUFDO0lBRU8sMERBQXFDLEdBQTdDLFVBQThDLFVBQWtCO1FBQzlELElBQUksUUFBUSxDQUFDLElBQUksQ0FBQyxVQUFVLENBQUMsRUFBRTtZQUM3QixPQUFPLGtCQUFrQixDQUFDO1NBQzNCO2FBQ0k7WUFDSCxPQUFPLGdCQUFnQixDQUFDO1NBQ3pCO0lBQ0gsQ0FBQztJQUNILGlCQUFDO0FBQUQsQ0F2RUEsQUF1RUMsQ0F2RXdCLElBQUksQ0FBQyxjQUFjLEdBdUUzQyIsImZpbGUiOiJydWxlcy90ZXJGdW5jQ2FsbFNwYWNpbmdSdWxlLmpzIiwic291cmNlUm9vdCI6Ii9Vc2Vycy9qbWxvcGV6L3RzbGludC1lc2xpbnQtcnVsZXMvc3JjIn0= diff --git a/node_modules/tslint-eslint-rules/dist/rules/terIndentRule.js b/node_modules/tslint-eslint-rules/dist/rules/terIndentRule.js new file mode 100644 index 000000000..7fd4bdede --- /dev/null +++ b/node_modules/tslint-eslint-rules/dist/rules/terIndentRule.js @@ -0,0 +1,915 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +var tslib_1 = require("tslib"); +var ts = require("typescript"); +var Lint = require("tslint"); +var RULE_NAME = 'ter-indent'; +var DEFAULT_VARIABLE_INDENT = 1; +var DEFAULT_PARAMETER_INDENT = null; +var DEFAULT_FUNCTION_BODY_INDENT = 1; +var indentType = 'space'; +var indentSize = 4; +var OPTIONS; +function assign(target) { + var sources = []; + for (var _i = 1; _i < arguments.length; _i++) { + sources[_i - 1] = arguments[_i]; + } + sources.forEach(function (source) { + if (source !== undefined && source !== null) { + for (var nextKey in source) { + if (source.hasOwnProperty(nextKey)) { + target[nextKey] = source[nextKey]; + } + } + } + }); + return target; +} +function isKind(node, kind) { + return node.kind === ts.SyntaxKind[kind]; +} +function isOneOf(node, kinds) { + return kinds.some(function (kind) { return node.kind === ts.SyntaxKind[kind]; }); +} +var Rule = (function (_super) { + tslib_1.__extends(Rule, _super); + function Rule() { + return _super !== null && _super.apply(this, arguments) || this; + } + Rule.prototype.apply = function (sourceFile) { + var walker = new IndentWalker(sourceFile, this.getOptions()); + return this.applyWithWalker(walker); + }; + Rule.metadata = { + ruleName: RULE_NAME, + hasFix: true, + description: 'enforce consistent indentation', + rationale: Lint.Utils.dedent(templateObject_1 || (templateObject_1 = tslib_1.__makeTemplateObject(["\n Using only one of tabs or spaces for indentation leads to more consistent editor behavior,\n cleaner diffs in version control, and easier programmatic manipulation.\n "], ["\n Using only one of tabs or spaces for indentation leads to more consistent editor behavior,\n cleaner diffs in version control, and easier programmatic manipulation.\n "]))), + optionsDescription: Lint.Utils.dedent(templateObject_2 || (templateObject_2 = tslib_1.__makeTemplateObject(["\n The string 'tab' or an integer indicating the number of spaces to use per tab.\n\n An object may be provided to fine tune the indentation rules:\n\n * `\"SwitchCase\"` (default: 0) enforces indentation level for `case` clauses in\n `switch` statements\n * `\"VariableDeclarator\"` (default: 1) enforces indentation level for `var` declarators;\n can also take an object to define separate rules for `var`,\n `let` and `const` declarations.\n * `\"outerIIFEBody\"` (default: 1) enforces indentation level for file-level IIFEs.\n * `\"MemberExpression\"` (off by default) enforces indentation level for multi-line\n property chains (except in variable declarations and assignments)\n * `\"FunctionDeclaration\"` takes an object to define rules for function declarations.\n * `\"parameters\"` (off by default) enforces indentation level for parameters in a\n function declaration. This can either be a number indicating\n indentation level, or the string `\"first\"` indicating that all\n parameters of the declaration must be aligned with the first parameter.\n * `\"body\"` (default: 1) enforces indentation level for the body of a function expression.\n * `\"FunctionExpression\"` takes an object to define rules for function declarations.\n * `\"parameters\"` (off by default) enforces indentation level for parameters in a\n function declaration. This can either be a number indicating\n indentation level, or the string `\"first\"` indicating that all\n parameters of the declaration must be aligned with the first parameter.\n * `\"body\"` (default: 1) enforces indentation level for the body of a function expression.\n * `\"CallExpression\"` takes an object to define rules for function call expressions.\n * `\"arguments\"` (off by default) enforces indentation level for arguments in a call\n expression. This can either be a number indicating indentation level,\n or the string `\"first\"` indicating that all arguments of the\n expression must be aligned with the first argument.\n "], ["\n The string 'tab' or an integer indicating the number of spaces to use per tab.\n\n An object may be provided to fine tune the indentation rules:\n\n * \\`\"SwitchCase\"\\` (default: 0) enforces indentation level for \\`case\\` clauses in\n \\`switch\\` statements\n * \\`\"VariableDeclarator\"\\` (default: 1) enforces indentation level for \\`var\\` declarators;\n can also take an object to define separate rules for \\`var\\`,\n \\`let\\` and \\`const\\` declarations.\n * \\`\"outerIIFEBody\"\\` (default: 1) enforces indentation level for file-level IIFEs.\n * \\`\"MemberExpression\"\\` (off by default) enforces indentation level for multi-line\n property chains (except in variable declarations and assignments)\n * \\`\"FunctionDeclaration\"\\` takes an object to define rules for function declarations.\n * \\`\"parameters\"\\` (off by default) enforces indentation level for parameters in a\n function declaration. This can either be a number indicating\n indentation level, or the string \\`\"first\"\\` indicating that all\n parameters of the declaration must be aligned with the first parameter.\n * \\`\"body\"\\` (default: 1) enforces indentation level for the body of a function expression.\n * \\`\"FunctionExpression\"\\` takes an object to define rules for function declarations.\n * \\`\"parameters\"\\` (off by default) enforces indentation level for parameters in a\n function declaration. This can either be a number indicating\n indentation level, or the string \\`\"first\"\\` indicating that all\n parameters of the declaration must be aligned with the first parameter.\n * \\`\"body\"\\` (default: 1) enforces indentation level for the body of a function expression.\n * \\`\"CallExpression\"\\` takes an object to define rules for function call expressions.\n * \\`\"arguments\"\\` (off by default) enforces indentation level for arguments in a call\n expression. This can either be a number indicating indentation level,\n or the string \\`\"first\"\\` indicating that all arguments of the\n expression must be aligned with the first argument.\n "]))), + options: { + type: 'array', + items: [{ + type: 'number', + minimum: '0' + }, { + type: 'string', + enum: ['tab'] + }, { + type: 'object', + properties: { + SwitchCase: { + type: 'number', + minimum: 0 + }, + VariableDeclarator: { + type: 'object', + properties: { + var: { + type: 'number', + minimum: 0 + }, + let: { + type: 'number', + minimum: 0 + }, + const: { + type: 'number', + minimum: 0 + } + } + }, + outerIIFEBody: { + type: 'number' + }, + FunctionDeclaration: { + type: 'object', + properties: { + parameters: { + type: 'number', + minimum: 0 + }, + body: { + type: 'number', + minimum: 0 + } + } + }, + FunctionExpression: { + type: 'object', + properties: { + parameters: { + type: 'number', + minimum: 0 + }, + body: { + type: 'number', + minimum: 0 + } + } + }, + MemberExpression: { + type: 'number' + }, + CallExpression: { + type: 'object', + properties: { + arguments: { + type: 'number', + minimum: 0 + } + } + } + }, + additionalProperties: false + }], + minLength: 1, + maxLength: 2 + }, + optionExamples: [ + Lint.Utils.dedent(templateObject_3 || (templateObject_3 = tslib_1.__makeTemplateObject(["\n \"", "\": [true, \"tab\"]\n "], ["\n \"", "\": [true, \"tab\"]\n "])), RULE_NAME), + Lint.Utils.dedent(templateObject_4 || (templateObject_4 = tslib_1.__makeTemplateObject(["\n \"", "\": [true, 2]\n "], ["\n \"", "\": [true, 2]\n "])), RULE_NAME), + Lint.Utils.dedent(templateObject_5 || (templateObject_5 = tslib_1.__makeTemplateObject(["\n \"", "\": [\n true,\n 2,\n {\n \"FunctionExpression\": {\n \"parameters\": 1,\n \"body\": 1\n }\n }\n ]\n "], ["\n \"", "\": [\n true,\n 2,\n {\n \"FunctionExpression\": {\n \"parameters\": 1,\n \"body\": 1\n }\n }\n ]\n "])), RULE_NAME) + ], + typescriptOnly: false, + type: 'maintainability' + }; + return Rule; +}(Lint.Rules.AbstractRule)); +exports.Rule = Rule; +var IndentWalker = (function (_super) { + tslib_1.__extends(IndentWalker, _super); + function IndentWalker(sourceFile, options) { + var _this = _super.call(this, sourceFile, options) || this; + _this.caseIndentStore = {}; + _this.varIndentStore = {}; + OPTIONS = { + SwitchCase: 0, + VariableDeclarator: { + var: DEFAULT_VARIABLE_INDENT, + let: DEFAULT_VARIABLE_INDENT, + const: DEFAULT_VARIABLE_INDENT + }, + outerIIFEBody: null, + FunctionDeclaration: { + parameters: DEFAULT_PARAMETER_INDENT, + body: DEFAULT_FUNCTION_BODY_INDENT + }, + FunctionExpression: { + parameters: DEFAULT_PARAMETER_INDENT, + body: DEFAULT_FUNCTION_BODY_INDENT + }, + CallExpression: { + arguments: DEFAULT_PARAMETER_INDENT + } + }; + var firstParam = _this.getOptions()[0]; + if (firstParam === 'tab') { + indentSize = 1; + indentType = 'tab'; + } + else { + indentSize = firstParam || 4; + indentType = 'space'; + } + var userOptions = _this.getOptions()[1]; + if (userOptions) { + OPTIONS.SwitchCase = userOptions.SwitchCase || 0; + if (typeof userOptions.VariableDeclarator === 'number') { + OPTIONS.VariableDeclarator = { + var: userOptions.VariableDeclarator, + let: userOptions.VariableDeclarator, + const: userOptions.VariableDeclarator + }; + } + else if (typeof userOptions.VariableDeclarator === 'object') { + assign(OPTIONS.VariableDeclarator, userOptions.VariableDeclarator); + } + if (typeof userOptions.outerIIFEBody === 'number') { + OPTIONS.outerIIFEBody = userOptions.outerIIFEBody; + } + if (typeof userOptions.MemberExpression === 'number') { + OPTIONS.MemberExpression = userOptions.MemberExpression; + } + if (typeof userOptions.FunctionDeclaration === 'object') { + assign(OPTIONS.FunctionDeclaration, userOptions.FunctionDeclaration); + } + if (typeof userOptions.FunctionExpression === 'object') { + assign(OPTIONS.FunctionExpression, userOptions.FunctionExpression); + } + if (typeof userOptions.CallExpression === 'object') { + assign(OPTIONS.CallExpression, userOptions.CallExpression); + } + } + _this.srcFile = sourceFile; + _this.srcText = sourceFile.getFullText(); + return _this; + } + IndentWalker.prototype.getSourceSubstr = function (start, end) { + return this.srcText.substr(start, end - start); + }; + IndentWalker.prototype.getLineAndCharacter = function (node, byEndLocation) { + if (byEndLocation === void 0) { byEndLocation = false; } + var index = byEndLocation ? node.getEnd() : node.getStart(); + return this.srcFile.getLineAndCharacterOfPosition(index); + }; + IndentWalker.prototype.getLine = function (node, byEndLocation) { + if (byEndLocation === void 0) { byEndLocation = false; } + return this.getLineAndCharacter(node, byEndLocation).line; + }; + IndentWalker.prototype.createErrorMessage = function (expectedAmount, actualSpaces, actualTabs) { + var expectedStatement = expectedAmount + " " + indentType + (expectedAmount === 1 ? '' : 's'); + var foundSpacesWord = "space" + (actualSpaces === 1 ? '' : 's'); + var foundTabsWord = "tab" + (actualTabs === 1 ? '' : 's'); + var foundStatement; + if (actualSpaces > 0 && actualTabs > 0) { + foundStatement = actualSpaces + " " + foundSpacesWord + " and " + actualTabs + " " + foundTabsWord; + } + else if (actualSpaces > 0) { + foundStatement = indentType === 'space' ? actualSpaces : actualSpaces + " " + foundSpacesWord; + } + else if (actualTabs > 0) { + foundStatement = indentType === 'tab' ? actualTabs : actualTabs + " " + foundTabsWord; + } + else { + foundStatement = '0'; + } + return "Expected indentation of " + expectedStatement + " but found " + foundStatement + "."; + }; + IndentWalker.prototype.report = function (node, needed, gottenSpaces, gottenTabs, loc) { + if (gottenSpaces && gottenTabs) { + return; + } + var msg = this.createErrorMessage(needed, gottenSpaces, gottenTabs); + var width = gottenSpaces + gottenTabs; + var start = (loc !== undefined ? loc : node.getStart()) - width; + var desiredIndent = (indentType === 'space' ? ' ' : '\t').repeat(needed); + var fix = this.createReplacement(start, width, desiredIndent); + this.addFailure(this.createFailure(start, width, msg, fix)); + }; + IndentWalker.prototype.isNodeFirstInLine = function (node, byEndLocation) { + if (byEndLocation === void 0) { byEndLocation = false; } + var token = byEndLocation ? node.getLastToken() : node.getFirstToken(); + var pos = token.getStart() - 1; + while ([' ', '\t'].indexOf(this.srcText.charAt(pos)) !== -1) { + pos -= 1; + } + return this.srcText.charAt(pos) === '\n' || this._firstInLineCommentHelper(node); + }; + IndentWalker.prototype._firstInLineCommentHelper = function (node) { + var pos; + var firstInLine = false; + var comments = ts.getLeadingCommentRanges(node.getFullText(), 0); + if (comments && comments.length) { + var offset = node.getFullStart(); + var lastComment = comments[comments.length - 1]; + var comment = this.getSourceSubstr(lastComment.pos + offset, lastComment.end + offset); + if (comment.indexOf('\n') !== -1) { + firstInLine = true; + } + else { + pos = lastComment.pos + offset; + while (pos > 0 && this.srcText.charAt(pos) !== '\n') { + pos -= 1; + } + var content = this.getSourceSubstr(pos + 1, lastComment.pos + offset); + if (content.trim() === '') { + firstInLine = true; + } + } + } + return firstInLine; + }; + IndentWalker.prototype.getNodeIndent = function (node) { + if (node === this.getSourceFile()) { + return { contentStart: 0, firstInLine: true, space: 0, tab: 0, goodChar: 0, badChar: 0 }; + } + if (node.kind === ts.SyntaxKind.SyntaxList && node.parent) { + return this.getNodeIndent(node.parent); + } + var endIndex = node.getStart(this.srcFile); + var pos = endIndex - 1; + while (pos > 0 && this.srcText.charAt(pos) !== '\n') { + pos -= 1; + } + var str = this.getSourceSubstr(pos + 1, endIndex); + var whiteSpace = (str.match(/^\s+/) || [''])[0]; + var indentChars = whiteSpace.split(''); + var spaces = indentChars.filter(function (char) { return char === ' '; }).length; + var tabs = indentChars.filter(function (char) { return char === '\t'; }).length; + return { + contentStart: pos + spaces + tabs + 1, + firstInLine: spaces + tabs === str.length || this._firstInLineCommentHelper(node), + space: spaces, + tab: tabs, + goodChar: indentType === 'space' ? spaces : tabs, + badChar: indentType === 'space' ? tabs : spaces + }; + }; + IndentWalker.prototype.checkNodeIndent = function (node, neededIndent) { + var actualIndent = this.getNodeIndent(node); + if (!isKind(node, 'ArrayLiteralExpression') && + !isKind(node, 'ObjectLiteralExpression') && + (actualIndent.goodChar !== neededIndent || actualIndent.badChar !== 0) && + actualIndent.firstInLine) { + this.report(node, neededIndent, actualIndent.space, actualIndent.tab, actualIndent.contentStart); + } + if (isKind(node, 'IfStatement')) { + var elseStatement = node.elseStatement; + if (elseStatement) { + var elseKeyword = node.getChildren().filter(function (ch) { return isKind(ch, 'ElseKeyword'); }).shift(); + this.checkNodeIndent(elseKeyword, neededIndent); + if (!this.isNodeFirstInLine(elseStatement)) { + this.checkNodeIndent(elseStatement, neededIndent); + } + } + } + else if (isKind(node, 'TryStatement')) { + var handler = node.catchClause; + if (handler) { + var catchKeyword = handler.getChildren().filter(function (ch) { return isKind(ch, 'CatchKeyword'); }).shift(); + this.checkNodeIndent(catchKeyword, neededIndent); + if (!this.isNodeFirstInLine(handler)) { + this.checkNodeIndent(handler, neededIndent); + } + } + var finalizer = node.finallyBlock; + if (finalizer) { + var finallyKeyword = node.getChildren().filter(function (ch) { return isKind(ch, 'FinallyKeyword'); }).shift(); + this.checkNodeIndent(finallyKeyword, neededIndent); + } + } + else if (isKind(node, 'DoStatement')) { + var whileKeyword = node.getChildren().filter(function (ch) { return isKind(ch, 'WhileKeyword'); }).shift(); + this.checkNodeIndent(whileKeyword, neededIndent); + } + }; + IndentWalker.prototype.isSingleLineNode = function (node) { + var text = node.kind === ts.SyntaxKind.SyntaxList ? node.getFullText() : node.getText(); + return text.indexOf('\n') === -1; + }; + IndentWalker.prototype.blockIndentationCheck = function (node) { + if (this.isSingleLineNode(node)) { + return; + } + var functionLike = [ + 'FunctionExpression', + 'FunctionDeclaration', + 'MethodDeclaration', + 'Constructor', + 'ArrowFunction' + ]; + if (node.parent && isOneOf(node.parent, functionLike)) { + this.checkIndentInFunctionBlock(node); + return; + } + var indent; + var nodesToCheck = []; + var statementsWithProperties = [ + 'IfStatement', + 'WhileStatement', + 'ForStatement', + 'ForInStatement', + 'ForOfStatement', + 'DoStatement', + 'ClassDeclaration', + 'ClassExpression', + 'InterfaceDeclaration', + 'TypeLiteral', + 'TryStatement', + 'SourceFile' + ]; + if (node.parent && isOneOf(node.parent, statementsWithProperties) && this.isNodeBodyBlock(node)) { + indent = this.getNodeIndent(node.parent).goodChar; + } + else if (node.parent && isKind(node.parent, 'CatchClause')) { + indent = this.getNodeIndent(node.parent.parent).goodChar; + } + else { + indent = this.getNodeIndent(node).goodChar; + } + if (isKind(node, 'IfStatement') && !isKind(node.thenStatement, 'Block')) { + nodesToCheck = [node.thenStatement]; + } + else { + if (isKind(node, 'Block')) { + nodesToCheck = node.getChildren()[1].getChildren(); + } + else if (node.parent && + isOneOf(node.parent, [ + 'ClassDeclaration', + 'ClassExpression', + 'InterfaceDeclaration', + 'TypeLiteral' + ])) { + nodesToCheck = node.getChildren(); + } + else { + nodesToCheck = [node.statement]; + } + } + this.checkNodeIndent(node, indent); + if (nodesToCheck.length > 0) { + this.checkNodesIndent(nodesToCheck, indent + indentSize); + } + if (isKind(node, 'Block')) { + this.checkLastNodeLineIndent(node, indent); + } + else if (node.parent && this.isNodeBodyBlock(node)) { + this.checkLastNodeLineIndent(node.parent, indent); + } + }; + IndentWalker.prototype.isAssignment = function (node) { + if (!isKind(node, 'BinaryExpression')) { + return false; + } + return node.operatorToken.getText() === '='; + }; + IndentWalker.prototype.isNodeBodyBlock = function (node) { + var hasBlock = [ + 'ClassDeclaration', + 'ClassExpression', + 'InterfaceDeclaration', + 'TypeLiteral' + ]; + return isKind(node, 'Block') || (isKind(node, 'SyntaxList') && + isOneOf(node.parent, hasBlock)); + }; + IndentWalker.prototype.checkFirstNodeLineIndent = function (node, firstLineIndent) { + var startIndent = this.getNodeIndent(node); + var firstInLine = startIndent.firstInLine; + if (firstInLine && (startIndent.goodChar !== firstLineIndent || startIndent.badChar !== 0)) { + this.report(node, firstLineIndent, startIndent.space, startIndent.tab, startIndent.contentStart); + } + }; + IndentWalker.prototype.checkLastNodeLineIndent = function (node, lastLineIndent) { + var lastToken = node.getLastToken(); + var endIndent = this.getNodeIndent(lastToken); + var firstInLine = endIndent.firstInLine; + if (firstInLine && (endIndent.goodChar !== lastLineIndent || endIndent.badChar !== 0)) { + this.report(lastToken, lastLineIndent, endIndent.space, endIndent.tab); + } + }; + IndentWalker.prototype.isOuterIIFE = function (node) { + if (!node.parent) + return false; + var parent = node.parent; + var expressionIsNode = parent.expression !== node; + if (isKind(parent, 'ParenthesizedExpression')) { + parent = parent.parent; + } + if (!isKind(parent, 'CallExpression') || expressionIsNode) { + return false; + } + var stmt = parent; + var condition; + do { + stmt = stmt.parent; + condition = (isKind(stmt, 'PrefixUnaryExpression') && (stmt.operator === ts.SyntaxKind.ExclamationToken || + stmt.operator === ts.SyntaxKind.TildeToken || + stmt.operator === ts.SyntaxKind.PlusToken || + stmt.operator === ts.SyntaxKind.MinusToken) || + isKind(stmt, 'BinaryExpression') || + isKind(stmt, 'SyntaxList') || + isKind(stmt, 'VariableDeclaration') || + isKind(stmt, 'VariableDeclarationList') || + isKind(stmt, 'ParenthesizedExpression')); + } while (condition); + return ((isKind(stmt, 'ExpressionStatement') || + isKind(stmt, 'VariableStatement')) && + !!stmt.parent && isKind(stmt.parent, 'SourceFile')); + }; + IndentWalker.prototype.isArgBeforeCalleeNodeMultiline = function (node) { + var parent = node.parent; + if (parent && parent['arguments'].length >= 2 && parent['arguments'][1] === node) { + var firstArg = parent['arguments'][0]; + return this.getLine(firstArg, true) > this.getLine(firstArg); + } + return false; + }; + IndentWalker.prototype.checkIndentInFunctionBlock = function (node) { + var calleeNode = node.parent; + var indent = this.getNodeIndent(calleeNode).goodChar; + if (calleeNode.parent && calleeNode.parent.kind === ts.SyntaxKind.CallExpression) { + var calleeParent = calleeNode.parent; + if (calleeNode.kind !== ts.SyntaxKind.FunctionExpression && calleeNode.kind !== ts.SyntaxKind.ArrowFunction) { + if (calleeParent && this.getLine(calleeParent) < this.getLine(node)) { + indent = this.getNodeIndent(calleeParent).goodChar; + } + } + else { + var callee = calleeParent.expression; + if (this.isArgBeforeCalleeNodeMultiline(calleeNode) && + this.getLine(callee) === this.getLine(callee, true) && + !this.isNodeFirstInLine(calleeNode)) { + indent = this.getNodeIndent(calleeParent).goodChar; + } + } + } + var functionOffset = indentSize; + if (OPTIONS.outerIIFEBody !== null && this.isOuterIIFE(calleeNode)) { + functionOffset = OPTIONS.outerIIFEBody * indentSize; + } + else if (calleeNode.kind === ts.SyntaxKind.FunctionExpression) { + functionOffset = OPTIONS.FunctionExpression.body * indentSize; + } + else if (calleeNode.kind === ts.SyntaxKind.FunctionDeclaration) { + functionOffset = OPTIONS.FunctionDeclaration.body * indentSize; + } + else if (isOneOf(calleeNode, ['MethodDeclaration', 'Constructor'])) { + functionOffset = OPTIONS.FunctionExpression.body * indentSize; + } + indent += functionOffset; + var parentVarNode = this.getVariableDeclaratorNode(node); + if (parentVarNode && this.isNodeInVarOnTop(node, parentVarNode) && parentVarNode.parent) { + var varKind = parentVarNode.parent.getFirstToken().getText(); + indent += indentSize * OPTIONS.VariableDeclarator[varKind]; + } + this.checkFirstNodeLineIndent(node, indent - functionOffset); + if (node.statements.length) { + this.checkNodesIndent(node.statements, indent); + } + this.checkLastNodeLineIndent(node, indent - functionOffset); + }; + IndentWalker.prototype.checkNodesIndent = function (nodes, indent) { + var _this = this; + nodes.forEach(function (node) { return _this.checkNodeIndent(node, indent); }); + }; + IndentWalker.prototype.expectedCaseIndent = function (node, switchIndent) { + var switchNode = (node.kind === ts.SyntaxKind.SwitchStatement) ? node : node.parent; + var line = this.getLine(switchNode); + var caseIndent; + if (this.caseIndentStore[line]) { + return this.caseIndentStore[line]; + } + else { + if (typeof switchIndent === 'undefined') { + switchIndent = this.getNodeIndent(switchNode).goodChar; + } + caseIndent = switchIndent + (indentSize * OPTIONS.SwitchCase); + this.caseIndentStore[line] = caseIndent; + return caseIndent; + } + }; + IndentWalker.prototype.expectedVarIndent = function (node, varIndent) { + var varNode = node.parent; + var line = this.getLine(varNode); + var indent; + if (this.varIndentStore[line]) { + return this.varIndentStore[line]; + } + else { + if (typeof varIndent === 'undefined') { + varIndent = this.getNodeIndent(varNode).goodChar; + } + var varKind = varNode.getFirstToken().getText(); + indent = varIndent + (indentSize * OPTIONS.VariableDeclarator[varKind]); + this.varIndentStore[line] = indent; + return indent; + } + }; + IndentWalker.prototype.getParentNodeByType = function (node, kind, stopAtList) { + if (stopAtList === void 0) { stopAtList = [ts.SyntaxKind.SourceFile]; } + var parent = node.parent; + while (parent + && parent.kind !== kind + && stopAtList.indexOf(parent.kind) === -1 + && parent.kind !== ts.SyntaxKind.SourceFile) { + parent = parent.parent; + } + return parent && parent.kind === kind ? parent : null; + }; + IndentWalker.prototype.getVariableDeclaratorNode = function (node) { + return this.getParentNodeByType(node, ts.SyntaxKind.VariableDeclaration); + }; + IndentWalker.prototype.getBinaryExpressionNode = function (node) { + return this.getParentNodeByType(node, ts.SyntaxKind.BinaryExpression); + }; + IndentWalker.prototype.checkIndentInArrayOrObjectBlock = function (node) { + if (this.isSingleLineNode(node)) { + return; + } + var elements = isKind(node, 'ObjectLiteralExpression') ? node['properties'] : node['elements']; + elements = elements.filter(function (elem) { return elem.getText() !== ''; }); + var nodeLine = this.getLine(node); + var nodeEndLine = this.getLine(node, true); + var nodeIndent; + var elementsIndent; + var varKind; + var parentVarNode = this.getVariableDeclaratorNode(node); + if (this.isNodeFirstInLine(node) && node.parent) { + var parent = node.parent; + nodeIndent = this.getNodeIndent(parent).goodChar; + if (parentVarNode && this.getLine(parentVarNode) !== nodeLine) { + if (!isKind(parent, 'VariableDeclaration') || parentVarNode === parentVarNode.parent.declarations[0]) { + var parentVarLine = this.getLine(parentVarNode); + var parentLine = this.getLine(parent); + if (isKind(parent, 'VariableDeclaration') && parentVarLine === parentLine && parentVarNode.parent) { + varKind = parentVarNode.parent.getFirstToken().getText(); + nodeIndent = nodeIndent + (indentSize * OPTIONS.VariableDeclarator[varKind]); + } + else if (isOneOf(parent, [ + 'ObjectLiteralExpression', + 'ArrayLiteralExpression', + 'CallExpression', + 'ArrowFunction', + 'NewExpression', + 'BinaryExpression' + ])) { + nodeIndent = nodeIndent + indentSize; + } + } + } + else if (!parentVarNode && + !this.isFirstArrayElementOnSameLine(parent) && + parent.kind !== ts.SyntaxKind.PropertyAccessExpression && + parent.kind !== ts.SyntaxKind.ExpressionStatement && + parent.kind !== ts.SyntaxKind.PropertyAssignment && + !(this.isAssignment(parent))) { + nodeIndent = nodeIndent + indentSize; + } + elementsIndent = nodeIndent + indentSize; + this.checkFirstNodeLineIndent(node, nodeIndent); + } + else { + nodeIndent = this.getNodeIndent(node).goodChar; + elementsIndent = nodeIndent + indentSize; + } + if (parentVarNode && this.isNodeInVarOnTop(node, parentVarNode) && parentVarNode.parent) { + varKind = parentVarNode.parent.getFirstToken().getText(); + elementsIndent += indentSize * OPTIONS.VariableDeclarator[varKind]; + } + this.checkNodesIndent(elements, elementsIndent); + if (elements.length > 0) { + var lastLine = this.getLine(elements[elements.length - 1], true); + if (lastLine === nodeEndLine) { + return; + } + } + this.checkLastNodeLineIndent(node, elementsIndent - indentSize); + }; + IndentWalker.prototype.isFirstArrayElementOnSameLine = function (node) { + if (isKind(node, 'ArrayLiteralExpression')) { + var ele = node.elements[0]; + if (ele) { + return isKind(ele, 'ObjectLiteralExpression') && this.getLine(ele) === this.getLine(node); + } + } + return false; + }; + IndentWalker.prototype.isNodeInVarOnTop = function (node, varNode) { + var nodeLine = this.getLine(node); + var parentLine = this.getLine(varNode.parent); + return varNode && + parentLine === nodeLine && + varNode.parent.declarations.length > 1; + }; + IndentWalker.prototype.blockLessNodes = function (node) { + if (!isKind(node.statement, 'Block')) { + this.blockIndentationCheck(node); + } + }; + IndentWalker.prototype.checkIndentInVariableDeclarations = function (node) { + var indent = this.expectedVarIndent(node); + this.checkNodeIndent(node, indent); + }; + IndentWalker.prototype.visitCase = function (node) { + if (this.isSingleLineNode(node)) { + return; + } + var caseIndent = this.expectedCaseIndent(node); + this.checkNodesIndent(node.statements, caseIndent + indentSize); + }; + IndentWalker.prototype.checkLastReturnStatementLineIndent = function (node, firstLineIndent) { + if (!node.expression) { + return; + } + var lastToken = node.expression.getLastToken(); + var endIndex = lastToken.getStart(); + var pos = endIndex - 1; + while (pos > 0 && this.srcText.charAt(pos) !== '\n') { + pos -= 1; + } + var textBeforeClosingParenthesis = this.getSourceSubstr(pos + 1, endIndex); + if (textBeforeClosingParenthesis.trim()) { + return; + } + var endIndent = this.getNodeIndent(lastToken); + if (endIndent.goodChar !== firstLineIndent) { + this.report(node, firstLineIndent, endIndent.space, endIndent.tab, lastToken.getStart()); + } + }; + IndentWalker.prototype.visitClassDeclaration = function (node) { + var len = node.getChildCount(); + this.blockIndentationCheck(node.getChildAt(len - 2)); + _super.prototype.visitClassDeclaration.call(this, node); + }; + IndentWalker.prototype.visitClassExpression = function (node) { + var len = node.getChildCount(); + this.blockIndentationCheck(node.getChildAt(len - 2)); + _super.prototype.visitClassExpression.call(this, node); + }; + IndentWalker.prototype.visitInterfaceDeclaration = function (node) { + var len = node.getChildCount(); + this.blockIndentationCheck(node.getChildAt(len - 2)); + _super.prototype.visitInterfaceDeclaration.call(this, node); + }; + IndentWalker.prototype.visitTypeLiteral = function (node) { + var len = node.getChildCount(); + this.blockIndentationCheck(node.getChildAt(len - 2)); + _super.prototype.visitTypeLiteral.call(this, node); + }; + IndentWalker.prototype.visitBlock = function (node) { + this.blockIndentationCheck(node); + _super.prototype.visitBlock.call(this, node); + }; + IndentWalker.prototype.visitIfStatement = function (node) { + var thenLine = this.getLine(node.thenStatement); + var line = this.getLine(node); + if (!isKind(node.thenStatement, 'Block') && thenLine > line) { + this.blockIndentationCheck(node); + } + _super.prototype.visitIfStatement.call(this, node); + }; + IndentWalker.prototype.visitObjectLiteralExpression = function (node) { + this.checkIndentInArrayOrObjectBlock(node); + _super.prototype.visitObjectLiteralExpression.call(this, node); + }; + IndentWalker.prototype.visitArrayLiteralExpression = function (node) { + this.checkIndentInArrayOrObjectBlock(node); + _super.prototype.visitArrayLiteralExpression.call(this, node); + }; + IndentWalker.prototype.visitSwitchStatement = function (node) { + var switchIndent = this.getNodeIndent(node).goodChar; + var caseIndent = this.expectedCaseIndent(node, switchIndent); + this.checkNodesIndent(node.caseBlock.clauses, caseIndent); + this.checkLastNodeLineIndent(node, switchIndent); + _super.prototype.visitSwitchStatement.call(this, node); + }; + IndentWalker.prototype.visitCaseClause = function (node) { + this.visitCase(node); + _super.prototype.visitCaseClause.call(this, node); + }; + IndentWalker.prototype.visitDefaultClause = function (node) { + this.visitCase(node); + _super.prototype.visitDefaultClause.call(this, node); + }; + IndentWalker.prototype.visitWhileStatement = function (node) { + this.blockLessNodes(node); + _super.prototype.visitWhileStatement.call(this, node); + }; + IndentWalker.prototype.visitForStatement = function (node) { + this.blockLessNodes(node); + _super.prototype.visitForStatement.call(this, node); + }; + IndentWalker.prototype.visitForInStatement = function (node) { + this.blockLessNodes(node); + _super.prototype.visitForInStatement.call(this, node); + }; + IndentWalker.prototype.visitDoStatement = function (node) { + this.blockLessNodes(node); + _super.prototype.visitDoStatement.call(this, node); + }; + IndentWalker.prototype.visitVariableDeclaration = function (node) { + this.checkIndentInVariableDeclarations(node); + _super.prototype.visitVariableDeclaration.call(this, node); + }; + IndentWalker.prototype.visitVariableStatement = function (node) { + _super.prototype.visitVariableStatement.call(this, node); + var list = node.getChildAt(0).getChildAt(1); + if (!list) { + return; + } + var len = list.getChildCount(); + if (len === 0) { + return; + } + var lastElement = list.getChildAt(len - 1); + var lastToken = node.getLastToken(); + var lastTokenLine = this.getLine(lastToken, true); + var lastElementLine = this.getLine(lastElement, true); + if (lastTokenLine <= lastElementLine) { + return; + } + var tokenBeforeLastElement = list.getChildAt(len - 2); + if (tokenBeforeLastElement && isKind(tokenBeforeLastElement, 'CommaToken')) { + this.checkLastNodeLineIndent(node, this.getNodeIndent(tokenBeforeLastElement).goodChar); + } + else { + var nodeIndent = this.getNodeIndent(node).goodChar; + var varKind = node.getFirstToken().getText(); + var declaratorIndent = typeof OPTIONS.VariableDeclarator[varKind] === 'number' ? OPTIONS.VariableDeclarator[varKind] : DEFAULT_VARIABLE_INDENT; + var elementsIndent = nodeIndent + indentSize * declaratorIndent; + this.checkLastNodeLineIndent(node, elementsIndent - indentSize); + } + }; + IndentWalker.prototype.visitFunctionDeclaration = function (node) { + if (this.isSingleLineNode(node)) { + return; + } + if (OPTIONS.FunctionDeclaration.parameters === 'first' && node.parameters.length) { + var indent = this.getLineAndCharacter(node.parameters[0]).character; + this.checkNodesIndent(node.parameters.slice(1), indent); + } + else if (OPTIONS.FunctionDeclaration.parameters !== null) { + var nodeIndent = this.getNodeIndent(node).goodChar; + this.checkNodesIndent(node.parameters, nodeIndent + indentSize * OPTIONS.FunctionDeclaration.parameters); + var closingParen = node.getChildAt(node.getChildCount() - 2); + this.checkNodeIndent(closingParen, nodeIndent); + } + _super.prototype.visitFunctionDeclaration.call(this, node); + }; + IndentWalker.prototype.checkFunctionMethodExpression = function (node) { + if (OPTIONS.FunctionExpression.parameters === 'first' && node.parameters.length) { + var indent = this.getLineAndCharacter(node.parameters[0]).character; + this.checkNodesIndent(node.parameters.slice(1), indent); + } + else if (OPTIONS.FunctionExpression.parameters !== null) { + var nodeIndent = this.getNodeIndent(node).goodChar; + this.checkNodesIndent(node.parameters, nodeIndent + indentSize * OPTIONS.FunctionExpression.parameters); + var closingParen = node.getChildAt(node.getChildCount() - 2); + this.checkNodeIndent(closingParen, nodeIndent); + } + }; + IndentWalker.prototype.visitFunctionExpression = function (node) { + if (this.isSingleLineNode(node)) { + return; + } + this.checkFunctionMethodExpression(node); + _super.prototype.visitFunctionExpression.call(this, node); + }; + IndentWalker.prototype.visitMethodDeclaration = function (node) { + if (this.isSingleLineNode(node)) { + return; + } + this.checkFunctionMethodExpression(node); + _super.prototype.visitMethodDeclaration.call(this, node); + }; + IndentWalker.prototype.visitConstructorDeclaration = function (node) { + if (this.isSingleLineNode(node)) { + return; + } + this.checkFunctionMethodExpression(node); + _super.prototype.visitConstructorDeclaration.call(this, node); + }; + IndentWalker.prototype.visitCallExpression = function (node) { + if (this.isSingleLineNode(node)) { + return; + } + if (OPTIONS.CallExpression.arguments === 'first' && node.arguments.length) { + var indent = this.getLineAndCharacter(node.arguments[0]).character; + this.checkNodesIndent(node.arguments.slice(1), indent); + } + else if (OPTIONS.CallExpression.arguments !== null) { + var openParen = node.getChildAt(node.getChildCount(this.srcFile) - 3, this.srcFile); + var openParenIndent = this.getNodeIndent(openParen); + this.checkNodesIndent(node.arguments, openParenIndent.goodChar + indentSize * OPTIONS.CallExpression.arguments); + } + _super.prototype.visitCallExpression.call(this, node); + }; + IndentWalker.prototype.visitPropertyAccessExpression = function (node) { + if (this.isSingleLineNode(node)) { + return; + } + var varDec = ts.SyntaxKind.VariableDeclaration; + var funcKind = [ts.SyntaxKind.FunctionExpression, ts.SyntaxKind.ArrowFunction]; + if (this.getParentNodeByType(node, varDec, funcKind)) { + return; + } + var binExp = ts.SyntaxKind.BinaryExpression; + var funcExp = ts.SyntaxKind.FunctionExpression; + var binaryNode = this.getParentNodeByType(node, binExp, [funcExp]); + if (binaryNode && this.isAssignment(binaryNode)) { + return; + } + _super.prototype.visitPropertyAccessExpression.call(this, node); + if (typeof OPTIONS.MemberExpression === 'undefined') { + return; + } + var propertyIndent = this.getNodeIndent(node).goodChar + indentSize * OPTIONS.MemberExpression; + var dotToken = node.getChildAt(1); + var checkNodes = [node.name, dotToken]; + this.checkNodesIndent(checkNodes, propertyIndent); + }; + IndentWalker.prototype.visitReturnStatement = function (node) { + if (this.isSingleLineNode(node) || !node.expression) { + return; + } + var firstLineIndent = this.getNodeIndent(node).goodChar; + if (isKind(node.expression, 'ParenthesizedExpression')) { + this.checkLastReturnStatementLineIndent(node, firstLineIndent); + } + else { + this.checkNodeIndent(node, firstLineIndent); + } + _super.prototype.visitReturnStatement.call(this, node); + }; + IndentWalker.prototype.visitSourceFile = function (node) { + this.checkNodesIndent(node.statements, 0); + _super.prototype.visitSourceFile.call(this, node); + }; + return IndentWalker; +}(Lint.RuleWalker)); +var templateObject_1, templateObject_2, templateObject_3, templateObject_4, templateObject_5; + +//# sourceMappingURL=data:application/json;charset=utf8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInJ1bGVzL3RlckluZGVudFJ1bGUudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7O0FBT0EsK0JBQWlDO0FBQ2pDLDZCQUErQjtBQUUvQixJQUFNLFNBQVMsR0FBRyxZQUFZLENBQUM7QUFDL0IsSUFBTSx1QkFBdUIsR0FBRyxDQUFDLENBQUM7QUFDbEMsSUFBTSx3QkFBd0IsR0FBRyxJQUFJLENBQUM7QUFDdEMsSUFBTSw0QkFBNEIsR0F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GtDQUFrQyxDQUFDLElBQUksRUFBRSxlQUFlLENBQUMsQ0FBQztTQUNoRTthQUFNO1lBQ0wsSUFBSSxDQUFDLGVBQWUsQ0FBQyxJQUFJLEVBQUUsZUFBZSxDQUFDLENBQUM7U0FDN0M7UUFDRCxpQkFBTSxvQkFBb0IsWUFBQyxJQUFJLENBQUMsQ0FBQztJQUNuQyxDQUFDO0lBRVMsc0NBQWUsR0FBekIsVUFBMEIsSUFBbUI7UUFFM0MsSUFBSSxDQUFDLGdCQUFnQixDQUFDLElBQUksQ0FBQyxVQUFVLEVBQUUsQ0FBQyxDQUFDLENBQUM7UUFDMUMsaUJBQU0sZUFBZSxZQUFDLElBQUksQ0FBQyxDQUFDO0lBQzlCLENBQUM7SUFDSCxtQkFBQztBQUFELENBM2dDQSxBQTJnQ0MsQ0EzZ0MwQixJQUFJLENBQUMsVUFBVSxHQTJnQ3pDIiwiZmlsZSI6InJ1bGVzL3RlckluZGVudFJ1bGUuanMiLCJzb3VyY2VSb290IjoiL1VzZXJzL2ptbG9wZXovdHNsaW50LWVzbGludC1ydWxlcy9zcmMifQ== diff --git a/node_modules/tslint-eslint-rules/dist/rules/terMaxLenRule.js b/node_modules/tslint-eslint-rules/dist/rules/terMaxLenRule.js new file mode 100644 index 000000000..df33b55ee --- /dev/null +++ b/node_modules/tslint-eslint-rules/dist/rules/terMaxLenRule.js @@ -0,0 +1,306 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +var tslib_1 = require("tslib"); +var _a; +var ts = require("typescript"); +var Lint = require("tslint"); +var tsutils_1 = require("tsutils"); +var RULE_NAME = 'ter-max-len'; +var CODE = 'code'; +var COMMENTS = 'comments'; +var TAB_WIDTH = 'tabWidth'; +var IGNORE_PATTERN = 'ignorePattern'; +var IGNORE_COMMENTS = 'ignoreComments'; +var IGNORE_STRINGS = 'ignoreStrings'; +var IGNORE_URLS = 'ignoreUrls'; +var IGNORE_TEMPLATE_LITERALS = 'ignoreTemplateLiterals'; +var IGNORE_REG_EXP_LITERALS = 'ignoreRegExpLiterals'; +var IGNORE_TRAILING_COMMENTS = 'ignoreTrailingComments'; +var IGNORE_IMPORTS = 'ignoreImports'; +function computeLineLength(line, tabWidth) { + var extraCharacterCount = 0; + line.replace(/\t/g, function (_, offset) { + var totalOffset = offset + extraCharacterCount; + var previousTabStopOffset = tabWidth ? totalOffset % tabWidth : 0; + var spaceCount = tabWidth - previousTabStopOffset; + extraCharacterCount += spaceCount - 1; + return '\t'; + }); + return line.length + extraCharacterCount; +} +function isFullLineComment(line, lineNumber, comment) { + var start = comment.start; + var end = comment.end; + var isFirstTokenOnLine = !line.slice(0, start[1]).trim(); + return comment && + (start[0] < lineNumber || (start[0] === lineNumber && isFirstTokenOnLine)) && + (end[0] > lineNumber || (end[0] === lineNumber && end[1] === line.length)); +} +function isTrailingComment(line, lineNumber, comment) { + return comment && + (comment.start[0] === lineNumber && lineNumber <= comment.end[0]) && + (comment.end[0] > lineNumber || comment.end[1] === line.length); +} +function stripTrailingComment(line, comment) { + return line.slice(0, comment.start[1]).replace(/\s+$/, ''); +} +function groupByLineNumber(acc, node) { + var startLoc = node.start; + var endLoc = node.end; + for (var i = startLoc[0]; i <= endLoc[0]; ++i) { + if (!Array.isArray(acc[i])) { + acc[i] = []; + } + acc[i].push(node); + } + return acc; +} +var Rule = (function (_super) { + tslib_1.__extends(Rule, _super); + function Rule() { + return _super !== null && _super.apply(this, arguments) || this; + } + Rule.mergeOptions = function (options) { + var optionsObj = {}; + var obj = options[0]; + if (typeof obj === 'number') { + optionsObj[CODE] = obj || 80; + obj = options[1]; + } + if (typeof obj === 'number') { + optionsObj[TAB_WIDTH] = obj || 4; + obj = options[2]; + } + if (typeof obj === 'object' && !Array.isArray(obj)) { + Object.keys(obj).forEach(function (key) { + optionsObj[key] = obj[key]; + }); + } + optionsObj[CODE] = optionsObj[CODE] || 80; + optionsObj[TAB_WIDTH] = optionsObj[TAB_WIDTH] || 4; + return optionsObj; + }; + Rule.prototype.isEnabled = function () { + if (_super.prototype.isEnabled.call(this)) { + var options = this.getOptions().ruleArguments; + var option = options[0]; + if (typeof option === 'number' && option > 0) { + return true; + } + var optionsObj = Rule.mergeOptions(options); + if (optionsObj[CODE]) { + return true; + } + } + return false; + }; + Rule.prototype.apply = function (sourceFile) { + return this.applyWithWalker(new MaxLenWalker(sourceFile, this.getOptions())); + }; + Rule.metadata = { + ruleName: RULE_NAME, + description: 'enforce a maximum line length', + rationale: Lint.Utils.dedent(templateObject_1 || (templateObject_1 = tslib_1.__makeTemplateObject(["\n Limiting the length of a line of code improves code readability.\n It also makes comparing code side-by-side easier and improves compatibility with\n various editors, IDEs, and diff viewers.\n "], ["\n Limiting the length of a line of code improves code readability.\n It also makes comparing code side-by-side easier and improves compatibility with\n various editors, IDEs, and diff viewers.\n "]))), + optionsDescription: Lint.Utils.dedent(templateObject_2 || (templateObject_2 = tslib_1.__makeTemplateObject(["\n An integer indicating the maximum length of lines followed by an optional integer specifying\n the character width for tab characters.\n\n An optional object may be provided to fine tune the rule:\n\n * `\"", "\"`: (default 80) enforces a maximum line length\n * `\"", "\"`: (default 4) specifies the character width for tab characters\n * `\"", "\"`: enforces a maximum line length for comments; defaults to value of code\n * `\"", "\"`: ignores lines matching a regular expression; can only match a single\n line and need to be double escaped when written in JSON\n * `\"", "\"`: true ignores all trailing comments and comments on their own line\n * `\"", "\"`: true ignores only trailing comments\n * `\"", "\"`: true ignores lines that contain a URL\n * `\"", "\"`: true ignores lines that contain a double-quoted or single-quoted string\n * `\"", "\"`: true ignores lines that contain a template literal\n * `\"", "\"`: true ignores lines that contain a RegExp literal\n * `\"", "\"`: true ignores lines that contain an import module specifier\n "], ["\n An integer indicating the maximum length of lines followed by an optional integer specifying\n the character width for tab characters.\n\n An optional object may be provided to fine tune the rule:\n\n * \\`\"", "\"\\`: (default 80) enforces a maximum line length\n * \\`\"", "\"\\`: (default 4) specifies the character width for tab characters\n * \\`\"", "\"\\`: enforces a maximum line length for comments; defaults to value of code\n * \\`\"", "\"\\`: ignores lines matching a regular expression; can only match a single\n line and need to be double escaped when written in JSON\n * \\`\"", "\"\\`: true ignores all trailing comments and comments on their own line\n * \\`\"", "\"\\`: true ignores only trailing comments\n * \\`\"", "\"\\`: true ignores lines that contain a URL\n * \\`\"", "\"\\`: true ignores lines that contain a double-quoted or single-quoted string\n * \\`\"", "\"\\`: true ignores lines that contain a template literal\n * \\`\"", "\"\\`: true ignores lines that contain a RegExp literal\n * \\`\"", "\"\\`: true ignores lines that contain an import module specifier\n "])), CODE, TAB_WIDTH, COMMENTS, IGNORE_PATTERN, IGNORE_COMMENTS, IGNORE_TRAILING_COMMENTS, IGNORE_URLS, IGNORE_STRINGS, IGNORE_TEMPLATE_LITERALS, IGNORE_REG_EXP_LITERALS, IGNORE_IMPORTS), + options: { + type: 'array', + items: [{ + type: 'number', + minimum: '0' + }, { + type: 'object', + properties: (_a = {}, + _a[CODE] = { + type: 'number', + minumum: '1' + }, + _a[COMMENTS] = { + type: 'number', + minumum: '1' + }, + _a[TAB_WIDTH] = { + type: 'number', + minumum: '1' + }, + _a[IGNORE_PATTERN] = { + type: 'string' + }, + _a[IGNORE_COMMENTS] = { + type: 'boolean' + }, + _a[IGNORE_STRINGS] = { + type: 'boolean' + }, + _a[IGNORE_URLS] = { + type: 'boolean' + }, + _a[IGNORE_TEMPLATE_LITERALS] = { + type: 'boolean' + }, + _a[IGNORE_REG_EXP_LITERALS] = { + type: 'boolean' + }, + _a[IGNORE_TRAILING_COMMENTS] = { + type: 'boolean' + }, + _a[IGNORE_IMPORTS] = { + type: 'boolean' + }, + _a), + additionalProperties: false + }], + minLength: 1, + maxLength: 3 + }, + optionExamples: [ + Lint.Utils.dedent(templateObject_3 || (templateObject_3 = tslib_1.__makeTemplateObject(["\n \"", "\": [true, 100]\n "], ["\n \"", "\": [true, 100]\n "])), RULE_NAME), + Lint.Utils.dedent(templateObject_4 || (templateObject_4 = tslib_1.__makeTemplateObject(["\n \"", "\": [\n true,\n 100,\n 2,\n {\n \"", "\": true,\n \"", "\": \"^\\\\s*(let|const)\\\\s.+=\\\\s*require\\\\s*\\\\(\"\n }\n ]\n "], ["\n \"", "\": [\n true,\n 100,\n 2,\n {\n \"", "\": true,\n \"", "\": \"^\\\\\\\\s*(let|const)\\\\\\\\s.+=\\\\\\\\s*require\\\\\\\\s*\\\\\\\\(\"\n }\n ]\n "])), RULE_NAME, IGNORE_URLS, IGNORE_PATTERN), + Lint.Utils.dedent(templateObject_5 || (templateObject_5 = tslib_1.__makeTemplateObject(["\n \"", "\": [\n true,\n {\n \"", "\": 100,\n \"", "\": 2,\n \"", "\": true,\n \"", "\": true,\n \"", "\": \"^\\\\s*(let|const)\\\\s.+=\\\\s*require\\\\s*\\\\(\"\n }\n ]\n "], ["\n \"", "\": [\n true,\n {\n \"", "\": 100,\n \"", "\": 2,\n \"", "\": true,\n \"", "\": true,\n \"", "\": \"^\\\\\\\\s*(let|const)\\\\\\\\s.+=\\\\\\\\s*require\\\\\\\\s*\\\\\\\\(\"\n }\n ]\n "])), RULE_NAME, CODE, TAB_WIDTH, IGNORE_IMPORTS, IGNORE_URLS, IGNORE_PATTERN) + ], + typescriptOnly: false, + type: 'style' + }; + Rule.URL_REGEXP = /[^:/?#]:\/\/[^?#]/; + return Rule; +}(Lint.Rules.AbstractRule)); +exports.Rule = Rule; +var MaxLenWalker = (function (_super) { + tslib_1.__extends(MaxLenWalker, _super); + function MaxLenWalker(sourceFile, options) { + var _this = _super.call(this, sourceFile, options) || this; + _this.ignoredIntervals = []; + _this.optionsObj = {}; + _this.comments = []; + _this.strings = []; + _this.templates = []; + _this.regExp = []; + _this.optionsObj = Rule.mergeOptions(_this.getOptions()); + return _this; + } + MaxLenWalker.prototype.hasOption = function (option) { + if (this.optionsObj[option] && this.optionsObj[option]) { + return true; + } + return false; + }; + MaxLenWalker.prototype.getOption = function (option) { + return this.optionsObj[option]; + }; + MaxLenWalker.prototype.visitStringLiteral = function (node) { + this.strings.push(this.getINode(node.kind, node.getText(), node.getStart())); + _super.prototype.visitStringLiteral.call(this, node); + }; + MaxLenWalker.prototype.visitRegularExpressionLiteral = function (node) { + this.regExp.push(this.getINode(node.kind, node.getText(), node.getStart())); + _super.prototype.visitRegularExpressionLiteral.call(this, node); + }; + MaxLenWalker.prototype.getINode = function (kind, text, startPos) { + var width = text.length; + var src = this.getSourceFile(); + var startLoc = src.getLineAndCharacterOfPosition(startPos); + var endLoc = src.getLineAndCharacterOfPosition(startPos + width); + return { + kind: kind, + text: text, + startPosition: startPos, + endPosition: startPos + width, + start: [startLoc.line, startLoc.character], + end: [endLoc.line, endLoc.character] + }; + }; + MaxLenWalker.prototype.visitSourceFile = function (node) { + var _this = this; + _super.prototype.visitSourceFile.call(this, node); + tsutils_1.forEachTokenWithTrivia(node, function (text, token, range) { + if (token === ts.SyntaxKind.SingleLineCommentTrivia || + token === ts.SyntaxKind.MultiLineCommentTrivia) { + _this.comments.push(_this.getINode(token, text.substring(range.pos, range.end), range.pos)); + } + else if (token === ts.SyntaxKind.FirstTemplateToken) { + _this.templates.push(_this.getINode(token, text.substring(range.pos, range.end), range.pos)); + } + }); + this.findFailures(node); + }; + MaxLenWalker.prototype.visitImportDeclaration = function (node) { + _super.prototype.visitImportDeclaration.call(this, node); + var startPos = node.moduleSpecifier.getStart(); + var text = node.moduleSpecifier.getText(); + var width = text.length; + if (this.hasOption(IGNORE_IMPORTS)) { + this.ignoredIntervals.push({ + endPosition: startPos + width, + startPosition: startPos + }); + } + }; + MaxLenWalker.prototype.findFailures = function (sourceFile) { + var lineStarts = sourceFile.getLineStarts(); + var source = sourceFile.getFullText(); + var lineLimit = this.getOption(CODE) || 80; + var ignoreTrailingComments = this.getOption(IGNORE_TRAILING_COMMENTS) || + this.getOption(IGNORE_COMMENTS) || + false; + var ignoreComments = this.getOption(IGNORE_COMMENTS) || false; + var ignoreStrings = this.getOption(IGNORE_STRINGS) || false; + var ignoreTemplateLiterals = this.getOption(IGNORE_TEMPLATE_LITERALS) || false; + var ignoreUrls = this.getOption(IGNORE_URLS) || false; + var ignoreRexExpLiterals = this.getOption(IGNORE_REG_EXP_LITERALS) || false; + var pattern = this.getOption(IGNORE_PATTERN) || null; + var tabWidth = this.getOption(TAB_WIDTH) || 4; + var maxCommentLength = this.getOption(COMMENTS); + var comments = ignoreComments || maxCommentLength || ignoreTrailingComments ? this.comments : []; + var commentsIndex = 0; + var stringsByLine = this.strings.reduce(groupByLineNumber, {}); + var templatesByLine = this.templates.reduce(groupByLineNumber, {}); + var regExpByLine = this.regExp.reduce(groupByLineNumber, {}); + var totalLines = lineStarts.length; + for (var i = 0; i < totalLines; ++i) { + var from = lineStarts[i]; + var to = lineStarts[i + 1] || source.length; + var line = source.substring(from, i === totalLines - 1 ? to : to - 1); + var lineIsComment = false; + if (commentsIndex < comments.length) { + var comment = void 0; + do { + comment = comments[++commentsIndex]; + } while (comment && comment.start[0] <= i); + comment = comments[--commentsIndex]; + if (isFullLineComment(line, i, comment)) { + lineIsComment = true; + } + else if (ignoreTrailingComments && isTrailingComment(line, i, comment)) { + line = stripTrailingComment(line, comment); + } + } + if (ignoreUrls && Rule.URL_REGEXP.test(line) || + pattern && new RegExp(pattern).test(line) || + ignoreStrings && stringsByLine[i] || + ignoreTemplateLiterals && templatesByLine[i] || + ignoreRexExpLiterals && regExpByLine[i]) { + continue; + } + var lineLength = computeLineLength(line, tabWidth); + if (lineIsComment && ignoreComments) { + continue; + } + var ruleFailure = null; + if (lineIsComment && exceedLineLimit(lineLength, maxCommentLength, source[to - 2])) { + ruleFailure = new Lint.RuleFailure(sourceFile, from, to - 1, "Line " + (i + 1) + " exceeds the maximum comment line length of " + maxCommentLength + ".", RULE_NAME); + } + else if (exceedLineLimit(lineLength, lineLimit, source[to - 2])) { + ruleFailure = new Lint.RuleFailure(sourceFile, from, to - 1, "Line " + (i + 1) + " exceeds the maximum line length of " + lineLimit + ".", RULE_NAME); + } + if (ruleFailure && !Lint.doesIntersect(ruleFailure, this.ignoredIntervals)) { + this.addFailure(ruleFailure); + } + } + }; + return MaxLenWalker; +}(Lint.RuleWalker)); +function exceedLineLimit(lineLength, lineLimit, secondToLast) { + return lineLength > lineLimit && !((lineLength - 1) === lineLimit && secondToLast === '\r'); +} +var templateObject_1, templateObject_2, templateObject_3, templateObject_4, templateObject_5; + +//# sourceMappingURL=data:application/json;charset=utf8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInJ1bGVzL3Rlck1heExlblJ1bGUudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7OztBQVFBLCtCQUFpQztBQUNqQyw2QkFBK0I7QUFFL0IsbUNBQWlEO0FBR2pELElBQU0sU0FBUyxHQUFHLGFBQWEsQ0FBQztBQUNoQyxJQUFNLElBQUksR0FBVyxNQUFNLENBQUM7QUFDNUIsSUFBTSxRQUFRLEdBQVcsVUFBVSxDQUFDO0FBQ3BDLElBQU0sU0FBUyxHQUFXLFVBQVUsQ0FBQztBQUNyQyxJQUFNLGNBQWMsR0FBVyxlQUFlLENBQUM7QUFDL0MsSUFBTSxlQUFlLEdBQVcsZ0JBQWdCLENBQUM7QUFDakQsSUFBTSxjQUFjLEdBQVcsZUFBZSxDQUFDO0FBQy9DLElBQU0sV0FBVyxHQUFXLFlBQVksQ0FBQztBQUN6QyxJQUFNLHdCQUF3QixHQUFXLHdCQUF3QixDQUFDO0FBQ2xFLElBQU0sdUJBQXVCLEdBQVcsc0JBQXNCLENBQUM7QUFDL0QsSUFBTSx3QkFBd0IsR0FBVyx3QkFBd0IsQ0FBQztBQUNsRSxJQUFNLGNBQWMsR0FBVyxlQUFlLENBQUM7QUFNL0MsU0FBUyxpQkFBaUIsQ0FBQyxJQUFZLEVBQUUsUUFBZ0I7SUFDdkQsSUFBSSxtQkFBbUIsR0FBRyxDQUFDLENBQUM7SUFDNUIsSUFBSSxDQUFDLE9BQU8sQ0FBQyxLQUFLLEVBQUUsVUFBQyxDQUFDLEVBQUUsTUFBTTtRQUM1QixJQUFNLFdBQVcsR0FBRy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RUFBRSxHQUFHLENBQUMsRUFDeEIsV0FBUSxDQUFDLEdBQUcsQ0FBQyw2Q0FBdUMsU0FBUyxNQUFHLEVBQ2hFLFNBQVMsQ0FDVixDQUFDO2FBQ0g7WUFFRCxJQUFJLFdBQVcsSUFBSSxDQUFDLElBQUksQ0FBQyxhQUFhLENBQUMsV0FBVyxFQUFFLElBQUksQ0FBQyxnQkFBZ0IsQ0FBQyxFQUFFO2dCQUMxRSxJQUFJLENBQUMsVUFBVSxDQUFDLFdBQVcsQ0FBQyxDQUFDO2FBQzlCO1NBQ0Y7SUFDSCxDQUFDO0lBQ0gsbUJBQUM7QUFBRCxDQWxMQSxBQWtMQyxDQWxMMEIsSUFBSSxDQUFDLFVBQVUsR0FrTHpDO0FBRUQsU0FBUyxlQUFlLENBQUMsVUFBa0IsRUFBRSxTQUFpQixFQUFFLFlBQW9CO0lBTWxGLE9BQU8sVUFBVSxHQUFHLFNBQVMsSUFBSSxDQUFDLENBQUMsQ0FBQyxVQUFVLEdBQUcsQ0FBQyxDQUFDLEtBQUssU0FBUyxJQUFJLFlBQVksS0FBSyxJQUFJLENBQUMsQ0FBQztBQUM5RixDQUFDIiwiZmlsZSI6InJ1bGVzL3Rlck1heExlblJ1bGUuanMiLCJzb3VyY2VSb290IjoiL1VzZXJzL2ptbG9wZXovdHNsaW50LWVzbGludC1ydWxlcy9zcmMifQ== diff --git a/node_modules/tslint-eslint-rules/dist/rules/terNewlineAfterVarRule.js b/node_modules/tslint-eslint-rules/dist/rules/terNewlineAfterVarRule.js new file mode 100644 index 000000000..9c76bd5ba --- /dev/null +++ b/node_modules/tslint-eslint-rules/dist/rules/terNewlineAfterVarRule.js @@ -0,0 +1,113 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +var tslib_1 = require("tslib"); +var ts = require("typescript"); +var Lint = require("tslint"); +var RULE_NAME = 'ter-newline-after-var'; +var EXPECTED_BLANK_LINE_MESSAGE = 'Expected blank line after variable declarations.'; +var UNEXPECTED_BLANK_LINE_MESSAGE = 'Unexpected blank line after variable declarations.'; +var Rule = (function (_super) { + tslib_1.__extends(Rule, _super); + function Rule() { + return _super !== null && _super.apply(this, arguments) || this; + } + Rule.prototype.formatOptions = function (_a) { + var alwaysOrNever = _a[0]; + return { + always: alwaysOrNever !== 'never' + }; + }; + Rule.prototype.apply = function (sourceFile) { + var opt = this.formatOptions(this.ruleArguments); + var walker = new RuleWalker(sourceFile, this.ruleName, opt); + return this.applyWithWalker(walker); + }; + Rule.metadata = { + ruleName: RULE_NAME, + hasFix: true, + description: 'require or disallow an empty line after variable declarations', + rationale: Lint.Utils.dedent(templateObject_1 || (templateObject_1 = tslib_1.__makeTemplateObject(["\n This rule enforces a coding style where empty lines are required or disallowed after `var`, `let`, or `const`\n statements to achieve a consistent coding style across the project.\n "], ["\n This rule enforces a coding style where empty lines are required or disallowed after \\`var\\`, \\`let\\`, or \\`const\\`\n statements to achieve a consistent coding style across the project.\n "]))), + optionsDescription: Lint.Utils.dedent(templateObject_2 || (templateObject_2 = tslib_1.__makeTemplateObject(["\n This rule has a string option:\n\n * `\"always\"` (default) requires an empty line after `var`, `let`, or `const`.\n Comments on a line directly after var statements are treated like additional var statements.\n * `\"never\"` disallows empty lines after `var`, `let`, or `const`.\n "], ["\n This rule has a string option:\n\n * \\`\"always\"\\` (default) requires an empty line after \\`var\\`, \\`let\\`, or \\`const\\`.\n Comments on a line directly after var statements are treated like additional var statements.\n * \\`\"never\"\\` disallows empty lines after \\`var\\`, \\`let\\`, or \\`const\\`.\n "]))), + options: { + type: 'array', + items: [{ + enum: ['always', 'never'] + }], + maxLength: 1 + }, + optionExamples: [ + Lint.Utils.dedent(templateObject_3 || (templateObject_3 = tslib_1.__makeTemplateObject(["\n \"", "\": [true]\n "], ["\n \"", "\": [true]\n "])), RULE_NAME), + Lint.Utils.dedent(templateObject_4 || (templateObject_4 = tslib_1.__makeTemplateObject(["\n \"", "\": [true, \"always\"]\n "], ["\n \"", "\": [true, \"always\"]\n "])), RULE_NAME), + Lint.Utils.dedent(templateObject_5 || (templateObject_5 = tslib_1.__makeTemplateObject(["\n \"", "\": [true, \"never\"]\n "], ["\n \"", "\": [true, \"never\"]\n "])), RULE_NAME) + ], + typescriptOnly: false, + type: 'style' + }; + return Rule; +}(Lint.Rules.AbstractRule)); +exports.Rule = Rule; +var RuleWalker = (function (_super) { + tslib_1.__extends(RuleWalker, _super); + function RuleWalker() { + return _super !== null && _super.apply(this, arguments) || this; + } + RuleWalker.prototype.walk = function (sourceFile) { + var _this = this; + this.sourceFileText = sourceFile.getFullText(); + var onNode = function (node) { + var _a = _this, lastVariableStatementNode = _a.lastVariableStatementNode, sourceFileText = _a.sourceFileText; + if (node.kind === ts.SyntaxKind.VariableStatement) { + _this.lastVariableStatementNode = node; + return; + } + if (node.kind === ts.SyntaxKind.EndOfFileToken) { + _this.lastVariableStatementNode = undefined; + return; + } + if (lastVariableStatementNode) { + var unexpectedLineFixes = []; + var expectedLineFixes = []; + var isNewLineRequired = _this.options.always; + var expectedLinePos = lastVariableStatementNode.end; + var newLinesCount = 0; + for (var i = lastVariableStatementNode.end; i < node.end; i++) { + var code = sourceFileText.charCodeAt(i); + if (code === 10) { + newLinesCount++; + if (!isNewLineRequired && newLinesCount > 1) { + unexpectedLineFixes.push(Lint.Replacement.deleteText(i, 1)); + } + } + else if (code !== 9 && code !== 13 && code !== 32) { + var leadingComments = ts.getLeadingCommentRanges("\n" + sourceFileText.slice(i), 0); + var lastLeadingComment = leadingComments && leadingComments.pop(); + if (lastLeadingComment && (!isNewLineRequired || (isNewLineRequired && newLinesCount < 2))) { + newLinesCount = 0; + expectedLinePos = i - 1 + lastLeadingComment.end; + i = expectedLinePos - 1; + } + else { + if (isNewLineRequired && newLinesCount < 2) { + expectedLineFixes.push(Lint.Replacement.appendText(expectedLinePos, '\n')); + } + break; + } + } + } + if (isNewLineRequired && expectedLineFixes[0]) { + _this.addFailureAt(lastVariableStatementNode.getStart(), 1, EXPECTED_BLANK_LINE_MESSAGE, expectedLineFixes); + } + else if (unexpectedLineFixes[0]) { + _this.addFailureAt(lastVariableStatementNode.getStart(), 1, UNEXPECTED_BLANK_LINE_MESSAGE, unexpectedLineFixes); + } + _this.lastVariableStatementNode = undefined; + } + return ts.forEachChild(node, onNode); + }; + return ts.forEachChild(sourceFile, onNode); + }; + return RuleWalker; +}(Lint.AbstractWalker)); +var templateObject_1, templateObject_2, templateObject_3, templateObject_4, templateObject_5; + +//# sourceMappingURL=data:application/json;charset=utf8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInJ1bGVzL3Rlck5ld2xpbmVBZnRlclZhclJ1bGUudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7O0FBQUEsK0JBQWlDO0FBQ2pDLDZCQUErQjtBQUUvQixJQUFNLFNBQVMsR0FBVyx1QkFBdUIsQ0FBQztBQU1sRCxJQUFNLDJCQUEyQixHQUFXLGtEQUFrRCxDQUFDO0FBQy9GLElBQU0sNkJBQTZCLEdBQVcsb0RBQW9ELENBQUM7QUFFbkc7SUFBMEIsZ0NBQXVCO0lBQWpEOztJQWlEQSxDQUFDO0lBWFMsNEJBQWEsR0FBckIsVUFBdUIsRUFBeUI7WUFBeEIscUJBQWE7UUFDbkMsT0FBTztZQUNMLE1BQU0sRUFBRSxhQUFhLEtBQUssT0FBTztTQUNsQyxDQUFDO0lBQ0osQ0FBQztJQUVNLG9CQUFLLEdBQVosVUFBYyxVQUF5QjtRQUNyQyxJQUFNLEdBQUcsR0FBRyxJQUFJLENBQUMsYUFBYSxDQUFDLElBQUksQ0FBQyxhQUFhLENBQUMsQ0FBQztRQUNuRCxJQUFNLE1BQU0sR0FBRyxJQUFJLFVBQVUsQ0FBQyxVQUFVLEVBQUUsSUFBSSxDQUFDLFFBQVEsRUFBRSxHQUFHLENBQUMsQ0FBQztRQUM5RCxPQUFPLElBQUksQ0FBQyxlQUFlLENBQUMsTUFBTSxDQUFDLENBQUM7SUFDdEMsQ0FBQztJQS9D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QUMsRUFBRTtvQkFFN0MsS0FBSSxDQUFDLFlBQVksQ0FDZix5QkFBeUIsQ0FBQyxRQUFRLEVBQUUsRUFDcEMsQ0FBQyxFQUNELDJCQUEyQixFQUMzQixpQkFBaUIsQ0FDbEIsQ0FBQztpQkFDSDtxQkFBTSxJQUFJLG1CQUFtQixDQUFDLENBQUMsQ0FBQyxFQUFFO29CQUNqQyxLQUFJLENBQUMsWUFBWSxDQUNmLHlCQUF5QixDQUFDLFFBQVEsRUFBRSxFQUNwQyxDQUFDLEVBQ0QsNkJBQTZCLEVBQzdCLG1CQUFtQixDQUNwQixDQUFDO2lCQUNIO2dCQUVELEtBQUksQ0FBQyx5QkFBeUIsR0FBRyxTQUFTLENBQUM7YUFDNUM7WUFFRCxPQUFPLEVBQUUsQ0FBQyxZQUFZLENBQUMsSUFBSSxFQUFFLE1BQU0sQ0FBQyxDQUFDO1FBQ3ZDLENBQUMsQ0FBQztRQUVGLE9BQU8sRUFBRSxDQUFDLFlBQVksQ0FBQyxVQUFVLEVBQUUsTUFBTSxDQUFDLENBQUM7SUFDN0MsQ0FBQztJQUNILGlCQUFDO0FBQUQsQ0FwRkEsQUFvRkMsQ0FwRndCLElBQUksQ0FBQyxjQUFjLEdBb0YzQyIsImZpbGUiOiJydWxlcy90ZXJOZXdsaW5lQWZ0ZXJWYXJSdWxlLmpzIiwic291cmNlUm9vdCI6Ii9Vc2Vycy9qbWxvcGV6L3RzbGludC1lc2xpbnQtcnVsZXMvc3JjIn0= diff --git a/node_modules/tslint-eslint-rules/dist/rules/terNoIrregularWhitespaceRule.js b/node_modules/tslint-eslint-rules/dist/rules/terNoIrregularWhitespaceRule.js new file mode 100644 index 000000000..0f9cce213 --- /dev/null +++ b/node_modules/tslint-eslint-rules/dist/rules/terNoIrregularWhitespaceRule.js @@ -0,0 +1,84 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +var tslib_1 = require("tslib"); +var ts = require("typescript"); +var Lint = require("tslint"); +var RULE_NAME = 'ter-no-irregular-whitespace'; +var Rule = (function (_super) { + tslib_1.__extends(Rule, _super); + function Rule() { + return _super !== null && _super.apply(this, arguments) || this; + } + Rule.prototype.apply = function (sourceFile) { + var walker = new NoIrregularWhitespaceWalker(sourceFile, this.getOptions()); + return this.applyWithWalker(walker); + }; + Rule.metadata = { + ruleName: RULE_NAME, + description: 'disallow irregular whitespace (recommended)', + rationale: Lint.Utils.dedent(templateObject_1 || (templateObject_1 = tslib_1.__makeTemplateObject(["\n Invalid or irregular whitespace causes issues with ECMAScript 5 parsers and also makes code\n harder to debug in a similar nature to mixed tabs and spaces.\n "], ["\n Invalid or irregular whitespace causes issues with ECMAScript 5 parsers and also makes code\n harder to debug in a similar nature to mixed tabs and spaces.\n "]))), + optionsDescription: '', + options: {}, + optionExamples: [ + Lint.Utils.dedent(templateObject_2 || (templateObject_2 = tslib_1.__makeTemplateObject(["\n \"", "\": [true]\n "], ["\n \"", "\": [true]\n "])), RULE_NAME) + ], + typescriptOnly: false, + type: 'typescript' + }; + Rule.RULE_NAME = 'ter-no-irregular-whitespace'; + Rule.FAILURE_STRING = 'irregular whitespace not allowed'; + return Rule; +}(Lint.Rules.AbstractRule)); +exports.Rule = Rule; +var NoIrregularWhitespaceWalker = (function (_super) { + tslib_1.__extends(NoIrregularWhitespaceWalker, _super); + function NoIrregularWhitespaceWalker() { + var _this = _super !== null && _super.apply(this, arguments) || this; + _this.IRREGULAR_WHITESPACE = /[\u0085\u00A0\ufeff\f\v\u00a0\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u200b\u202f\u205f\u3000]+/mg; + _this.IRREGULAR_LINE_TERMINATORS = /[\u2028\u2029]/mg; + return _this; + } + NoIrregularWhitespaceWalker.prototype.visitSourceFile = function (node) { + this.validateIrregularWhitespace(node); + _super.prototype.visitSourceFile.call(this, node); + }; + NoIrregularWhitespaceWalker.prototype.visitNode = function (node) { + if (node.kind === ts.SyntaxKind.StringLiteral) { + this.removeStringError(node); + } + _super.prototype.visitNode.call(this, node); + }; + NoIrregularWhitespaceWalker.prototype.removeStringError = function (node) { + var start = node.getStart(); + var end = node.getEnd(); + var failures = this.getFailures(); + for (var i = failures.length - 1; i >= 0; i--) { + var failure = failures[i]; + if (failure.getRuleName() === Rule.RULE_NAME) { + if (failure.getStartPosition().getPosition() >= start && failure.getEndPosition().getPosition() <= end) { + failures.splice(i, 1); + } + } + } + }; + NoIrregularWhitespaceWalker.prototype.validateIrregularWhitespace = function (node) { + var _this = this; + var lines = node.text.split(/\n/g); + lines.forEach(function (line, i) { + var match = _this.IRREGULAR_WHITESPACE.exec(line); + while (match) { + _this.addFailure(_this.createFailure(node.getPositionOfLineAndCharacter(i, match.index), 1, Rule.FAILURE_STRING)); + match = _this.IRREGULAR_WHITESPACE.exec(line); + } + match = _this.IRREGULAR_LINE_TERMINATORS.exec(line); + while (match) { + _this.addFailure(_this.createFailure(node.getPositionOfLineAndCharacter(i, match.index), 1, Rule.FAILURE_STRING)); + match = _this.IRREGULAR_LINE_TERMINATORS.exec(line); + } + }); + }; + return NoIrregularWhitespaceWalker; +}(Lint.RuleWalker)); +var templateObject_1, templateObject_2; + +//# sourceMappingURL=data:application/json;charset=utf8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInJ1bGVzL3Rlck5vSXJyZWd1bGFyV2hpdGVzcGFjZVJ1bGUudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7O0FBQUEsK0JBQWlDO0FBQ2pDLDZCQUErQjtBQUUvQixJQUFNLFNBQVMsR0FBRyw2QkFBNkIsQ0FBQztBQUVoRDtJQUEwQixnQ0FBdUI7SUFBakQ7O0lBeUJBLENBQUM7SUFKUSxvQkFBSyxHQUFaLFVBQWEsVUFBeUI7UUFDcEMsSUFBTSxNQUFNLEdBQUcsSUFBSSwyQkFBMkIsQ0FBQyxVQUFVLEVBQUUsSUFBSSxDQUFDLFVBQVUsRUFBRSxDQUFDLENBQUM7UUF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2Vycy9qbWxvcGV6L3RzbGludC1lc2xpbnQtcnVsZXMvc3JjIn0= diff --git a/node_modules/tslint-eslint-rules/dist/rules/terNoMixedSpacesAndTabsRule.js b/node_modules/tslint-eslint-rules/dist/rules/terNoMixedSpacesAndTabsRule.js new file mode 100644 index 000000000..9a7f3b74f --- /dev/null +++ b/node_modules/tslint-eslint-rules/dist/rules/terNoMixedSpacesAndTabsRule.js @@ -0,0 +1,115 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +var tslib_1 = require("tslib"); +var ts = require("typescript"); +var Lint = require("tslint"); +var tsutils_1 = require("tsutils"); +var RULE_NAME = 'ter-no-mixed-spaces-and-tabs'; +var OPTION_USE_TABS = 'tabs'; +var OPTION_USE_SPACES = 'spaces'; +var Rule = (function (_super) { + tslib_1.__extends(Rule, _super); + function Rule() { + return _super !== null && _super.apply(this, arguments) || this; + } + Rule.FAILURE_STRING = function (expected, mixed) { + if (!mixed) { + return expected + " indentation expected"; + } + return "indentation has mixed tabs and spaces"; + }; + Rule.prototype.formatOptions = function (ruleArguments) { + var tabs = undefined; + var smartTabs = false; + var options = ruleArguments[0]; + if (options !== undefined) { + tabs = options.type === OPTION_USE_TABS ? true : options.type === OPTION_USE_SPACES ? false : undefined; + smartTabs = options.smartTabs; + } + return { + tabs: tabs, + smartTabs: smartTabs + }; + }; + Rule.prototype.apply = function (sourceFile) { + var options = this.formatOptions(this.ruleArguments); + return this.applyWithFunction(sourceFile, walk, options); + }; + Rule.metadata = { + ruleName: RULE_NAME, + description: 'Enforces indentation with unmixed tabs or spaces.', + rationale: Lint.Utils.dedent(templateObject_1 || (templateObject_1 = tslib_1.__makeTemplateObject(["\n Using only one of tabs or spaces for indentation leads to more consistent editor behavior,\n cleaner diffs in version control, and easier programmatic manipulation."], ["\n Using only one of tabs or spaces for indentation leads to more consistent editor behavior,\n cleaner diffs in version control, and easier programmatic manipulation."]))), + optionsDescription: Lint.Utils.dedent(templateObject_2 || (templateObject_2 = tslib_1.__makeTemplateObject(["\n This rule takes an object argument with an optional `type` property which can be set to:\n\n * `", "` enforces consistent spaces for indentation.\n * `", "` enforces consistent tabs for indentation.\n\n If the above is not provided, the rule will enforce either all tabs or all spaces on each\n line, although different lines may differ between tabs and spaces.\n\n Optionally, a `smartTabs` boolean property can be specified. If set to true, smart tabs\n allow mixing tabs and spaces if tabs are used for indentation and spaces for alignment, eg.\n\n function main() {\n // --->const a = 1,\n // --->......b = 2;\n\n const a = 1,\n b = 2;\n }\n "], ["\n This rule takes an object argument with an optional \\`type\\` property which can be set to:\n\n * \\`", "\\` enforces consistent spaces for indentation.\n * \\`", "\\` enforces consistent tabs for indentation.\n\n If the above is not provided, the rule will enforce either all tabs or all spaces on each\n line, although different lines may differ between tabs and spaces.\n\n Optionally, a \\`smartTabs\\` boolean property can be specified. If set to true, smart tabs\n allow mixing tabs and spaces if tabs are used for indentation and spaces for alignment, eg.\n\n function main() {\n // --->const a = 1,\n // --->......b = 2;\n\n const a = 1,\n b = 2;\n }\n "])), OPTION_USE_SPACES, OPTION_USE_TABS), + options: { + type: 'array', + items: [ + { + type: 'object', + properties: { + type: { + type: 'string', + enum: [OPTION_USE_TABS, OPTION_USE_SPACES] + }, + smartTabs: { + type: 'boolean' + } + }, + additionalProperties: false + } + ], + minLength: 0, + maxLength: 1 + }, + optionExamples: [ + Lint.Utils.dedent(templateObject_3 || (templateObject_3 = tslib_1.__makeTemplateObject(["\n \"", "\": { \"type\": \"", "\" } ]\n "], ["\n \"", "\": { \"type\": \"", "\" } ]\n "])), RULE_NAME, OPTION_USE_TABS), + Lint.Utils.dedent(templateObject_4 || (templateObject_4 = tslib_1.__makeTemplateObject(["\n \"", "\": { \"type\": \"", "\" } ]\n "], ["\n \"", "\": { \"type\": \"", "\" } ]\n "])), RULE_NAME, OPTION_USE_SPACES), + Lint.Utils.dedent(templateObject_5 || (templateObject_5 = tslib_1.__makeTemplateObject(["\n \"", "\": { \"smartTabs\": true } ]\n "], ["\n \"", "\": { \"smartTabs\": true } ]\n "])), RULE_NAME), + Lint.Utils.dedent(templateObject_6 || (templateObject_6 = tslib_1.__makeTemplateObject(["\n \"", "\": { \"type\": \"", "\", \"smartTabs\": true } ]\n "], ["\n \"", "\": { \"type\": \"", "\", \"smartTabs\": true } ]\n "])), RULE_NAME, OPTION_USE_TABS) + ], + type: 'maintainability', + typescriptOnly: false + }; + return Rule; +}(Lint.Rules.AbstractRule)); +exports.Rule = Rule; +function walk(ctx) { + var sourceFile = ctx.sourceFile, _a = ctx.options, tabs = _a.tabs, smartTabs = _a.smartTabs; + var regExp; + if (tabs === true) { + regExp = new RegExp(" " + (smartTabs ? '\\t' : '')); + } + else if (tabs === false) { + regExp = new RegExp("\\t"); + } + else { + regExp = new RegExp((smartTabs ? '' : '\\t |') + " \\t"); + } + var failure = Rule.FAILURE_STRING(tabs ? 'tab' : 'space', typeof tabs === 'undefined'); + for (var _i = 0, _b = tsutils_1.getLineRanges(sourceFile); _i < _b.length; _i++) { + var _c = _b[_i], pos = _c.pos, contentLength = _c.contentLength; + if (contentLength === 0) { + continue; + } + var line = sourceFile.text.substr(pos, contentLength); + var indentEnd = line.search(/\S/); + if (indentEnd === 0) { + continue; + } + if (indentEnd === -1) { + indentEnd = contentLength; + } + var indentSpace = line.slice(0, indentEnd); + if (!regExp.test(indentSpace)) { + continue; + } + var token = tsutils_1.getTokenAtPosition(sourceFile, pos); + if (token.kind !== ts.SyntaxKind.JsxText && + (pos >= token.getStart(sourceFile) || tsutils_1.isPositionInComment(sourceFile, pos, token))) { + continue; + } + ctx.addFailureAt(pos, indentEnd, failure); + } +} +var templateObject_1, templateObject_2, templateObject_3, templateObject_4, templateObject_5, templateObject_6; + +//# sourceMappingURL=data:application/json;charset=utf8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInJ1bGVzL3Rlck5vTWl4ZWRTcGFjZXNBbmRUYWJzUnVsZS50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7QUFBQSwrQk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UFJLEtBQUssQ0FBQyxRQUFRLENBQUMsVUFBVSxDQUFDLElBQUksNkJBQW1CLENBQUMsVUFBVSxFQUFFLEdBQUcsRUFBRSxLQUFLLENBQUMsQ0FBQyxFQUFFO1lBQ3BGLFNBQVM7U0FDVjtRQUNELEdBQUcsQ0FBQyxZQUFZLENBQUMsR0FBRyxFQUFFLFNBQVMsRUFBRSxPQUFPLENBQUMsQ0FBQztLQUMzQztBQUNILENBQUMiLCJmaWxlIjoicnVsZXMvdGVyTm9NaXhlZFNwYWNlc0FuZFRhYnNSdWxlLmpzIiwic291cmNlUm9vdCI6Ii9Vc2Vycy9qbWxvcGV6L3RzbGludC1lc2xpbnQtcnVsZXMvc3JjIn0= diff --git a/node_modules/tslint-eslint-rules/dist/rules/terNoProtoRule.js b/node_modules/tslint-eslint-rules/dist/rules/terNoProtoRule.js new file mode 100644 index 000000000..b19210046 --- /dev/null +++ b/node_modules/tslint-eslint-rules/dist/rules/terNoProtoRule.js @@ -0,0 +1,46 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +var tslib_1 = require("tslib"); +var ts = require("typescript"); +var Lint = require("tslint"); +var RULE_NAME = 'ter-no-proto'; +var Rule = (function (_super) { + tslib_1.__extends(Rule, _super); + function Rule() { + return _super !== null && _super.apply(this, arguments) || this; + } + Rule.prototype.apply = function (sourceFile) { + return this.applyWithFunction(sourceFile, walk); + }; + Rule.FAILURE_STRING = 'The `__proto__` property is deprecated.'; + Rule.metadata = { + ruleName: RULE_NAME, + hasFix: false, + description: 'disallow the use of `__proto__` property', + rationale: '`__proto__` property has been deprecated as of ECMAScript 3.1 and shouldn’t be used in the code. Use getPrototypeOf method instead.', + optionsDescription: '', + options: {}, + optionExamples: [Lint.Utils.dedent(templateObject_1 || (templateObject_1 = tslib_1.__makeTemplateObject(["\n \"", "\": true\n "], ["\n \"", "\": true\n "])), RULE_NAME)], + typescriptOnly: false, + type: 'functionality' + }; + return Rule; +}(Lint.Rules.AbstractRule)); +exports.Rule = Rule; +function walk(ctx) { + return ts.forEachChild(ctx.sourceFile, cb); + function cb(node) { + if ((node.kind === ts.SyntaxKind.Identifier && + node.text === '__proto__' && + node.parent && + node.parent.kind === ts.SyntaxKind.PropertyAccessExpression) || + (node.kind === ts.SyntaxKind.StringLiteral && + node.text === '__proto__')) { + return ctx.addFailureAtNode(node, Rule.FAILURE_STRING); + } + return ts.forEachChild(node, cb); + } +} +var templateObject_1; + +//# sourceMappingURL=data:application/json;charset=utf8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInJ1bGVzL3Rlck5vUHJvdG9SdWxlLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7OztBQU1BLCtCQUFpQztBQUNqQyw2QkFBK0I7QUFFL0IsSUFBTSxTQUFTLEdBQUcsY0FBYyxDQUFDO0FBRWpDO0lBQTBCLGdDQUF1QjtJQUFqRDs7SUFxQkEsQ0FBQztJQUhRLG9CQUFLLEdBQVosVUFBYSxVQUF5QjtRQUNwQyxPQUFPLElBQUksQ0FBQyxpQkFBaUIsQ0FBQyxVQUFVLEVBQUUsSUFBSSxDQUFDLENBQUM7SUFDbEQsQ0FBQztJQW5CYSxtQkFBYyxHQUFHLHlDQUF5QyxDQUFDO0lBRTNELGFBQVEsR0FBdUI7UUFDM0MsUUFBUSxFQUFFLFNBQVM7UUFDbkIsTUFBTSxFQUFFLEtBQUs7UUFDYixXQUFXLEVBQUUsMENBQTBDO1FBQ3ZELFNBQVMsRUFDUCxxSUFBcUk7UUFDdkksa0JBQWtCLEVBQUUsRUFBRTtRQUN0QixPQUFPLEVBQUUsRUFBRTtRQUNYLGNBQWMsRUFBRSxDQUFDLElBQUksQ0FBQyxLQUFLLENBQUMsTUFBTSwyR0FBQSxZQUM3QixFQUFTLGtCQUNYLEtBREUsU0FBUyxFQUNWO1FBQ0osY0FBYyxFQUFFLEtBQUs7UUFDckIsSUFBSSxFQUFFLGVBQWU7S0FDdEIsQ0FBQztJQUtKLFdBQUM7Q0FyQkQsQUFxQkMsQ0FyQnlCLElBQUksQ0FBQyxLQUFLLENBQUMsWUFBWSxHQXFCaEQ7QUFyQlksb0JBQUk7QUF1QmpCLFNBQVMsSUFBSSxDQUFDLEdBQTJCO0lBQ3ZDLE9BQU8sRUFBRSxDQUFDLFlBQVksQ0FBQyxHQUFHLENBQUMsVUFBVSxFQUFFLEVBQUUsQ0FBQyxDQUFDO0lBRTNDLFNBQVMsRUFBRSxDQUFDLElBQWE7UUFDdkIsSUFDRSxDQUFDLElBQUksQ0FBQyxJQUFJLEtBQUssRUFBRSxDQUFDLFVBQVUsQ0FBQyxVQUFVO1lBQ3BDLElBQXNCLENBQUMsSUFBSSxLQUFLLFdBQVc7WUFDNUMsSUFBSSxDQUFDLE1BQU07WUFDWCxJQUFJLENBQUMsTUFBTSxDQUFDLElBQUksS0FBSyxFQUFFLENBQUMsVUFBVSxDQUFDLHdCQUF3QixDQUFDO1lBQzlELENBQUMsSUFBSSxDQUFDLElBQUksS0FBSyxFQUFFLENBQUMsVUFBVSxDQUFDLGFBQWE7Z0JBQ3ZDLElBQXlCLENBQUMsSUFBSSxLQUFLLFdBQVcsQ0FBQyxFQUNsRDtZQUNBLE9BQU8sR0FBRyxDQUFDLGdCQUFnQixDQUFDLElBQUksRUFBRSxJQUFJLENBQUMsY0FBYyxDQUFDLENBQUM7U0FDeEQ7UUFDRCxPQUFPLEVBQUUsQ0FBQyxZQUFZLENBQUMsSUFBSSxFQUFFLEVBQUUsQ0FBQyxDQUFDO0lBQ25DLENBQUM7QUFDSCxDQUFDIiwiZmlsZSI6InJ1bGVzL3Rlck5vUHJvdG9SdWxlLmpzIiwic291cmNlUm9vdCI6Ii9Vc2Vycy9qbWxvcGV6L3RzbGludC1lc2xpbnQtcnVsZXMvc3JjIn0= diff --git a/node_modules/tslint-eslint-rules/dist/rules/terNoScriptUrlRule.js b/node_modules/tslint-eslint-rules/dist/rules/terNoScriptUrlRule.js new file mode 100644 index 000000000..6602f7519 --- /dev/null +++ b/node_modules/tslint-eslint-rules/dist/rules/terNoScriptUrlRule.js @@ -0,0 +1,48 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +var tslib_1 = require("tslib"); +var ts = require("typescript"); +var Lint = require("tslint"); +var RULE_NAME = 'ter-no-script-url'; +var Rule = (function (_super) { + tslib_1.__extends(Rule, _super); + function Rule() { + return _super !== null && _super.apply(this, arguments) || this; + } + Rule.prototype.apply = function (sourceFile) { + return this.applyWithFunction(sourceFile, walk); + }; + Rule.FAILURE_STRING = 'Script URL is a form of eval.'; + Rule.metadata = { + ruleName: RULE_NAME, + hasFix: false, + description: 'disallow use of `javascript:` urls.', + rationale: 'Using `javascript:` URLs is considered by some as a form of `eval`. ' + + 'Code passed in `javascript:` URLs has to be parsed and evaluated by the browser ' + + 'in the same way that eval is processed.', + optionsDescription: '', + options: {}, + optionExamples: [ + Lint.Utils.dedent(templateObject_1 || (templateObject_1 = tslib_1.__makeTemplateObject(["\n \"", "\": true\n "], ["\n \"", "\": true\n "])), RULE_NAME) + ], + typescriptOnly: false, + type: 'functionality' + }; + return Rule; +}(Lint.Rules.AbstractRule)); +exports.Rule = Rule; +function walk(ctx) { + return ts.forEachChild(ctx.sourceFile, cb); + function cb(node) { + if (node.kind === ts.SyntaxKind.StringLiteral) { + var value = node.text.toLowerCase(); + if (value.indexOf('javascript:') === 0) { + return ctx.addFailureAtNode(node, Rule.FAILURE_STRING); + } + } + return ts.forEachChild(node, cb); + } +} +var templateObject_1; + +//# sourceMappingURL=data:application/json;charset=utf8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInJ1bGVzL3Rlck5vU2NyaXB0VXJsUnVsZS50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7QUFJQSwrQkFBaUM7QUFDakMsNkJBQStCO0FBRS9CLElBQU0sU0FBUyxHQUFHLG1CQUFtQixDQUFDO0FBRXRDO0lBQTBCLGdDQUF1QjtJQUFqRDs7SUF5QkEsQ0F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DLEtBQUssQ0FBQyxFQUFFO2dCQUN0QyxPQUFPLEdBQUcsQ0FBQyxnQkFBZ0IsQ0FBQyxJQUFJLEVBQUUsSUFBSSxDQUFDLGNBQWMsQ0FBQyxDQUFDO2FBQ3hEO1NBQ0Y7UUFDRCxPQUFPLEVBQUUsQ0FBQyxZQUFZLENBQUMsSUFBSSxFQUFFLEVBQUUsQ0FBQyxDQUFDO0lBQ25DLENBQUM7QUFDSCxDQUFDIiwiZmlsZSI6InJ1bGVzL3Rlck5vU2NyaXB0VXJsUnVsZS5qcyIsInNvdXJjZVJvb3QiOiIvVXNlcnMvam1sb3Blei90c2xpbnQtZXNsaW50LXJ1bGVzL3NyYyJ9 diff --git a/node_modules/tslint-eslint-rules/dist/rules/terNoSelfCompareRule.js b/node_modules/tslint-eslint-rules/dist/rules/terNoSelfCompareRule.js new file mode 100644 index 000000000..565e91d10 --- /dev/null +++ b/node_modules/tslint-eslint-rules/dist/rules/terNoSelfCompareRule.js @@ -0,0 +1,75 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +var tslib_1 = require("tslib"); +var ts = require("typescript"); +var Lint = require("tslint"); +var RULE_NAME = 'ter-no-self-compare'; +var Rule = (function (_super) { + tslib_1.__extends(Rule, _super); + function Rule() { + return _super !== null && _super.apply(this, arguments) || this; + } + Rule.prototype.apply = function (sourceFile) { + return this.applyWithWalker(new NoSelfCompareWalker(sourceFile, this.ruleName, new Set(this.ruleArguments.map(String)))); + }; + Rule.FAILURE_STRING = 'Comparing to itself is potentially pointless.'; + Rule.metadata = { + ruleName: RULE_NAME, + hasFix: false, + description: 'disallow comparisons where both sides are exactly the same', + rationale: 'Comparing a variable against itself is usually an error, ' + + 'either a typo or refactoring error. It is confusing to the reader ' + + 'and may potentially introduce a runtime error.', + optionsDescription: '', + options: {}, + optionExamples: [ + Lint.Utils.dedent(templateObject_1 || (templateObject_1 = tslib_1.__makeTemplateObject(["\n \"", "\": true\n "], ["\n \"", "\": true\n "])), RULE_NAME) + ], + typescriptOnly: false, + type: 'maintainability' + }; + return Rule; +}(Lint.Rules.AbstractRule)); +exports.Rule = Rule; +var NoSelfCompareWalker = (function (_super) { + tslib_1.__extends(NoSelfCompareWalker, _super); + function NoSelfCompareWalker() { + return _super !== null && _super.apply(this, arguments) || this; + } + NoSelfCompareWalker.prototype.isComparisonOperator = function (node) { + var operators = new Set([ + ts.SyntaxKind.EqualsEqualsEqualsToken, + ts.SyntaxKind.EqualsEqualsToken, + ts.SyntaxKind.ExclamationEqualsEqualsToken, + ts.SyntaxKind.ExclamationEqualsToken, + ts.SyntaxKind.GreaterThanToken, + ts.SyntaxKind.LessThanToken, + ts.SyntaxKind.GreaterThanEqualsToken, + ts.SyntaxKind.LessThanEqualsToken + ]); + return operators.has(node.operatorToken.kind); + }; + NoSelfCompareWalker.prototype.hasSameToken = function (left, right) { + return left.kind === right.kind && left.getText() === right.getText(); + }; + NoSelfCompareWalker.prototype.walk = function (sourceFile) { + var _this = this; + var cb = function (node) { + if (ts.isBinaryExpression(node)) { + var nodeExpr = node; + if (_this.isComparisonOperator(nodeExpr) && + _this.hasSameToken(nodeExpr.left, nodeExpr.right)) { + _this.addFailureAt(nodeExpr.operatorToken.getStart(), nodeExpr.operatorToken.getWidth(), Rule.FAILURE_STRING); + } + } + else { + return ts.forEachChild(node, cb); + } + }; + return ts.forEachChild(sourceFile, cb); + }; + return NoSelfCompareWalker; +}(Lint.AbstractWalker)); +var templateObject_1; + +//# sourceMappingURL=data:application/json;charset=utf8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInJ1bGVzL3Rlck5vU2VsZkNvbXBhcmVSdWxlLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7OztBQUFBLCtCQUFpQztBQUNqQyw2QkFBK0I7QUFFL0IsSUFBTSxTQUFTLEdBQUcscUJBQXFCLENBQUM7QUFFeEM7SUFBMEIsZ0NBQXVCO0lBQWpEOztJQStCQSxDQUFDO0lBVFEsb0JBQUss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FhLENBQUMsUUFBUSxFQUFFLEVBQ2pDLElBQUksQ0FBQyxjQUFjLENBQ3BCLENBQUM7aUJBQ0g7YUFDRjtpQkFBTTtnQkFFTCxPQUFPLEVBQUUsQ0FBQyxZQUFZLENBQUMsSUFBSSxFQUFFLEVBQUUsQ0FBQyxDQUFDO2FBQ2xDO1FBQ0gsQ0FBQyxDQUFDO1FBR0YsT0FBTyxFQUFFLENBQUMsWUFBWSxDQUFDLFVBQVUsRUFBRSxFQUFFLENBQUMsQ0FBQztJQUN6QyxDQUFDO0lBQ0gsMEJBQUM7QUFBRCxDQTNDQSxBQTJDQyxDQTNDaUMsSUFBSSxDQUFDLGNBQWMsR0EyQ3BEIiwiZmlsZSI6InJ1bGVzL3Rlck5vU2VsZkNvbXBhcmVSdWxlLmpzIiwic291cmNlUm9vdCI6Ii9Vc2Vycy9qbWxvcGV6L3RzbGludC1lc2xpbnQtcnVsZXMvc3JjIn0= diff --git a/node_modules/tslint-eslint-rules/dist/rules/terNoSparseArraysRule.js b/node_modules/tslint-eslint-rules/dist/rules/terNoSparseArraysRule.js new file mode 100644 index 000000000..d06e2d549 --- /dev/null +++ b/node_modules/tslint-eslint-rules/dist/rules/terNoSparseArraysRule.js @@ -0,0 +1,51 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +var tslib_1 = require("tslib"); +var ts = require("typescript"); +var Lint = require("tslint"); +var RULE_NAME = 'ter-no-sparse-arrays'; +var Rule = (function (_super) { + tslib_1.__extends(Rule, _super); + function Rule() { + return _super !== null && _super.apply(this, arguments) || this; + } + Rule.prototype.apply = function (sourceFile) { + var walker = new NoSparseArraysWalker(sourceFile, this.getOptions()); + return this.applyWithWalker(walker); + }; + Rule.metadata = { + ruleName: RULE_NAME, + description: 'disallow sparse arrays (recommended)', + rationale: Lint.Utils.dedent(templateObject_1 || (templateObject_1 = tslib_1.__makeTemplateObject(["\n Invalid or irregular whitespace causes issues with ECMAScript 5 parsers and also makes code\n harder to debug in a similar nature to mixed tabs and spaces.\n "], ["\n Invalid or irregular whitespace causes issues with ECMAScript 5 parsers and also makes code\n harder to debug in a similar nature to mixed tabs and spaces.\n "]))), + optionsDescription: '', + options: {}, + optionExamples: [ + Lint.Utils.dedent(templateObject_2 || (templateObject_2 = tslib_1.__makeTemplateObject(["\n \"", "\": [true]\n "], ["\n \"", "\": [true]\n "])), RULE_NAME) + ], + typescriptOnly: false, + type: 'typescript' + }; + Rule.FAILURE_STRING = 'unexpected comma in middle of array'; + return Rule; +}(Lint.Rules.AbstractRule)); +exports.Rule = Rule; +var NoSparseArraysWalker = (function (_super) { + tslib_1.__extends(NoSparseArraysWalker, _super); + function NoSparseArraysWalker() { + return _super !== null && _super.apply(this, arguments) || this; + } + NoSparseArraysWalker.prototype.visitArrayLiteralExpression = function (node) { + this.validateNoSparseArray(node); + _super.prototype.visitArrayLiteralExpression.call(this, node); + }; + NoSparseArraysWalker.prototype.validateNoSparseArray = function (node) { + var hasEmptySlot = node.elements.some(function (el) { return el.kind === ts.SyntaxKind.OmittedExpression; }); + if (hasEmptySlot) { + this.addFailure(this.createFailure(node.getStart(), node.getWidth(), Rule.FAILURE_STRING)); + } + }; + return NoSparseArraysWalker; +}(Lint.RuleWalker)); +var templateObject_1, templateObject_2; + +//# sourceMappingURL=data:application/json;charset=utf8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInJ1bGVzL3Rlck5vU3BhcnNlQXJyYXlzUnVsZS50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7QUFBQSwrQkFBaUM7QUFDakMsNkJBQStCO0FBRS9CLElBQU0sU0FBUyxHQUFHLHNCQUFzQixDQUFDO0FBRXpDO0lBQTBCLGdDQUF1QjtJQUFqRDs7SUF3QkEsQ0FBQztJQUpRLG9CQUFLLEdBQVosVUFBYSxVQUF5QjtRQUNwQyxJQUFNLE1BQU0sR0FBRyxJQUFJLG9CQUFvQixDQUFDLFVBQVUsRUFBRSxJQUFJLENBQUMsVUFBVS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MsQ0FBQyxDQUFDO1FBRTNGLElBQUksWUFBWSxFQUFFO1lBQ2hCLElBQUksQ0FBQyxVQUFVLENBQUMsSUFBSSxDQUFDLGFBQWEsQ0FBQyxJQUFJLENBQUMsUUFBUSxFQUFFLEVBQUUsSUFBSSxDQUFDLFFBQVEsRUFBRSxFQUFFLElBQUksQ0FBQyxjQUFjLENBQUMsQ0FBQyxDQUFDO1NBQzVGO0lBQ0gsQ0FBQztJQUNILDJCQUFDO0FBQUQsQ0FiQSxBQWFDLENBYmtDLElBQUksQ0FBQyxVQUFVLEdBYWpEIiwiZmlsZSI6InJ1bGVzL3Rlck5vU3BhcnNlQXJyYXlzUnVsZS5qcyIsInNvdXJjZVJvb3QiOiIvVXNlcnMvam1sb3Blei90c2xpbnQtZXNsaW50LXJ1bGVzL3NyYyJ9 diff --git a/node_modules/tslint-eslint-rules/dist/rules/terNoTabsRule.js b/node_modules/tslint-eslint-rules/dist/rules/terNoTabsRule.js new file mode 100644 index 000000000..a97abcaa7 --- /dev/null +++ b/node_modules/tslint-eslint-rules/dist/rules/terNoTabsRule.js @@ -0,0 +1,43 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +var tslib_1 = require("tslib"); +var Lint = require("tslint"); +var RULE_NAME = 'ter-no-tabs'; +var Rule = (function (_super) { + tslib_1.__extends(Rule, _super); + function Rule() { + return _super !== null && _super.apply(this, arguments) || this; + } + Rule.prototype.apply = function (sourceFile) { + return this.applyWithFunction(sourceFile, walk); + }; + Rule.FAILURE_STRING = 'Unexpected tab character.'; + Rule.metadata = { + ruleName: RULE_NAME, + hasFix: false, + description: 'disallow all tabs', + rationale: Lint.Utils.dedent(templateObject_1 || (templateObject_1 = tslib_1.__makeTemplateObject(["\n This rule looks for tabs anywhere inside a file: code, comments or anything else, and disallows their usage.\n "], ["\n This rule looks for tabs anywhere inside a file: code, comments or anything else, and disallows their usage.\n "]))), + optionsDescription: '', + options: {}, + optionExamples: [ + Lint.Utils.dedent(templateObject_2 || (templateObject_2 = tslib_1.__makeTemplateObject(["\n \"", "\": true\n "], ["\n \"", "\": true\n "])), RULE_NAME) + ], + typescriptOnly: false, + type: 'style' + }; + return Rule; +}(Lint.Rules.AbstractRule)); +exports.Rule = Rule; +function walk(ctx) { + var TAB_REGEX = /\t/; + var lines = ctx.sourceFile.text.split(/\n/g); + lines.forEach(function (line, i) { + var match = TAB_REGEX.exec(line); + if (match) { + ctx.addFailureAt(ctx.sourceFile.getPositionOfLineAndCharacter(i, match.index), 1, Rule.FAILURE_STRING); + } + }); +} +var templateObject_1, templateObject_2; + +//# sourceMappingURL=data:application/json;charset=utf8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInJ1bGVzL3Rlck5vVGFic1J1bGUudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7O0FBUUEsNkJBQStCO0FBRS9CLElBQU0sU0FBUyxHQUFHLGFBQWEsQ0FBQztBQUVoQztJQUEwQixnQ0FBdUI7SUFBakQ7O0lBdUJBLENBQUM7SUFIUSxvQkFBSyxHQUFaLFVBQWEsVUFBeUI7UUFDcEMsT0FBTyxJQUFJLENBQUMsaUJBQWlCLENBQUMsVUFBVSxFQUFFLElBQUksQ0FBQyxDQUFDO0lBQ2xELENBQUM7SUFyQmEsbUJBQWMsR0FBRywyQkFBMkIsQ0FBQztJQUM3QyxhQUFRLEdBQXVCO1FBQzNDLFFBQVEsRUFBRSxTQUFTO1FBQ25CLE1BQU0sRUFBRSxLQUFLO1FBQ2IsV0FBVyxFQUFFLG1CQUFtQjtRQUNoQyxTQUFTLEVBQUUsSUFBSSxDQUFDLEtBQUssQ0FBQyxNQUFNLHlNQUFBLDhIQUV6QixJQUFBO1FBQ0gsa0JBQWtCLEVBQUUsRUFBRTtRQUN0QixPQUFPLEVBQUUsRUFBRTtRQUNYLGNBQWMsRUFBRTtZQUNkLElBQUksQ0FBQyxLQUFLLENBQUMsTUFBTSwrR0FBQSxjQUNaLEVBQVMsb0JBQ1gsS0FERSxTQUFTO1NBRWY7UUFDRCxjQUFjLEVBQUUsS0FBSztRQUNyQixJQUFJLEVBQUUsT0FBTztLQUNkLENBQUM7SUFLSixXQUFDO0NBdkJELEFBdUJDLENBdkJ5QixJQUFJLENBQUMsS0FBSyxDQUFDLFlBQVksR0F1QmhEO0FBdkJZLG9CQUFJO0FBeUJqQixTQUFTLElBQUksQ0FBQyxHQUEyQjtJQUN2QyxJQUFNLFNBQVMsR0FBRyxJQUFJLENBQUM7SUFDdkIsSUFBTSxLQUFLLEdBQUcsR0FBRyxDQUFDLFVBQVUsQ0FBQyxJQUFJLENBQUMsS0FBSyxDQUFDLEtBQUssQ0FBQyxDQUFDO0lBRS9DLEtBQUssQ0FBQyxPQUFPLENBQUMsVUFBQyxJQUFJLEVBQUUsQ0FBQztRQUNwQixJQUFNLEtBQUssR0FBRyxTQUFTLENBQUMsSUFBSSxDQUFDLElBQUksQ0FBQyxDQUFDO1FBQ25DLElBQUksS0FBSyxFQUFFO1lBQ1QsR0FBRyxDQUFDLFlBQVksQ0FDZCxHQUFHLENBQUMsVUFBVSxDQUFDLDZCQUE2QixDQUFDLENBQUMsRUFBRSxLQUFLLENBQUMsS0FBSyxDQUFDLEVBQzVELENBQUMsRUFDRCxJQUFJLENBQUMsY0FBYyxDQUNwQixDQUFDO1NBQ0g7SUFDSCxDQUFDLENBQUMsQ0FBQztBQUNMLENBQUMiLCJmaWxlIjoicnVsZXMvdGVyTm9UYWJzUnVsZS5qcyIsInNvdXJjZVJvb3QiOiIvVXNlcnMvam1sb3Blei90c2xpbnQtZXNsaW50LXJ1bGVzL3NyYyJ9 diff --git a/node_modules/tslint-eslint-rules/dist/rules/terPaddedBlocksRule.js b/node_modules/tslint-eslint-rules/dist/rules/terPaddedBlocksRule.js new file mode 100644 index 000000000..210e900cc --- /dev/null +++ b/node_modules/tslint-eslint-rules/dist/rules/terPaddedBlocksRule.js @@ -0,0 +1,229 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +var tslib_1 = require("tslib"); +var ts = require("typescript"); +var Lint = require("tslint"); +var tsutils_1 = require("tsutils"); +var RULE_NAME = 'ter-padded-blocks'; +var OPTION_ALWAYS = 'always'; +var Rule = (function (_super) { + tslib_1.__extends(Rule, _super); + function Rule() { + return _super !== null && _super.apply(this, arguments) || this; + } + Rule.prototype.formatOptions = function (ruleArguments) { + var config = ruleArguments[0] || OPTION_ALWAYS; + if (typeof (config) === 'string') { + var always = config === OPTION_ALWAYS; + return { + blocks: always, + classes: always, + switches: always + }; + } + return { + blocks: config['blocks'] && config['blocks'] === OPTION_ALWAYS, + classes: config['classes'] && config['classes'] === OPTION_ALWAYS, + switches: config['switches'] && config['switches'] === OPTION_ALWAYS + }; + }; + Rule.prototype.apply = function (sourceFile) { + var opt = this.formatOptions(this.ruleArguments); + var walker = new RuleWalker(sourceFile, this.ruleName, opt); + return this.applyWithWalker(walker); + }; + Rule.metadata = { + ruleName: RULE_NAME, + hasFix: false, + description: 'enforces consistent empty line padding within blocks', + rationale: Lint.Utils.dedent(templateObject_1 || (templateObject_1 = tslib_1.__makeTemplateObject(["\n Some style guides require block statements to start and end with blank\n lines. The goal is to improve readability by visually separating the\n block content and the surrounding code.\n "], ["\n Some style guides require block statements to start and end with blank\n lines. The goal is to improve readability by visually separating the\n block content and the surrounding code.\n "]))), + optionsDescription: 'This rule has one option, which can be a string option or an object option', + options: { + type: 'array', + items: [ + { + enum: ['always', 'never'] + }, + { + type: 'object', + properties: { + blocks: { + enum: ['always', 'never'] + }, + classes: { + enum: ['always', 'never'] + }, + switches: { + enum: ['always', 'never'] + } + }, + additionalProperties: false + } + ], + maxLength: 1 + }, + optionExamples: [ + Lint.Utils.dedent(templateObject_2 || (templateObject_2 = tslib_1.__makeTemplateObject(["\n \"", "\": [true]\n "], ["\n \"", "\": [true]\n "])), RULE_NAME), + Lint.Utils.dedent(templateObject_3 || (templateObject_3 = tslib_1.__makeTemplateObject(["\n \"", "\": [true, \"always\"]\n "], ["\n \"", "\": [true, \"always\"]\n "])), RULE_NAME), + Lint.Utils.dedent(templateObject_4 || (templateObject_4 = tslib_1.__makeTemplateObject(["\n \"", "\": [true, \"never\"]\n "], ["\n \"", "\": [true, \"never\"]\n "])), RULE_NAME), + Lint.Utils.dedent(templateObject_5 || (templateObject_5 = tslib_1.__makeTemplateObject(["\n \"", "\": [true, { \"blocks\": \"always\" }]\n "], ["\n \"", "\": [true, { \"blocks\": \"always\" }]\n "])), RULE_NAME), + Lint.Utils.dedent(templateObject_6 || (templateObject_6 = tslib_1.__makeTemplateObject(["\n \"", "\": [true, { \"blocks\": \"never\" }]\n "], ["\n \"", "\": [true, { \"blocks\": \"never\" }]\n "])), RULE_NAME) + ], + typescriptOnly: false, + type: 'style' + }; + Rule.FAILURE_STRING = { + always: 'Block must be padded by blank lines.', + never: 'Block must not be padded by blank lines.' + }; + return Rule; +}(Lint.Rules.AbstractRule)); +exports.Rule = Rule; +var RuleWalker = (function (_super) { + tslib_1.__extends(RuleWalker, _super); + function RuleWalker() { + return _super !== null && _super.apply(this, arguments) || this; + } + RuleWalker.prototype.walk = function (sourceFile) { + var _this = this; + sourceFile.forEachChild(function (node) { return _this.processNode(node); }); + }; + RuleWalker.prototype.processNode = function (node) { + var _this = this; + switch (node.kind) { + case ts.SyntaxKind.Block: + case ts.SyntaxKind.ClassDeclaration: + case ts.SyntaxKind.CaseBlock: + this.checkPadding(node); + } + node.forEachChild(function (child) { return _this.processNode(child); }); + }; + RuleWalker.prototype.getParts = function (node) { + var openBrace, body, closeBrace; + node.getChildren().forEach(function (child) { + if (child.kind === ts.SyntaxKind.OpenBraceToken) { + openBrace = child; + } + else if (child.kind === ts.SyntaxKind.SyntaxList) { + body = child; + } + else if (child.kind === ts.SyntaxKind.CloseBraceToken) { + closeBrace = child; + } + }); + return { + openBrace: openBrace, + body: body, + closeBrace: closeBrace + }; + }; + RuleWalker.prototype.getPositions = function (node) { + var _a = this.getParts(node), openBrace = _a.openBrace, body = _a.body, closeBrace = _a.closeBrace; + var firstChild = body.getChildAt(0); + var lastChild = body.getChildAt(body.getChildCount() - 1); + var positions = { + openPosition: openBrace.getStart(this.sourceFile), + openLine: this.getLine(openBrace.getStart(this.sourceFile)), + closePosition: closeBrace.getEnd(), + closeLine: this.getLine(closeBrace.getEnd()) + }; + if (firstChild) { + positions.firstChildPosition = firstChild.getStart(this.sourceFile); + positions.firstChildLine = this.getLine(positions.firstChildPosition); + } + if (lastChild) { + positions.lastChildPosition = lastChild.getEnd(); + positions.lastChildLine = this.getLine(positions.lastChildPosition); + } + return positions; + }; + RuleWalker.prototype.checkPadding = function (node) { + var _this = this; + var paddingAllowed = this.options.blocks; + if (node.kind === ts.SyntaxKind.ClassDeclaration) { + paddingAllowed = this.options.classes; + } + else if (node.parent && node.parent.kind === ts.SyntaxKind.SwitchStatement) { + paddingAllowed = this.options.switches; + } + if (paddingAllowed === undefined) { + return; + } + var positions = this.getPositions(node); + var openBraceReplacement = { + from: positions.openPosition + 1, + to: positions.firstChildPosition || positions.closePosition + }; + var closeBraceReplacement = { + from: positions.lastChildPosition || positions.openPosition, + to: positions.closePosition - 1 + }; + var comments = []; + tsutils_1.forEachComment(node, function (_fullText, comment) { + if (comment.pos > positions.openPosition && comment.pos < positions.closePosition) { + var commentLineEnd = _this.getLine(comment.end); + if (commentLineEnd > positions.openLine) { + comments.push(comment); + } + else if (commentLineEnd === positions.openLine) { + openBraceReplacement.from = comment.end; + } + } + }); + if (comments.length > 0) { + var firstCommentLine = this.getLine(comments[0].pos); + var lastCommentLine = this.getLine(comments[comments.length - 1].end); + if (!positions.firstChildLine || firstCommentLine < positions.firstChildLine) { + positions.firstChildLine = firstCommentLine; + positions.firstChildPosition = comments[0].pos; + openBraceReplacement.to = positions.firstChildPosition; + } + if (!positions.lastChildLine || lastCommentLine >= positions.lastChildLine) { + positions.lastChildLine = lastCommentLine; + positions.lastChildPosition = comments[comments.length - 1].end; + closeBraceReplacement.from = positions.lastChildPosition; + } + } + if (this.getLine(openBraceReplacement.from) !== this.getLine(openBraceReplacement.to)) { + openBraceReplacement.to = this.getPosition(this.getLine(openBraceReplacement.to)); + } + if (this.getLine(closeBraceReplacement.from) !== this.getLine(closeBraceReplacement.to)) { + closeBraceReplacement.to = this.getPosition(this.getLine(closeBraceReplacement.to)); + } + if (positions.firstChildLine === undefined && positions.lastChildLine === undefined) { + return; + } + var openPadded = false; + if (positions.firstChildLine !== undefined) { + openPadded = positions.firstChildLine - positions.openLine > 1; + } + else { + openPadded = positions.closeLine - positions.openLine > 1; + } + var closePadded = false; + if (positions.lastChildLine !== undefined) { + closePadded = positions.closeLine - positions.lastChildLine > 1; + } + else { + closePadded = positions.closeLine - positions.openLine > 1; + } + if (paddingAllowed ? !openPadded : openPadded) { + var openFix = Lint.Replacement.replaceFromTo(openBraceReplacement.from, openBraceReplacement.to, paddingAllowed ? '\n\n' : '\n'); + this.addFailure(positions.openPosition, positions.openPosition + 1, paddingAllowed ? Rule.FAILURE_STRING.always : Rule.FAILURE_STRING.never, openFix); + } + if (paddingAllowed ? !closePadded : closePadded) { + var closeFix = Lint.Replacement.replaceFromTo(closeBraceReplacement.from, closeBraceReplacement.to, paddingAllowed ? '\n\n' : '\n'); + this.addFailure(positions.closePosition - 1, positions.closePosition, paddingAllowed ? Rule.FAILURE_STRING.always : Rule.FAILURE_STRING.never, closeFix); + } + }; + RuleWalker.prototype.getLine = function (pos) { + return this.sourceFile.getLineAndCharacterOfPosition(pos).line; + }; + RuleWalker.prototype.getPosition = function (line) { + return this.sourceFile.getPositionOfLineAndCharacter(line, 0); + }; + return RuleWalker; +}(Lint.AbstractWalker)); +var templateObject_1, templateObject_2, templateObject_3, templateObject_4, templateObject_5, templateObject_6; + +//# sourceMappingURL=data:application/json;charset=utf8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInJ1bGVzL3RlclBhZGRlZEJsb2Nrc1J1bGUudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7O0FBQUEsK0JBQWlDO0FBQ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int-rules/dist/rules/terPreferArrowCallbackRule.js b/node_modules/tslint-eslint-rules/dist/rules/terPreferArrowCallbackRule.js new file mode 100644 index 000000000..eda4c1dea --- /dev/null +++ b/node_modules/tslint-eslint-rules/dist/rules/terPreferArrowCallbackRule.js @@ -0,0 +1,188 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +var tslib_1 = require("tslib"); +var ts = require("typescript"); +var Lint = require("tslint"); +var RULE_NAME = 'ter-prefer-arrow-callback'; +var OPTIONS; +var Rule = (function (_super) { + tslib_1.__extends(Rule, _super); + function Rule() { + return _super !== null && _super.apply(this, arguments) || this; + } + Rule.prototype.apply = function (sourceFile) { + var walker = new RuleWalker(sourceFile, this.getOptions()); + return this.applyWithWalker(walker); + }; + Rule.metadata = { + ruleName: RULE_NAME, + description: 'require arrow functions as callbacks', + rationale: Lint.Utils.dedent(templateObject_1 || (templateObject_1 = tslib_1.__makeTemplateObject(["\n Arrow functions are suited to callbacks, because:\n\n * `this` keywords in arrow functions bind to the upper scope\u2019s.\n * The notation of the arrow function is shorter than function expression\u2019s.\n "], ["\n Arrow functions are suited to callbacks, because:\n\n * \\`this\\` keywords in arrow functions bind to the upper scope\u2019s.\n * The notation of the arrow function is shorter than function expression\u2019s.\n "]))), + optionsDescription: Lint.Utils.dedent(templateObject_2 || (templateObject_2 = tslib_1.__makeTemplateObject(["\n This rule takes one optional argument, an object which is an options object. This object\n may specify the following properties:\n\n * `\"allowNamedFunctions\"` (default false) When set to `true`, the rule doesn't warn on\n named functions used as callback.\n * `\"allowUnboundThis\"` (default true) When set to `false`, this option allows the use of\n `this` without restriction and checks for dynamically assigned\n `this` values such as when using `Array.prototype.map` with a\n `context` argument. Normally, the rule will flag the use of this\n whenever a function does not use `bind()` to specify the value of\n `this` constantly.\n "], ["\n This rule takes one optional argument, an object which is an options object. This object\n may specify the following properties:\n\n * \\`\"allowNamedFunctions\"\\` (default false) When set to \\`true\\`, the rule doesn't warn on\n named functions used as callback.\n * \\`\"allowUnboundThis\"\\` (default true) When set to \\`false\\`, this option allows the use of\n \\`this\\` without restriction and checks for dynamically assigned\n \\`this\\` values such as when using \\`Array.prototype.map\\` with a\n \\`context\\` argument. Normally, the rule will flag the use of this\n whenever a function does not use \\`bind()\\` to specify the value of\n \\`this\\` constantly.\n "]))), + options: { + type: 'array', + items: [{ + type: 'object', + properties: { + allowNamedFunctions: { + type: 'boolean' + }, + allowUnboundThis: { + type: 'boolean' + } + }, + additionalProperties: false + }], + maxLength: 1 + }, + optionExamples: [ + Lint.Utils.dedent(templateObject_3 || (templateObject_3 = tslib_1.__makeTemplateObject(["\n \"", "\": [true]\n "], ["\n \"", "\": [true]\n "])), RULE_NAME), + Lint.Utils.dedent(templateObject_4 || (templateObject_4 = tslib_1.__makeTemplateObject(["\n \"", "\": [true, {\n \"allowNamedFunctions\": true\n }]\n "], ["\n \"", "\": [true, {\n \"allowNamedFunctions\": true\n }]\n "])), RULE_NAME), + Lint.Utils.dedent(templateObject_5 || (templateObject_5 = tslib_1.__makeTemplateObject(["\n \"", "\": [true, {\n \"allowUnboundThis\": false\n }]\n "], ["\n \"", "\": [true, {\n \"allowUnboundThis\": false\n }]\n "])), RULE_NAME), + Lint.Utils.dedent(templateObject_6 || (templateObject_6 = tslib_1.__makeTemplateObject(["\n \"", "\": [true, {\n \"allowNamedFunctions\": true,\n \"allowUnboundThis\": false\n }]\n "], ["\n \"", "\": [true, {\n \"allowNamedFunctions\": true,\n \"allowUnboundThis\": false\n }]\n "])), RULE_NAME) + ], + typescriptOnly: false, + type: 'typescript' + }; + return Rule; +}(Lint.Rules.AbstractRule)); +exports.Rule = Rule; +function checkMetaProperty(node, name, prop) { + return node.parent && node.parent.getFirstToken().getText() === name && node.name.text === prop; +} +function getCallbackInfo(func) { + var retv = { isCallback: false, isLexicalThis: false }; + var node = func; + var parent = node.parent; + while (node && parent) { + switch (parent.kind) { + case ts.SyntaxKind.BinaryExpression: + case ts.SyntaxKind.ConditionalExpression: + break; + case ts.SyntaxKind.PropertyAccessExpression: + if (parent.name.kind === ts.SyntaxKind.Identifier && + parent.name.text === 'bind' && + parent.parent && + parent.parent.kind === ts.SyntaxKind.CallExpression && + parent.parent.expression === parent) { + retv.isLexicalThis = (parent.parent.arguments.length === 1 && + parent.parent.arguments[0].kind === ts.SyntaxKind.ThisKeyword); + node = parent; + parent = parent.parent; + } + else { + return retv; + } + break; + case ts.SyntaxKind.CallExpression: + case ts.SyntaxKind.NewExpression: + if (parent.expression !== node) { + retv.isCallback = true; + } + return retv; + default: + return retv; + } + node = parent; + parent = node.parent; + } + throw new Error('unreachable'); +} +var RuleWalker = (function (_super) { + tslib_1.__extends(RuleWalker, _super); + function RuleWalker(sourceFile, options) { + var _this = _super.call(this, sourceFile, options) || this; + _this.stack = []; + OPTIONS = { + allowUnboundThis: true, + allowNamedFunctions: null + }; + var userOptions = _this.getOptions()[0]; + if (userOptions) { + OPTIONS.allowUnboundThis = userOptions.allowUnboundThis !== false; + OPTIONS.allowNamedFunctions = userOptions.allowNamedFunctions; + } + return _this; + } + RuleWalker.prototype.enterScope = function (functionName) { + this.stack.push({ + functionName: functionName, + isRecursive: false, + hasThis: false, + hasSuper: false, + hasMeta: false, + hasArguments: false + }); + }; + RuleWalker.prototype.exitScope = function () { + return this.stack.pop(); + }; + RuleWalker.prototype.exitFunctionExpression = function (node) { + var scopeInfo = this.exitScope(); + if (node.asteriskToken) { + return; + } + if (node.name && node.name.text) { + if (OPTIONS.allowNamedFunctions || scopeInfo.isRecursive) { + return; + } + } + var params = node.parameters.map(function (x) { return x.name.getText(); }); + var argumentsIsParam = params.indexOf('arguments') !== -1; + if (!argumentsIsParam && scopeInfo.hasArguments) { + return; + } + var callbackInfo = getCallbackInfo(node); + if (callbackInfo.isCallback && + (!OPTIONS.allowUnboundThis || !scopeInfo.hasThis || callbackInfo.isLexicalThis) && + !scopeInfo.hasSuper && + !scopeInfo.hasMeta) { + var failure = this.createFailure(node.getStart(), node.getWidth(), 'Unexpected function expression.'); + this.addFailure(failure); + } + }; + RuleWalker.prototype.visitSourceFile = function (node) { + this.stack = []; + _super.prototype.visitSourceFile.call(this, node); + }; + RuleWalker.prototype.visitFunctionDeclaration = function (node) { + this.enterScope(); + _super.prototype.visitFunctionDeclaration.call(this, node); + this.exitScope(); + }; + RuleWalker.prototype.visitFunctionExpression = function (node) { + this.enterScope(node.name ? node.name.text : undefined); + _super.prototype.visitFunctionExpression.call(this, node); + this.exitFunctionExpression(node); + }; + RuleWalker.prototype.visitNode = function (node) { + var info = this.stack[this.stack.length - 1]; + if (info && node.parent && node.parent.kind !== ts.SyntaxKind.FunctionExpression) { + if (node.kind === ts.SyntaxKind.ThisKeyword) { + info.hasThis = true; + } + else if (node.kind === ts.SyntaxKind.SuperKeyword) { + info.hasSuper = true; + } + else if (node.kind === ts.SyntaxKind.Identifier) { + var text = node.text; + if (text === 'arguments') { + info.hasArguments = true; + } + else if (text === info.functionName) { + info.isRecursive = true; + } + } + else if ((node.kind === ts.SyntaxKind.PropertyAccessExpression || + node.kind === ts.SyntaxKind.MetaProperty) && + checkMetaProperty(node, 'new', 'target')) { + info.hasMeta = true; + } + } + _super.prototype.visitNode.call(this, node); + }; + return RuleWalker; +}(Lint.RuleWalker)); +var templateObject_1, templateObject_2, templateObject_3, templateObject_4, templateObject_5, templateObject_6; + +//# sourceMappingURL=data:application/json;charset=utf8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInJ1bGVzL3RlclByZWZlckFycm93Q2FsbGJhY2tSdWxlLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7OztBQU1BLCtCQUFpQztBQUNqQyw2QkFBK0I7QUFFL0IsSUFBTSxTQUFTLEdBQUcsMkJBQTJCLENBQUM7QUFDOUMsSUFBSSxPQUFZLENBQUM7QUFFakI7SUFBMEIsZ0NBQXVCO0lBQWpEOztJQW9FQSxDQUFDO0lBSlEsb0JBQUssR0FBWixVQUFhLFVBQXlCO1FBQ3BDLElBQU0sTUFBTSxHQUF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6L3RzbGludC1lc2xpbnQtcnVsZXMvc3JjIn0= diff --git a/node_modules/tslint-eslint-rules/dist/rules/validJsdocRule.js b/node_modules/tslint-eslint-rules/dist/rules/validJsdocRule.js new file mode 100644 index 000000000..d57e8962a --- /dev/null +++ b/node_modules/tslint-eslint-rules/dist/rules/validJsdocRule.js @@ -0,0 +1,336 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +var tslib_1 = require("tslib"); +var ts = require("typescript"); +var Lint = require("tslint"); +var doctrine = require("doctrine"); +var RULE_NAME = 'valid-jsdoc'; +var OPTIONS; +var Rule = (function (_super) { + tslib_1.__extends(Rule, _super); + function Rule() { + return _super !== null && _super.apply(this, arguments) || this; + } + Rule.prototype.apply = function (sourceFile) { + var opts = this.getOptions().ruleArguments; + OPTIONS = { + prefer: {}, + requireReturn: true, + requireParamType: true, + requireReturnType: true, + requireParamDescription: true, + requireReturnDescription: true, + matchDescription: '' + }; + if (opts && opts.length > 0) { + if (opts[0].prefer) { + OPTIONS.prefer = opts[0].prefer; + } + OPTIONS.requireReturn = opts[0].requireReturn !== false; + OPTIONS.requireParamType = opts[0].requireParamType !== false; + OPTIONS.requireReturnType = opts[0].requireReturnType !== false; + OPTIONS.requireParamDescription = opts[0].requireParamDescription !== false; + OPTIONS.requireReturnDescription = opts[0].requireReturnDescription !== false; + OPTIONS.matchDescription = opts[0].matchDescription; + } + var walker = new ValidJsdocWalker(sourceFile, this.getOptions()); + return this.applyWithWalker(walker); + }; + Rule.FAILURE_STRING = { + missingBrace: 'JSDoc type missing brace', + syntaxError: 'JSDoc syntax error', + missingParameterType: function (name) { return "missing JSDoc parameter type for '" + name + "'"; }, + missingParameterDescription: function (name) { return "missing JSDoc parameter description for '" + name + "'"; }, + duplicateParameter: function (name) { return "duplicate JSDoc parameter '" + name + "'"; }, + unexpectedTag: function (title) { return "unexpected @" + title + " tag; function has no return statement"; }, + missingReturnType: 'missing JSDoc return type', + missingReturnDescription: 'missing JSDoc return description', + prefer: function (name) { return "use @" + name + " instead"; }, + missingReturn: function (param) { return "missing JSDoc @" + (param || 'returns') + " for function"; }, + wrongParam: function (expected, actual) { return "expected JSDoc for '" + expected + "' but found '" + actual + "'"; }, + missingParam: function (name) { return "missing JSDoc for parameter '" + name + "'"; }, + wrongDescription: 'JSDoc description does not satisfy the regex pattern', + invalidRegexDescription: function (error) { return "configured matchDescription is an invalid RegExp. Error: " + error; } + }; + Rule.metadata = { + ruleName: RULE_NAME, + hasFix: false, + description: 'enforce valid JSDoc comments', + rationale: Lint.Utils.dedent(templateObject_1 || (templateObject_1 = tslib_1.__makeTemplateObject(["\n [JSDoc](http://usejsdoc.org/) generates application programming interface (API) documentation\n from specially-formatted comments in JavaScript code. So does [typedoc](http://typedoc.org/).\n\n If comments are invalid because of typing mistakes, then documentation will be incomplete.\n\n If comments are inconsistent because they are not updated when function definitions are\n modified, then readers might become confused.\n "], ["\n [JSDoc](http://usejsdoc.org/) generates application programming interface (API) documentation\n from specially-formatted comments in JavaScript code. So does [typedoc](http://typedoc.org/).\n\n If comments are invalid because of typing mistakes, then documentation will be incomplete.\n\n If comments are inconsistent because they are not updated when function definitions are\n modified, then readers might become confused.\n "]))), + optionsDescription: Lint.Utils.dedent(templateObject_2 || (templateObject_2 = tslib_1.__makeTemplateObject(["\n This rule has an object option:\n\n * `\"prefer\"` enforces consistent documentation tags specified by an object whose properties\n mean instead of key use value (for example, `\"return\": \"returns\"` means\n instead of `@return` use `@returns`)\n * `\"preferType\"` enforces consistent type strings specified by an object whose properties\n mean instead of key use value (for example, `\"object\": \"Object\"` means\n instead of `object` use `Object`)\n * `\"requireReturn\"` requires a return tag:\n * `true` (default) *even if* the function or method does not have a return statement\n (this option value does not apply to constructors)\n * `false` *if and only if* the function or method has a return statement (this option\n value does apply to constructors)\n * `\"requireParamType\"`: `false` allows missing type in param tags\n * `\"requireReturnType\"`: `false` allows missing type in return tags\n * `\"matchDescription\"` specifies (as a string) a regular expression to match the description\n in each JSDoc comment (for example, `\".+\"` requires a description;\n this option does not apply to descriptions in parameter or return\n tags)\n * `\"requireParamDescription\"`: `false` allows missing description in parameter tags\n * `\"requireReturnDescription\"`: `false` allows missing description in return tags\n "], ["\n This rule has an object option:\n\n * \\`\"prefer\"\\` enforces consistent documentation tags specified by an object whose properties\n mean instead of key use value (for example, \\`\"return\": \"returns\"\\` means\n instead of \\`@return\\` use \\`@returns\\`)\n * \\`\"preferType\"\\` enforces consistent type strings specified by an object whose properties\n mean instead of key use value (for example, \\`\"object\": \"Object\"\\` means\n instead of \\`object\\` use \\`Object\\`)\n * \\`\"requireReturn\"\\` requires a return tag:\n * \\`true\\` (default) *even if* the function or method does not have a return statement\n (this option value does not apply to constructors)\n * \\`false\\` *if and only if* the function or method has a return statement (this option\n value does apply to constructors)\n * \\`\"requireParamType\"\\`: \\`false\\` allows missing type in param tags\n * \\`\"requireReturnType\"\\`: \\`false\\` allows missing type in return tags\n * \\`\"matchDescription\"\\` specifies (as a string) a regular expression to match the description\n in each JSDoc comment (for example, \\`\".+\"\\` requires a description;\n this option does not apply to descriptions in parameter or return\n tags)\n * \\`\"requireParamDescription\"\\`: \\`false\\` allows missing description in parameter tags\n * \\`\"requireReturnDescription\"\\`: \\`false\\` allows missing description in return tags\n "]))), + options: { + type: 'object', + properties: { + prefer: { + type: 'object', + additionalProperties: { + type: 'string' + } + }, + preferType: { + type: 'object', + additionalProperties: { + type: 'string' + } + }, + requireReturn: { + type: 'boolean' + }, + requireParamDescription: { + type: 'boolean' + }, + requireReturnDescription: { + type: 'boolean' + }, + matchDescription: { + type: 'string' + }, + requireParamType: { + type: 'boolean' + }, + requireReturnType: { + type: 'boolean' + } + }, + additionalProperties: false + }, + optionExamples: [ + Lint.Utils.dedent(templateObject_3 || (templateObject_3 = tslib_1.__makeTemplateObject(["\n \"", "\": [true]\n "], ["\n \"", "\": [true]\n "])), RULE_NAME), + Lint.Utils.dedent(templateObject_4 || (templateObject_4 = tslib_1.__makeTemplateObject(["\n \"", "\": [true, {\n \"prefer\": {\n \"return\": \"returns\"\n },\n \"requireReturn\": false,\n \"requireParamDescription\": true,\n \"requireReturnDescription\": true,\n \"matchDescription\": \"^[A-Z][A-Za-z0-9\\\\s]*[.]$\"\n }]\n "], ["\n \"", "\": [true, {\n \"prefer\": {\n \"return\": \"returns\"\n },\n \"requireReturn\": false,\n \"requireParamDescription\": true,\n \"requireReturnDescription\": true,\n \"matchDescription\": \"^[A-Z][A-Za-z0-9\\\\\\\\s]*[.]$\"\n }]\n "])), RULE_NAME) + ], + typescriptOnly: false, + type: 'maintainability' + }; + return Rule; +}(Lint.Rules.AbstractRule)); +exports.Rule = Rule; +var ValidJsdocWalker = (function (_super) { + tslib_1.__extends(ValidJsdocWalker, _super); + function ValidJsdocWalker() { + var _this = _super !== null && _super.apply(this, arguments) || this; + _this.fns = []; + return _this; + } + ValidJsdocWalker.prototype.visitSourceFile = function (node) { + _super.prototype.visitSourceFile.call(this, node); + }; + ValidJsdocWalker.prototype.visitNode = function (node) { + if (node.kind === ts.SyntaxKind.ClassExpression) { + this.visitClassExpression(node); + } + else { + _super.prototype.visitNode.call(this, node); + } + }; + ValidJsdocWalker.prototype.visitArrowFunction = function (node) { + this.startFunction(node); + _super.prototype.visitArrowFunction.call(this, node); + this.checkJSDoc(node); + }; + ValidJsdocWalker.prototype.visitFunctionExpression = function (node) { + this.startFunction(node); + _super.prototype.visitFunctionExpression.call(this, node); + this.checkJSDoc(node); + }; + ValidJsdocWalker.prototype.visitFunctionDeclaration = function (node) { + this.startFunction(node); + _super.prototype.visitFunctionDeclaration.call(this, node); + this.checkJSDoc(node); + }; + ValidJsdocWalker.prototype.visitClassExpression = function (node) { + this.startFunction(node); + _super.prototype.visitClassExpression.call(this, node); + this.checkJSDoc(node); + }; + ValidJsdocWalker.prototype.visitClassDeclaration = function (node) { + this.startFunction(node); + _super.prototype.visitClassDeclaration.call(this, node); + this.checkJSDoc(node); + }; + ValidJsdocWalker.prototype.visitMethodDeclaration = function (node) { + this.startFunction(node); + _super.prototype.visitMethodDeclaration.call(this, node); + this.checkJSDoc(node); + }; + ValidJsdocWalker.prototype.visitConstructorDeclaration = function (node) { + this.startFunction(node); + _super.prototype.visitConstructorDeclaration.call(this, node); + this.checkJSDoc(node); + }; + ValidJsdocWalker.prototype.visitReturnStatement = function (node) { + this.addReturn(node); + _super.prototype.visitReturnStatement.call(this, node); + }; + ValidJsdocWalker.prototype.startFunction = function (node) { + var returnPresent = false; + var isVoidOrNever = false; + var returnType; + if (node.kind === ts.SyntaxKind.ArrowFunction && node.body.kind !== ts.SyntaxKind.Block) + returnPresent = true; + if (this.isTypeClass(node)) + returnPresent = true; + returnType = node.type; + if (returnType !== undefined) { + switch (returnType.kind) { + case ts.SyntaxKind.VoidKeyword: + case ts.SyntaxKind.NeverKeyword: + isVoidOrNever = true; + break; + } + } + this.fns.push({ node: node, returnPresent: returnPresent, isVoidOrNever: isVoidOrNever }); + }; + ValidJsdocWalker.prototype.addReturn = function (node) { + var parent = node; + var nodes = this.fns.map(function (fn) { return fn.node; }); + while (parent && nodes.indexOf(parent) === -1) + parent = parent.parent; + if (parent && node.expression) { + this.fns[nodes.indexOf(parent)].returnPresent = true; + } + }; + ValidJsdocWalker.prototype.isTypeClass = function (node) { + return node.kind === ts.SyntaxKind.ClassExpression || node.kind === ts.SyntaxKind.ClassDeclaration; + }; + ValidJsdocWalker.prototype.isValidReturnType = function (tag) { + return tag.type && (tag.type.name === 'void' || tag.type.type === 'UndefinedLiteral'); + }; + ValidJsdocWalker.prototype.getJSDocComment = function (node) { + var ALLOWED_PARENTS = [ + ts.SyntaxKind.BinaryExpression, + ts.SyntaxKind.VariableDeclaration, + ts.SyntaxKind.VariableDeclarationList, + ts.SyntaxKind.VariableStatement + ]; + if (!/^\/\*\*/.test(node.getFullText().trim())) { + if (node.parent && ALLOWED_PARENTS.indexOf(node.parent.kind) !== -1) { + return this.getJSDocComment(node.parent); + } + return {}; + } + var comments = node.getFullText(); + var offset = comments.indexOf('/**'); + comments = comments.substring(offset); + comments = comments.substring(0, comments.indexOf('*/') + 2); + var start = node.pos + offset; + var width = comments.length; + if (!/^\/\*\*/.test(comments) || !/\*\/$/.test(comments)) { + return {}; + } + return { comments: comments, start: start, width: width }; + }; + ValidJsdocWalker.prototype.checkJSDoc = function (node) { + var _this = this; + var _a = this.getJSDocComment(node), comments = _a.comments, start = _a.start, width = _a.width; + if (!comments || start === undefined || width === undefined) + return; + var jsdoc; + try { + jsdoc = doctrine.parse(comments, { + strict: true, + unwrap: true, + sloppy: true + }); + } + catch (e) { + if (/braces/i.test(e.message)) { + this.addFailure(this.createFailure(start, width, Rule.FAILURE_STRING.missingBrace)); + } + else { + this.addFailure(this.createFailure(start, width, Rule.FAILURE_STRING.syntaxError)); + } + return; + } + var fn = this.fns.filter(function (f) { return node === f.node; })[0]; + var params = {}; + var hasReturns = false; + var hasConstructor = false; + var isOverride = false; + var isAbstract = false; + for (var _i = 0, _b = jsdoc.tags; _i < _b.length; _i++) { + var tag = _b[_i]; + switch (tag.title) { + case 'param': + case 'arg': + case 'argument': + if (!tag.type && OPTIONS.requireParamType) { + this.addFailure(this.createFailure(start, width, Rule.FAILURE_STRING.missingParameterType(tag.name))); + } + if (!tag.description && OPTIONS.requireParamDescription) { + this.addFailure(this.createFailure(start, width, Rule.FAILURE_STRING.missingParameterDescription(tag.name))); + } + if (params[tag.name]) { + this.addFailure(this.createFailure(start, width, Rule.FAILURE_STRING.duplicateParameter(tag.name))); + } + else if (tag.name.indexOf('.') === -1) { + params[tag.name] = true; + } + break; + case 'return': + case 'returns': + hasReturns = true; + isAbstract = Lint.hasModifier(fn.node.modifiers, ts.SyntaxKind.AbstractKeyword); + if (!isAbstract && !OPTIONS.requireReturn && !fn.returnPresent && tag.type && tag.type.name !== 'void' && tag.type.name !== 'undefined') { + this.addFailure(this.createFailure(start, width, Rule.FAILURE_STRING.unexpectedTag(tag.title))); + } + else { + if (!tag.type && OPTIONS.requireReturnType) { + this.addFailure(this.createFailure(start, width, Rule.FAILURE_STRING.missingReturnType)); + } + if (!this.isValidReturnType(tag) && !tag.description && OPTIONS.requireReturnDescription) { + this.addFailure(this.createFailure(start, width, Rule.FAILURE_STRING.missingReturnDescription)); + } + } + break; + case 'constructor': + case 'class': + hasConstructor = true; + break; + case 'override': + case 'inheritdoc': + case 'inheritDoc': + isOverride = true; + break; + } + var title = OPTIONS.prefer[tag.title]; + if (OPTIONS.prefer.hasOwnProperty(tag.title) && tag.title !== title) { + this.addFailure(this.createFailure(start, width, Rule.FAILURE_STRING.prefer(title))); + } + } + if (!isOverride && !hasReturns && !hasConstructor && node.parent && node.parent.kind !== ts.SyntaxKind.GetKeyword && !this.isTypeClass(node)) { + if (OPTIONS.requireReturn || (fn.returnPresent && !fn.isVoidOrNever)) { + this.addFailure(this.createFailure(start, width, Rule.FAILURE_STRING.missingReturn(OPTIONS.prefer['returns']))); + } + } + var jsdocParams = Object.keys(params); + var parameters = node.parameters; + if (parameters) { + parameters.forEach(function (param, i) { + if (param.name.kind === ts.SyntaxKind.Identifier) { + var name = param.name.text; + if (jsdocParams[i] && name !== jsdocParams[i]) { + _this.addFailure(_this.createFailure(start, width, Rule.FAILURE_STRING.wrongParam(name, jsdocParams[i]))); + } + else if (!params[name] && !isOverride) { + _this.addFailure(_this.createFailure(start, width, Rule.FAILURE_STRING.missingParam(name))); + } + } + }); + } + if (OPTIONS.matchDescription) { + try { + var regex = new RegExp(OPTIONS.matchDescription); + if (!regex.test(jsdoc.description)) { + this.addFailure(this.createFailure(start, width, Rule.FAILURE_STRING.wrongDescription)); + } + } + catch (e) { + this.addFailure(this.createFailure(start, width, e.message)); + } + } + }; + return ValidJsdocWalker; +}(Lint.RuleWalker)); +var templateObject_1, templateObject_2, templateObject_3, templateObject_4; + +//# sourceMappingURL=data:application/json;charset=utf8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInJ1bGVzL3ZhbGlkSnNkb2NSdWxlLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7Ozt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am1sb3Blei90c2xpbnQtZXNsaW50LXJ1bGVzL3NyYyJ9 diff --git a/node_modules/tslint-eslint-rules/dist/rules/validTypeofRule.js b/node_modules/tslint-eslint-rules/dist/rules/validTypeofRule.js new file mode 100644 index 000000000..73652d52c --- /dev/null +++ b/node_modules/tslint-eslint-rules/dist/rules/validTypeofRule.js @@ -0,0 +1,47 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +var tslib_1 = require("tslib"); +var ts = require("typescript"); +var Lint = require("tslint"); +var Rule = (function (_super) { + tslib_1.__extends(Rule, _super); + function Rule() { + return _super !== null && _super.apply(this, arguments) || this; + } + Rule.prototype.apply = function (sourceFile) { + var walker = new ValidTypeofWalker(sourceFile, this.getOptions()); + return this.applyWithWalker(walker); + }; + Rule.FAILURE_STRING = 'invalid typeof comparison value'; + return Rule; +}(Lint.Rules.AbstractRule)); +exports.Rule = Rule; +var ValidTypeofWalker = (function (_super) { + tslib_1.__extends(ValidTypeofWalker, _super); + function ValidTypeofWalker() { + var _this = _super !== null && _super.apply(this, arguments) || this; + _this.VALID_TYPES = ['symbol', 'undefined', 'object', 'boolean', 'number', 'string', 'function']; + _this.OPERATORS = [ts.SyntaxKind.EqualsEqualsToken, ts.SyntaxKind.EqualsEqualsEqualsToken, ts.SyntaxKind.ExclamationEqualsToken, ts.SyntaxKind.ExclamationEqualsEqualsToken]; + return _this; + } + ValidTypeofWalker.prototype.visitNode = function (node) { + if (node.kind === ts.SyntaxKind.TypeOfExpression) { + this.validateTypeOf(node); + } + _super.prototype.visitNode.call(this, node); + }; + ValidTypeofWalker.prototype.validateTypeOf = function (node) { + if (node.parent && node.parent.kind === ts.SyntaxKind.BinaryExpression) { + var parent = node.parent; + if (this.OPERATORS.indexOf(parent.operatorToken.kind) !== -1) { + var sibling = parent.left === node ? parent.right : parent.left; + if (sibling.kind === ts.SyntaxKind.StringLiteral && this.VALID_TYPES.indexOf(sibling.text) === -1) { + this.addFailure(this.createFailure(node.getStart(), node.getWidth(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0FBQyxDQUFDLENBQUM7aUJBQzVGO2FBQ0Y7U0FDRjtJQUNILENBQUM7SUFDSCx3QkFBQztBQUFELENBdkJBLEFBdUJDLENBdkIrQixJQUFJLENBQUMsVUFBVSxHQXVCOUMiLCJmaWxlIjoicnVsZXMvdmFsaWRUeXBlb2ZSdWxlLmpzIiwic291cmNlUm9vdCI6Ii9Vc2Vycy9qbWxvcGV6L3RzbGludC1lc2xpbnQtcnVsZXMvc3JjIn0= diff --git a/node_modules/tslint-eslint-rules/dist/support/token.js b/node_modules/tslint-eslint-rules/dist/support/token.js new file mode 100644 index 000000000..16bfb37f2 --- /dev/null +++ b/node_modules/tslint-eslint-rules/dist/support/token.js @@ -0,0 +1,9 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +var ts = require("typescript"); +function isAssignmentToken(token) { + return token.kind >= ts.SyntaxKind.FirstAssignment && token.kind <= ts.SyntaxKind.LastAssignment; +} +exports.isAssignmentToken = isAssignmentToken; + +//# sourceMappingURL=data:application/json;charset=utf8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInN1cHBvcnQvdG9rZW4udHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7QUFBQSwrQkFBaUM7QUFFakMsU0FBZ0IsaUJBQWlCLENBQUMsS0FBYztJQUM5QyxPQUFPLEtBQUssQ0FBQyxJQUFJLElBQUksRUFBRSxDQUFDLFVBQVUsQ0FBQyxlQUFlLElBQUksS0FBSyxDQUFDLElBQUksSUFBSSxFQUFFLENBQUMsVUFBVSxDQUFDLGNBQWMsQ0FBQztBQUNuRyxDQUFDO0FBRkQsOENBRUMiLCJmaWxlIjoic3VwcG9ydC90b2tlbi5qcyIsInNvdXJjZVJvb3QiOiIvVXNlcnMvam1sb3Blei90c2xpbnQtZXNsaW50LXJ1bGVzL3NyYyJ9 diff --git a/node_modules/tslint-eslint-rules/index.js b/node_modules/tslint-eslint-rules/index.js new file mode 100644 index 000000000..9da1de991 --- /dev/null +++ b/node_modules/tslint-eslint-rules/index.js @@ -0,0 +1,5 @@ +// unopinionated extensable tslint configuration +// loads rules for extending packages, but does not enable any +module.exports = { + rulesDirectory: "./dist/rules", +}; diff --git a/node_modules/tslint-eslint-rules/node_modules/tslib/.gitattributes b/node_modules/tslint-eslint-rules/node_modules/tslib/.gitattributes new file mode 100644 index 000000000..74f5f4a64 --- /dev/null +++ b/node_modules/tslint-eslint-rules/node_modules/tslib/.gitattributes @@ -0,0 +1 @@ +*.js linguist-language=TypeScript \ No newline at end of file diff --git a/node_modules/tslint-eslint-rules/node_modules/tslib/CopyrightNotice.txt b/node_modules/tslint-eslint-rules/node_modules/tslib/CopyrightNotice.txt new file mode 100644 index 000000000..0f6db1f75 --- /dev/null +++ b/node_modules/tslint-eslint-rules/node_modules/tslib/CopyrightNotice.txt @@ -0,0 +1,15 @@ +/*! ***************************************************************************** +Copyright (c) Microsoft Corporation. All rights reserved. +Licensed under the Apache License, Version 2.0 (the "License"); you may not use +this file except in compliance with the License. You may obtain a copy of the +License at http://www.apache.org/licenses/LICENSE-2.0 + +THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED +WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, +MERCHANTABLITY OR NON-INFRINGEMENT. + +See the Apache Version 2.0 License for specific language governing permissions +and limitations under the License. +***************************************************************************** */ + diff --git a/node_modules/tslint-eslint-rules/node_modules/tslib/LICENSE.txt b/node_modules/tslint-eslint-rules/node_modules/tslib/LICENSE.txt new file mode 100644 index 000000000..8746124b2 --- /dev/null +++ b/node_modules/tslint-eslint-rules/node_modules/tslib/LICENSE.txt @@ -0,0 +1,55 @@ +Apache License + +Version 2.0, January 2004 + +http://www.apache.org/licenses/ + +TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + +1. Definitions. + +"License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. + +"Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. + +"Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. + +"You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License. + +"Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files. + +"Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types. + +"Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below). + +"Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof. + +"Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution." + +"Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work. + +2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form. + +3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed. + +4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions: + +You must give any other recipients of the Work or Derivative Works a copy of this License; and + +You must cause any modified files to carry prominent notices stating that You changed the files; and + +You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and + +If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License. + +5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions. + +6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file. + +7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License. + +8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages. + +9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability. + +END OF TERMS AND CONDITIONS diff --git a/node_modules/tslint-eslint-rules/node_modules/tslib/README.md b/node_modules/tslint-eslint-rules/node_modules/tslib/README.md new file mode 100644 index 000000000..d71a60019 --- /dev/null +++ b/node_modules/tslint-eslint-rules/node_modules/tslib/README.md @@ -0,0 +1,134 @@ +# tslib + +This is a runtime library for [TypeScript](http://www.typescriptlang.org/) that contains all of the TypeScript helper functions. + +This library is primarily used by the `--importHelpers` flag in TypeScript. +When using `--importHelpers`, a module that uses helper functions like `__extends` and `__assign` in the following emitted file: + +```ts +var __assign = (this && this.__assign) || Object.assign || function(t) { + for (var s, i = 1, n = arguments.length; i < n; i++) { + s = arguments[i]; + for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) + t[p] = s[p]; + } + return t; +}; +exports.x = {}; +exports.y = __assign({}, exports.x); + +``` + +will instead be emitted as something like the following: + +```ts +var tslib_1 = require("tslib"); +exports.x = {}; +exports.y = tslib_1.__assign({}, exports.x); +``` + +Because this can avoid duplicate declarations of things like `__extends`, `__assign`, etc., this means delivering users smaller files on average, as well as less runtime overhead. +For optimized bundles with TypeScript, you should absolutely consider using `tslib` and `--importHelpers`. + +# Installing + +For the latest stable version, run: + +## npm + +```sh +# TypeScript 2.3.3 or later +npm install --save tslib + +# TypeScript 2.3.2 or earlier +npm install --save tslib@1.6.1 +``` + +## bower + +```sh +# TypeScript 2.3.3 or later +bower install tslib + +# TypeScript 2.3.2 or earlier +bower install tslib@1.6.1 +``` + +## JSPM + +```sh +# TypeScript 2.3.3 or later +jspm install tslib + +# TypeScript 2.3.2 or earlier +jspm install tslib@1.6.1 +``` + +# Usage + +Set the `importHelpers` compiler option on the command line: + +``` +tsc --importHelpers file.ts +``` + +or in your tsconfig.json: + +```json +{ + "compilerOptions": { + "importHelpers": true + } +} +``` + +#### For bower and JSPM users + +You will need to add a `paths` mapping for `tslib`, e.g. For Bower users: + +```json +{ + "compilerOptions": { + "module": "amd", + "importHelpers": true, + "baseUrl": "./", + "paths": { + "tslib" : ["bower_components/tslib/tslib.d.ts"] + } + } +} +``` + +For JSPM users: + +```json +{ + "compilerOptions": { + "module": "system", + "importHelpers": true, + "baseUrl": "./", + "paths": { + "tslib" : ["jspm_packages/npm/tslib@1.9.0/tslib.d.ts"] + } + } +} +``` + + +# Contribute + +There are many ways to [contribute](https://github.com/Microsoft/TypeScript/blob/master/CONTRIBUTING.md) to TypeScript. + +* [Submit bugs](https://github.com/Microsoft/TypeScript/issues) and help us verify fixes as they are checked in. +* Review the [source code changes](https://github.com/Microsoft/TypeScript/pulls). +* Engage with other TypeScript users and developers on [StackOverflow](http://stackoverflow.com/questions/tagged/typescript). +* Join the [#typescript](http://twitter.com/#!/search/realtime/%23typescript) discussion on Twitter. +* [Contribute bug fixes](https://github.com/Microsoft/TypeScript/blob/master/CONTRIBUTING.md). +* Read the language specification ([docx](http://go.microsoft.com/fwlink/?LinkId=267121), [pdf](http://go.microsoft.com/fwlink/?LinkId=267238)). + +# Documentation + +* [Quick tutorial](http://www.typescriptlang.org/Tutorial) +* [Programming handbook](http://www.typescriptlang.org/Handbook) +* [Language specification](https://github.com/Microsoft/TypeScript/blob/master/doc/spec.md) +* [Homepage](http://www.typescriptlang.org/) diff --git a/node_modules/tslint-eslint-rules/node_modules/tslib/bower.json b/node_modules/tslint-eslint-rules/node_modules/tslib/bower.json new file mode 100644 index 000000000..169a4d11e --- /dev/null +++ b/node_modules/tslint-eslint-rules/node_modules/tslib/bower.json @@ -0,0 +1,34 @@ +{ + "name": "tslib", + "authors": [ + "Microsoft Corp." + ], + "homepage": "http://typescriptlang.org/", + "version": "1.9.0", + "license": "Apache-2.0", + "description": "Runtime library for TypeScript helper functions", + "keywords": [ + "TypeScript", + "Microsoft", + "compiler", + "language", + "javascript", + "tslib", + "runtime" + ], + "repository": { + "type": "git", + "url": "https://github.com/Microsoft/tslib.git" + }, + "main": "tslib.js", + "ignore": [ + "**/.*", + "node_modules", + "bower_components", + "docs", + "package.json", + ".npmignore", + ".gitignore", + ".gitattributes" + ] +} diff --git a/node_modules/tslint-eslint-rules/node_modules/tslib/docs/generator.md b/node_modules/tslint-eslint-rules/node_modules/tslib/docs/generator.md new file mode 100644 index 000000000..88ffb08e2 --- /dev/null +++ b/node_modules/tslint-eslint-rules/node_modules/tslib/docs/generator.md @@ -0,0 +1,486 @@ +# The `__generator` helper + +The `__generator` helper is a function designed to support TypeScript's down-level emit for +async functions when targeting ES5 and earlier. But how, exactly, does it work? + +Here's the body of the `__generator` helper: + +```js +__generator = function (thisArg, body) { + var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t; + return { next: verb(0), "throw": verb(1), "return": verb(2) }; + function verb(n) { return function (v) { return step([n, v]); }; } + function step(op) { + if (f) throw new TypeError("Generator is already executing."); + while (_) try { + if (f = 1, y && (t = y[op[0] & 2 ? "return" : op[0] ? "throw" : "next"]) && !(t = t.call(y, op[1])).done) return t; + if (y = 0, t) op = [0, t.value]; + switch (op[0]) { + case 0: case 1: t = op; break; + case 4: _.label++; return { value: op[1], done: false }; + case 5: _.label++; y = op[1]; op = [0]; continue; + case 7: op = _.ops.pop(); _.trys.pop(); continue; + default: + if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; } + if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; } + if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; } + if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; } + if (t[2]) _.ops.pop(); + _.trys.pop(); continue; + } + op = body.call(thisArg, _); + } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; } + if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true }; + } +}; +``` + +And here's an example of it in use: + +```ts +// source +async function func(x) { + try { + await x; + } + catch (e) { + console.error(e); + } + finally { + console.log("finally"); + } +} + +// generated +function func(x) { + return __awaiter(this, void 0, void 0, function () { + var e_1; + return __generator(this, function (_a) { + switch (_a.label) { + case 0: + _a.trys.push([0, 1, 3, 4]); + return [4 /*yield*/, x]; + case 1: + _a.sent(); + return [3 /*break*/, 4]; + case 2: + e_1 = _a.sent(); + console.error(e_1); + return [3 /*break*/, 4]; + case 3: + console.log("finally"); + return [7 /*endfinally*/]; + case 4: return [2 /*return*/]; + } + }); + }); +} +``` + +There is a lot going on in this function, so the following will break down what each part of the +`__generator` helper does and how it works. + +# Opcodes + +The `__generator` helper uses opcodes which represent various operations that are interpreted by +the helper to affect its internal state. The following table lists the various opcodes, their +arguments, and their purpose: + +| Opcode | Arguments | Purpose | +|----------------|-----------|--------------------------------------------------------------------------------------------------------------------------------| +| 0 (next) | *value* | Starts the generator, or resumes the generator with *value* as the result of the `AwaitExpression` where execution was paused. | +| 1 (throw) | *value* | Resumes the generator, throwing *value* at `AwaitExpression` where execution was paused. | +| 2 (return) | *value* | Exits the generator, executing any `finally` blocks starting at the `AwaitExpression` where execution was paused. | +| 3 (break) | *label* | Performs an unconditional jump to the specified label, executing any `finally` between the current instruction and the label. | +| 4 (yield) | *value* | Suspends the generator, setting the resume point at the next label and yielding the value. | +| 5 (yieldstar) | *value* | Suspends the generator, setting the resume point at the next label and delegating operations to the supplied value. | +| 6 (catch) | *error* | An internal instruction used to indicate an exception that was thrown from the body of the generator. | +| 7 (endfinally) | | Exits a finally block, resuming any previous operation (such as a break, return, throw, etc.) | + +# State +The `_`, `f`, `y`, and `t` variables make up the persistent state of the `__generator` function. Each variable +has a specific purpose, as described in the following sections: + +## The `_` variable +The `__generator` helper must share state between its internal `step` orchestration function and +the `body` function passed to the helper. + +```ts +var _ = { + label: 0, + sent: function() { + if (t[0] & 1) // NOTE: true for `throw`, but not `next` or `catch` + throw t[1]; + return sent[1]; + }, + trys: [], + ops: [] +}; +``` + +The following table describes the members of the `_` state object and their purpose: + +| Name | Description | +|---------|---------------------------------------------------------------------------------------------------------------------------| +| `label` | Specifies the next switch case to execute in the `body` function. | +| `sent` | Handles the completion result passed to the generator. | +| `trys` | A stack of **Protected Regions**, which are 4-tuples that describe the labels that make up a `try..catch..finally` block. | +| `ops` | A stack of pending operations used for `try..finally` blocks. | + +The `__generator` helper passes this state object to the `body` function for use with switching +between switch cases in the body, handling completions from `AwaitExpression`, etc. + +## The `f` variable +The `f` variable indicates whether the generator is currently executing, to prevent re-entry of +the same generator during its execution. + +## The `y` variable +The `y` variable stores the iterator passed to a `yieldstar` instruction to which operations should be delegated. + +## The `t` variable +The `t` variable is a temporary variable that stores one of the following values: + +- The completion value when resuming from a `yield` or `yield*`. +- The error value for a catch block. +- The current **Protected Region**. +- The verb (`next`, `throw`, or `return` method) to delegate to the expression of a `yield*`. +- The result of evaluating the verb delegated to the expression of a `yield*`. + +> NOTE: None of the above cases overlap. + +# Protected Regions +A **Protected Region** is a region within the `body` function that indicates a +`try..catch..finally` statement. It consists of a 4-tuple that contains 4 labels: + +| Offset | Description | +|--------|-----------------------------------------------------------------------------------------| +| 0 | *Required* The label that indicates the beginning of a `try..catch..finally` statement. | +| 1 | *Optional* The label that indicates the beginning of a `catch` clause. | +| 2 | *Optional* The label that indicates the beginning of a `finally` clause. | +| 3 | *Required* The label that indicates the end of the `try..catch..finally` statement. | + +# The generator object +The final step of the `__generator` helper is the allocation of an object that implements the +`Generator` protocol, to be used by the `__awaiter` helper: + +```ts +return { next: verb(0), "throw": verb(1), "return": verb(2) }; +function verb(n) { return function (v) { return step([n, v]); }; } +``` + +This object translates calls to `next`, `throw`, and `return` to the appropriate Opcodes and +invokes the `step` orchestration function to continue execution. The `throw` and `return` method +names are quoted to better support ES3. + +# Orchestration +The `step` function is the main orechestration mechanism for the `__generator` helper. It +interprets opcodes, handles **protected regions**, and communicates results back to the caller. + +Here's a closer look at the `step` function: + +```ts +function step(op) { + if (f) throw new TypeError("Generator is already executing."); + while (_) try { + if (f = 1, y && (t = y[op[0] & 2 ? "return" : op[0] ? "throw" : "next"]) && !(t = t.call(y, op[1])).done) return t; + if (y = 0, t) op = [0, t.value]; + switch (op[0]) { + case 0: case 1: t = op; break; + case 4: _.label++; return { value: op[1], done: false }; + case 5: _.label++; y = op[1]; op = [0]; continue; + case 7: op = _.ops.pop(); _.trys.pop(); continue; + default: + if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; } + if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; } + if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; } + if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; } + if (t[2]) _.ops.pop(); + _.trys.pop(); continue; + } + op = body.call(thisArg, _); + } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; } + if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true }; +} +``` + +The main body of `step` exists in a `while` loop. This allows us to continually interpret +operations until we have reached some completion value, be it a `return`, `await`, or `throw`. + +## Preventing re-entry +The first part of the `step` function is used as a check to prevent re-entry into a currently +executing generator: + +```ts +if (f) throw new TypeError("Generator is already executing."); +``` + +## Running the generator +The main body of the `step` function consists of a `while` loop which continues to evaluate +instructions until the generator exits or is suspended: + +```ts +while (_) try ... +``` + +When the generator has run to completion, the `_` state variable will be cleared, forcing the loop +to exit. + +## Evaluating the generator body. +```ts +try { + ... + op = body.call(thisArg, _); +} +catch (e) { + op = [6, e]; + y = 0; +} +finally { + f = t = 0; +} +``` + +Depending on the current operation, we re-enter the generator body to start or continue execution. +Here we invoke `body` with `thisArg` as the `this` binding and the `_` state object as the only +argument. The result is a tuple that contains the next Opcode and argument. + +If evaluation of the body resulted in an exception, we convert this into an Opcode 6 ("catch") +operation to be handled in the next spin of the `while` loop. We also clear the `y` variable in +case it is set to ensure we are no longer delegating operations as the exception occurred in +user code *outside* of, or at the function boundary of, the delegated iterator (otherwise the +iterator would have handled the exception itself). + +After executing user code, we clear the `f` flag that indicates we are executing the generator, +as well as the `t` temporary value so that we don't hold onto values sent to the generator for +longer than necessary. + +Inside of the `try..finally` statement are a series of statements that are used to evaluate the +operations of the transformed generator body. + +The first thing we do is mark the generator as executing: + +```ts +if (f = 1, ...) +``` + +Despite the fact this expression is part of the head of an `if` statement, the comma operator +causes it to be evaluated and the result thrown out. This is a minification added purely to +reduce the overall footprint of the helper. + +## Delegating `yield*` + +The first two statements of the `try..finally` statement handle delegation for `yield*`: + +```ts +if (f = 1, y && (t = y[op[0] & 2 ? "return" : op[0] ? "throw" : "next"]) && !(t = t.call(y, op[1])).done) return t; +if (y = 0, t) op = [0, t.value]; +``` + +If the `y` variable is set, and `y` has a `next`, `throw`, or `return` method (depending on the +current operation), we invoke this method and store the return value (an IteratorResult) in `t`. + +If `t` indicates it is a yielded value (e.g. `t.done === false`), we return `t` to the caller. +If `t` indicates it is a returned value (e.g. `t.done === true`), we mark the operation with the +`next` Opcode, and the returned value. +If `y` did not have the appropriate method, or `t` was a returned value, we reset `y` to a falsey +value and continue processing the operation. + +## Handling operations + +The various Opcodes are handled in the following switch statement: + +```ts +switch (op[0]) { + case 0: case 1: t = op; break; + case 4: _.label++; return { value: op[1], done: false }; + case 5: _.label++; y = op[1]; op = [0]; continue; + case 7: op = _.ops.pop(); _.trys.pop(); continue; + default: + if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; } + if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; } + if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; } + if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; } + if (t[2]) _.ops.pop(); + _.trys.pop(); continue; +} +``` + +The following sections describe the various Opcodes: + +### Opcode 0 ("next") and Opcode 1 ("throw") +```ts +case 0: // next +case 1: // throw + t = op; + break; +``` + +Both Opcode 0 ("next") and Opcode 1 ("throw") have the same behavior. The current operation is +stored in the `t` variable and the `body` function is invoked. The `body` function should call +`_.sent()` which will evaluate the appropriate completion result. + +### Opcode 4 ("yield") +```ts +case 4: // yield + _.label++; + return { value: op[1], done: false }; +``` + +When we encounter Opcode 4 ("yield"), we increment the label by one to indicate the point at which +the generator will resume execution. We then return an `IteratorResult` whose `value` is the +yielded value, and `done` is `false`. + +### Opcode 5 ("yieldstar") +```ts +case 5: // yieldstar + _.label++; + y = op[1]; + op = [0]; + continue; +``` + +When we receive Opcode 5 ("yieldstar"), we increment the label by one to indicate the point at which +the generator will resume execution. We then store the iterator in `op[1]` in the `y` variable, and +set the operation to delegate to Opcode 0 ("next") with no value. Finally, we continue execution at +the top of the loop to start delegation. + +### Opcode 7 ("endfinally") +```ts +case 7: + op = _.ops.pop(); + _.trys.pop(); + continue; +``` + +Opcode 7 ("endfinally") indicates that we have hit the end of a `finally` clause, and that the last +operation recorded before entering the `finally` block should be evaluated. + +### Opcode 2 ("return"), Opcode 3 ("break"), and Opcode 6 ("catch") +```ts +default: + if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { + _ = 0; + continue; + } + if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { + _.label = op[1]; + break; + } + if (op[0] === 6 && _.label < t[1]) { + _.label = t[1]; + t = op; + break; + } + if (t && _.label < t[2]) { + _.label = t[2]; + _.ops.push(op); + break; + } + if (t[2]) + _.ops.pop(); + _.trys.pop(); + continue; +} +``` + +The handling for Opcode 2 ("return"), Opcode 3 ("break") and Opcode 6 ("catch") is more +complicated, as we must obey the specified runtime semantics of generators. The first line in this +clause gets the current **Protected Region** if found and stores it in the `t` temp variable: + +```ts +if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && ...) ... +``` + +The remainder of this statement, as well as the following by several `if` statements test for more +complex conditions. The first of these is the following: + +```ts +if (!(t = ...) && (op[0] === 6 || op[0] === 2)) { + _ = 0; + continue; +} +``` + +If we encounter an Opcode 6 ("catch") or Opcode 2 ("return"), and we are not in a protected region, +then this operation completes the generator by setting the `_` variable to a falsey value. The +`continue` statement resumes execution at the top of the `while` statement, which will exit the loop +so that we continue execution at the statement following the loop. + +```ts +if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { + _.label = op[1]; + break; +} +``` + +The `if` statement above handles Opcode 3 ("break") when we are either not in a **protected region**, or +are performing an unconditional jump to a label inside of the current **protected region**. In this case +we can unconditionally jump to the specified label. + +```ts +if (op[0] === 6 && _.label < t[1]) { + _.label = t[1]; + t = op; + break; +} +``` + +The `if` statement above handles Opcode 6 ("catch") when inside the `try` block of a **protected +region**. In this case we jump to the `catch` block, if present. We replace the value of `t` with +the operation so that the exception can be read as the first statement of the transformed `catch` +clause of the transformed generator body. + +```ts +if (t && _.label < t[2]) { + _.label = t[2]; + _.ops.push(op); + break; +} +``` + +This `if` statement handles all Opcodes when in a **protected region** with a `finally` clause. +As long as we are not already inside the `finally` clause, we jump to the `finally` clause and +push the pending operation onto the `_.ops` stack. This allows us to resume execution of the +pending operation once we have completed execution of the `finally` clause, as long as it does not +supersede this operation with its own completion value. + +```ts +if (t[2]) + _.ops.pop(); +``` + +Any other completion value inside of a `finally` clause will supersede the pending completion value +from the `try` or `catch` clauses. The above `if` statement pops the pending completion from the +stack. + +```ts +_.trys.pop(); +continue; +``` + +The remaining statements handle the point at which we exit a **protected region**. Here we pop the +current **protected region** from the stack and spin the `while` statement to evaluate the current +operation again in the next **protected region** or at the function boundary. + +## Handling a completed generator +Once the generator has completed, the `_` state variable will be falsey. As a result, the `while` +loop will terminate and hand control off to the final statement of the orchestration function, +which deals with how a completed generator is evaluated: + +```ts +if (op[0] & 5) + throw op[1]; +return { value: op[0] ? op[1] : void 0, done: true }; +``` + +If the caller calls `throw` on the generator it will send Opcode 1 ("throw"). If an exception +is uncaught within the body of the generator, it will send Opcode 6 ("catch"). As the generator has +completed, it throws the exception. Both of these cases are caught by the bitmask `5`, which does +not collide with the only two other valid completion Opcodes. + +If the caller calls `next` on the generator, it will send Opcode 0 ("next"). As the generator has +completed, it returns an `IteratorResult` where `value` is `undefined` and `done` is true. + +If the caller calls `return` on the generator, it will send Opcode 2 ("return"). As the generator +has completed, it returns an `IteratorResult` where `value` is the value provided to `return`, and +`done` is true. \ No newline at end of file diff --git a/node_modules/tslint-eslint-rules/node_modules/tslib/package.json b/node_modules/tslint-eslint-rules/node_modules/tslib/package.json new file mode 100644 index 000000000..9637ece6e --- /dev/null +++ b/node_modules/tslint-eslint-rules/node_modules/tslib/package.json @@ -0,0 +1,28 @@ +{ + "name": "tslib", + "author": "Microsoft Corp.", + "homepage": "http://typescriptlang.org/", + "version": "1.9.0", + "license": "Apache-2.0", + "description": "Runtime library for TypeScript helper functions", + "keywords": [ + "TypeScript", + "Microsoft", + "compiler", + "language", + "javascript", + "tslib", + "runtime" + ], + "bugs": { + "url": "https://github.com/Microsoft/TypeScript/issues" + }, + "repository": { + "type": "git", + "url": "https://github.com/Microsoft/tslib.git" + }, + "main": "tslib.js", + "module": "tslib.es6.js", + "jsnext:main": "tslib.es6.js", + "typings": "tslib.d.ts" +} \ No newline at end of file diff --git a/node_modules/tslint-eslint-rules/node_modules/tslib/tslib.d.ts b/node_modules/tslint-eslint-rules/node_modules/tslib/tslib.d.ts new file mode 100644 index 000000000..c4a0e1158 --- /dev/null +++ b/node_modules/tslint-eslint-rules/node_modules/tslib/tslib.d.ts @@ -0,0 +1,33 @@ +/*! ***************************************************************************** +Copyright (c) Microsoft Corporation. All rights reserved. +Licensed under the Apache License, Version 2.0 (the "License"); you may not use +this file except in compliance with the License. You may obtain a copy of the +License at http://www.apache.org/licenses/LICENSE-2.0 + +THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED +WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, +MERCHANTABLITY OR NON-INFRINGEMENT. + +See the Apache Version 2.0 License for specific language governing permissions +and limitations under the License. +***************************************************************************** */ +export declare function __extends(d: Function, b: Function): void; +export declare function __assign(t: any, ...sources: any[]): any; +export declare function __rest(t: any, propertyNames: (string | symbol)[]): any; +export declare function __decorate(decorators: Function[], target: any, key?: string | symbol, desc?: any): any; +export declare function __param(paramIndex: number, decorator: Function): Function; +export declare function __metadata(metadataKey: any, metadataValue: any): Function; +export declare function __awaiter(thisArg: any, _arguments: any, P: Function, generator: Function): any; +export declare function __generator(thisArg: any, body: Function): any; +export declare function __exportStar(m: any, exports: any): void; +export declare function __values(o: any): any; +export declare function __read(o: any, n?: number): any[]; +export declare function __spread(...args: any[]): any[]; +export declare function __await(v: any): any; +export declare function __asyncGenerator(thisArg: any, _arguments: any, generator: Function): any; +export declare function __asyncDelegator(o: any): any; +export declare function __asyncValues(o: any): any; +export declare function __makeTemplateObject(cooked: string[], raw: string[]): TemplateStringsArray; +export declare function __importStar(mod: T): T; +export declare function __importDefault(mod: T): T | { default: T }; diff --git a/node_modules/tslint-eslint-rules/node_modules/tslib/tslib.es6.html b/node_modules/tslint-eslint-rules/node_modules/tslib/tslib.es6.html new file mode 100644 index 000000000..b122e41b0 --- /dev/null +++ b/node_modules/tslint-eslint-rules/node_modules/tslib/tslib.es6.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/node_modules/tslint-eslint-rules/node_modules/tslib/tslib.es6.js b/node_modules/tslint-eslint-rules/node_modules/tslib/tslib.es6.js new file mode 100644 index 000000000..195600ad1 --- /dev/null +++ b/node_modules/tslint-eslint-rules/node_modules/tslib/tslib.es6.js @@ -0,0 +1,178 @@ +/*! ***************************************************************************** +Copyright (c) Microsoft Corporation. All rights reserved. +Licensed under the Apache License, Version 2.0 (the "License"); you may not use +this file except in compliance with the License. You may obtain a copy of the +License at http://www.apache.org/licenses/LICENSE-2.0 + +THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED +WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, +MERCHANTABLITY OR NON-INFRINGEMENT. + +See the Apache Version 2.0 License for specific language governing permissions +and limitations under the License. +***************************************************************************** */ +/* global Reflect, Promise */ + +var extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + +export function __extends(d, b) { + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); +} + +export var __assign = Object.assign || function __assign(t) { + for (var s, i = 1, n = arguments.length; i < n; i++) { + s = arguments[i]; + for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p]; + } + return t; +} + +export function __rest(s, e) { + var t = {}; + for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) + t[p] = s[p]; + if (s != null && typeof Object.getOwnPropertySymbols === "function") + for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) if (e.indexOf(p[i]) < 0) + t[p[i]] = s[p[i]]; + return t; +} + +export function __decorate(decorators, target, key, desc) { + var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); + else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; + return c > 3 && r && Object.defineProperty(target, key, r), r; +} + +export function __param(paramIndex, decorator) { + return function (target, key) { decorator(target, key, paramIndex); } +} + +export function __metadata(metadataKey, metadataValue) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(metadataKey, metadataValue); +} + +export function __awaiter(thisArg, _arguments, P, generator) { + return new (P || (P = Promise))(function (resolve, reject) { + function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } + function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } + function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); +} + +export function __generator(thisArg, body) { + var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g; + return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g; + function verb(n) { return function (v) { return step([n, v]); }; } + function step(op) { + if (f) throw new TypeError("Generator is already executing."); + while (_) try { + if (f = 1, y && (t = y[op[0] & 2 ? "return" : op[0] ? "throw" : "next"]) && !(t = t.call(y, op[1])).done) return t; + if (y = 0, t) op = [0, t.value]; + switch (op[0]) { + case 0: case 1: t = op; break; + case 4: _.label++; return { value: op[1], done: false }; + case 5: _.label++; y = op[1]; op = [0]; continue; + case 7: op = _.ops.pop(); _.trys.pop(); continue; + default: + if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; } + if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; } + if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; } + if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; } + if (t[2]) _.ops.pop(); + _.trys.pop(); continue; + } + op = body.call(thisArg, _); + } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; } + if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true }; + } +} + +export function __exportStar(m, exports) { + for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p]; +} + +export function __values(o) { + var m = typeof Symbol === "function" && o[Symbol.iterator], i = 0; + if (m) return m.call(o); + return { + next: function () { + if (o && i >= o.length) o = void 0; + return { value: o && o[i++], done: !o }; + } + }; +} + +export function __read(o, n) { + var m = typeof Symbol === "function" && o[Symbol.iterator]; + if (!m) return o; + var i = m.call(o), r, ar = [], e; + try { + while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value); + } + catch (error) { e = { error: error }; } + finally { + try { + if (r && !r.done && (m = i["return"])) m.call(i); + } + finally { if (e) throw e.error; } + } + return ar; +} + +export function __spread() { + for (var ar = [], i = 0; i < arguments.length; i++) + ar = ar.concat(__read(arguments[i])); + return ar; +} + +export function __await(v) { + return this instanceof __await ? (this.v = v, this) : new __await(v); +} + +export function __asyncGenerator(thisArg, _arguments, generator) { + if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined."); + var g = generator.apply(thisArg, _arguments || []), i, q = []; + return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i; + function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; } + function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } } + function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); } + function fulfill(value) { resume("next", value); } + function reject(value) { resume("throw", value); } + function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); } +} + +export function __asyncDelegator(o) { + var i, p; + return i = {}, verb("next"), verb("throw", function (e) { throw e; }), verb("return"), i[Symbol.iterator] = function () { return this; }, i; + function verb(n, f) { if (o[n]) i[n] = function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === "return" } : f ? f(v) : v; }; } +} + +export function __asyncValues(o) { + if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined."); + var m = o[Symbol.asyncIterator]; + return m ? m.call(o) : typeof __values === "function" ? __values(o) : o[Symbol.iterator](); +} + +export function __makeTemplateObject(cooked, raw) { + if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; } + return cooked; +}; + +export function __importStar(mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k]; + result.default = mod; + return result; +} + +export function __importDefault(mod) { + return (mod && mod.__esModule) ? mod : { default: mod }; +} diff --git a/node_modules/tslint-eslint-rules/node_modules/tslib/tslib.html b/node_modules/tslint-eslint-rules/node_modules/tslib/tslib.html new file mode 100644 index 000000000..44c9ba51e --- /dev/null +++ b/node_modules/tslint-eslint-rules/node_modules/tslib/tslib.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/node_modules/tslint-eslint-rules/node_modules/tslib/tslib.js b/node_modules/tslint-eslint-rules/node_modules/tslib/tslib.js new file mode 100644 index 000000000..f7ba570bd --- /dev/null +++ b/node_modules/tslint-eslint-rules/node_modules/tslib/tslib.js @@ -0,0 +1,241 @@ +/*! ***************************************************************************** +Copyright (c) Microsoft Corporation. All rights reserved. +Licensed under the Apache License, Version 2.0 (the "License"); you may not use +this file except in compliance with the License. You may obtain a copy of the +License at http://www.apache.org/licenses/LICENSE-2.0 + +THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED +WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, +MERCHANTABLITY OR NON-INFRINGEMENT. + +See the Apache Version 2.0 License for specific language governing permissions +and limitations under the License. +***************************************************************************** */ +/* global global, define, System, Reflect, Promise */ +var __extends; +var __assign; +var __rest; +var __decorate; +var __param; +var __metadata; +var __awaiter; +var __generator; +var __exportStar; +var __values; +var __read; +var __spread; +var __await; +var __asyncGenerator; +var __asyncDelegator; +var __asyncValues; +var __makeTemplateObject; +var __importStar; +var __importDefault; +(function (factory) { + var root = typeof global === "object" ? global : typeof self === "object" ? self : typeof this === "object" ? this : {}; + if (typeof define === "function" && define.amd) { + define("tslib", ["exports"], function (exports) { factory(createExporter(root, createExporter(exports))); }); + } + else if (typeof module === "object" && typeof module.exports === "object") { + factory(createExporter(root, createExporter(module.exports))); + } + else { + factory(createExporter(root)); + } + function createExporter(exports, previous) { + if (exports !== root) { + if (typeof Object.create === "function") { + Object.defineProperty(exports, "__esModule", { value: true }); + } + else { + exports.__esModule = true; + } + } + return function (id, v) { return exports[id] = previous ? previous(id, v) : v; }; + } +}) +(function (exporter) { + var extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + + __extends = function (d, b) { + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; + + __assign = Object.assign || function (t) { + for (var s, i = 1, n = arguments.length; i < n; i++) { + s = arguments[i]; + for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p]; + } + return t; + }; + + __rest = function (s, e) { + var t = {}; + for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) + t[p] = s[p]; + if (s != null && typeof Object.getOwnPropertySymbols === "function") + for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) if (e.indexOf(p[i]) < 0) + t[p[i]] = s[p[i]]; + return t; + }; + + __decorate = function (decorators, target, key, desc) { + var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); + else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; + return c > 3 && r && Object.defineProperty(target, key, r), r; + }; + + __param = function (paramIndex, decorator) { + return function (target, key) { decorator(target, key, paramIndex); } + }; + + __metadata = function (metadataKey, metadataValue) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(metadataKey, metadataValue); + }; + + __awaiter = function (thisArg, _arguments, P, generator) { + return new (P || (P = Promise))(function (resolve, reject) { + function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } + function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } + function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); + }; + + __generator = function (thisArg, body) { + var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g; + return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g; + function verb(n) { return function (v) { return step([n, v]); }; } + function step(op) { + if (f) throw new TypeError("Generator is already executing."); + while (_) try { + if (f = 1, y && (t = y[op[0] & 2 ? "return" : op[0] ? "throw" : "next"]) && !(t = t.call(y, op[1])).done) return t; + if (y = 0, t) op = [0, t.value]; + switch (op[0]) { + case 0: case 1: t = op; break; + case 4: _.label++; return { value: op[1], done: false }; + case 5: _.label++; y = op[1]; op = [0]; continue; + case 7: op = _.ops.pop(); _.trys.pop(); continue; + default: + if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; } + if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; } + if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; } + if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; } + if (t[2]) _.ops.pop(); + _.trys.pop(); continue; + } + op = body.call(thisArg, _); + } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; } + if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true }; + } + }; + + __exportStar = function (m, exports) { + for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p]; + }; + + __values = function (o) { + var m = typeof Symbol === "function" && o[Symbol.iterator], i = 0; + if (m) return m.call(o); + return { + next: function () { + if (o && i >= o.length) o = void 0; + return { value: o && o[i++], done: !o }; + } + }; + }; + + __read = function (o, n) { + var m = typeof Symbol === "function" && o[Symbol.iterator]; + if (!m) return o; + var i = m.call(o), r, ar = [], e; + try { + while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value); + } + catch (error) { e = { error: error }; } + finally { + try { + if (r && !r.done && (m = i["return"])) m.call(i); + } + finally { if (e) throw e.error; } + } + return ar; + }; + + __spread = function () { + for (var ar = [], i = 0; i < arguments.length; i++) + ar = ar.concat(__read(arguments[i])); + return ar; + }; + + __await = function (v) { + return this instanceof __await ? (this.v = v, this) : new __await(v); + }; + + __asyncGenerator = function (thisArg, _arguments, generator) { + if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined."); + var g = generator.apply(thisArg, _arguments || []), i, q = []; + return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i; + function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; } + function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } } + function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); } + function fulfill(value) { resume("next", value); } + function reject(value) { resume("throw", value); } + function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); } + }; + + __asyncDelegator = function (o) { + var i, p; + return i = {}, verb("next"), verb("throw", function (e) { throw e; }), verb("return"), i[Symbol.iterator] = function () { return this; }, i; + function verb(n, f) { if (o[n]) i[n] = function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === "return" } : f ? f(v) : v; }; } + }; + + __asyncValues = function (o) { + if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined."); + var m = o[Symbol.asyncIterator]; + return m ? m.call(o) : typeof __values === "function" ? __values(o) : o[Symbol.iterator](); + }; + + __makeTemplateObject = function (cooked, raw) { + if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; } + return cooked; + }; + + __importStar = function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k]; + result["default"] = mod; + return result; + }; + + __importDefault = function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; + }; + + exporter("__extends", __extends); + exporter("__assign", __assign); + exporter("__rest", __rest); + exporter("__decorate", __decorate); + exporter("__param", __param); + exporter("__metadata", __metadata); + exporter("__awaiter", __awaiter); + exporter("__generator", __generator); + exporter("__exportStar", __exportStar); + exporter("__values", __values); + exporter("__read", __read); + exporter("__spread", __spread); + exporter("__await", __await); + exporter("__asyncGenerator", __asyncGenerator); + exporter("__asyncDelegator", __asyncDelegator); + exporter("__asyncValues", __asyncValues); + exporter("__makeTemplateObject", __makeTemplateObject); + exporter("__importStar", __importStar); + exporter("__importDefault", __importDefault); +}); diff --git a/node_modules/tslint-eslint-rules/node_modules/tsutils/.editorconfig b/node_modules/tslint-eslint-rules/node_modules/tsutils/.editorconfig new file mode 100644 index 000000000..4818afd6b --- /dev/null +++ b/node_modules/tslint-eslint-rules/node_modules/tsutils/.editorconfig @@ -0,0 +1,12 @@ +root = true + +[*] +end_of_line = lf +insert_final_newline = true +charset = utf-8 +indent_size = 4 +indent_style = space +trim_trailing_whitespace = true + +[*.{json,yml,md}] +indent_size = 2 diff --git a/node_modules/tslint-eslint-rules/node_modules/tsutils/.fimbullinter.yaml b/node_modules/tslint-eslint-rules/node_modules/tsutils/.fimbullinter.yaml new file mode 100644 index 000000000..74e903e76 --- /dev/null +++ b/node_modules/tslint-eslint-rules/node_modules/tsutils/.fimbullinter.yaml @@ -0,0 +1,2 @@ +exclude: + - test/rules/** diff --git a/node_modules/tslint-eslint-rules/node_modules/tsutils/.wotanrc.yaml b/node_modules/tslint-eslint-rules/node_modules/tsutils/.wotanrc.yaml new file mode 100644 index 000000000..46153ecb7 --- /dev/null +++ b/node_modules/tslint-eslint-rules/node_modules/tsutils/.wotanrc.yaml @@ -0,0 +1,5 @@ +extends: wotan:recommended +rules: + # TODO enable once https://github.com/Microsoft/TypeScript/issues/24706 is resolved + no-useless-assertion: off + no-useless-predicate: off diff --git a/node_modules/tslint-eslint-rules/node_modules/tsutils/CHANGELOG.md b/node_modules/tslint-eslint-rules/node_modules/tsutils/CHANGELOG.md new file mode 100644 index 000000000..0d01e793b --- /dev/null +++ b/node_modules/tslint-eslint-rules/node_modules/tsutils/CHANGELOG.md @@ -0,0 +1,741 @@ +# 3.17.1 + +**Bugfixes:** + +* `isValidJsxIdentifier`, `isValidPropertyAccess`, `isValidPropertyName`: fix unicode character width handling + +# 3.17.0 + +**Features:** + +* `isValidJsxIdentifier` added an optional parameter to specify the target ECMAScript version + +**Bugfixes:** + +* `isValidJsxIdentifier` now handles astral plane characters + +# 3.16.0 + +**Features:** + +* added `getIteratorYieldResultFromIteratorResult` to extract the `yield`ed type from `IteratorResult` + +# 3.15.0 + +**Features:** + +* `isValidIdentifier`, `isValidPropertyName`, `isValidPropertyAccess`, `isValidNumericLiteral` added an optional parameter to specify the target ECMAScript version + +**Bugfixes:** + +* `isValidPropertyName`, `isValidPropertyAccess` now handle astral plane characters + +# 3.14.1 + +**Bugfixes:** + +* `findImports`: fixed crash on nested namespaces + +# 3.14.0 + +**Features:** + +* added `getInstanceTypeOfClassLikeDeclaration` and `getConstructorTypeOfClassLikeDeclaration` +* added `AccessKind.Delete` to `getAccessKind`: `getAccessKind(node) & AccessKind.Modification` can now be used to restore the old behavior of `isReassignmentTarget(node)` + +# 3.13.0 + +**Features:** + +* `getAccessKind` determines whether an expression is read from, written to or both +* optimized `getPropertyOfType` for unambiguous property names to partially work around https://github.com/microsoft/TypeScript/issues/31565 + +**Bugfixes:** + +* `isReassignmentTarget` no longer returns `true` for `DeleteExpression` as it doesn't **assign** a value to the operand + +# 3.12.0 + +**Features:** + +* `getLateBoundPropertyNamesOfPropertyName` returns all statically analyzable names of a property, method, ... +* `getSingleLateBoundPropertyNameOfPropertyName` returns the literal name of a property, method, ... if statically analyzable + +**Bugfixes:** + +* fixed circular import + +# 3.11.0 + +**Features:** + +* typeguards: `isNumericOrStringLikeLiteral`, `isTupleTypeReference` +* `intersectionTypeParts` as counterpart to `unionTypeParts` +* `someTypePart` to execute a callback for each union or intersection constituent until the callback returns true +* `getPropertyOfType` looks up a property by its escaped name +* `isPropertyReadonlyInType` determines whether a property in a given type cannot be written to +* `symbolHasReadonlyDeclaration` determines if a Symbol has any readonly or constant declaration +* `isNumericPropertyName` determines whether a property name would match an index signature +* `isBindableObjectDefinePropertyCall` returns true for statically analyzable forms of `Object.defineProperty(o, 'p', {value, writable})` +* `isReadonlyAssignmentDeclaration` determines whether an `Object.defineProperty` call is known to result in a readonly property +* `getLateBoundPropertyNames` returns all known property names of an expression +* `getPropertyNameFromType` extracts the property name of literal types +* `isWellKnownSymbolLiterally` to recognize expressions in the form of `Symbol.` +* `getPropertyNameOfWellKnownSymbol` returns the escaped name for a well known symbol literal +* `unwrapParentheses` returns the first child expression that is not a `ParenthesizedExpression` + +# 3.10.0 + +**Features:** + +* `isCompilerOptionEnabled`: `incremental` is implicitly enabled by `composite` + +**Bugfixes:** + +* `collectVariableUsage`/`getUsageDomain`: no longer treat `as const` as type usage + +# 3.9.1 + +**Bugfixes:** + +* reverted invalid deprecation of `canHaveJsdoc` +* fixed condition in `parseJsdocOfNode` + +# 3.9.0 + +**Features:** + +* added typeguards: `isNullLiteral` and `isBooleanLiteral` + +# 3.8.0 + +**Features:** + +* exposes typeguards for typescript@3.2 by default +* added utilities: `isConstAssertion` and `isInConstContext` + +# 3.7.0 + +**Features:** + +* added `isBlockScopedDeclarationStatement` +* added `isInSingleStatementContext` + +# 3.6.0 + +**Features:** + +* added `getCheckJsDirective` utility to parse `// @ts-check` and `// @ts-nocheck` pragmas + +# 3.5.2 + +**Bugfixes:** + +* Published declaration files no longer contain `const enum`. They are now declared as regular enums instead. + +# 3.5.1 + +**Bugfixes:** + +* `isThenableType` allows `Node` instead of `Expression` as parameter +* `isBlockScopeBoundary` and `isScopeBoundary` consider `WithStatement` as scope boundary + +# 3.5.0 + +**Features:** + +* correctly handle BigInt literals + * added typeguard `isBigIntLiteral` + * `isLiteralType` recognises BigInt + * `getPropertyName` adds special handling for BigInt + +# 3.4.0 + +**Features:** + +* added utility `commentText` to get the actual text content of a comment excluding the characters needed to start and end the comment + +# 3.3.1 + +**Bugfixes:** + +* `findImports`: fixed handling of ImportEqualsDeclaration + +# 3.3.0 + +**Features:** + +* `isCompilerOptionEnabled`: recognizes `strictBindCallApply` +* `getTokenAtPosition`: optionally includes JSDoc during lookup + +**Bugfixes:** + +* `isCompilerOptionEnabled`: correctly implements logic for `allowSyntheticDefaultImports` +* `findImportLikeNodes`: correctly finds imports in namespaces +* `findImportLikeNodes` / `findImports`: finds import types in JSDoc of JS files + +# 3.2.0 + +**Features:** + +* added utility `findImportLikeNodes` that works similar to `findImports` but returns the import statement or expression instead of the module specifier and doesn't filter non-string module specifiers + +# 3.1.0 + +**Features:** + +* added utilities: `isKeywordKind` and `isValidJsxIdentifier` +* exposes typeguards for typescript@3.0 by default + +# 3.0.0 + +:warning: **Breaking Changes:** + +* Dropped support for `typescript@<2.8.0` +* Dropped support for Node.js 4 +* Removed deprecated APIs: + * `getIdentifierText`, `isJsxFramgment`, `ImportOptions` + * deprected overloads of `isModifierFlagSet`, `findImports` and `getControlFlowEnd` +* control flow related symbols can no longer be imported from `'tsutils/util/util'`, import directly from `'tsutils/util/control-flow'` or `'tsutils/util'` +* `isFunctionScopeBoundary` and `isBlockScopeBoundary` now return a enum member of `ScopeBoundary` instead of a boolean +* `isFunctionScopeBoundary` no longer returns a truthy value for `InterfaceDeclaration`, `TypeAliasDeclaration` + +**Features:** + +* added utility `isTypeScopeBoundary` returning `ScopeBoundary.Type` or `ScopeBoundary.ConditionalType` +* added enum `ScopeBoundarySelector` whose members can be used to determine if a declaration belongs to a given `ScopeBoundary` by using bitwise AND + +**Bugfixes:** + +* `collectVariableUsage` now correctly handles `infer T` nested inside function signatures or mapped types +* `isCompilerOptionEnabled` correctly handles `skipDefaultLibCHeck` and `suppressImplicitAnyIndexErrors` + +# 2.29.0 + +**Features:** + +* added utility `isCompilerOptionEnabled` + +# 2.28.0 + +Typeguards are now split into multiple submodules for each version of TypeScript (starting with 2.8.0). +That means you can now import directly from `"tsutils/typeguard/2.8"` to get compatible declaraton files for TypeScript@2.8. +For more information please read the relevant section in [README.md](README.md). + +**Features:** + +* added typeguards: `isTupleType`, `isOptionalTypeNode`, `isRestTypeNode`, `isSyntheticExpression` (currently available from `"tsutils/typeguard/3.0"`) +* added utility `isStrictCompilerOptionEnabled` + +# 2.27.2 + +Avoid crash caused by removed function in `typescript@3.0.0`. + +# 2.27.1 + +Added support for TypeScript@3.0.0 nightly builds. + +# 2.27.0 + +**Features:** + +* added `getIIFE` utility + +# 2.26.2 + +**Bugfixes:** + +* `forEachComment` and `forEachTokenWithTrivia` no longer duplicate comments around missing nodes + +# 2.26.1 + +**Bugfixes:** + +* fixed crash in `hasSideEffects` with tagged template literal without substitution: ``tag`template` `` + +# 2.26.0 + +**Features:** + +* added typeguard `isLiteralTypeNode` +* added support for type imports (`type T = import('foo')`) to `findImports` via `ImportKind.ImportType` + +# 2.25.1 + +**Bugfixes:** + +* `collectVariableUsage`: fixed name lookup in function signatures to match runtime behavior. Note that this is not completely fixed in TypeScript, yet. See: [Microsoft/TypeScript#22825](https://github.com/Microsoft/TypeScript/issues/22825) and [Microsoft/TypeScript#22769](https://github.com/Microsoft/TypeScript/issues/22769) + +# 2.25.0 + +**Features:** + +* added utilities: `isStatementInAmbientContext` and `isAmbientModuleBlock` + +# 2.24.0 + +**Features:** + +* added typeguards for typescript@2.8: `isConditionalTypeNode`, `isInferTypeNode`, `isConditionalType`, `isInstantiableType`, `isSubstitutionType` + +# 2.23.0 + +**Features:** + +* added typeguard `isForInOrOfStatement` + +**Bugfixes:** + +* correctly handle comments in generic JSX elements: `/*comment*/>` +* fixed a bug with false positive trailing comments at the end of JSX self closing element: `

/*no comment*/
` + +# 2.22.2 + +**Bugfixes:** + +* `collectVariableUsage`: handle ConditionalTypes and `infer T`, which will be introduced in TypeScript@2.8.0 and are already available in nightly builds +* `isLiteralType` no longer returns true for `ts.TypeFlags.BooleanLiteral` as this is not a `ts.LiteralType` + +# 2.22.1 + +**Bugfixes:** + +* `endsControlFlow`: + * handle loops that might not even run a single iteration + * handle constant boolean conditions in loops and if + +# 2.22.0 + +**Features:** + +* added `isFalsyType` utility + +# 2.21.2 + +**Bugfixes:** + +* fixed compile error with `typescript@2.8.0-dev` + +# 2.21.1 + +**Bugfixes:** + +* `isReassignmentTarget`: handle type assertions and non-null assertion + +# 2.21.0 + +**Bugfixes:** + +* `forEachDeclaredVariable` uses a more precise type for the callback parameter to make it useable again with typescript@2.7.1 + +**Features:** + +* added `isUniqueESSymbolType` typeguard + +# 2.20.0 + +**Features:** + +* added `isThenableType` utility +* added `unionTypeParts` utility + +# 2.19.1 + +**Bugfixes:** + +* `forEachComment`, `getCommentAtPosition` and `isPositionInComment`: skip shebang (`#! something`) to not miss following comments at the start of the file + +# 2.19.0 + +**Features:** + +* added `WrappedAst` interface that models the type of a wrapped SourceFile more accurate +* added `getWrappedNodeAtPosition` utiltiy that takes a `NodeWrap` and returns the most deeply nested NodeWrap that contains the given position + +# 2.18.0 + +**Features:** + +* `getControlFlowEnd` accepts BlockLike as argument + +**Bugfixes:** + +* `getControlFlowEnd` and `endsControlFlow`: correctly handle nested LabeledStatements +* `endsControlFlow` removed erroneous special case when an IterationStatement is passed as argument whose parent is a LabeledStatement. + * if you want labels of an IterationStatement (or SwitchStatement) to be handled, you need to pass the LabeledStatement as argument. + * :warning: this fix may change the returned value if you relied on the buggy behavior + +**Deprecations:** + +* deprecated overload of `getControlFlowEnd` that contains the `label` parameter. This parameter is no longer used and should no longer be passed to the function. + +# 2.17.1 + +**Bugfixes:** + +* `getControlFlowEnd` and `endsControlFlow` (#22) + * ThrowStatements inside `try` are filtered out if there is a `catch` clause + * TryStatements with `catch` only end control flow if `try` AND `catch` definitely end control flow + +# 2.17.0 + +**Features:** + +* added `kind` property to `NodeWrap` +* added `getControlFlowEnd` to public API + +# 2.16.0 + +**Features:** + +* added `isDecorator` and `isCallLikeExpression` typeguards + +# 2.15.0 + +**Features:** + +* added `convertAst` utility to produce a flattened and wrapped version of the AST + +# 2.14.0 + +**Features:** + +* added `isDeleteExpression` +* added `getLineBreakStyle` + +# 2.13.1 + +**Bugfixes:** + +* fixed name of `isJsxFragment` + +# 2.13.0 + +**Features:** + +* added support for `JsxFragment` introduced in typescript@2.6.2 +* added corresponding typeguard functions + +# 2.12.2 + +**Bugfixes:** + +* `endsControlFlow` + * added missing logic for labeled statement, iteration statements and try-catch + * added missing logic for `break` and `continue` with labels + * take all jump statements into account, not only the last statement +* `isValidIdentifier` and `isValidNumericLiteral` handle irregular whitespace +* `findImports` searches in ambient modules inside regular `.ts` files (not only `.d.ts`) +* `canHaveJsDoc` is now a typeguard + +# 2.12.1 + +**Bugfixes:** + +* `forEachTokenWithTrivia` + * handles irregular whitespace and no longer visits some tokens twice + * correctly calculates the range of JsxText + +# 2.12.0 + +**API-Changes:** + +* deprecated `ImportOptions` if favor of the new `ImportKind` enum + +# 2.11.2 + +**Bugfixes:** + +* `parseJsDocOfNode`: set correct `pos`, `end` and `parent` properties. Also affects `getJsDoc` of `EndOfFileToken` + +# 2.11.1 + +**Bugfixes:** + +* `collectVariableUsage`: correctly consider catch binding as block scoped declaration inside catch block + +# 2.11.0 + +**Bugfixes:** + +* `getJsDoc` now correctly returns JsDoc for `EndOfFileToken` + +**Features:** + +* added utility `parseJsDocOfNode` + +# 2.10.0 + +**Features:** + +* added utility `findImports` to find all kinds of imports in a source file + +# 2.9.0 + +**Features:** + +* added typeguard `isMappedTypeNode` +* added utilities `canHaveJsDoc` and `getJsDoc` + +# 2.8.2 + +**Bugfixes:** + +* `collectVariableUsage`: handle global augmentation like other module augmentations + +# 2.8.1 + +**Bugfixes:** + +* Support `typescript@2.5.1` with optional catch binding +* `collectVariableUsage` fixed a bug where method decorator had method's parameters in scope + +# 2.8.0 + +* Compatibility with the latest typescript nightly +* Added `getIdentifierText` to unescape identifiers across typescript versions + +# 2.7.1 + +**Bugfixes:** + +* `isReassignmentTarget` don't return `true` for right side of assignment + +# 2.7.0 + +**Features:** + +* Added `isReassignmentTarget` utility + +# 2.6.1 + +**Bugfixes:** + +* `getDeclarationDomain` now returns `undefined` for Parameter in IndexSignature +* `collectVariableUsage` ignores Parameter in IndexSignature + +# 2.6.0 + +**Bugfixes:** + +* `collectVariableUsage`: + * don't merge imports with global declarations + * treat everything in a declaration file as exported if there is no explicit `export {};` +* `isExpressionValueUsed`: handle destructuring in `for...of` + +**Features:** + +* Added `getModifier` utility +* Added `DeclarationDomain.Import` to distinguish imports from other declarations + +# 2.5.1 + +**Bugfixes:** + +* `collectVariableUsage` ignore jump labels as in `break label;` + +# 2.5.0 + +**Bugfixes:** + +* `isFunctionWithBody` handles constructor overload correctly. + +**Features:** + +* Implemented `isExpressionValueUsed` to check whether the result of an expression is actually used. +* Implemented `getDeclarationDomain` to determine if a given declaration introduces a new symbol in the value or type domain. + +**`collectVariableUses` is now usable** + +* no longer ignores signatures and its parameters +* don't merge declarations and uses across domains +* no longer marks exceptions in catch clause or parameter properties as exported +* fixed exports of namespaces +* fixed scoping of ClassExpression name +* correcly handle ambient namespaces and module augmentations +* fixed how `: typeof foo` is handled for parameters and function return type +* **still WIP**: `export {Foo as Bar}` inside ambient namespaces and modules + +# 2.4.0 + +**Bugfixes:** + +* `getLineRanges`: `contentLength` now contains the correct line length when there are multiple consecutive line break characters +* `getTokenAtPosition`: don't match tokens that end at the specified position (because that's already outside of their range) +* deprecated the misnamed `isModfierFlagSet`, use the new `isModifierFlagSet` instead + +**Features:** + +* Added typeguard: `isJsDoc` +* Added experimental scope and usage analysis (`getUsageDomain` and `collectVariableUsage`) + +# 2.3.0 + +**Bugfixes:** + +* `forEachComment` no longer omits some comments when callback returns a truthy value +* `isPositionInComment` fixed false positive inside JSXText + +**Features:** + +* Added utility: `getCommentAtPosition` + +# 2.2.0 + +**Bugfixes:** + +* Fixed bit value of `SideEffectOptions.JsxElement` to be a power of 2 + +**Features:** + +* Added utilities: `getTokenAtPosition` and `isPositionInComment` + +# 2.1.0 + +**Features:** + +* Added typeguard `isExpression` +* Added utilities: `hasSideEffects`, `getDeclarationOfBindingElement` + +# 2.0.0 + +**Breaking Changes:** + +* Dropped compatibility with `typescript@<2.1.0` +* Removed misnamed `isNumericliteral`, use `isNumericLiteral` instead (notice the uppercase L) +* Removed `isEnumLiteralType` which will cause compile errors with typescript@2.4.0 +* Refactored directory structure: all imports that referenced subdirectories (e.g. `require('tsutils/src/typeguard')` will be broken + +**Features:** + +* New directory structure allows imports of typeguards or utils independently, e.g. (`require('tsutils/typeguard')`) + +# 1.9.1 + +**Bugfixes:** + +* `isObjectFlagSet` now uses the correct `objectFlags` property + +# 1.9.0 + +**Bugfixes:** + +* `getNextToken` no longer omits `EndOfFileToken` when there is no trivia before EOF. That means the only inputs where `getNextToken` returns `undefined` are `SourceFile` and `EndOfFileToken` + +**Features**: + +* Added typeguards for types +* Added utilities for flag checking: `isNodeFlagSet`, `isTypeFlagSet`, `isSymbolFlagSet`,`isObjectFlagSet`, `isModifierFlagSet` + +# 1.8.0 + +**Features:** + +* Support peer dependency of typescript nightlies of 2.4.0 +* Added typeguards: `isJsxAttributes`, `isIntersectionTypeNode`, `isTypeOperatorNode`, `isTypePredicateNode`, `isTypeQueryNode`, `isUnionTypeNode` + +# 1.7.0 + +**Bugfixes:** + +* `isFunctionScopeBoundary` now handles Interfaces, TypeAliases, FunctionSignatures, etc + +**Features:** + +* Added utilities: `isThisParameter`, `isSameLine` and `isFunctionWithBody` + +# 1.6.0 + +**Features:** + +* Add `isValidPropertyAccess`, `isValidNumericLiteral` and `isValidPropertyName` + +# 1.5.0 + +**Features:** + +* Add `isValidIdentifier` + +# 1.4.0 + +**Features:** + +* Add `contentLength` property to the result of `getLineRanges` + +# 1.3.0 + +**Bugfixes:** + +* `canHaveLeadingTrivia`: + * Fix property access on undefined parent reference + * Fixes: [palantir/tslint#2330](https://github.com/palantir/tslint/issues/2330) +* `hasOwnThisReference`: now includes accessors on object literals + +**Features:** + +* Typeguards: + * isTypeParameterDeclaration + * isEnitityName + +# 1.2.2 + +**Bugfixes:** + +* `hasOwnThisReference`: + * exclude overload signatures of function declarations + * add method declarations on object literals + +# 1.2.1 + +**Bugfixes:** + +* Fix name of `isNumericLiteral` + +# 1.2.0 + +**Features:** + +* Typeguards: + * isEnumMember + * isExpressionWithTypeArguments + * isImportSpecifier +* Utilities: + * isJsDocKind, isTypeNodeKind +* Allow typescript@next in peerDependencies + +# 1.1.0 + +**Bugfixes:** + +* Fix isBlockScopeBoundary: Remove WithStatement, IfStatment, DoStatement and WhileStatement because they are no scope boundary whitout a block. + +**Features:** + +* Added more typeguards: + * isAssertionExpression + * isEmptyStatement + * isJsxAttributeLike + * isJsxOpeningLikeElement + * isNonNullExpression + * isSyntaxList +* Utilities: + * getNextToken, getPreviousToken + * hasOwnThisReference + * getLineRanges + +# 1.0.0 + +**Features:** + +* Initial implementation of typeguards +* Utilities: + * getChildOfKind + * isNodeKind, isAssignmentKind + * hasModifier, isParameterProperty, hasAccessModifier + * getPreviousStatement, getNextStatement + * getPropertyName + * forEachDestructuringIdentifier, forEachDeclaredVariable + * getVariableDeclarationKind, isBlockScopedVariableDeclarationList, isBlockScopedVariableDeclaration + * isScopeBoundary, isFunctionScopeBoundary, isBlockScopeBoundary + * forEachToken, forEachTokenWithTrivia, forEachComment + * endsControlFlow diff --git a/node_modules/tslint-eslint-rules/node_modules/tsutils/LICENSE b/node_modules/tslint-eslint-rules/node_modules/tsutils/LICENSE new file mode 100644 index 000000000..3a990ff40 --- /dev/null +++ b/node_modules/tslint-eslint-rules/node_modules/tsutils/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2017 Klaus Meinhardt + +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. diff --git a/node_modules/tslint-eslint-rules/node_modules/tsutils/README.md b/node_modules/tslint-eslint-rules/node_modules/tsutils/README.md new file mode 100644 index 000000000..a2363e6ac --- /dev/null +++ b/node_modules/tslint-eslint-rules/node_modules/tsutils/README.md @@ -0,0 +1,61 @@ +# Utility functions for working with typescript's AST + +[![Greenkeeper badge](https://badges.greenkeeper.io/ajafff/tsutils.svg)](https://greenkeeper.io/) + +## Usage + +This package consists of two major parts: utilities and typeguard functions. +By importing the project you will get both of them. +```js +import * as utils from "tsutils"; +utils.isIdentifier(node); // typeguard +utils.getLineRanges(sourceFile); // utilities +``` + +If you don't need everything offered by this package, you can select what should be imported. The parts that are not imported are never read from disk and may save some startup time and reduce memory consumtion. + +If you only need typeguards you can explicitly import them: +```js +import { isIdentifier } from "tsutils/typeguard"; +// You can even distiguish between typeguards for nodes and types +import { isUnionTypeNode } from "tsutils/typeguard/node"; +import { isUnionType } from "tsutils/typeguard/type"; +``` + +If you only need the utilities you can also explicitly import them: +```js +import { forEachComment, forEachToken } from "tsutils/util"; +``` + +### Typescript version dependency + +This package is backwards compatible with typescript 2.8.0 at runtime although compiling might need a newer version of typescript installed. + +Using `typescript@next` might work, but it's not officially supported. If you encounter any bugs, please open an issue. + +For compatibility with older versions of TypeScript typeguard functions are separated by TypeScript version. If you are stuck on `typescript@2.8`, you should import directly from the submodule for that version: + +```js +// all typeguards compatible with typescript@2.8 +import { isIdentifier } from "tsutils/typeguard/2.8"; +// you can even use nested submodules +import { isIdentifier } from "tsutils/typeguard/2.8/node"; + +// all typeguards compatible with typescript@2.9 (includes those of 2.8) +import { isIdentifier } from "tsutils/typeguard/2.9"; + +// always points to the latest stable version (2.9 as of writing this) +import { isIdentifier } from "tsutils/typeguard"; +import { isIdentifier } from "tsutils"; + +// always points to the typeguards for the next TypeScript version (3.0 as of writing this) +import { isIdentifier } from "tsutils/typeguard/next"; +``` + +Note that if you are also using utility functions, you should prefer the relevant submodule: + +```js +// importing directly from 'tsutils' would pull in the latest typeguards +import { forEachToken } from 'tsutils/util'; +import { isIdentifier } from 'tsutils/typeguard/2.8'; +``` diff --git a/node_modules/tslint-eslint-rules/node_modules/tsutils/index.d.ts b/node_modules/tslint-eslint-rules/node_modules/tsutils/index.d.ts new file mode 100644 index 000000000..26b9ee17c --- /dev/null +++ b/node_modules/tslint-eslint-rules/node_modules/tsutils/index.d.ts @@ -0,0 +1,2 @@ +export * from './typeguard'; +export * from './util'; diff --git a/node_modules/tslint-eslint-rules/node_modules/tsutils/index.js b/node_modules/tslint-eslint-rules/node_modules/tsutils/index.js new file mode 100644 index 000000000..4ee8dc264 --- /dev/null +++ b/node_modules/tslint-eslint-rules/node_modules/tsutils/index.js @@ -0,0 +1,5 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const tslib_1 = require("tslib"); +tslib_1.__exportStar(require("./typeguard"), exports); +tslib_1.__exportStar(require("./util"), exports); diff --git a/node_modules/tslint-eslint-rules/node_modules/tsutils/package.json b/node_modules/tslint-eslint-rules/node_modules/tsutils/package.json new file mode 100644 index 000000000..dbe0a2098 --- /dev/null +++ b/node_modules/tslint-eslint-rules/node_modules/tsutils/package.json @@ -0,0 +1,61 @@ +{ + "name": "tsutils", + "version": "3.17.1", + "description": "utilities for working with typescript's AST", + "scripts": { + "compile": "rm -rf {,util,typeguard,test/**}/*.js; ttsc -p .", + "lint:tslint": "wotan -m @fimbul/valtyr", + "lint:wotan": "wotan", + "lint": "run-p lint:*", + "test": "mocha test/*Tests.js && tslint --test 'test/rules/**/tslint.json'", + "verify": "run-s compile lint coverage", + "prepublishOnly": "run-s verify", + "coverage": "nyc run-s test", + "report-coverage": "cat ./coverage/lcov.info | coveralls", + "github-release": "GITHUB_TOKEN=$(cat ~/github_token.txt) github-release-from-changelog", + "postpublish": "git push origin master --tags; run-s github-release" + }, + "repository": { + "type": "git", + "url": "https://github.com/ajafff/tsutils" + }, + "keywords": [ + "typescript", + "ts", + "ast", + "typeguard", + "utils", + "helper", + "node" + ], + "author": "Klaus Meinhardt", + "license": "MIT", + "devDependencies": { + "@fimbul/mithotyn": "^0.17.0", + "@fimbul/valtyr": "^0.20.0", + "@fimbul/wotan": "^0.20.0", + "@types/chai": "^4.0.10", + "@types/mocha": "^5.0.0", + "@types/node": "^11.13.0", + "chai": "^4.1.2", + "coveralls": "^3.0.0", + "github-release-from-changelog": "^1.3.0", + "mocha": "^6.0.2", + "npm-run-all": "^4.1.2", + "nyc": "^13.3.0", + "ts-transform-const-enum": "^0.0.1", + "tslint": "^5.8.0", + "tslint-consistent-codestyle": "^1.11.0", + "ttypescript": "^1.5.5", + "typescript": "^3.6.0-dev.20190804" + }, + "peerDependencies": { + "typescript": ">=2.8.0 || >= 3.2.0-dev || >= 3.3.0-dev || >= 3.4.0-dev || >= 3.5.0-dev || >= 3.6.0-dev || >= 3.6.0-beta || >= 3.7.0-dev || >= 3.7.0-beta" + }, + "dependencies": { + "tslib": "^1.8.1" + }, + "engines": { + "node": ">= 6" + } +} \ No newline at end of file diff --git a/node_modules/tslint-eslint-rules/node_modules/tsutils/typeguard/2.8/index.d.ts b/node_modules/tslint-eslint-rules/node_modules/tsutils/typeguard/2.8/index.d.ts new file mode 100644 index 000000000..71762921c --- /dev/null +++ b/node_modules/tslint-eslint-rules/node_modules/tsutils/typeguard/2.8/index.d.ts @@ -0,0 +1,2 @@ +export * from './node'; +export * from './type'; diff --git a/node_modules/tslint-eslint-rules/node_modules/tsutils/typeguard/2.8/index.js b/node_modules/tslint-eslint-rules/node_modules/tsutils/typeguard/2.8/index.js new file mode 100644 index 000000000..0c381e79a --- /dev/null +++ b/node_modules/tslint-eslint-rules/node_modules/tsutils/typeguard/2.8/index.js @@ -0,0 +1,5 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const tslib_1 = require("tslib"); +tslib_1.__exportStar(require("./node"), exports); +tslib_1.__exportStar(require("./type"), exports); diff --git a/node_modules/tslint-eslint-rules/node_modules/tsutils/typeguard/2.8/node.d.ts b/node_modules/tslint-eslint-rules/node_modules/tsutils/typeguard/2.8/node.d.ts new file mode 100644 index 000000000..c5aa5a9d1 --- /dev/null +++ b/node_modules/tslint-eslint-rules/node_modules/tsutils/typeguard/2.8/node.d.ts @@ -0,0 +1,155 @@ +import * as ts from 'typescript'; +export declare function isAccessorDeclaration(node: ts.Node): node is ts.AccessorDeclaration; +export declare function isArrayBindingPattern(node: ts.Node): node is ts.ArrayBindingPattern; +export declare function isArrayLiteralExpression(node: ts.Node): node is ts.ArrayLiteralExpression; +export declare function isArrayTypeNode(node: ts.Node): node is ts.ArrayTypeNode; +export declare function isArrowFunction(node: ts.Node): node is ts.ArrowFunction; +export declare function isAsExpression(node: ts.Node): node is ts.AsExpression; +export declare function isAssertionExpression(node: ts.Node): node is ts.AssertionExpression; +export declare function isAwaitExpression(node: ts.Node): node is ts.AwaitExpression; +export declare function isBinaryExpression(node: ts.Node): node is ts.BinaryExpression; +export declare function isBindingElement(node: ts.Node): node is ts.BindingElement; +export declare function isBindingPattern(node: ts.Node): node is ts.BindingPattern; +export declare function isBlock(node: ts.Node): node is ts.Block; +export declare function isBlockLike(node: ts.Node): node is ts.BlockLike; +export declare function isBooleanLiteral(node: ts.Node): node is ts.BooleanLiteral; +export declare function isBreakOrContinueStatement(node: ts.Node): node is ts.BreakOrContinueStatement; +export declare function isBreakStatement(node: ts.Node): node is ts.BreakStatement; +export declare function isCallExpression(node: ts.Node): node is ts.CallExpression; +export declare function isCallLikeExpression(node: ts.Node): node is ts.CallLikeExpression; +export declare function isCallSignatureDeclaration(node: ts.Node): node is ts.CallSignatureDeclaration; +export declare function isCaseBlock(node: ts.Node): node is ts.CaseBlock; +export declare function isCaseClause(node: ts.Node): node is ts.CaseClause; +export declare function isCaseOrDefaultClause(node: ts.Node): node is ts.CaseOrDefaultClause; +export declare function isCatchClause(node: ts.Node): node is ts.CatchClause; +export declare function isClassDeclaration(node: ts.Node): node is ts.ClassDeclaration; +export declare function isClassExpression(node: ts.Node): node is ts.ClassExpression; +export declare function isClassLikeDeclaration(node: ts.Node): node is ts.ClassLikeDeclaration; +export declare function isCommaListExpression(node: ts.Node): node is ts.CommaListExpression; +export declare function isConditionalExpression(node: ts.Node): node is ts.ConditionalExpression; +export declare function isConditionalTypeNode(node: ts.Node): node is ts.ConditionalTypeNode; +export declare function isConstructorDeclaration(node: ts.Node): node is ts.ConstructorDeclaration; +export declare function isConstructorTypeNode(node: ts.Node): node is ts.ConstructorTypeNode; +export declare function isConstructSignatureDeclaration(node: ts.Node): node is ts.ConstructSignatureDeclaration; +export declare function isContinueStatement(node: ts.Node): node is ts.ContinueStatement; +export declare function isComputedPropertyName(node: ts.Node): node is ts.ComputedPropertyName; +export declare function isDebuggerStatement(node: ts.Node): node is ts.DebuggerStatement; +export declare function isDecorator(node: ts.Node): node is ts.Decorator; +export declare function isDefaultClause(node: ts.Node): node is ts.DefaultClause; +export declare function isDeleteExpression(node: ts.Node): node is ts.DeleteExpression; +export declare function isDoStatement(node: ts.Node): node is ts.DoStatement; +export declare function isElementAccessExpression(node: ts.Node): node is ts.ElementAccessExpression; +export declare function isEmptyStatement(node: ts.Node): node is ts.EmptyStatement; +export declare function isEntityName(node: ts.Node): node is ts.EntityName; +export declare function isEntityNameExpression(node: ts.Node): node is ts.EntityNameExpression; +export declare function isEnumDeclaration(node: ts.Node): node is ts.EnumDeclaration; +export declare function isEnumMember(node: ts.Node): node is ts.EnumMember; +export declare function isExportAssignment(node: ts.Node): node is ts.ExportAssignment; +export declare function isExportDeclaration(node: ts.Node): node is ts.ExportDeclaration; +export declare function isExportSpecifier(node: ts.Node): node is ts.ExportSpecifier; +export declare function isExpression(node: ts.Node): node is ts.Expression; +export declare function isExpressionStatement(node: ts.Node): node is ts.ExpressionStatement; +export declare function isExpressionWithTypeArguments(node: ts.Node): node is ts.ExpressionWithTypeArguments; +export declare function isExternalModuleReference(node: ts.Node): node is ts.ExternalModuleReference; +export declare function isForInStatement(node: ts.Node): node is ts.ForInStatement; +export declare function isForInOrOfStatement(node: ts.Node): node is ts.ForInOrOfStatement; +export declare function isForOfStatement(node: ts.Node): node is ts.ForOfStatement; +export declare function isForStatement(node: ts.Node): node is ts.ForStatement; +export declare function isFunctionDeclaration(node: ts.Node): node is ts.FunctionDeclaration; +export declare function isFunctionExpression(node: ts.Node): node is ts.FunctionExpression; +export declare function isFunctionTypeNode(node: ts.Node): node is ts.FunctionTypeNode; +export declare function isGetAccessorDeclaration(node: ts.Node): node is ts.GetAccessorDeclaration; +export declare function isIdentifier(node: ts.Node): node is ts.Identifier; +export declare function isIfStatement(node: ts.Node): node is ts.IfStatement; +export declare function isImportClause(node: ts.Node): node is ts.ImportClause; +export declare function isImportDeclaration(node: ts.Node): node is ts.ImportDeclaration; +export declare function isImportEqualsDeclaration(node: ts.Node): node is ts.ImportEqualsDeclaration; +export declare function isImportSpecifier(node: ts.Node): node is ts.ImportSpecifier; +export declare function isIndexedAccessTypeNode(node: ts.Node): node is ts.IndexedAccessTypeNode; +export declare function isIndexSignatureDeclaration(node: ts.Node): node is ts.IndexSignatureDeclaration; +export declare function isInferTypeNode(node: ts.Node): node is ts.InferTypeNode; +export declare function isInterfaceDeclaration(node: ts.Node): node is ts.InterfaceDeclaration; +export declare function isIntersectionTypeNode(node: ts.Node): node is ts.IntersectionTypeNode; +export declare function isIterationStatement(node: ts.Node): node is ts.IterationStatement; +export declare function isJsDoc(node: ts.Node): node is ts.JSDoc; +export declare function isJsxAttribute(node: ts.Node): node is ts.JsxAttribute; +export declare function isJsxAttributeLike(node: ts.Node): node is ts.JsxAttributeLike; +export declare function isJsxAttributes(node: ts.Node): node is ts.JsxAttributes; +export declare function isJsxClosingElement(node: ts.Node): node is ts.JsxClosingElement; +export declare function isJsxClosingFragment(node: ts.Node): node is ts.JsxClosingFragment; +export declare function isJsxElement(node: ts.Node): node is ts.JsxElement; +export declare function isJsxExpression(node: ts.Node): node is ts.JsxExpression; +export declare function isJsxFragment(node: ts.Node): node is ts.JsxFragment; +export declare function isJsxOpeningElement(node: ts.Node): node is ts.JsxOpeningElement; +export declare function isJsxOpeningFragment(node: ts.Node): node is ts.JsxOpeningFragment; +export declare function isJsxOpeningLikeElement(node: ts.Node): node is ts.JsxOpeningLikeElement; +export declare function isJsxSelfClosingElement(node: ts.Node): node is ts.JsxSelfClosingElement; +export declare function isJsxSpreadAttribute(node: ts.Node): node is ts.JsxSpreadAttribute; +export declare function isJsxText(node: ts.Node): node is ts.JsxText; +export declare function isLabeledStatement(node: ts.Node): node is ts.LabeledStatement; +export declare function isLiteralExpression(node: ts.Node): node is ts.LiteralExpression; +export declare function isLiteralTypeNode(node: ts.Node): node is ts.LiteralTypeNode; +export declare function isMappedTypeNode(node: ts.Node): node is ts.MappedTypeNode; +export declare function isMetaProperty(node: ts.Node): node is ts.MetaProperty; +export declare function isMethodDeclaration(node: ts.Node): node is ts.MethodDeclaration; +export declare function isMethodSignature(node: ts.Node): node is ts.MethodSignature; +export declare function isModuleBlock(node: ts.Node): node is ts.ModuleBlock; +export declare function isModuleDeclaration(node: ts.Node): node is ts.ModuleDeclaration; +export declare function isNamedExports(node: ts.Node): node is ts.NamedExports; +export declare function isNamedImports(node: ts.Node): node is ts.NamedImports; +export declare function isNamespaceDeclaration(node: ts.Node): node is ts.NamespaceDeclaration; +export declare function isNamespaceImport(node: ts.Node): node is ts.NamespaceImport; +export declare function isNamespaceExportDeclaration(node: ts.Node): node is ts.NamespaceExportDeclaration; +export declare function isNewExpression(node: ts.Node): node is ts.NewExpression; +export declare function isNonNullExpression(node: ts.Node): node is ts.NonNullExpression; +export declare function isNoSubstitutionTemplateLiteral(node: ts.Node): node is ts.NoSubstitutionTemplateLiteral; +export declare function isNullLiteral(node: ts.Node): node is ts.NullLiteral; +export declare function isNumericLiteral(node: ts.Node): node is ts.NumericLiteral; +export declare function isNumericOrStringLikeLiteral(node: ts.Node): node is ts.NumericLiteral | ts.StringLiteral | ts.NoSubstitutionTemplateLiteral; +export declare function isObjectBindingPattern(node: ts.Node): node is ts.ObjectBindingPattern; +export declare function isObjectLiteralExpression(node: ts.Node): node is ts.ObjectLiteralExpression; +export declare function isOmittedExpression(node: ts.Node): node is ts.OmittedExpression; +export declare function isParameterDeclaration(node: ts.Node): node is ts.ParameterDeclaration; +export declare function isParenthesizedExpression(node: ts.Node): node is ts.ParenthesizedExpression; +export declare function isParenthesizedTypeNode(node: ts.Node): node is ts.ParenthesizedTypeNode; +export declare function isPostfixUnaryExpression(node: ts.Node): node is ts.PostfixUnaryExpression; +export declare function isPrefixUnaryExpression(node: ts.Node): node is ts.PrefixUnaryExpression; +export declare function isPropertyAccessExpression(node: ts.Node): node is ts.PropertyAccessExpression; +export declare function isPropertyAssignment(node: ts.Node): node is ts.PropertyAssignment; +export declare function isPropertyDeclaration(node: ts.Node): node is ts.PropertyDeclaration; +export declare function isPropertySignature(node: ts.Node): node is ts.PropertySignature; +export declare function isQualifiedName(node: ts.Node): node is ts.QualifiedName; +export declare function isRegularExpressionLiteral(node: ts.Node): node is ts.RegularExpressionLiteral; +export declare function isReturnStatement(node: ts.Node): node is ts.ReturnStatement; +export declare function isSetAccessorDeclaration(node: ts.Node): node is ts.SetAccessorDeclaration; +export declare function isShorthandPropertyAssignment(node: ts.Node): node is ts.ShorthandPropertyAssignment; +export declare function isSignatureDeclaration(node: ts.Node): node is ts.SignatureDeclaration; +export declare function isSourceFile(node: ts.Node): node is ts.SourceFile; +export declare function isSpreadAssignment(node: ts.Node): node is ts.SpreadAssignment; +export declare function isSpreadElement(node: ts.Node): node is ts.SpreadElement; +export declare function isStringLiteral(node: ts.Node): node is ts.StringLiteral; +export declare function isSwitchStatement(node: ts.Node): node is ts.SwitchStatement; +export declare function isSyntaxList(node: ts.Node): node is ts.SyntaxList; +export declare function isTaggedTemplateExpression(node: ts.Node): node is ts.TaggedTemplateExpression; +export declare function isTemplateExpression(node: ts.Node): node is ts.TemplateExpression; +export declare function isTemplateLiteral(node: ts.Node): node is ts.TemplateLiteral; +export declare function isTextualLiteral(node: ts.Node): node is ts.StringLiteral | ts.NoSubstitutionTemplateLiteral; +export declare function isThrowStatement(node: ts.Node): node is ts.ThrowStatement; +export declare function isTryStatement(node: ts.Node): node is ts.TryStatement; +export declare function isTupleTypeNode(node: ts.Node): node is ts.TupleTypeNode; +export declare function isTypeAliasDeclaration(node: ts.Node): node is ts.TypeAliasDeclaration; +export declare function isTypeAssertion(node: ts.Node): node is ts.TypeAssertion; +export declare function isTypeLiteralNode(node: ts.Node): node is ts.TypeLiteralNode; +export declare function isTypeOfExpression(node: ts.Node): node is ts.TypeOfExpression; +export declare function isTypeOperatorNode(node: ts.Node): node is ts.TypeOperatorNode; +export declare function isTypeParameterDeclaration(node: ts.Node): node is ts.TypeParameterDeclaration; +export declare function isTypePredicateNode(node: ts.Node): node is ts.TypePredicateNode; +export declare function isTypeReferenceNode(node: ts.Node): node is ts.TypeReferenceNode; +export declare function isTypeQueryNode(node: ts.Node): node is ts.TypeQueryNode; +export declare function isUnionTypeNode(node: ts.Node): node is ts.UnionTypeNode; +export declare function isVariableDeclaration(node: ts.Node): node is ts.VariableDeclaration; +export declare function isVariableStatement(node: ts.Node): node is ts.VariableStatement; +export declare function isVariableDeclarationList(node: ts.Node): node is ts.VariableDeclarationList; +export declare function isVoidExpression(node: ts.Node): node is ts.VoidExpression; +export declare function isWhileStatement(node: ts.Node): node is ts.WhileStatement; +export declare function isWithStatement(node: ts.Node): node is ts.WithStatement; diff --git a/node_modules/tslint-eslint-rules/node_modules/tsutils/typeguard/2.8/node.js b/node_modules/tslint-eslint-rules/node_modules/tsutils/typeguard/2.8/node.js new file mode 100644 index 000000000..b63a09be9 --- /dev/null +++ b/node_modules/tslint-eslint-rules/node_modules/tsutils/typeguard/2.8/node.js @@ -0,0 +1,709 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const ts = require("typescript"); +function isAccessorDeclaration(node) { + return node.kind === ts.SyntaxKind.GetAccessor || + node.kind === ts.SyntaxKind.SetAccessor; +} +exports.isAccessorDeclaration = isAccessorDeclaration; +function isArrayBindingPattern(node) { + return node.kind === ts.SyntaxKind.ArrayBindingPattern; +} +exports.isArrayBindingPattern = isArrayBindingPattern; +function isArrayLiteralExpression(node) { + return node.kind === ts.SyntaxKind.ArrayLiteralExpression; +} +exports.isArrayLiteralExpression = isArrayLiteralExpression; +function isArrayTypeNode(node) { + return node.kind === ts.SyntaxKind.ArrayType; +} +exports.isArrayTypeNode = isArrayTypeNode; +function isArrowFunction(node) { + return node.kind === ts.SyntaxKind.ArrowFunction; +} +exports.isArrowFunction = isArrowFunction; +function isAsExpression(node) { + return node.kind === ts.SyntaxKind.AsExpression; +} +exports.isAsExpression = isAsExpression; +function isAssertionExpression(node) { + return node.kind === ts.SyntaxKind.AsExpression || + node.kind === ts.SyntaxKind.TypeAssertionExpression; +} +exports.isAssertionExpression = isAssertionExpression; +function isAwaitExpression(node) { + return node.kind === ts.SyntaxKind.AwaitExpression; +} +exports.isAwaitExpression = isAwaitExpression; +function isBinaryExpression(node) { + return node.kind === ts.SyntaxKind.BinaryExpression; +} +exports.isBinaryExpression = isBinaryExpression; +function isBindingElement(node) { + return node.kind === ts.SyntaxKind.BindingElement; +} +exports.isBindingElement = isBindingElement; +function isBindingPattern(node) { + return node.kind === ts.SyntaxKind.ArrayBindingPattern || + node.kind === ts.SyntaxKind.ObjectBindingPattern; +} +exports.isBindingPattern = isBindingPattern; +function isBlock(node) { + return node.kind === ts.SyntaxKind.Block; +} +exports.isBlock = isBlock; +function isBlockLike(node) { + return node.statements !== undefined; +} +exports.isBlockLike = isBlockLike; +function isBooleanLiteral(node) { + return node.kind === ts.SyntaxKind.TrueKeyword || node.kind === ts.SyntaxKind.FalseKeyword; +} +exports.isBooleanLiteral = isBooleanLiteral; +function isBreakOrContinueStatement(node) { + return node.kind === ts.SyntaxKind.BreakStatement || + node.kind === ts.SyntaxKind.ContinueStatement; +} +exports.isBreakOrContinueStatement = isBreakOrContinueStatement; +function isBreakStatement(node) { + return node.kind === ts.SyntaxKind.BreakStatement; +} +exports.isBreakStatement = isBreakStatement; +function isCallExpression(node) { + return node.kind === ts.SyntaxKind.CallExpression; +} +exports.isCallExpression = isCallExpression; +function isCallLikeExpression(node) { + switch (node.kind) { + case ts.SyntaxKind.CallExpression: + case ts.SyntaxKind.Decorator: + case ts.SyntaxKind.JsxOpeningElement: + case ts.SyntaxKind.JsxSelfClosingElement: + case ts.SyntaxKind.NewExpression: + case ts.SyntaxKind.TaggedTemplateExpression: + return true; + default: + return false; + } +} +exports.isCallLikeExpression = isCallLikeExpression; +function isCallSignatureDeclaration(node) { + return node.kind === ts.SyntaxKind.CallSignature; +} +exports.isCallSignatureDeclaration = isCallSignatureDeclaration; +function isCaseBlock(node) { + return node.kind === ts.SyntaxKind.CaseBlock; +} +exports.isCaseBlock = isCaseBlock; +function isCaseClause(node) { + return node.kind === ts.SyntaxKind.CaseClause; +} +exports.isCaseClause = isCaseClause; +function isCaseOrDefaultClause(node) { + return node.kind === ts.SyntaxKind.CaseClause || + node.kind === ts.SyntaxKind.DefaultClause; +} +exports.isCaseOrDefaultClause = isCaseOrDefaultClause; +function isCatchClause(node) { + return node.kind === ts.SyntaxKind.CatchClause; +} +exports.isCatchClause = isCatchClause; +function isClassDeclaration(node) { + return node.kind === ts.SyntaxKind.ClassDeclaration; +} +exports.isClassDeclaration = isClassDeclaration; +function isClassExpression(node) { + return node.kind === ts.SyntaxKind.ClassExpression; +} +exports.isClassExpression = isClassExpression; +function isClassLikeDeclaration(node) { + return node.kind === ts.SyntaxKind.ClassDeclaration || + node.kind === ts.SyntaxKind.ClassExpression; +} +exports.isClassLikeDeclaration = isClassLikeDeclaration; +function isCommaListExpression(node) { + return node.kind === ts.SyntaxKind.CommaListExpression; +} +exports.isCommaListExpression = isCommaListExpression; +function isConditionalExpression(node) { + return node.kind === ts.SyntaxKind.ConditionalExpression; +} +exports.isConditionalExpression = isConditionalExpression; +function isConditionalTypeNode(node) { + return node.kind === ts.SyntaxKind.ConditionalType; +} +exports.isConditionalTypeNode = isConditionalTypeNode; +function isConstructorDeclaration(node) { + return node.kind === ts.SyntaxKind.Constructor; +} +exports.isConstructorDeclaration = isConstructorDeclaration; +function isConstructorTypeNode(node) { + return node.kind === ts.SyntaxKind.ConstructorType; +} +exports.isConstructorTypeNode = isConstructorTypeNode; +function isConstructSignatureDeclaration(node) { + return node.kind === ts.SyntaxKind.ConstructSignature; +} +exports.isConstructSignatureDeclaration = isConstructSignatureDeclaration; +function isContinueStatement(node) { + return node.kind === ts.SyntaxKind.ContinueStatement; +} +exports.isContinueStatement = isContinueStatement; +function isComputedPropertyName(node) { + return node.kind === ts.SyntaxKind.ComputedPropertyName; +} +exports.isComputedPropertyName = isComputedPropertyName; +function isDebuggerStatement(node) { + return node.kind === ts.SyntaxKind.DebuggerStatement; +} +exports.isDebuggerStatement = isDebuggerStatement; +function isDecorator(node) { + return node.kind === ts.SyntaxKind.Decorator; +} +exports.isDecorator = isDecorator; +function isDefaultClause(node) { + return node.kind === ts.SyntaxKind.DefaultClause; +} +exports.isDefaultClause = isDefaultClause; +function isDeleteExpression(node) { + return node.kind === ts.SyntaxKind.DeleteExpression; +} +exports.isDeleteExpression = isDeleteExpression; +function isDoStatement(node) { + return node.kind === ts.SyntaxKind.DoStatement; +} +exports.isDoStatement = isDoStatement; +function isElementAccessExpression(node) { + return node.kind === ts.SyntaxKind.ElementAccessExpression; +} +exports.isElementAccessExpression = isElementAccessExpression; +function isEmptyStatement(node) { + return node.kind === ts.SyntaxKind.EmptyStatement; +} +exports.isEmptyStatement = isEmptyStatement; +function isEntityName(node) { + return node.kind === ts.SyntaxKind.Identifier || isQualifiedName(node); +} +exports.isEntityName = isEntityName; +function isEntityNameExpression(node) { + return node.kind === ts.SyntaxKind.Identifier || + isPropertyAccessExpression(node) && isEntityNameExpression(node.expression); +} +exports.isEntityNameExpression = isEntityNameExpression; +function isEnumDeclaration(node) { + return node.kind === ts.SyntaxKind.EnumDeclaration; +} +exports.isEnumDeclaration = isEnumDeclaration; +function isEnumMember(node) { + return node.kind === ts.SyntaxKind.EnumMember; +} +exports.isEnumMember = isEnumMember; +function isExportAssignment(node) { + return node.kind === ts.SyntaxKind.ExportAssignment; +} +exports.isExportAssignment = isExportAssignment; +function isExportDeclaration(node) { + return node.kind === ts.SyntaxKind.ExportDeclaration; +} +exports.isExportDeclaration = isExportDeclaration; +function isExportSpecifier(node) { + return node.kind === ts.SyntaxKind.ExportSpecifier; +} +exports.isExportSpecifier = isExportSpecifier; +function isExpression(node) { + switch (node.kind) { + case ts.SyntaxKind.ArrayLiteralExpression: + case ts.SyntaxKind.ArrowFunction: + case ts.SyntaxKind.AsExpression: + case ts.SyntaxKind.AwaitExpression: + case ts.SyntaxKind.BinaryExpression: + case ts.SyntaxKind.CallExpression: + case ts.SyntaxKind.ClassExpression: + case ts.SyntaxKind.CommaListExpression: + case ts.SyntaxKind.ConditionalExpression: + case ts.SyntaxKind.DeleteExpression: + case ts.SyntaxKind.ElementAccessExpression: + case ts.SyntaxKind.FalseKeyword: + case ts.SyntaxKind.FunctionExpression: + case ts.SyntaxKind.Identifier: + case ts.SyntaxKind.JsxElement: + case ts.SyntaxKind.JsxFragment: + case ts.SyntaxKind.JsxExpression: + case ts.SyntaxKind.JsxOpeningElement: + case ts.SyntaxKind.JsxOpeningFragment: + case ts.SyntaxKind.JsxSelfClosingElement: + case ts.SyntaxKind.MetaProperty: + case ts.SyntaxKind.NewExpression: + case ts.SyntaxKind.NonNullExpression: + case ts.SyntaxKind.NoSubstitutionTemplateLiteral: + case ts.SyntaxKind.NullKeyword: + case ts.SyntaxKind.NumericLiteral: + case ts.SyntaxKind.ObjectLiteralExpression: + case ts.SyntaxKind.OmittedExpression: + case ts.SyntaxKind.ParenthesizedExpression: + case ts.SyntaxKind.PostfixUnaryExpression: + case ts.SyntaxKind.PrefixUnaryExpression: + case ts.SyntaxKind.PropertyAccessExpression: + case ts.SyntaxKind.RegularExpressionLiteral: + case ts.SyntaxKind.SpreadElement: + case ts.SyntaxKind.StringLiteral: + case ts.SyntaxKind.SuperKeyword: + case ts.SyntaxKind.TaggedTemplateExpression: + case ts.SyntaxKind.TemplateExpression: + case ts.SyntaxKind.ThisKeyword: + case ts.SyntaxKind.TrueKeyword: + case ts.SyntaxKind.TypeAssertionExpression: + case ts.SyntaxKind.TypeOfExpression: + case ts.SyntaxKind.VoidExpression: + case ts.SyntaxKind.YieldExpression: + return true; + default: + return false; + } +} +exports.isExpression = isExpression; +function isExpressionStatement(node) { + return node.kind === ts.SyntaxKind.ExpressionStatement; +} +exports.isExpressionStatement = isExpressionStatement; +function isExpressionWithTypeArguments(node) { + return node.kind === ts.SyntaxKind.ExpressionWithTypeArguments; +} +exports.isExpressionWithTypeArguments = isExpressionWithTypeArguments; +function isExternalModuleReference(node) { + return node.kind === ts.SyntaxKind.ExternalModuleReference; +} +exports.isExternalModuleReference = isExternalModuleReference; +function isForInStatement(node) { + return node.kind === ts.SyntaxKind.ForInStatement; +} +exports.isForInStatement = isForInStatement; +function isForInOrOfStatement(node) { + return node.kind === ts.SyntaxKind.ForOfStatement || node.kind === ts.SyntaxKind.ForInStatement; +} +exports.isForInOrOfStatement = isForInOrOfStatement; +function isForOfStatement(node) { + return node.kind === ts.SyntaxKind.ForOfStatement; +} +exports.isForOfStatement = isForOfStatement; +function isForStatement(node) { + return node.kind === ts.SyntaxKind.ForStatement; +} +exports.isForStatement = isForStatement; +function isFunctionDeclaration(node) { + return node.kind === ts.SyntaxKind.FunctionDeclaration; +} +exports.isFunctionDeclaration = isFunctionDeclaration; +function isFunctionExpression(node) { + return node.kind === ts.SyntaxKind.FunctionExpression; +} +exports.isFunctionExpression = isFunctionExpression; +function isFunctionTypeNode(node) { + return node.kind === ts.SyntaxKind.FunctionType; +} +exports.isFunctionTypeNode = isFunctionTypeNode; +function isGetAccessorDeclaration(node) { + return node.kind === ts.SyntaxKind.GetAccessor; +} +exports.isGetAccessorDeclaration = isGetAccessorDeclaration; +function isIdentifier(node) { + return node.kind === ts.SyntaxKind.Identifier; +} +exports.isIdentifier = isIdentifier; +function isIfStatement(node) { + return node.kind === ts.SyntaxKind.IfStatement; +} +exports.isIfStatement = isIfStatement; +function isImportClause(node) { + return node.kind === ts.SyntaxKind.ImportClause; +} +exports.isImportClause = isImportClause; +function isImportDeclaration(node) { + return node.kind === ts.SyntaxKind.ImportDeclaration; +} +exports.isImportDeclaration = isImportDeclaration; +function isImportEqualsDeclaration(node) { + return node.kind === ts.SyntaxKind.ImportEqualsDeclaration; +} +exports.isImportEqualsDeclaration = isImportEqualsDeclaration; +function isImportSpecifier(node) { + return node.kind === ts.SyntaxKind.ImportSpecifier; +} +exports.isImportSpecifier = isImportSpecifier; +function isIndexedAccessTypeNode(node) { + return node.kind === ts.SyntaxKind.IndexedAccessType; +} +exports.isIndexedAccessTypeNode = isIndexedAccessTypeNode; +function isIndexSignatureDeclaration(node) { + return node.kind === ts.SyntaxKind.IndexSignature; +} +exports.isIndexSignatureDeclaration = isIndexSignatureDeclaration; +function isInferTypeNode(node) { + return node.kind === ts.SyntaxKind.InferType; +} +exports.isInferTypeNode = isInferTypeNode; +function isInterfaceDeclaration(node) { + return node.kind === ts.SyntaxKind.InterfaceDeclaration; +} +exports.isInterfaceDeclaration = isInterfaceDeclaration; +function isIntersectionTypeNode(node) { + return node.kind === ts.SyntaxKind.IntersectionType; +} +exports.isIntersectionTypeNode = isIntersectionTypeNode; +function isIterationStatement(node) { + switch (node.kind) { + case ts.SyntaxKind.ForStatement: + case ts.SyntaxKind.ForOfStatement: + case ts.SyntaxKind.ForInStatement: + case ts.SyntaxKind.WhileStatement: + case ts.SyntaxKind.DoStatement: + return true; + default: + return false; + } +} +exports.isIterationStatement = isIterationStatement; +function isJsDoc(node) { + return node.kind === ts.SyntaxKind.JSDocComment; +} +exports.isJsDoc = isJsDoc; +function isJsxAttribute(node) { + return node.kind === ts.SyntaxKind.JsxAttribute; +} +exports.isJsxAttribute = isJsxAttribute; +function isJsxAttributeLike(node) { + return node.kind === ts.SyntaxKind.JsxAttribute || + node.kind === ts.SyntaxKind.JsxSpreadAttribute; +} +exports.isJsxAttributeLike = isJsxAttributeLike; +function isJsxAttributes(node) { + return node.kind === ts.SyntaxKind.JsxAttributes; +} +exports.isJsxAttributes = isJsxAttributes; +function isJsxClosingElement(node) { + return node.kind === ts.SyntaxKind.JsxClosingElement; +} +exports.isJsxClosingElement = isJsxClosingElement; +function isJsxClosingFragment(node) { + return node.kind === ts.SyntaxKind.JsxClosingFragment; +} +exports.isJsxClosingFragment = isJsxClosingFragment; +function isJsxElement(node) { + return node.kind === ts.SyntaxKind.JsxElement; +} +exports.isJsxElement = isJsxElement; +function isJsxExpression(node) { + return node.kind === ts.SyntaxKind.JsxExpression; +} +exports.isJsxExpression = isJsxExpression; +function isJsxFragment(node) { + return node.kind === ts.SyntaxKind.JsxFragment; +} +exports.isJsxFragment = isJsxFragment; +function isJsxOpeningElement(node) { + return node.kind === ts.SyntaxKind.JsxOpeningElement; +} +exports.isJsxOpeningElement = isJsxOpeningElement; +function isJsxOpeningFragment(node) { + return node.kind === ts.SyntaxKind.JsxOpeningFragment; +} +exports.isJsxOpeningFragment = isJsxOpeningFragment; +function isJsxOpeningLikeElement(node) { + return node.kind === ts.SyntaxKind.JsxOpeningElement || + node.kind === ts.SyntaxKind.JsxSelfClosingElement; +} +exports.isJsxOpeningLikeElement = isJsxOpeningLikeElement; +function isJsxSelfClosingElement(node) { + return node.kind === ts.SyntaxKind.JsxSelfClosingElement; +} +exports.isJsxSelfClosingElement = isJsxSelfClosingElement; +function isJsxSpreadAttribute(node) { + return node.kind === ts.SyntaxKind.JsxSpreadAttribute; +} +exports.isJsxSpreadAttribute = isJsxSpreadAttribute; +function isJsxText(node) { + return node.kind === ts.SyntaxKind.JsxText; +} +exports.isJsxText = isJsxText; +function isLabeledStatement(node) { + return node.kind === ts.SyntaxKind.LabeledStatement; +} +exports.isLabeledStatement = isLabeledStatement; +function isLiteralExpression(node) { + return node.kind >= ts.SyntaxKind.FirstLiteralToken && + node.kind <= ts.SyntaxKind.LastLiteralToken; +} +exports.isLiteralExpression = isLiteralExpression; +function isLiteralTypeNode(node) { + return node.kind === ts.SyntaxKind.LiteralType; +} +exports.isLiteralTypeNode = isLiteralTypeNode; +function isMappedTypeNode(node) { + return node.kind === ts.SyntaxKind.MappedType; +} +exports.isMappedTypeNode = isMappedTypeNode; +function isMetaProperty(node) { + return node.kind === ts.SyntaxKind.MetaProperty; +} +exports.isMetaProperty = isMetaProperty; +function isMethodDeclaration(node) { + return node.kind === ts.SyntaxKind.MethodDeclaration; +} +exports.isMethodDeclaration = isMethodDeclaration; +function isMethodSignature(node) { + return node.kind === ts.SyntaxKind.MethodSignature; +} +exports.isMethodSignature = isMethodSignature; +function isModuleBlock(node) { + return node.kind === ts.SyntaxKind.ModuleBlock; +} +exports.isModuleBlock = isModuleBlock; +function isModuleDeclaration(node) { + return node.kind === ts.SyntaxKind.ModuleDeclaration; +} +exports.isModuleDeclaration = isModuleDeclaration; +function isNamedExports(node) { + return node.kind === ts.SyntaxKind.NamedExports; +} +exports.isNamedExports = isNamedExports; +function isNamedImports(node) { + return node.kind === ts.SyntaxKind.NamedImports; +} +exports.isNamedImports = isNamedImports; +function isNamespaceDeclaration(node) { + return isModuleDeclaration(node) && + node.name.kind === ts.SyntaxKind.Identifier && + node.body !== undefined && + (node.body.kind === ts.SyntaxKind.ModuleBlock || + isNamespaceDeclaration(node.body)); +} +exports.isNamespaceDeclaration = isNamespaceDeclaration; +function isNamespaceImport(node) { + return node.kind === ts.SyntaxKind.NamespaceImport; +} +exports.isNamespaceImport = isNamespaceImport; +function isNamespaceExportDeclaration(node) { + return node.kind === ts.SyntaxKind.NamespaceExportDeclaration; +} +exports.isNamespaceExportDeclaration = isNamespaceExportDeclaration; +function isNewExpression(node) { + return node.kind === ts.SyntaxKind.NewExpression; +} +exports.isNewExpression = isNewExpression; +function isNonNullExpression(node) { + return node.kind === ts.SyntaxKind.NonNullExpression; +} +exports.isNonNullExpression = isNonNullExpression; +function isNoSubstitutionTemplateLiteral(node) { + return node.kind === ts.SyntaxKind.NoSubstitutionTemplateLiteral; +} +exports.isNoSubstitutionTemplateLiteral = isNoSubstitutionTemplateLiteral; +function isNullLiteral(node) { + return node.kind === ts.SyntaxKind.NullKeyword; +} +exports.isNullLiteral = isNullLiteral; +function isNumericLiteral(node) { + return node.kind === ts.SyntaxKind.NumericLiteral; +} +exports.isNumericLiteral = isNumericLiteral; +function isNumericOrStringLikeLiteral(node) { + switch (node.kind) { + case ts.SyntaxKind.StringLiteral: + case ts.SyntaxKind.NumericLiteral: + case ts.SyntaxKind.NoSubstitutionTemplateLiteral: + return true; + default: + return false; + } +} +exports.isNumericOrStringLikeLiteral = isNumericOrStringLikeLiteral; +function isObjectBindingPattern(node) { + return node.kind === ts.SyntaxKind.ObjectBindingPattern; +} +exports.isObjectBindingPattern = isObjectBindingPattern; +function isObjectLiteralExpression(node) { + return node.kind === ts.SyntaxKind.ObjectLiteralExpression; +} +exports.isObjectLiteralExpression = isObjectLiteralExpression; +function isOmittedExpression(node) { + return node.kind === ts.SyntaxKind.OmittedExpression; +} +exports.isOmittedExpression = isOmittedExpression; +function isParameterDeclaration(node) { + return node.kind === ts.SyntaxKind.Parameter; +} +exports.isParameterDeclaration = isParameterDeclaration; +function isParenthesizedExpression(node) { + return node.kind === ts.SyntaxKind.ParenthesizedExpression; +} +exports.isParenthesizedExpression = isParenthesizedExpression; +function isParenthesizedTypeNode(node) { + return node.kind === ts.SyntaxKind.ParenthesizedType; +} +exports.isParenthesizedTypeNode = isParenthesizedTypeNode; +function isPostfixUnaryExpression(node) { + return node.kind === ts.SyntaxKind.PostfixUnaryExpression; +} +exports.isPostfixUnaryExpression = isPostfixUnaryExpression; +function isPrefixUnaryExpression(node) { + return node.kind === ts.SyntaxKind.PrefixUnaryExpression; +} +exports.isPrefixUnaryExpression = isPrefixUnaryExpression; +function isPropertyAccessExpression(node) { + return node.kind === ts.SyntaxKind.PropertyAccessExpression; +} +exports.isPropertyAccessExpression = isPropertyAccessExpression; +function isPropertyAssignment(node) { + return node.kind === ts.SyntaxKind.PropertyAssignment; +} +exports.isPropertyAssignment = isPropertyAssignment; +function isPropertyDeclaration(node) { + return node.kind === ts.SyntaxKind.PropertyDeclaration; +} +exports.isPropertyDeclaration = isPropertyDeclaration; +function isPropertySignature(node) { + return node.kind === ts.SyntaxKind.PropertySignature; +} +exports.isPropertySignature = isPropertySignature; +function isQualifiedName(node) { + return node.kind === ts.SyntaxKind.QualifiedName; +} +exports.isQualifiedName = isQualifiedName; +function isRegularExpressionLiteral(node) { + return node.kind === ts.SyntaxKind.RegularExpressionLiteral; +} +exports.isRegularExpressionLiteral = isRegularExpressionLiteral; +function isReturnStatement(node) { + return node.kind === ts.SyntaxKind.ReturnStatement; +} +exports.isReturnStatement = isReturnStatement; +function isSetAccessorDeclaration(node) { + return node.kind === ts.SyntaxKind.SetAccessor; +} +exports.isSetAccessorDeclaration = isSetAccessorDeclaration; +function isShorthandPropertyAssignment(node) { + return node.kind === ts.SyntaxKind.ShorthandPropertyAssignment; +} +exports.isShorthandPropertyAssignment = isShorthandPropertyAssignment; +function isSignatureDeclaration(node) { + return node.parameters !== undefined; +} +exports.isSignatureDeclaration = isSignatureDeclaration; +function isSourceFile(node) { + return node.kind === ts.SyntaxKind.SourceFile; +} +exports.isSourceFile = isSourceFile; +function isSpreadAssignment(node) { + return node.kind === ts.SyntaxKind.SpreadAssignment; +} +exports.isSpreadAssignment = isSpreadAssignment; +function isSpreadElement(node) { + return node.kind === ts.SyntaxKind.SpreadElement; +} +exports.isSpreadElement = isSpreadElement; +function isStringLiteral(node) { + return node.kind === ts.SyntaxKind.StringLiteral; +} +exports.isStringLiteral = isStringLiteral; +function isSwitchStatement(node) { + return node.kind === ts.SyntaxKind.SwitchStatement; +} +exports.isSwitchStatement = isSwitchStatement; +function isSyntaxList(node) { + return node.kind === ts.SyntaxKind.SyntaxList; +} +exports.isSyntaxList = isSyntaxList; +function isTaggedTemplateExpression(node) { + return node.kind === ts.SyntaxKind.TaggedTemplateExpression; +} +exports.isTaggedTemplateExpression = isTaggedTemplateExpression; +function isTemplateExpression(node) { + return node.kind === ts.SyntaxKind.TemplateExpression; +} +exports.isTemplateExpression = isTemplateExpression; +function isTemplateLiteral(node) { + return node.kind === ts.SyntaxKind.TemplateExpression || + node.kind === ts.SyntaxKind.NoSubstitutionTemplateLiteral; +} +exports.isTemplateLiteral = isTemplateLiteral; +function isTextualLiteral(node) { + return node.kind === ts.SyntaxKind.StringLiteral || + node.kind === ts.SyntaxKind.NoSubstitutionTemplateLiteral; +} +exports.isTextualLiteral = isTextualLiteral; +function isThrowStatement(node) { + return node.kind === ts.SyntaxKind.ThrowStatement; +} +exports.isThrowStatement = isThrowStatement; +function isTryStatement(node) { + return node.kind === ts.SyntaxKind.TryStatement; +} +exports.isTryStatement = isTryStatement; +function isTupleTypeNode(node) { + return node.kind === ts.SyntaxKind.TupleType; +} +exports.isTupleTypeNode = isTupleTypeNode; +function isTypeAliasDeclaration(node) { + return node.kind === ts.SyntaxKind.TypeAliasDeclaration; +} +exports.isTypeAliasDeclaration = isTypeAliasDeclaration; +function isTypeAssertion(node) { + return node.kind === ts.SyntaxKind.TypeAssertionExpression; +} +exports.isTypeAssertion = isTypeAssertion; +function isTypeLiteralNode(node) { + return node.kind === ts.SyntaxKind.TypeLiteral; +} +exports.isTypeLiteralNode = isTypeLiteralNode; +function isTypeOfExpression(node) { + return node.kind === ts.SyntaxKind.TypeOfExpression; +} +exports.isTypeOfExpression = isTypeOfExpression; +function isTypeOperatorNode(node) { + return node.kind === ts.SyntaxKind.TypeOperator; +} +exports.isTypeOperatorNode = isTypeOperatorNode; +function isTypeParameterDeclaration(node) { + return node.kind === ts.SyntaxKind.TypeParameter; +} +exports.isTypeParameterDeclaration = isTypeParameterDeclaration; +function isTypePredicateNode(node) { + return node.kind === ts.SyntaxKind.TypePredicate; +} +exports.isTypePredicateNode = isTypePredicateNode; +function isTypeReferenceNode(node) { + return node.kind === ts.SyntaxKind.TypeReference; +} +exports.isTypeReferenceNode = isTypeReferenceNode; +function isTypeQueryNode(node) { + return node.kind === ts.SyntaxKind.TypeQuery; +} +exports.isTypeQueryNode = isTypeQueryNode; +function isUnionTypeNode(node) { + return node.kind === ts.SyntaxKind.UnionType; +} +exports.isUnionTypeNode = isUnionTypeNode; +function isVariableDeclaration(node) { + return node.kind === ts.SyntaxKind.VariableDeclaration; +} +exports.isVariableDeclaration = isVariableDeclaration; +function isVariableStatement(node) { + return node.kind === ts.SyntaxKind.VariableStatement; +} +exports.isVariableStatement = isVariableStatement; +function isVariableDeclarationList(node) { + return node.kind === ts.SyntaxKind.VariableDeclarationList; +} +exports.isVariableDeclarationList = isVariableDeclarationList; +function isVoidExpression(node) { + return node.kind === ts.SyntaxKind.VoidExpression; +} +exports.isVoidExpression = isVoidExpression; +function isWhileStatement(node) { + return node.kind === ts.SyntaxKind.WhileStatement; +} +exports.isWhileStatement = isWhileStatement; +function isWithStatement(node) { + return node.kind === ts.SyntaxKind.WithStatement; +} +exports.isWithStatement = isWithStatement; diff --git a/node_modules/tslint-eslint-rules/node_modules/tsutils/typeguard/2.8/type.d.ts b/node_modules/tslint-eslint-rules/node_modules/tsutils/typeguard/2.8/type.d.ts new file mode 100644 index 000000000..45b6bc3d3 --- /dev/null +++ b/node_modules/tslint-eslint-rules/node_modules/tsutils/typeguard/2.8/type.d.ts @@ -0,0 +1,18 @@ +import * as ts from 'typescript'; +export declare function isConditionalType(type: ts.Type): type is ts.ConditionalType; +export declare function isEnumType(type: ts.Type): type is ts.EnumType; +export declare function isGenericType(type: ts.Type): type is ts.GenericType; +export declare function isIndexedAccessType(type: ts.Type): type is ts.IndexedAccessType; +export declare function isIndexedAccessype(type: ts.Type): type is ts.IndexType; +export declare function isInstantiableType(type: ts.Type): type is ts.InstantiableType; +export declare function isInterfaceType(type: ts.Type): type is ts.InterfaceType; +export declare function isIntersectionType(type: ts.Type): type is ts.IntersectionType; +export declare function isLiteralType(type: ts.Type): type is ts.LiteralType; +export declare function isObjectType(type: ts.Type): type is ts.ObjectType; +export declare function isSubstitutionType(type: ts.Type): type is ts.SubstitutionType; +export declare function isTypeParameter(type: ts.Type): type is ts.TypeParameter; +export declare function isTypeReference(type: ts.Type): type is ts.TypeReference; +export declare function isTypeVariable(type: ts.Type): type is ts.TypeParameter | ts.IndexedAccessType; +export declare function isUnionOrIntersectionType(type: ts.Type): type is ts.UnionOrIntersectionType; +export declare function isUnionType(type: ts.Type): type is ts.UnionType; +export declare function isUniqueESSymbolType(type: ts.Type): type is ts.UniqueESSymbolType; diff --git a/node_modules/tslint-eslint-rules/node_modules/tsutils/typeguard/2.8/type.js b/node_modules/tslint-eslint-rules/node_modules/tsutils/typeguard/2.8/type.js new file mode 100644 index 000000000..01fc06ead --- /dev/null +++ b/node_modules/tslint-eslint-rules/node_modules/tsutils/typeguard/2.8/type.js @@ -0,0 +1,75 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const ts = require("typescript"); +function isConditionalType(type) { + return (type.flags & ts.TypeFlags.Conditional) !== 0; +} +exports.isConditionalType = isConditionalType; +function isEnumType(type) { + return (type.flags & ts.TypeFlags.Enum) !== 0; +} +exports.isEnumType = isEnumType; +function isGenericType(type) { + return (type.flags & ts.TypeFlags.Object) !== 0 && + (type.objectFlags & ts.ObjectFlags.ClassOrInterface) !== 0 && + (type.objectFlags & ts.ObjectFlags.Reference) !== 0; +} +exports.isGenericType = isGenericType; +function isIndexedAccessType(type) { + return (type.flags & ts.TypeFlags.IndexedAccess) !== 0; +} +exports.isIndexedAccessType = isIndexedAccessType; +function isIndexedAccessype(type) { + return (type.flags & ts.TypeFlags.Index) !== 0; +} +exports.isIndexedAccessype = isIndexedAccessype; +function isInstantiableType(type) { + return (type.flags & ts.TypeFlags.Instantiable) !== 0; +} +exports.isInstantiableType = isInstantiableType; +function isInterfaceType(type) { + return (type.flags & ts.TypeFlags.Object) !== 0 && + (type.objectFlags & ts.ObjectFlags.ClassOrInterface) !== 0; +} +exports.isInterfaceType = isInterfaceType; +function isIntersectionType(type) { + return (type.flags & ts.TypeFlags.Intersection) !== 0; +} +exports.isIntersectionType = isIntersectionType; +function isLiteralType(type) { + return (type.flags & (ts.TypeFlags.StringOrNumberLiteral | ts.TypeFlags.BigIntLiteral)) !== 0; +} +exports.isLiteralType = isLiteralType; +function isObjectType(type) { + return (type.flags & ts.TypeFlags.Object) !== 0; +} +exports.isObjectType = isObjectType; +function isSubstitutionType(type) { + return (type.flags & ts.TypeFlags.Substitution) !== 0; +} +exports.isSubstitutionType = isSubstitutionType; +function isTypeParameter(type) { + return (type.flags & ts.TypeFlags.TypeParameter) !== 0; +} +exports.isTypeParameter = isTypeParameter; +function isTypeReference(type) { + return (type.flags & ts.TypeFlags.Object) !== 0 && + (type.objectFlags & ts.ObjectFlags.Reference) !== 0; +} +exports.isTypeReference = isTypeReference; +function isTypeVariable(type) { + return (type.flags & ts.TypeFlags.TypeVariable) !== 0; +} +exports.isTypeVariable = isTypeVariable; +function isUnionOrIntersectionType(type) { + return (type.flags & ts.TypeFlags.UnionOrIntersection) !== 0; +} +exports.isUnionOrIntersectionType = isUnionOrIntersectionType; +function isUnionType(type) { + return (type.flags & ts.TypeFlags.Union) !== 0; +} +exports.isUnionType = isUnionType; +function isUniqueESSymbolType(type) { + return (type.flags & ts.TypeFlags.UniqueESSymbol) !== 0; +} +exports.isUniqueESSymbolType = isUniqueESSymbolType; diff --git a/node_modules/tslint-eslint-rules/node_modules/tsutils/typeguard/2.9/index.d.ts b/node_modules/tslint-eslint-rules/node_modules/tsutils/typeguard/2.9/index.d.ts new file mode 100644 index 000000000..71762921c --- /dev/null +++ b/node_modules/tslint-eslint-rules/node_modules/tsutils/typeguard/2.9/index.d.ts @@ -0,0 +1,2 @@ +export * from './node'; +export * from './type'; diff --git a/node_modules/tslint-eslint-rules/node_modules/tsutils/typeguard/2.9/index.js b/node_modules/tslint-eslint-rules/node_modules/tsutils/typeguard/2.9/index.js new file mode 100644 index 000000000..0c381e79a --- /dev/null +++ b/node_modules/tslint-eslint-rules/node_modules/tsutils/typeguard/2.9/index.js @@ -0,0 +1,5 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const tslib_1 = require("tslib"); +tslib_1.__exportStar(require("./node"), exports); +tslib_1.__exportStar(require("./type"), exports); diff --git a/node_modules/tslint-eslint-rules/node_modules/tsutils/typeguard/2.9/node.d.ts b/node_modules/tslint-eslint-rules/node_modules/tsutils/typeguard/2.9/node.d.ts new file mode 100644 index 000000000..bf2ec1d1f --- /dev/null +++ b/node_modules/tslint-eslint-rules/node_modules/tsutils/typeguard/2.9/node.d.ts @@ -0,0 +1,3 @@ +export * from '../2.8/node'; +import * as ts from 'typescript'; +export declare function isImportTypeNode(node: ts.Node): node is ts.ImportTypeNode; diff --git a/node_modules/tslint-eslint-rules/node_modules/tsutils/typeguard/2.9/node.js b/node_modules/tslint-eslint-rules/node_modules/tsutils/typeguard/2.9/node.js new file mode 100644 index 000000000..e24159778 --- /dev/null +++ b/node_modules/tslint-eslint-rules/node_modules/tsutils/typeguard/2.9/node.js @@ -0,0 +1,9 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const tslib_1 = require("tslib"); +tslib_1.__exportStar(require("../2.8/node"), exports); +const ts = require("typescript"); +function isImportTypeNode(node) { + return node.kind === ts.SyntaxKind.ImportType; +} +exports.isImportTypeNode = isImportTypeNode; diff --git a/node_modules/tslint-eslint-rules/node_modules/tsutils/typeguard/2.9/type.d.ts b/node_modules/tslint-eslint-rules/node_modules/tsutils/typeguard/2.9/type.d.ts new file mode 100644 index 000000000..ec83ac3f4 --- /dev/null +++ b/node_modules/tslint-eslint-rules/node_modules/tsutils/typeguard/2.9/type.d.ts @@ -0,0 +1 @@ +export * from '../2.8/type'; diff --git a/node_modules/tslint-eslint-rules/node_modules/tsutils/typeguard/2.9/type.js b/node_modules/tslint-eslint-rules/node_modules/tsutils/typeguard/2.9/type.js new file mode 100644 index 000000000..9315cac2b --- /dev/null +++ b/node_modules/tslint-eslint-rules/node_modules/tsutils/typeguard/2.9/type.js @@ -0,0 +1,4 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const tslib_1 = require("tslib"); +tslib_1.__exportStar(require("../2.8/type"), exports); diff --git a/node_modules/tslint-eslint-rules/node_modules/tsutils/typeguard/3.0/index.d.ts b/node_modules/tslint-eslint-rules/node_modules/tsutils/typeguard/3.0/index.d.ts new file mode 100644 index 000000000..71762921c --- /dev/null +++ b/node_modules/tslint-eslint-rules/node_modules/tsutils/typeguard/3.0/index.d.ts @@ -0,0 +1,2 @@ +export * from './node'; +export * from './type'; diff --git a/node_modules/tslint-eslint-rules/node_modules/tsutils/typeguard/3.0/index.js b/node_modules/tslint-eslint-rules/node_modules/tsutils/typeguard/3.0/index.js new file mode 100644 index 000000000..0c381e79a --- /dev/null +++ b/node_modules/tslint-eslint-rules/node_modules/tsutils/typeguard/3.0/index.js @@ -0,0 +1,5 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const tslib_1 = require("tslib"); +tslib_1.__exportStar(require("./node"), exports); +tslib_1.__exportStar(require("./type"), exports); diff --git a/node_modules/tslint-eslint-rules/node_modules/tsutils/typeguard/3.0/node.d.ts b/node_modules/tslint-eslint-rules/node_modules/tsutils/typeguard/3.0/node.d.ts new file mode 100644 index 000000000..305991140 --- /dev/null +++ b/node_modules/tslint-eslint-rules/node_modules/tsutils/typeguard/3.0/node.d.ts @@ -0,0 +1,5 @@ +export * from '../2.9/node'; +import * as ts from 'typescript'; +export declare function isOptionalTypeNode(node: ts.Node): node is ts.OptionalTypeNode; +export declare function isRestTypeNode(node: ts.Node): node is ts.RestTypeNode; +export declare function isSyntheticExpression(node: ts.Node): node is ts.SyntheticExpression; diff --git a/node_modules/tslint-eslint-rules/node_modules/tsutils/typeguard/3.0/node.js b/node_modules/tslint-eslint-rules/node_modules/tsutils/typeguard/3.0/node.js new file mode 100644 index 000000000..943bb36e8 --- /dev/null +++ b/node_modules/tslint-eslint-rules/node_modules/tsutils/typeguard/3.0/node.js @@ -0,0 +1,17 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const tslib_1 = require("tslib"); +tslib_1.__exportStar(require("../2.9/node"), exports); +const ts = require("typescript"); +function isOptionalTypeNode(node) { + return node.kind === ts.SyntaxKind.OptionalType; +} +exports.isOptionalTypeNode = isOptionalTypeNode; +function isRestTypeNode(node) { + return node.kind === ts.SyntaxKind.RestType; +} +exports.isRestTypeNode = isRestTypeNode; +function isSyntheticExpression(node) { + return node.kind === ts.SyntaxKind.SyntheticExpression; +} +exports.isSyntheticExpression = isSyntheticExpression; diff --git a/node_modules/tslint-eslint-rules/node_modules/tsutils/typeguard/3.0/type.d.ts b/node_modules/tslint-eslint-rules/node_modules/tsutils/typeguard/3.0/type.d.ts new file mode 100644 index 000000000..5cf0df95a --- /dev/null +++ b/node_modules/tslint-eslint-rules/node_modules/tsutils/typeguard/3.0/type.d.ts @@ -0,0 +1,6 @@ +export * from '../2.9/type'; +import * as ts from 'typescript'; +export declare function isTupleType(type: ts.Type): type is ts.TupleType; +export declare function isTupleTypeReference(type: ts.Type): type is ts.TypeReference & { + target: ts.TupleType; +}; diff --git a/node_modules/tslint-eslint-rules/node_modules/tsutils/typeguard/3.0/type.js b/node_modules/tslint-eslint-rules/node_modules/tsutils/typeguard/3.0/type.js new file mode 100644 index 000000000..7ec876f8f --- /dev/null +++ b/node_modules/tslint-eslint-rules/node_modules/tsutils/typeguard/3.0/type.js @@ -0,0 +1,14 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const tslib_1 = require("tslib"); +tslib_1.__exportStar(require("../2.9/type"), exports); +const ts = require("typescript"); +const type_1 = require("../2.9/type"); +function isTupleType(type) { + return (type.flags & ts.TypeFlags.Object && type.objectFlags & ts.ObjectFlags.Tuple) !== 0; +} +exports.isTupleType = isTupleType; +function isTupleTypeReference(type) { + return type_1.isTypeReference(type) && isTupleType(type.target); +} +exports.isTupleTypeReference = isTupleTypeReference; diff --git a/node_modules/tslint-eslint-rules/node_modules/tsutils/typeguard/3.2/index.d.ts b/node_modules/tslint-eslint-rules/node_modules/tsutils/typeguard/3.2/index.d.ts new file mode 100644 index 000000000..71762921c --- /dev/null +++ b/node_modules/tslint-eslint-rules/node_modules/tsutils/typeguard/3.2/index.d.ts @@ -0,0 +1,2 @@ +export * from './node'; +export * from './type'; diff --git a/node_modules/tslint-eslint-rules/node_modules/tsutils/typeguard/3.2/index.js b/node_modules/tslint-eslint-rules/node_modules/tsutils/typeguard/3.2/index.js new file mode 100644 index 000000000..0c381e79a --- /dev/null +++ b/node_modules/tslint-eslint-rules/node_modules/tsutils/typeguard/3.2/index.js @@ -0,0 +1,5 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const tslib_1 = require("tslib"); +tslib_1.__exportStar(require("./node"), exports); +tslib_1.__exportStar(require("./type"), exports); diff --git a/node_modules/tslint-eslint-rules/node_modules/tsutils/typeguard/3.2/node.d.ts b/node_modules/tslint-eslint-rules/node_modules/tsutils/typeguard/3.2/node.d.ts new file mode 100644 index 000000000..cf88ae114 --- /dev/null +++ b/node_modules/tslint-eslint-rules/node_modules/tsutils/typeguard/3.2/node.d.ts @@ -0,0 +1,3 @@ +export * from '../3.0/node'; +import * as ts from 'typescript'; +export declare function isBigIntLiteral(node: ts.Node): node is ts.BigIntLiteral; diff --git a/node_modules/tslint-eslint-rules/node_modules/tsutils/typeguard/3.2/node.js b/node_modules/tslint-eslint-rules/node_modules/tsutils/typeguard/3.2/node.js new file mode 100644 index 000000000..26e8c1a74 --- /dev/null +++ b/node_modules/tslint-eslint-rules/node_modules/tsutils/typeguard/3.2/node.js @@ -0,0 +1,9 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const tslib_1 = require("tslib"); +tslib_1.__exportStar(require("../3.0/node"), exports); +const ts = require("typescript"); +function isBigIntLiteral(node) { + return node.kind === ts.SyntaxKind.BigIntLiteral; +} +exports.isBigIntLiteral = isBigIntLiteral; diff --git a/node_modules/tslint-eslint-rules/node_modules/tsutils/typeguard/3.2/type.d.ts b/node_modules/tslint-eslint-rules/node_modules/tsutils/typeguard/3.2/type.d.ts new file mode 100644 index 000000000..fee77fb18 --- /dev/null +++ b/node_modules/tslint-eslint-rules/node_modules/tsutils/typeguard/3.2/type.d.ts @@ -0,0 +1 @@ +export * from '../3.0/type'; diff --git a/node_modules/tslint-eslint-rules/node_modules/tsutils/typeguard/3.2/type.js b/node_modules/tslint-eslint-rules/node_modules/tsutils/typeguard/3.2/type.js new file mode 100644 index 000000000..d800ef841 --- /dev/null +++ b/node_modules/tslint-eslint-rules/node_modules/tsutils/typeguard/3.2/type.js @@ -0,0 +1,4 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const tslib_1 = require("tslib"); +tslib_1.__exportStar(require("../3.0/type"), exports); diff --git a/node_modules/tslint-eslint-rules/node_modules/tsutils/typeguard/index.d.ts b/node_modules/tslint-eslint-rules/node_modules/tsutils/typeguard/index.d.ts new file mode 100644 index 000000000..71762921c --- /dev/null +++ b/node_modules/tslint-eslint-rules/node_modules/tsutils/typeguard/index.d.ts @@ -0,0 +1,2 @@ +export * from './node'; +export * from './type'; diff --git a/node_modules/tslint-eslint-rules/node_modules/tsutils/typeguard/index.js b/node_modules/tslint-eslint-rules/node_modules/tsutils/typeguard/index.js new file mode 100644 index 000000000..0c381e79a --- /dev/null +++ b/node_modules/tslint-eslint-rules/node_modules/tsutils/typeguard/index.js @@ -0,0 +1,5 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const tslib_1 = require("tslib"); +tslib_1.__exportStar(require("./node"), exports); +tslib_1.__exportStar(require("./type"), exports); diff --git a/node_modules/tslint-eslint-rules/node_modules/tsutils/typeguard/next/index.d.ts b/node_modules/tslint-eslint-rules/node_modules/tsutils/typeguard/next/index.d.ts new file mode 100644 index 000000000..71762921c --- /dev/null +++ b/node_modules/tslint-eslint-rules/node_modules/tsutils/typeguard/next/index.d.ts @@ -0,0 +1,2 @@ +export * from './node'; +export * from './type'; diff --git a/node_modules/tslint-eslint-rules/node_modules/tsutils/typeguard/next/index.js b/node_modules/tslint-eslint-rules/node_modules/tsutils/typeguard/next/index.js new file mode 100644 index 000000000..0c381e79a --- /dev/null +++ b/node_modules/tslint-eslint-rules/node_modules/tsutils/typeguard/next/index.js @@ -0,0 +1,5 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const tslib_1 = require("tslib"); +tslib_1.__exportStar(require("./node"), exports); +tslib_1.__exportStar(require("./type"), exports); diff --git a/node_modules/tslint-eslint-rules/node_modules/tsutils/typeguard/next/node.d.ts b/node_modules/tslint-eslint-rules/node_modules/tsutils/typeguard/next/node.d.ts new file mode 100644 index 000000000..d64678a34 --- /dev/null +++ b/node_modules/tslint-eslint-rules/node_modules/tsutils/typeguard/next/node.d.ts @@ -0,0 +1 @@ +export * from '../3.2/node'; diff --git a/node_modules/tslint-eslint-rules/node_modules/tsutils/typeguard/next/node.js b/node_modules/tslint-eslint-rules/node_modules/tsutils/typeguard/next/node.js new file mode 100644 index 000000000..e2c022f12 --- /dev/null +++ b/node_modules/tslint-eslint-rules/node_modules/tsutils/typeguard/next/node.js @@ -0,0 +1,4 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const tslib_1 = require("tslib"); +tslib_1.__exportStar(require("../3.2/node"), exports); diff --git a/node_modules/tslint-eslint-rules/node_modules/tsutils/typeguard/next/type.d.ts b/node_modules/tslint-eslint-rules/node_modules/tsutils/typeguard/next/type.d.ts new file mode 100644 index 000000000..6cd4408ac --- /dev/null +++ b/node_modules/tslint-eslint-rules/node_modules/tsutils/typeguard/next/type.d.ts @@ -0,0 +1 @@ +export * from '../3.2/type'; diff --git a/node_modules/tslint-eslint-rules/node_modules/tsutils/typeguard/next/type.js b/node_modules/tslint-eslint-rules/node_modules/tsutils/typeguard/next/type.js new file mode 100644 index 000000000..ef88473b6 --- /dev/null +++ b/node_modules/tslint-eslint-rules/node_modules/tsutils/typeguard/next/type.js @@ -0,0 +1,4 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const tslib_1 = require("tslib"); +tslib_1.__exportStar(require("../3.2/type"), exports); diff --git a/node_modules/tslint-eslint-rules/node_modules/tsutils/typeguard/node.d.ts b/node_modules/tslint-eslint-rules/node_modules/tsutils/typeguard/node.d.ts new file mode 100644 index 000000000..f6a9f8b7d --- /dev/null +++ b/node_modules/tslint-eslint-rules/node_modules/tsutils/typeguard/node.d.ts @@ -0,0 +1 @@ +export * from './3.2/node'; diff --git a/node_modules/tslint-eslint-rules/node_modules/tsutils/typeguard/node.js b/node_modules/tslint-eslint-rules/node_modules/tsutils/typeguard/node.js new file mode 100644 index 000000000..3d8e37608 --- /dev/null +++ b/node_modules/tslint-eslint-rules/node_modules/tsutils/typeguard/node.js @@ -0,0 +1,4 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const tslib_1 = require("tslib"); +tslib_1.__exportStar(require("./3.2/node"), exports); diff --git a/node_modules/tslint-eslint-rules/node_modules/tsutils/typeguard/type.d.ts b/node_modules/tslint-eslint-rules/node_modules/tsutils/typeguard/type.d.ts new file mode 100644 index 000000000..8a20aeb1f --- /dev/null +++ b/node_modules/tslint-eslint-rules/node_modules/tsutils/typeguard/type.d.ts @@ -0,0 +1 @@ +export * from './3.2/type'; diff --git a/node_modules/tslint-eslint-rules/node_modules/tsutils/typeguard/type.js b/node_modules/tslint-eslint-rules/node_modules/tsutils/typeguard/type.js new file mode 100644 index 000000000..cecc6fd6c --- /dev/null +++ b/node_modules/tslint-eslint-rules/node_modules/tsutils/typeguard/type.js @@ -0,0 +1,4 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const tslib_1 = require("tslib"); +tslib_1.__exportStar(require("./3.2/type"), exports); diff --git a/node_modules/tslint-eslint-rules/node_modules/tsutils/util/control-flow.d.ts b/node_modules/tslint-eslint-rules/node_modules/tsutils/util/control-flow.d.ts new file mode 100644 index 000000000..528155c1b --- /dev/null +++ b/node_modules/tslint-eslint-rules/node_modules/tsutils/util/control-flow.d.ts @@ -0,0 +1,8 @@ +import * as ts from 'typescript'; +export declare function endsControlFlow(statement: ts.Statement | ts.BlockLike): boolean; +export declare type ControlFlowStatement = ts.BreakStatement | ts.ContinueStatement | ts.ReturnStatement | ts.ThrowStatement; +export interface ControlFlowEnd { + readonly statements: ReadonlyArray; + readonly end: boolean; +} +export declare function getControlFlowEnd(statement: ts.Statement | ts.BlockLike): ControlFlowEnd; diff --git a/node_modules/tslint-eslint-rules/node_modules/tsutils/util/control-flow.js b/node_modules/tslint-eslint-rules/node_modules/tsutils/util/control-flow.js new file mode 100644 index 000000000..7e83773f0 --- /dev/null +++ b/node_modules/tslint-eslint-rules/node_modules/tsutils/util/control-flow.js @@ -0,0 +1,171 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const ts = require("typescript"); +const node_1 = require("../typeguard/node"); +function endsControlFlow(statement) { + return getControlFlowEnd(statement).end; +} +exports.endsControlFlow = endsControlFlow; +const defaultControlFlowEnd = { statements: [], end: false }; +function getControlFlowEnd(statement) { + return node_1.isBlockLike(statement) ? handleBlock(statement) : getControlFlowEndWorker(statement); +} +exports.getControlFlowEnd = getControlFlowEnd; +function getControlFlowEndWorker(statement) { + switch (statement.kind) { + case ts.SyntaxKind.ReturnStatement: + case ts.SyntaxKind.ThrowStatement: + case ts.SyntaxKind.ContinueStatement: + case ts.SyntaxKind.BreakStatement: + return { statements: [statement], end: true }; + case ts.SyntaxKind.Block: + return handleBlock(statement); + case ts.SyntaxKind.ForStatement: + case ts.SyntaxKind.WhileStatement: + return handleForAndWhileStatement(statement); + case ts.SyntaxKind.ForOfStatement: + case ts.SyntaxKind.ForInStatement: + return handleForInOrOfStatement(statement); + case ts.SyntaxKind.DoStatement: + return matchBreakOrContinue(getControlFlowEndWorker(statement.statement), node_1.isBreakOrContinueStatement); + case ts.SyntaxKind.IfStatement: + return handleIfStatement(statement); + case ts.SyntaxKind.SwitchStatement: + return matchBreakOrContinue(handleSwitchStatement(statement), node_1.isBreakStatement); + case ts.SyntaxKind.TryStatement: + return handleTryStatement(statement); + case ts.SyntaxKind.LabeledStatement: + return matchLabel(getControlFlowEndWorker(statement.statement), statement.label); + case ts.SyntaxKind.WithStatement: + return getControlFlowEndWorker(statement.statement); + default: + return defaultControlFlowEnd; + } +} +function handleBlock(statement) { + const result = { statements: [], end: false }; + for (const s of statement.statements) { + const current = getControlFlowEndWorker(s); + result.statements.push(...current.statements); + if (current.end) { + result.end = true; + break; + } + } + return result; +} +function handleForInOrOfStatement(statement) { + const end = matchBreakOrContinue(getControlFlowEndWorker(statement.statement), node_1.isBreakOrContinueStatement); + end.end = false; + return end; +} +function handleForAndWhileStatement(statement) { + const constantCondition = statement.kind === ts.SyntaxKind.WhileStatement + ? getConstantCondition(statement.expression) + : statement.condition === undefined || getConstantCondition(statement.condition); + if (constantCondition === false) + return defaultControlFlowEnd; + const end = matchBreakOrContinue(getControlFlowEndWorker(statement.statement), node_1.isBreakOrContinueStatement); + if (constantCondition === undefined) + end.end = false; + return end; +} +function getConstantCondition(node) { + switch (node.kind) { + case ts.SyntaxKind.TrueKeyword: + return true; + case ts.SyntaxKind.FalseKeyword: + return false; + default: + return; + } +} +function handleIfStatement(node) { + switch (getConstantCondition(node.expression)) { + case true: + return getControlFlowEndWorker(node.thenStatement); + case false: + return node.elseStatement === undefined + ? defaultControlFlowEnd + : getControlFlowEndWorker(node.elseStatement); + } + const then = getControlFlowEndWorker(node.thenStatement); + if (node.elseStatement === undefined) + return { + statements: then.statements, + end: false, + }; + const elze = getControlFlowEndWorker(node.elseStatement); + return { + statements: [...then.statements, ...elze.statements], + end: then.end && elze.end, + }; +} +function handleSwitchStatement(node) { + let hasDefault = false; + const result = { + statements: [], + end: false, + }; + for (const clause of node.caseBlock.clauses) { + if (clause.kind === ts.SyntaxKind.DefaultClause) + hasDefault = true; + const current = handleBlock(clause); + result.end = current.end; + result.statements.push(...current.statements); + } + if (!hasDefault) + result.end = false; + return result; +} +function handleTryStatement(node) { + let finallyResult; + if (node.finallyBlock !== undefined) { + finallyResult = handleBlock(node.finallyBlock); + if (finallyResult.end) + return finallyResult; + } + const tryResult = handleBlock(node.tryBlock); + if (node.catchClause === undefined) + return { statements: finallyResult.statements.concat(tryResult.statements), end: tryResult.end }; + const catchResult = handleBlock(node.catchClause.block); + return { + statements: tryResult.statements + .filter((s) => s.kind !== ts.SyntaxKind.ThrowStatement) + .concat(catchResult.statements, finallyResult === undefined ? [] : finallyResult.statements), + end: tryResult.end && catchResult.end, + }; +} +function matchBreakOrContinue(current, pred) { + const result = { + statements: [], + end: current.end, + }; + for (const statement of current.statements) { + if (pred(statement) && statement.label === undefined) { + result.end = false; + continue; + } + result.statements.push(statement); + } + return result; +} +function matchLabel(current, label) { + const result = { + statements: [], + end: current.end, + }; + const labelText = label.text; + for (const statement of current.statements) { + switch (statement.kind) { + case ts.SyntaxKind.BreakStatement: + case ts.SyntaxKind.ContinueStatement: + if (statement.label !== undefined && statement.label.text === labelText) { + result.end = false; + continue; + } + } + result.statements.push(statement); + } + return result; +} diff --git a/node_modules/tslint-eslint-rules/node_modules/tsutils/util/convert-ast.d.ts b/node_modules/tslint-eslint-rules/node_modules/tsutils/util/convert-ast.d.ts new file mode 100644 index 000000000..7e95feaf0 --- /dev/null +++ b/node_modules/tslint-eslint-rules/node_modules/tsutils/util/convert-ast.d.ts @@ -0,0 +1,20 @@ +import * as ts from 'typescript'; +export interface NodeWrap { + node: ts.Node; + kind: ts.SyntaxKind; + children: NodeWrap[]; + next?: NodeWrap; + skip?: NodeWrap; + parent?: NodeWrap; +} +export interface WrappedAst extends NodeWrap { + node: ts.SourceFile; + next: NodeWrap; + skip: undefined; + parent: undefined; +} +export interface ConvertedAst { + wrapped: WrappedAst; + flat: ReadonlyArray; +} +export declare function convertAst(sourceFile: ts.SourceFile): ConvertedAst; diff --git a/node_modules/tslint-eslint-rules/node_modules/tsutils/util/convert-ast.js b/node_modules/tslint-eslint-rules/node_modules/tsutils/util/convert-ast.js new file mode 100644 index 000000000..bfdb0282c --- /dev/null +++ b/node_modules/tslint-eslint-rules/node_modules/tsutils/util/convert-ast.js @@ -0,0 +1,47 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const ts = require("typescript"); +const util_1 = require("./util"); +function convertAst(sourceFile) { + const wrapped = { + node: sourceFile, + parent: undefined, + kind: ts.SyntaxKind.SourceFile, + children: [], + next: undefined, + skip: undefined, + }; + const flat = []; + let current = wrapped; + let previous = current; + ts.forEachChild(sourceFile, function wrap(node) { + flat.push(node); + const parent = current; + previous.next = current = { + node, + parent, + kind: node.kind, + children: [], + next: undefined, + skip: undefined, + }; + if (previous !== parent) + setSkip(previous, current); + previous = current; + parent.children.push(current); + if (util_1.isNodeKind(node.kind)) + ts.forEachChild(node, wrap); + current = parent; + }); + return { + wrapped, + flat, + }; +} +exports.convertAst = convertAst; +function setSkip(node, skip) { + do { + node.skip = skip; + node = node.parent; + } while (node !== skip.parent); +} diff --git a/node_modules/tslint-eslint-rules/node_modules/tsutils/util/index.d.ts b/node_modules/tslint-eslint-rules/node_modules/tsutils/util/index.d.ts new file mode 100644 index 000000000..9e93ff6f1 --- /dev/null +++ b/node_modules/tslint-eslint-rules/node_modules/tsutils/util/index.d.ts @@ -0,0 +1,5 @@ +export * from './util'; +export * from './usage'; +export * from './control-flow'; +export * from './type'; +export * from './convert-ast'; diff --git a/node_modules/tslint-eslint-rules/node_modules/tsutils/util/index.js b/node_modules/tslint-eslint-rules/node_modules/tsutils/util/index.js new file mode 100644 index 000000000..2087d2a37 --- /dev/null +++ b/node_modules/tslint-eslint-rules/node_modules/tsutils/util/index.js @@ -0,0 +1,8 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const tslib_1 = require("tslib"); +tslib_1.__exportStar(require("./util"), exports); +tslib_1.__exportStar(require("./usage"), exports); +tslib_1.__exportStar(require("./control-flow"), exports); +tslib_1.__exportStar(require("./type"), exports); +tslib_1.__exportStar(require("./convert-ast"), exports); diff --git a/node_modules/tslint-eslint-rules/node_modules/tsutils/util/type.d.ts b/node_modules/tslint-eslint-rules/node_modules/tsutils/util/type.d.ts new file mode 100644 index 000000000..f4343a458 --- /dev/null +++ b/node_modules/tslint-eslint-rules/node_modules/tsutils/util/type.d.ts @@ -0,0 +1,21 @@ +import * as ts from 'typescript'; +import { PropertyName } from './util'; +export declare function isEmptyObjectType(type: ts.Type): type is ts.ObjectType; +export declare function removeOptionalityFromType(checker: ts.TypeChecker, type: ts.Type): ts.Type; +export declare function isTypeAssignableToNumber(checker: ts.TypeChecker, type: ts.Type): boolean; +export declare function isTypeAssignableToString(checker: ts.TypeChecker, type: ts.Type): boolean; +export declare function getCallSignaturesOfType(type: ts.Type): ReadonlyArray; +export declare function unionTypeParts(type: ts.Type): ts.Type[]; +export declare function intersectionTypeParts(type: ts.Type): ts.Type[]; +export declare function someTypePart(type: ts.Type, predicate: (t: ts.Type) => t is ts.UnionOrIntersectionType, cb: (t: ts.Type) => boolean): boolean; +export declare function isThenableType(checker: ts.TypeChecker, node: ts.Node, type: ts.Type): boolean; +export declare function isThenableType(checker: ts.TypeChecker, node: ts.Expression, type?: ts.Type): boolean; +export declare function isFalsyType(type: ts.Type): boolean; +export declare function isBooleanLiteralType(type: ts.Type, literal: boolean): boolean; +export declare function getPropertyOfType(type: ts.Type, name: ts.__String): ts.Symbol | undefined; +export declare function isPropertyReadonlyInType(type: ts.Type, name: ts.__String, checker: ts.TypeChecker): boolean; +export declare function symbolHasReadonlyDeclaration(symbol: ts.Symbol, checker: ts.TypeChecker): boolean; +export declare function getPropertyNameFromType(type: ts.Type): PropertyName | undefined; +export declare function getConstructorTypeOfClassLikeDeclaration(node: ts.ClassLikeDeclaration, checker: ts.TypeChecker): ts.Type; +export declare function getInstanceTypeOfClassLikeDeclaration(node: ts.ClassLikeDeclaration, checker: ts.TypeChecker): ts.Type; +export declare function getIteratorYieldResultFromIteratorResult(type: ts.Type, node: ts.Node, checker: ts.TypeChecker): ts.Type; diff --git a/node_modules/tslint-eslint-rules/node_modules/tsutils/util/type.js b/node_modules/tslint-eslint-rules/node_modules/tsutils/util/type.js new file mode 100644 index 000000000..7a530d9fd --- /dev/null +++ b/node_modules/tslint-eslint-rules/node_modules/tsutils/util/type.js @@ -0,0 +1,238 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const ts = require("typescript"); +const type_1 = require("../typeguard/type"); +const util_1 = require("./util"); +const node_1 = require("../typeguard/node"); +function isEmptyObjectType(type) { + if (type_1.isObjectType(type) && + type.objectFlags & ts.ObjectFlags.Anonymous && + type.getProperties().length === 0 && + type.getCallSignatures().length === 0 && + type.getConstructSignatures().length === 0 && + type.getStringIndexType() === undefined && + type.getNumberIndexType() === undefined) { + const baseTypes = type.getBaseTypes(); + return baseTypes === undefined || baseTypes.every(isEmptyObjectType); + } + return false; +} +exports.isEmptyObjectType = isEmptyObjectType; +function removeOptionalityFromType(checker, type) { + if (!containsTypeWithFlag(type, ts.TypeFlags.Undefined)) + return type; + const allowsNull = containsTypeWithFlag(type, ts.TypeFlags.Null); + type = checker.getNonNullableType(type); + return allowsNull ? checker.getNullableType(type, ts.TypeFlags.Null) : type; +} +exports.removeOptionalityFromType = removeOptionalityFromType; +function containsTypeWithFlag(type, flag) { + for (const t of unionTypeParts(type)) + if (util_1.isTypeFlagSet(t, flag)) + return true; + return false; +} +function isTypeAssignableToNumber(checker, type) { + return isTypeAssignableTo(checker, type, ts.TypeFlags.NumberLike); +} +exports.isTypeAssignableToNumber = isTypeAssignableToNumber; +function isTypeAssignableToString(checker, type) { + return isTypeAssignableTo(checker, type, ts.TypeFlags.StringLike); +} +exports.isTypeAssignableToString = isTypeAssignableToString; +function isTypeAssignableTo(checker, type, flags) { + flags |= ts.TypeFlags.Any; + let typeParametersSeen; + return (function check(t) { + if (type_1.isTypeParameter(t) && t.symbol !== undefined && t.symbol.declarations !== undefined) { + if (typeParametersSeen === undefined) { + typeParametersSeen = new Set([t]); + } + else if (!typeParametersSeen.has(t)) { + typeParametersSeen.add(t); + } + else { + return false; + } + const declaration = t.symbol.declarations[0]; + if (declaration.constraint === undefined) + return true; + return check(checker.getTypeFromTypeNode(declaration.constraint)); + } + if (type_1.isUnionType(t)) + return t.types.every(check); + if (type_1.isIntersectionType(t)) + return t.types.some(check); + return util_1.isTypeFlagSet(t, flags); + })(type); +} +function getCallSignaturesOfType(type) { + if (type_1.isUnionType(type)) { + const signatures = []; + for (const t of type.types) + signatures.push(...getCallSignaturesOfType(t)); + return signatures; + } + if (type_1.isIntersectionType(type)) { + let signatures; + for (const t of type.types) { + const sig = getCallSignaturesOfType(t); + if (sig.length !== 0) { + if (signatures !== undefined) + return []; + signatures = sig; + } + } + return signatures === undefined ? [] : signatures; + } + return type.getCallSignatures(); +} +exports.getCallSignaturesOfType = getCallSignaturesOfType; +function unionTypeParts(type) { + return type_1.isUnionType(type) ? type.types : [type]; +} +exports.unionTypeParts = unionTypeParts; +function intersectionTypeParts(type) { + return type_1.isIntersectionType(type) ? type.types : [type]; +} +exports.intersectionTypeParts = intersectionTypeParts; +function someTypePart(type, predicate, cb) { + return predicate(type) ? type.types.some(cb) : cb(type); +} +exports.someTypePart = someTypePart; +function isThenableType(checker, node, type = checker.getTypeAtLocation(node)) { + for (const ty of unionTypeParts(checker.getApparentType(type))) { + const then = ty.getProperty('then'); + if (then === undefined) + continue; + const thenType = checker.getTypeOfSymbolAtLocation(then, node); + for (const t of unionTypeParts(thenType)) + for (const signature of t.getCallSignatures()) + if (signature.parameters.length !== 0 && isCallback(checker, signature.parameters[0], node)) + return true; + } + return false; +} +exports.isThenableType = isThenableType; +function isCallback(checker, param, node) { + let type = checker.getApparentType(checker.getTypeOfSymbolAtLocation(param, node)); + if (param.valueDeclaration.dotDotDotToken) { + type = type.getNumberIndexType(); + if (type === undefined) + return false; + } + for (const t of unionTypeParts(type)) + if (t.getCallSignatures().length !== 0) + return true; + return false; +} +function isFalsyType(type) { + if (type.flags & (ts.TypeFlags.Undefined | ts.TypeFlags.Null | ts.TypeFlags.Void)) + return true; + if (type_1.isLiteralType(type)) + return !type.value; + return isBooleanLiteralType(type, false); +} +exports.isFalsyType = isFalsyType; +function isBooleanLiteralType(type, literal) { + return util_1.isTypeFlagSet(type, ts.TypeFlags.BooleanLiteral) && + type.intrinsicName === (literal ? 'true' : 'false'); +} +exports.isBooleanLiteralType = isBooleanLiteralType; +function getPropertyOfType(type, name) { + if (!name.startsWith('__')) + return type.getProperty(name); + return type.getProperties().find((s) => s.escapedName === name); +} +exports.getPropertyOfType = getPropertyOfType; +function isPropertyReadonlyInType(type, name, checker) { + let seenProperty = false; + let seenReadonlySignature = false; + for (const t of unionTypeParts(type)) { + if (getPropertyOfType(t, name) === undefined) { + const index = (util_1.isNumericPropertyName(name) ? checker.getIndexInfoOfType(t, ts.IndexKind.Number) : undefined) || + checker.getIndexInfoOfType(t, ts.IndexKind.String); + if (index !== undefined && index.isReadonly) { + if (seenProperty) + return true; + seenReadonlySignature = true; + } + } + else if (seenReadonlySignature || isReadonlyPropertyIntersection(t, name, checker)) { + return true; + } + else { + seenProperty = true; + } + } + return false; +} +exports.isPropertyReadonlyInType = isPropertyReadonlyInType; +function isReadonlyPropertyIntersection(type, name, checker) { + return someTypePart(type, type_1.isIntersectionType, (t) => { + const prop = getPropertyOfType(t, name); + if (prop === undefined) + return false; + if (prop.flags & ts.SymbolFlags.Transient) { + if (/^(?:[1-9]\d*|0)$/.test(name) && type_1.isTupleTypeReference(t)) + return t.target.readonly; + switch (isReadonlyPropertyFromMappedType(t, name, checker)) { + case true: + return true; + case false: + return false; + default: + } + } + return (util_1.isSymbolFlagSet(prop, ts.SymbolFlags.ValueModule) || + symbolHasReadonlyDeclaration(prop, checker)); + }); +} +function isReadonlyPropertyFromMappedType(type, name, checker) { + if (!type_1.isObjectType(type) || !util_1.isObjectFlagSet(type, ts.ObjectFlags.Mapped)) + return; + const declaration = type.symbol.declarations[0]; + if (declaration.readonlyToken !== undefined && !/^__@[^@]+$/.test(name)) + return declaration.readonlyToken.kind !== ts.SyntaxKind.MinusToken; + return isPropertyReadonlyInType(type.modifiersType, name, checker); +} +function symbolHasReadonlyDeclaration(symbol, checker) { + return (symbol.flags & ts.SymbolFlags.Accessor) === ts.SymbolFlags.GetAccessor || + symbol.declarations !== undefined && + symbol.declarations.some((node) => util_1.isModifierFlagSet(node, ts.ModifierFlags.Readonly) || + node_1.isVariableDeclaration(node) && util_1.isNodeFlagSet(node.parent, ts.NodeFlags.Const) || + node_1.isCallExpression(node) && util_1.isReadonlyAssignmentDeclaration(node, checker) || + node_1.isEnumMember(node) || + (node_1.isPropertyAssignment(node) || node_1.isShorthandPropertyAssignment(node)) && util_1.isInConstContext(node.parent)); +} +exports.symbolHasReadonlyDeclaration = symbolHasReadonlyDeclaration; +function getPropertyNameFromType(type) { + if (type.flags & (ts.TypeFlags.StringLiteral | ts.TypeFlags.NumberLiteral)) { + const value = String(type.value); + return { displayName: value, symbolName: ts.escapeLeadingUnderscores(value) }; + } + if (type_1.isUniqueESSymbolType(type)) + return { + displayName: `[${type.symbol ? type.symbol.name : type.escapedName.replace(/^__@|@\d+$/g, '')}]`, + symbolName: type.escapedName, + }; +} +exports.getPropertyNameFromType = getPropertyNameFromType; +function getConstructorTypeOfClassLikeDeclaration(node, checker) { + return checker.getDeclaredTypeOfSymbol(node.name !== undefined ? checker.getSymbolAtLocation(node.name) : checker.getTypeAtLocation(node).symbol); +} +exports.getConstructorTypeOfClassLikeDeclaration = getConstructorTypeOfClassLikeDeclaration; +function getInstanceTypeOfClassLikeDeclaration(node, checker) { + return node.kind === ts.SyntaxKind.ClassDeclaration + ? checker.getTypeAtLocation(node) + : checker.getTypeOfSymbolAtLocation(checker.getTypeAtLocation(node).getProperty('prototype'), node); +} +exports.getInstanceTypeOfClassLikeDeclaration = getInstanceTypeOfClassLikeDeclaration; +function getIteratorYieldResultFromIteratorResult(type, node, checker) { + return type_1.isUnionType(type) && type.types.find((t) => { + const done = t.getProperty('done'); + return done !== undefined && + isBooleanLiteralType(removeOptionalityFromType(checker, checker.getTypeOfSymbolAtLocation(done, node)), false); + }) || type; +} +exports.getIteratorYieldResultFromIteratorResult = getIteratorYieldResultFromIteratorResult; diff --git a/node_modules/tslint-eslint-rules/node_modules/tsutils/util/usage.d.ts b/node_modules/tslint-eslint-rules/node_modules/tsutils/util/usage.d.ts new file mode 100644 index 000000000..a4c022c9d --- /dev/null +++ b/node_modules/tslint-eslint-rules/node_modules/tsutils/util/usage.d.ts @@ -0,0 +1,30 @@ +import * as ts from 'typescript'; +export interface VariableInfo { + domain: DeclarationDomain; + exported: boolean; + uses: VariableUse[]; + inGlobalScope: boolean; + declarations: ts.Identifier[]; +} +export interface VariableUse { + domain: UsageDomain; + location: ts.Identifier; +} +export declare enum DeclarationDomain { + Namespace = 1, + Type = 2, + Value = 4, + Import = 8, + Any = 7 +} +export declare enum UsageDomain { + Namespace = 1, + Type = 2, + Value = 4, + ValueOrNamespace = 5, + Any = 7, + TypeQuery = 8 +} +export declare function getUsageDomain(node: ts.Identifier): UsageDomain | undefined; +export declare function getDeclarationDomain(node: ts.Identifier): DeclarationDomain | undefined; +export declare function collectVariableUsage(sourceFile: ts.SourceFile): Map; diff --git a/node_modules/tslint-eslint-rules/node_modules/tsutils/util/usage.js b/node_modules/tslint-eslint-rules/node_modules/tsutils/util/usage.js new file mode 100644 index 000000000..372d38a69 --- /dev/null +++ b/node_modules/tslint-eslint-rules/node_modules/tsutils/util/usage.js @@ -0,0 +1,645 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const util_1 = require("./util"); +const ts = require("typescript"); +var DeclarationDomain; +(function (DeclarationDomain) { + DeclarationDomain[DeclarationDomain["Namespace"] = 1] = "Namespace"; + DeclarationDomain[DeclarationDomain["Type"] = 2] = "Type"; + DeclarationDomain[DeclarationDomain["Value"] = 4] = "Value"; + DeclarationDomain[DeclarationDomain["Import"] = 8] = "Import"; + DeclarationDomain[DeclarationDomain["Any"] = 7] = "Any"; +})(DeclarationDomain = exports.DeclarationDomain || (exports.DeclarationDomain = {})); +var UsageDomain; +(function (UsageDomain) { + UsageDomain[UsageDomain["Namespace"] = 1] = "Namespace"; + UsageDomain[UsageDomain["Type"] = 2] = "Type"; + UsageDomain[UsageDomain["Value"] = 4] = "Value"; + UsageDomain[UsageDomain["ValueOrNamespace"] = 5] = "ValueOrNamespace"; + UsageDomain[UsageDomain["Any"] = 7] = "Any"; + UsageDomain[UsageDomain["TypeQuery"] = 8] = "TypeQuery"; +})(UsageDomain = exports.UsageDomain || (exports.UsageDomain = {})); +function getUsageDomain(node) { + const parent = node.parent; + switch (parent.kind) { + case ts.SyntaxKind.TypeReference: + return node.originalKeywordKind !== ts.SyntaxKind.ConstKeyword ? 2 : undefined; + case ts.SyntaxKind.ExpressionWithTypeArguments: + return parent.parent.token === ts.SyntaxKind.ImplementsKeyword || + parent.parent.parent.kind === ts.SyntaxKind.InterfaceDeclaration + ? 2 + : 4; + case ts.SyntaxKind.TypeQuery: + return 5 | 8; + case ts.SyntaxKind.QualifiedName: + if (parent.left === node) { + if (getEntityNameParent(parent).kind === ts.SyntaxKind.TypeQuery) + return 1 | 8; + return 1; + } + break; + case ts.SyntaxKind.ExportSpecifier: + if (parent.propertyName === undefined || + parent.propertyName === node) + return 7; + break; + case ts.SyntaxKind.ExportAssignment: + return 7; + case ts.SyntaxKind.BindingElement: + if (parent.initializer === node) + return 5; + break; + case ts.SyntaxKind.Parameter: + case ts.SyntaxKind.EnumMember: + case ts.SyntaxKind.PropertyDeclaration: + case ts.SyntaxKind.VariableDeclaration: + case ts.SyntaxKind.PropertyAssignment: + case ts.SyntaxKind.PropertyAccessExpression: + case ts.SyntaxKind.ImportEqualsDeclaration: + if (parent.name !== node) + return 5; + break; + case ts.SyntaxKind.JsxAttribute: + case ts.SyntaxKind.FunctionDeclaration: + case ts.SyntaxKind.FunctionExpression: + case ts.SyntaxKind.NamespaceImport: + case ts.SyntaxKind.ClassDeclaration: + case ts.SyntaxKind.ClassExpression: + case ts.SyntaxKind.ModuleDeclaration: + case ts.SyntaxKind.MethodDeclaration: + case ts.SyntaxKind.EnumDeclaration: + case ts.SyntaxKind.GetAccessor: + case ts.SyntaxKind.SetAccessor: + case ts.SyntaxKind.LabeledStatement: + case ts.SyntaxKind.BreakStatement: + case ts.SyntaxKind.ContinueStatement: + case ts.SyntaxKind.ImportClause: + case ts.SyntaxKind.ImportSpecifier: + case ts.SyntaxKind.TypePredicate: + case ts.SyntaxKind.MethodSignature: + case ts.SyntaxKind.PropertySignature: + case ts.SyntaxKind.NamespaceExportDeclaration: + case ts.SyntaxKind.InterfaceDeclaration: + case ts.SyntaxKind.TypeAliasDeclaration: + case ts.SyntaxKind.TypeParameter: + break; + default: + return 5; + } +} +exports.getUsageDomain = getUsageDomain; +function getDeclarationDomain(node) { + switch (node.parent.kind) { + case ts.SyntaxKind.TypeParameter: + case ts.SyntaxKind.InterfaceDeclaration: + case ts.SyntaxKind.TypeAliasDeclaration: + return 2; + case ts.SyntaxKind.ClassDeclaration: + case ts.SyntaxKind.ClassExpression: + return 2 | 4; + case ts.SyntaxKind.EnumDeclaration: + return 7; + case ts.SyntaxKind.NamespaceImport: + case ts.SyntaxKind.ImportClause: + return 7 | 8; + case ts.SyntaxKind.ImportEqualsDeclaration: + case ts.SyntaxKind.ImportSpecifier: + return node.parent.name === node + ? 7 | 8 + : undefined; + case ts.SyntaxKind.ModuleDeclaration: + return 1; + case ts.SyntaxKind.Parameter: + if (node.parent.parent.kind === ts.SyntaxKind.IndexSignature || node.originalKeywordKind === ts.SyntaxKind.ThisKeyword) + return; + case ts.SyntaxKind.BindingElement: + case ts.SyntaxKind.VariableDeclaration: + return node.parent.name === node ? 4 : undefined; + case ts.SyntaxKind.FunctionDeclaration: + case ts.SyntaxKind.FunctionExpression: + return 4; + } +} +exports.getDeclarationDomain = getDeclarationDomain; +function collectVariableUsage(sourceFile) { + return new UsageWalker().getUsage(sourceFile); +} +exports.collectVariableUsage = collectVariableUsage; +class AbstractScope { + constructor(_global) { + this._global = _global; + this._variables = new Map(); + this._uses = []; + this._namespaceScopes = undefined; + this._enumScopes = undefined; + } + addVariable(identifier, name, selector, exported, domain) { + const variables = this.getDestinationScope(selector).getVariables(); + const declaration = { + domain, + exported, + declaration: name, + }; + const variable = variables.get(identifier); + if (variable === undefined) { + variables.set(identifier, { + domain, + declarations: [declaration], + uses: [], + }); + } + else { + variable.domain |= domain; + variable.declarations.push(declaration); + } + } + addUse(use) { + this._uses.push(use); + } + getVariables() { + return this._variables; + } + getFunctionScope() { + return this; + } + end(cb) { + if (this._namespaceScopes !== undefined) + this._namespaceScopes.forEach((value) => value.finish(cb)); + this._namespaceScopes = this._enumScopes = undefined; + this._applyUses(); + this._variables.forEach((variable) => { + for (const declaration of variable.declarations) { + const result = { + declarations: [], + domain: declaration.domain, + exported: declaration.exported, + inGlobalScope: this._global, + uses: [], + }; + for (const other of variable.declarations) + if (other.domain & declaration.domain) + result.declarations.push(other.declaration); + for (const use of variable.uses) + if (use.domain & declaration.domain) + result.uses.push(use); + cb(result, declaration.declaration, this); + } + }); + } + markExported(_name) { } + createOrReuseNamespaceScope(name, _exported, ambient, hasExportStatement) { + let scope; + if (this._namespaceScopes === undefined) { + this._namespaceScopes = new Map(); + } + else { + scope = this._namespaceScopes.get(name); + } + if (scope === undefined) { + scope = new NamespaceScope(ambient, hasExportStatement, this); + this._namespaceScopes.set(name, scope); + } + else { + scope.refresh(ambient, hasExportStatement); + } + return scope; + } + createOrReuseEnumScope(name, _exported) { + let scope; + if (this._enumScopes === undefined) { + this._enumScopes = new Map(); + } + else { + scope = this._enumScopes.get(name); + } + if (scope === undefined) { + scope = new EnumScope(this); + this._enumScopes.set(name, scope); + } + return scope; + } + _applyUses() { + for (const use of this._uses) + if (!this._applyUse(use)) + this._addUseToParent(use); + this._uses = []; + } + _applyUse(use, variables = this._variables) { + const variable = variables.get(use.location.text); + if (variable === undefined || (variable.domain & use.domain) === 0) + return false; + variable.uses.push(use); + return true; + } + _addUseToParent(_use) { } +} +class RootScope extends AbstractScope { + constructor(_exportAll, global) { + super(global); + this._exportAll = _exportAll; + this._exports = undefined; + this._innerScope = new NonRootScope(this, 1); + } + addVariable(identifier, name, selector, exported, domain) { + if (domain & 8) + return super.addVariable(identifier, name, selector, exported, domain); + return this._innerScope.addVariable(identifier, name, selector, exported, domain); + } + addUse(use, origin) { + if (origin === this._innerScope) + return super.addUse(use); + return this._innerScope.addUse(use); + } + markExported(id) { + if (this._exports === undefined) { + this._exports = [id.text]; + } + else { + this._exports.push(id.text); + } + } + end(cb) { + this._innerScope.end((value, key) => { + value.exported = value.exported || this._exportAll + || this._exports !== undefined && this._exports.includes(key.text); + value.inGlobalScope = this._global; + return cb(value, key, this); + }); + return super.end((value, key, scope) => { + value.exported = value.exported || scope === this + && this._exports !== undefined && this._exports.includes(key.text); + return cb(value, key, scope); + }); + } + getDestinationScope() { + return this; + } +} +class NonRootScope extends AbstractScope { + constructor(_parent, _boundary) { + super(false); + this._parent = _parent; + this._boundary = _boundary; + } + _addUseToParent(use) { + return this._parent.addUse(use, this); + } + getDestinationScope(selector) { + return this._boundary & selector + ? this + : this._parent.getDestinationScope(selector); + } +} +class EnumScope extends NonRootScope { + constructor(parent) { + super(parent, 1); + } + end() { + this._applyUses(); + } +} +class ConditionalTypeScope extends NonRootScope { + constructor(parent) { + super(parent, 8); + this._state = 0; + } + updateState(newState) { + this._state = newState; + } + addUse(use) { + if (this._state === 2) + return void this._uses.push(use); + return this._parent.addUse(use, this); + } +} +class FunctionScope extends NonRootScope { + constructor(parent) { + super(parent, 1); + } + beginBody() { + this._applyUses(); + } +} +class AbstractNamedExpressionScope extends NonRootScope { + constructor(_name, _domain, parent) { + super(parent, 1); + this._name = _name; + this._domain = _domain; + } + end(cb) { + this._innerScope.end(cb); + return cb({ + declarations: [this._name], + domain: this._domain, + exported: false, + uses: this._uses, + inGlobalScope: false, + }, this._name, this); + } + addUse(use, source) { + if (source !== this._innerScope) + return this._innerScope.addUse(use); + if (use.domain & this._domain && use.location.text === this._name.text) { + this._uses.push(use); + } + else { + return this._parent.addUse(use, this); + } + } + getFunctionScope() { + return this._innerScope; + } + getDestinationScope() { + return this._innerScope; + } +} +class FunctionExpressionScope extends AbstractNamedExpressionScope { + constructor(name, parent) { + super(name, 4, parent); + this._innerScope = new FunctionScope(this); + } + beginBody() { + return this._innerScope.beginBody(); + } +} +class ClassExpressionScope extends AbstractNamedExpressionScope { + constructor(name, parent) { + super(name, 4 | 2, parent); + this._innerScope = new NonRootScope(this, 1); + } +} +class BlockScope extends NonRootScope { + constructor(_functionScope, parent) { + super(parent, 2); + this._functionScope = _functionScope; + } + getFunctionScope() { + return this._functionScope; + } +} +function mapDeclaration(declaration) { + return { + declaration, + exported: true, + domain: getDeclarationDomain(declaration), + }; +} +class NamespaceScope extends NonRootScope { + constructor(_ambient, _hasExport, parent) { + super(parent, 1); + this._ambient = _ambient; + this._hasExport = _hasExport; + this._innerScope = new NonRootScope(this, 1); + this._exports = undefined; + } + finish(cb) { + return super.end(cb); + } + end(cb) { + this._innerScope.end((variable, key, scope) => { + if (scope !== this._innerScope || + !variable.exported && (!this._ambient || this._exports !== undefined && !this._exports.has(key.text))) + return cb(variable, key, scope); + const namespaceVar = this._variables.get(key.text); + if (namespaceVar === undefined) { + this._variables.set(key.text, { + declarations: variable.declarations.map(mapDeclaration), + domain: variable.domain, + uses: [...variable.uses], + }); + } + else { + outer: for (const declaration of variable.declarations) { + for (const existing of namespaceVar.declarations) + if (existing.declaration === declaration) + continue outer; + namespaceVar.declarations.push(mapDeclaration(declaration)); + } + namespaceVar.domain |= variable.domain; + for (const use of variable.uses) { + if (namespaceVar.uses.includes(use)) + continue; + namespaceVar.uses.push(use); + } + } + }); + this._applyUses(); + this._innerScope = new NonRootScope(this, 1); + } + createOrReuseNamespaceScope(name, exported, ambient, hasExportStatement) { + if (!exported && (!this._ambient || this._hasExport)) + return this._innerScope.createOrReuseNamespaceScope(name, exported, ambient || this._ambient, hasExportStatement); + return super.createOrReuseNamespaceScope(name, exported, ambient || this._ambient, hasExportStatement); + } + createOrReuseEnumScope(name, exported) { + if (!exported && (!this._ambient || this._hasExport)) + return this._innerScope.createOrReuseEnumScope(name, exported); + return super.createOrReuseEnumScope(name, exported); + } + addUse(use, source) { + if (source !== this._innerScope) + return this._innerScope.addUse(use); + this._uses.push(use); + } + refresh(ambient, hasExport) { + this._ambient = ambient; + this._hasExport = hasExport; + } + markExported(name, _as) { + if (this._exports === undefined) + this._exports = new Set(); + this._exports.add(name.text); + } + getDestinationScope() { + return this._innerScope; + } +} +function getEntityNameParent(name) { + let parent = name.parent; + while (parent.kind === ts.SyntaxKind.QualifiedName) + parent = parent.parent; + return parent; +} +class UsageWalker { + constructor() { + this._result = new Map(); + } + getUsage(sourceFile) { + const variableCallback = (variable, key) => { + this._result.set(key, variable); + }; + const isModule = ts.isExternalModule(sourceFile); + this._scope = new RootScope(sourceFile.isDeclarationFile && isModule && !containsExportStatement(sourceFile), !isModule); + const cb = (node) => { + if (util_1.isBlockScopeBoundary(node)) + return continueWithScope(node, new BlockScope(this._scope.getFunctionScope(), this._scope), handleBlockScope); + switch (node.kind) { + case ts.SyntaxKind.ClassExpression: + return continueWithScope(node, node.name !== undefined + ? new ClassExpressionScope(node.name, this._scope) + : new NonRootScope(this._scope, 1)); + case ts.SyntaxKind.ClassDeclaration: + this._handleDeclaration(node, true, 4 | 2); + return continueWithScope(node, new NonRootScope(this._scope, 1)); + case ts.SyntaxKind.InterfaceDeclaration: + case ts.SyntaxKind.TypeAliasDeclaration: + this._handleDeclaration(node, true, 2); + return continueWithScope(node, new NonRootScope(this._scope, 4)); + case ts.SyntaxKind.EnumDeclaration: + this._handleDeclaration(node, true, 7); + return continueWithScope(node, this._scope.createOrReuseEnumScope(node.name.text, util_1.hasModifier(node.modifiers, ts.SyntaxKind.ExportKeyword))); + case ts.SyntaxKind.ModuleDeclaration: + return this._handleModule(node, continueWithScope); + case ts.SyntaxKind.MappedType: + return continueWithScope(node, new NonRootScope(this._scope, 4)); + case ts.SyntaxKind.FunctionExpression: + case ts.SyntaxKind.ArrowFunction: + case ts.SyntaxKind.Constructor: + case ts.SyntaxKind.MethodDeclaration: + case ts.SyntaxKind.FunctionDeclaration: + case ts.SyntaxKind.GetAccessor: + case ts.SyntaxKind.SetAccessor: + case ts.SyntaxKind.MethodSignature: + case ts.SyntaxKind.CallSignature: + case ts.SyntaxKind.ConstructSignature: + case ts.SyntaxKind.ConstructorType: + case ts.SyntaxKind.FunctionType: + return this._handleFunctionLikeDeclaration(node, cb, variableCallback); + case ts.SyntaxKind.ConditionalType: + return this._handleConditionalType(node, cb, variableCallback); + case ts.SyntaxKind.VariableDeclarationList: + this._handleVariableDeclaration(node); + break; + case ts.SyntaxKind.Parameter: + if (node.parent.kind !== ts.SyntaxKind.IndexSignature && + (node.name.kind !== ts.SyntaxKind.Identifier || + node.name.originalKeywordKind !== ts.SyntaxKind.ThisKeyword)) + this._handleBindingName(node.name, false, false); + break; + case ts.SyntaxKind.EnumMember: + this._scope.addVariable(util_1.getPropertyName(node.name), node.name, 1, true, 4); + break; + case ts.SyntaxKind.ImportClause: + case ts.SyntaxKind.ImportSpecifier: + case ts.SyntaxKind.NamespaceImport: + case ts.SyntaxKind.ImportEqualsDeclaration: + this._handleDeclaration(node, false, 7 | 8); + break; + case ts.SyntaxKind.TypeParameter: + this._scope.addVariable(node.name.text, node.name, node.parent.kind === ts.SyntaxKind.InferType ? 8 : 7, false, 2); + break; + case ts.SyntaxKind.ExportSpecifier: + if (node.propertyName !== undefined) + return this._scope.markExported(node.propertyName, node.name); + return this._scope.markExported(node.name); + case ts.SyntaxKind.ExportAssignment: + if (node.expression.kind === ts.SyntaxKind.Identifier) + return this._scope.markExported(node.expression); + break; + case ts.SyntaxKind.Identifier: + const domain = getUsageDomain(node); + if (domain !== undefined) + this._scope.addUse({ domain, location: node }); + return; + } + return ts.forEachChild(node, cb); + }; + const continueWithScope = (node, scope, next = forEachChild) => { + const savedScope = this._scope; + this._scope = scope; + next(node); + this._scope.end(variableCallback); + this._scope = savedScope; + }; + const handleBlockScope = (node) => { + if (node.kind === ts.SyntaxKind.CatchClause && node.variableDeclaration !== undefined) + this._handleBindingName(node.variableDeclaration.name, true, false); + return ts.forEachChild(node, cb); + }; + ts.forEachChild(sourceFile, cb); + this._scope.end(variableCallback); + return this._result; + function forEachChild(node) { + return ts.forEachChild(node, cb); + } + } + _handleConditionalType(node, cb, varCb) { + const savedScope = this._scope; + const scope = this._scope = new ConditionalTypeScope(savedScope); + cb(node.checkType); + scope.updateState(1); + cb(node.extendsType); + scope.updateState(2); + cb(node.trueType); + scope.updateState(3); + cb(node.falseType); + scope.end(varCb); + this._scope = savedScope; + } + _handleFunctionLikeDeclaration(node, cb, varCb) { + if (node.decorators !== undefined) + node.decorators.forEach(cb); + const savedScope = this._scope; + if (node.kind === ts.SyntaxKind.FunctionDeclaration) + this._handleDeclaration(node, false, 4); + const scope = this._scope = node.kind === ts.SyntaxKind.FunctionExpression && node.name !== undefined + ? new FunctionExpressionScope(node.name, savedScope) + : new FunctionScope(savedScope); + if (node.name !== undefined) + cb(node.name); + if (node.typeParameters !== undefined) + node.typeParameters.forEach(cb); + node.parameters.forEach(cb); + if (node.type !== undefined) + cb(node.type); + if (node.body !== undefined) { + scope.beginBody(); + cb(node.body); + } + scope.end(varCb); + this._scope = savedScope; + } + _handleModule(node, next) { + if (node.flags & ts.NodeFlags.GlobalAugmentation) + return next(node, this._scope.createOrReuseNamespaceScope('-global', false, true, false)); + if (node.name.kind === ts.SyntaxKind.Identifier) { + const exported = isNamespaceExported(node); + this._scope.addVariable(node.name.text, node.name, 1, exported, 1 | 4); + const ambient = util_1.hasModifier(node.modifiers, ts.SyntaxKind.DeclareKeyword); + return next(node, this._scope.createOrReuseNamespaceScope(node.name.text, exported, ambient, ambient && namespaceHasExportStatement(node))); + } + return next(node, this._scope.createOrReuseNamespaceScope(`"${node.name.text}"`, false, true, namespaceHasExportStatement(node))); + } + _handleDeclaration(node, blockScoped, domain) { + if (node.name !== undefined) + this._scope.addVariable(node.name.text, node.name, blockScoped ? 3 : 1, util_1.hasModifier(node.modifiers, ts.SyntaxKind.ExportKeyword), domain); + } + _handleBindingName(name, blockScoped, exported) { + if (name.kind === ts.SyntaxKind.Identifier) + return this._scope.addVariable(name.text, name, blockScoped ? 3 : 1, exported, 4); + util_1.forEachDestructuringIdentifier(name, (declaration) => { + this._scope.addVariable(declaration.name.text, declaration.name, blockScoped ? 3 : 1, exported, 4); + }); + } + _handleVariableDeclaration(declarationList) { + const blockScoped = util_1.isBlockScopedVariableDeclarationList(declarationList); + const exported = declarationList.parent.kind === ts.SyntaxKind.VariableStatement && + util_1.hasModifier(declarationList.parent.modifiers, ts.SyntaxKind.ExportKeyword); + for (const declaration of declarationList.declarations) + this._handleBindingName(declaration.name, blockScoped, exported); + } +} +function isNamespaceExported(node) { + return node.parent.kind === ts.SyntaxKind.ModuleDeclaration || util_1.hasModifier(node.modifiers, ts.SyntaxKind.ExportKeyword); +} +function namespaceHasExportStatement(ns) { + if (ns.body === undefined || ns.body.kind !== ts.SyntaxKind.ModuleBlock) + return false; + return containsExportStatement(ns.body); +} +function containsExportStatement(block) { + for (const statement of block.statements) + if (statement.kind === ts.SyntaxKind.ExportDeclaration || statement.kind === ts.SyntaxKind.ExportAssignment) + return true; + return false; +} diff --git a/node_modules/tslint-eslint-rules/node_modules/tsutils/util/util.d.ts b/node_modules/tslint-eslint-rules/node_modules/tsutils/util/util.d.ts new file mode 100644 index 000000000..1ae3299a8 --- /dev/null +++ b/node_modules/tslint-eslint-rules/node_modules/tsutils/util/util.d.ts @@ -0,0 +1,167 @@ +import * as ts from 'typescript'; +import { NodeWrap } from './convert-ast'; +export declare function getChildOfKind(node: ts.Node, kind: T, sourceFile?: ts.SourceFile): ts.Token | undefined; +export declare function isTokenKind(kind: ts.SyntaxKind): boolean; +export declare function isNodeKind(kind: ts.SyntaxKind): boolean; +export declare function isAssignmentKind(kind: ts.SyntaxKind): boolean; +export declare function isTypeNodeKind(kind: ts.SyntaxKind): boolean; +export declare function isJsDocKind(kind: ts.SyntaxKind): boolean; +export declare function isKeywordKind(kind: ts.SyntaxKind): boolean; +export declare function isThisParameter(parameter: ts.ParameterDeclaration): boolean; +export declare function getModifier(node: ts.Node, kind: ts.Modifier['kind']): ts.Modifier | undefined; +export declare function hasModifier(modifiers: ts.ModifiersArray | undefined, ...kinds: Array): boolean; +export declare function isParameterProperty(node: ts.ParameterDeclaration): boolean; +export declare function hasAccessModifier(node: ts.ClassElement | ts.ParameterDeclaration): boolean; +export declare const isNodeFlagSet: (node: ts.Node, flag: ts.NodeFlags) => boolean; +export declare const isTypeFlagSet: (type: ts.Type, flag: ts.TypeFlags) => boolean; +export declare const isSymbolFlagSet: (symbol: ts.Symbol, flag: ts.SymbolFlags) => boolean; +export declare function isObjectFlagSet(objectType: ts.ObjectType, flag: ts.ObjectFlags): boolean; +export declare function isModifierFlagSet(node: ts.Node, flag: ts.ModifierFlags): boolean; +export declare function getPreviousStatement(statement: ts.Statement): ts.Statement | undefined; +export declare function getNextStatement(statement: ts.Statement): ts.Statement | undefined; +export declare function getPreviousToken(node: ts.Node, sourceFile?: ts.SourceFile): ts.Node | undefined; +export declare function getNextToken(node: ts.Node, sourceFile?: ts.SourceFile): ts.Node | undefined; +export declare function getTokenAtPosition(parent: ts.Node, pos: number, sourceFile?: ts.SourceFile, allowJsDoc?: boolean): ts.Node | undefined; +export declare function getCommentAtPosition(sourceFile: ts.SourceFile, pos: number, parent?: ts.Node): ts.CommentRange | undefined; +export declare function isPositionInComment(sourceFile: ts.SourceFile, pos: number, parent?: ts.Node): boolean; +export declare function commentText(sourceText: string, comment: ts.CommentRange): string; +export declare function getWrappedNodeAtPosition(wrap: NodeWrap, pos: number): NodeWrap | undefined; +export declare function getPropertyName(propertyName: ts.PropertyName): string | undefined; +export declare function forEachDestructuringIdentifier(pattern: ts.BindingPattern, fn: (element: ts.BindingElement & { + name: ts.Identifier; +}) => T): T | undefined; +export declare function forEachDeclaredVariable(declarationList: ts.VariableDeclarationList, cb: (element: (ts.VariableDeclaration | ts.BindingElement) & { + name: ts.Identifier; +}) => T): T | undefined; +export declare enum VariableDeclarationKind { + Var = 0, + Let = 1, + Const = 2 +} +export declare function getVariableDeclarationKind(declarationList: ts.VariableDeclarationList): VariableDeclarationKind; +export declare function isBlockScopedVariableDeclarationList(declarationList: ts.VariableDeclarationList): boolean; +export declare function isBlockScopedVariableDeclaration(declaration: ts.VariableDeclaration): boolean; +export declare function isBlockScopedDeclarationStatement(statement: ts.Statement): statement is ts.DeclarationStatement; +export declare function isInSingleStatementContext(statement: ts.Statement): boolean; +export declare enum ScopeBoundary { + None = 0, + Function = 1, + Block = 2, + Type = 4, + ConditionalType = 8 +} +export declare enum ScopeBoundarySelector { + Function = 1, + Block = 3, + Type = 7, + InferType = 8 +} +export declare function isScopeBoundary(node: ts.Node): ScopeBoundary; +export declare function isTypeScopeBoundary(node: ts.Node): ScopeBoundary; +export declare function isFunctionScopeBoundary(node: ts.Node): ScopeBoundary; +export declare function isBlockScopeBoundary(node: ts.Node): ScopeBoundary; +export declare function hasOwnThisReference(node: ts.Node): boolean; +export declare function isFunctionWithBody(node: ts.Node): node is ts.FunctionLikeDeclaration & { + body: {}; +}; +export declare function forEachToken(node: ts.Node, cb: (node: ts.Node) => void, sourceFile?: ts.SourceFile): void; +export declare type ForEachTokenCallback = (fullText: string, kind: ts.SyntaxKind, range: ts.TextRange, parent: ts.Node) => void; +export declare function forEachTokenWithTrivia(node: ts.Node, cb: ForEachTokenCallback, sourceFile?: ts.SourceFile): void; +export declare type ForEachCommentCallback = (fullText: string, comment: ts.CommentRange) => void; +export declare function forEachComment(node: ts.Node, cb: ForEachCommentCallback, sourceFile?: ts.SourceFile): void; +export interface LineRange extends ts.TextRange { + contentLength: number; +} +export declare function getLineRanges(sourceFile: ts.SourceFile): LineRange[]; +export declare function getLineBreakStyle(sourceFile: ts.SourceFile): "\n" | "\r\n"; +export declare function isValidIdentifier(text: string, languageVersion?: ts.ScriptTarget): boolean; +export declare function isValidPropertyAccess(text: string, languageVersion?: ts.ScriptTarget): boolean; +export declare function isValidPropertyName(text: string, languageVersion?: ts.ScriptTarget): boolean; +export declare function isValidNumericLiteral(text: string, languageVersion?: ts.ScriptTarget): boolean; +export declare function isValidJsxIdentifier(text: string, languageVersion?: ts.ScriptTarget): boolean; +export declare function isNumericPropertyName(name: string | ts.__String): boolean; +export declare function isSameLine(sourceFile: ts.SourceFile, pos1: number, pos2: number): boolean; +export declare enum SideEffectOptions { + None = 0, + TaggedTemplate = 1, + Constructor = 2, + JsxElement = 4 +} +export declare function hasSideEffects(node: ts.Expression, options?: SideEffectOptions): boolean; +export declare function getDeclarationOfBindingElement(node: ts.BindingElement): ts.VariableDeclaration | ts.ParameterDeclaration; +export declare function isExpressionValueUsed(node: ts.Expression): boolean; +export declare enum AccessKind { + None = 0, + Read = 1, + Write = 2, + Delete = 4, + ReadWrite = 3, + Modification = 6 +} +export declare function getAccessKind(node: ts.Node): AccessKind; +export declare function isReassignmentTarget(node: ts.Expression): boolean; +export declare function canHaveJsDoc(node: ts.Node): node is ts.HasJSDoc; +export declare function getJsDoc(node: ts.Node, sourceFile?: ts.SourceFile): ts.JSDoc[]; +export declare function parseJsDocOfNode(node: ts.Node, considerTrailingComments?: boolean, sourceFile?: ts.SourceFile): ts.JSDoc[]; +export declare enum ImportKind { + ImportDeclaration = 1, + ImportEquals = 2, + ExportFrom = 4, + DynamicImport = 8, + Require = 16, + ImportType = 32, + All = 63, + AllImports = 59, + AllStaticImports = 3, + AllImportExpressions = 24, + AllRequireLike = 18 +} +export declare function findImports(sourceFile: ts.SourceFile, kinds: ImportKind): (ts.StringLiteral | ts.NoSubstitutionTemplateLiteral)[]; +export declare type ImportLike = ts.ImportDeclaration | (ts.ImportEqualsDeclaration & { + moduleReference: ts.ExternalModuleReference; +}) | (ts.ExportDeclaration & { + moduleSpecifier: {}; +}) | (ts.CallExpression & { + expression: ts.Token | (ts.Identifier & { + text: 'require'; + }); + arguments: [ts.Expression]; +}) | ts.ImportTypeNode; +export declare function findImportLikeNodes(sourceFile: ts.SourceFile, kinds: ImportKind): ImportLike[]; +export declare function isStatementInAmbientContext(node: ts.Statement): boolean; +export declare function isAmbientModuleBlock(node: ts.Node): node is ts.ModuleBlock; +export declare function getIIFE(func: ts.FunctionExpression | ts.ArrowFunction): ts.CallExpression | undefined; +export declare type StrictCompilerOption = 'noImplicitAny' | 'noImplicitThis' | 'strictNullChecks' | 'strictFunctionTypes' | 'strictPropertyInitialization' | 'alwaysStrict' | 'strictBindCallApply'; +export declare function isStrictCompilerOptionEnabled(options: ts.CompilerOptions, option: StrictCompilerOption): boolean; +export declare type BooleanCompilerOptions = { + [K in keyof ts.CompilerOptions]: NonNullable extends boolean ? K : never; +} extends { + [_ in keyof ts.CompilerOptions]: infer U; +} ? U : never; +export declare function isCompilerOptionEnabled(options: ts.CompilerOptions, option: BooleanCompilerOptions | 'stripInternal'): boolean; +export declare function isAmbientModule(node: ts.ModuleDeclaration): boolean; +export declare function getCheckJsDirective(source: string): ts.CheckJsDirective | undefined; +export declare function isConstAssertion(node: ts.AssertionExpression): boolean; +export declare function isInConstContext(node: ts.Expression): boolean; +export declare function isReadonlyAssignmentDeclaration(node: ts.CallExpression, checker: ts.TypeChecker): boolean; +export declare function isBindableObjectDefinePropertyCall(node: ts.CallExpression): boolean; +export interface WellKnownSymbolLiteral extends ts.PropertyAccessExpression { + expression: ts.Identifier & { + text: 'Symbol'; + escapedText: 'symbol'; + }; +} +export declare function isWellKnownSymbolLiterally(node: ts.Expression): node is WellKnownSymbolLiteral; +export interface PropertyName { + displayName: string; + symbolName: ts.__String; +} +export declare function getPropertyNameOfWellKnownSymbol(node: WellKnownSymbolLiteral): PropertyName; +export interface LateBoundPropertyNames { + known: boolean; + names: PropertyName[]; +} +export declare function getLateBoundPropertyNames(node: ts.Expression, checker: ts.TypeChecker): LateBoundPropertyNames; +export declare function getLateBoundPropertyNamesOfPropertyName(node: ts.PropertyName, checker: ts.TypeChecker): LateBoundPropertyNames; +export declare function getSingleLateBoundPropertyNameOfPropertyName(node: ts.PropertyName, checker: ts.TypeChecker): PropertyName | undefined; +export declare function unwrapParentheses(node: ts.Expression): ts.Expression; diff --git a/node_modules/tslint-eslint-rules/node_modules/tsutils/util/util.js b/node_modules/tslint-eslint-rules/node_modules/tsutils/util/util.js new file mode 100644 index 000000000..07b469a49 --- /dev/null +++ b/node_modules/tslint-eslint-rules/node_modules/tsutils/util/util.js @@ -0,0 +1,1422 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const ts = require("typescript"); +const node_1 = require("../typeguard/node"); +const _3_2_1 = require("../typeguard/3.2"); +const type_1 = require("./type"); +function getChildOfKind(node, kind, sourceFile) { + for (const child of node.getChildren(sourceFile)) + if (child.kind === kind) + return child; +} +exports.getChildOfKind = getChildOfKind; +function isTokenKind(kind) { + return kind >= ts.SyntaxKind.FirstToken && kind <= ts.SyntaxKind.LastToken; +} +exports.isTokenKind = isTokenKind; +function isNodeKind(kind) { + return kind >= ts.SyntaxKind.FirstNode; +} +exports.isNodeKind = isNodeKind; +function isAssignmentKind(kind) { + return kind >= ts.SyntaxKind.FirstAssignment && kind <= ts.SyntaxKind.LastAssignment; +} +exports.isAssignmentKind = isAssignmentKind; +function isTypeNodeKind(kind) { + return kind >= ts.SyntaxKind.FirstTypeNode && kind <= ts.SyntaxKind.LastTypeNode; +} +exports.isTypeNodeKind = isTypeNodeKind; +function isJsDocKind(kind) { + return kind >= ts.SyntaxKind.FirstJSDocNode && kind <= ts.SyntaxKind.LastJSDocNode; +} +exports.isJsDocKind = isJsDocKind; +function isKeywordKind(kind) { + return kind >= ts.SyntaxKind.FirstKeyword && kind <= ts.SyntaxKind.LastKeyword; +} +exports.isKeywordKind = isKeywordKind; +function isThisParameter(parameter) { + return parameter.name.kind === ts.SyntaxKind.Identifier && parameter.name.originalKeywordKind === ts.SyntaxKind.ThisKeyword; +} +exports.isThisParameter = isThisParameter; +function getModifier(node, kind) { + if (node.modifiers !== undefined) + for (const modifier of node.modifiers) + if (modifier.kind === kind) + return modifier; +} +exports.getModifier = getModifier; +function hasModifier(modifiers, ...kinds) { + if (modifiers === undefined) + return false; + for (const modifier of modifiers) + if (kinds.includes(modifier.kind)) + return true; + return false; +} +exports.hasModifier = hasModifier; +function isParameterProperty(node) { + return hasModifier(node.modifiers, ts.SyntaxKind.PublicKeyword, ts.SyntaxKind.ProtectedKeyword, ts.SyntaxKind.PrivateKeyword, ts.SyntaxKind.ReadonlyKeyword); +} +exports.isParameterProperty = isParameterProperty; +function hasAccessModifier(node) { + return hasModifier(node.modifiers, ts.SyntaxKind.PublicKeyword, ts.SyntaxKind.ProtectedKeyword, ts.SyntaxKind.PrivateKeyword); +} +exports.hasAccessModifier = hasAccessModifier; +function isFlagSet(obj, flag) { + return (obj.flags & flag) !== 0; +} +exports.isNodeFlagSet = isFlagSet; +exports.isTypeFlagSet = isFlagSet; +exports.isSymbolFlagSet = isFlagSet; +function isObjectFlagSet(objectType, flag) { + return (objectType.objectFlags & flag) !== 0; +} +exports.isObjectFlagSet = isObjectFlagSet; +function isModifierFlagSet(node, flag) { + return (ts.getCombinedModifierFlags(node) & flag) !== 0; +} +exports.isModifierFlagSet = isModifierFlagSet; +function getPreviousStatement(statement) { + const parent = statement.parent; + if (node_1.isBlockLike(parent)) { + const index = parent.statements.indexOf(statement); + if (index > 0) + return parent.statements[index - 1]; + } +} +exports.getPreviousStatement = getPreviousStatement; +function getNextStatement(statement) { + const parent = statement.parent; + if (node_1.isBlockLike(parent)) { + const index = parent.statements.indexOf(statement); + if (index < parent.statements.length) + return parent.statements[index + 1]; + } +} +exports.getNextStatement = getNextStatement; +function getPreviousToken(node, sourceFile) { + let parent = node.parent; + while (parent !== undefined && parent.pos === node.pos) + parent = parent.parent; + if (parent === undefined) + return; + outer: while (true) { + const children = parent.getChildren(sourceFile); + for (let i = children.length - 1; i >= 0; --i) { + const child = children[i]; + if (child.pos < node.pos && child.kind !== ts.SyntaxKind.JSDocComment) { + if (isTokenKind(child.kind)) + return child; + parent = child; + continue outer; + } + } + return; + } +} +exports.getPreviousToken = getPreviousToken; +function getNextToken(node, sourceFile = node.getSourceFile()) { + if (node.kind === ts.SyntaxKind.SourceFile || node.kind === ts.SyntaxKind.EndOfFileToken) + return; + const end = node.end; + node = node.parent; + while (node.end === end) { + if (node.parent === undefined) + return node.endOfFileToken; + node = node.parent; + } + return getTokenAtPositionWorker(node, end, sourceFile, false); +} +exports.getNextToken = getNextToken; +function getTokenAtPosition(parent, pos, sourceFile, allowJsDoc) { + if (pos < parent.pos || pos >= parent.end) + return; + if (isTokenKind(parent.kind)) + return parent; + if (sourceFile === undefined) + sourceFile = parent.getSourceFile(); + return getTokenAtPositionWorker(parent, pos, sourceFile, allowJsDoc === true); +} +exports.getTokenAtPosition = getTokenAtPosition; +function getTokenAtPositionWorker(node, pos, sourceFile, allowJsDoc) { + outer: while (true) { + for (const child of node.getChildren(sourceFile)) { + if (child.end > pos && (allowJsDoc || child.kind !== ts.SyntaxKind.JSDocComment)) { + if (isTokenKind(child.kind)) + return child; + node = child; + continue outer; + } + } + return; + } +} +function getCommentAtPosition(sourceFile, pos, parent = sourceFile) { + const token = getTokenAtPosition(parent, pos, sourceFile); + if (token === undefined || token.kind === ts.SyntaxKind.JsxText || pos >= token.end - (ts.tokenToString(token.kind) || '').length) + return; + const startPos = token.pos === 0 + ? (ts.getShebang(sourceFile.text) || '').length + : token.pos; + return startPos !== 0 && ts.forEachTrailingCommentRange(sourceFile.text, startPos, commentAtPositionCallback, pos) || + ts.forEachLeadingCommentRange(sourceFile.text, startPos, commentAtPositionCallback, pos); +} +exports.getCommentAtPosition = getCommentAtPosition; +function commentAtPositionCallback(pos, end, kind, _nl, at) { + return at >= pos && at < end ? { pos, end, kind } : undefined; +} +function isPositionInComment(sourceFile, pos, parent) { + return getCommentAtPosition(sourceFile, pos, parent) !== undefined; +} +exports.isPositionInComment = isPositionInComment; +function commentText(sourceText, comment) { + return sourceText.substring(comment.pos + 2, comment.kind === ts.SyntaxKind.SingleLineCommentTrivia ? comment.end : comment.end - 2); +} +exports.commentText = commentText; +function getWrappedNodeAtPosition(wrap, pos) { + if (wrap.node.pos > pos || wrap.node.end <= pos) + return; + outer: while (true) { + for (const child of wrap.children) { + if (child.node.pos > pos) + return wrap; + if (child.node.end > pos) { + wrap = child; + continue outer; + } + } + return wrap; + } +} +exports.getWrappedNodeAtPosition = getWrappedNodeAtPosition; +function getPropertyName(propertyName) { + if (propertyName.kind === ts.SyntaxKind.ComputedPropertyName) { + if (!node_1.isLiteralExpression(propertyName.expression)) + return; + if (_3_2_1.isBigIntLiteral(propertyName.expression)) + return propertyName.expression.text.slice(0, -1); + return propertyName.expression.text; + } + return propertyName.text; +} +exports.getPropertyName = getPropertyName; +function forEachDestructuringIdentifier(pattern, fn) { + for (const element of pattern.elements) { + if (element.kind !== ts.SyntaxKind.BindingElement) + continue; + let result; + if (element.name.kind === ts.SyntaxKind.Identifier) { + result = fn(element); + } + else { + result = forEachDestructuringIdentifier(element.name, fn); + } + if (result) + return result; + } +} +exports.forEachDestructuringIdentifier = forEachDestructuringIdentifier; +function forEachDeclaredVariable(declarationList, cb) { + for (const declaration of declarationList.declarations) { + let result; + if (declaration.name.kind === ts.SyntaxKind.Identifier) { + result = cb(declaration); + } + else { + result = forEachDestructuringIdentifier(declaration.name, cb); + } + if (result) + return result; + } +} +exports.forEachDeclaredVariable = forEachDeclaredVariable; +var VariableDeclarationKind; +(function (VariableDeclarationKind) { + VariableDeclarationKind[VariableDeclarationKind["Var"] = 0] = "Var"; + VariableDeclarationKind[VariableDeclarationKind["Let"] = 1] = "Let"; + VariableDeclarationKind[VariableDeclarationKind["Const"] = 2] = "Const"; +})(VariableDeclarationKind = exports.VariableDeclarationKind || (exports.VariableDeclarationKind = {})); +function getVariableDeclarationKind(declarationList) { + if (declarationList.flags & ts.NodeFlags.Let) + return 1; + if (declarationList.flags & ts.NodeFlags.Const) + return 2; + return 0; +} +exports.getVariableDeclarationKind = getVariableDeclarationKind; +function isBlockScopedVariableDeclarationList(declarationList) { + return (declarationList.flags & ts.NodeFlags.BlockScoped) !== 0; +} +exports.isBlockScopedVariableDeclarationList = isBlockScopedVariableDeclarationList; +function isBlockScopedVariableDeclaration(declaration) { + const parent = declaration.parent; + return parent.kind === ts.SyntaxKind.CatchClause || + isBlockScopedVariableDeclarationList(parent); +} +exports.isBlockScopedVariableDeclaration = isBlockScopedVariableDeclaration; +function isBlockScopedDeclarationStatement(statement) { + switch (statement.kind) { + case ts.SyntaxKind.VariableStatement: + return isBlockScopedVariableDeclarationList(statement.declarationList); + case ts.SyntaxKind.ClassDeclaration: + case ts.SyntaxKind.EnumDeclaration: + case ts.SyntaxKind.InterfaceDeclaration: + case ts.SyntaxKind.TypeAliasDeclaration: + return true; + default: + return false; + } +} +exports.isBlockScopedDeclarationStatement = isBlockScopedDeclarationStatement; +function isInSingleStatementContext(statement) { + switch (statement.parent.kind) { + case ts.SyntaxKind.ForStatement: + case ts.SyntaxKind.ForInStatement: + case ts.SyntaxKind.ForOfStatement: + case ts.SyntaxKind.WhileStatement: + case ts.SyntaxKind.DoStatement: + case ts.SyntaxKind.IfStatement: + case ts.SyntaxKind.WithStatement: + case ts.SyntaxKind.LabeledStatement: + return true; + default: + return false; + } +} +exports.isInSingleStatementContext = isInSingleStatementContext; +var ScopeBoundary; +(function (ScopeBoundary) { + ScopeBoundary[ScopeBoundary["None"] = 0] = "None"; + ScopeBoundary[ScopeBoundary["Function"] = 1] = "Function"; + ScopeBoundary[ScopeBoundary["Block"] = 2] = "Block"; + ScopeBoundary[ScopeBoundary["Type"] = 4] = "Type"; + ScopeBoundary[ScopeBoundary["ConditionalType"] = 8] = "ConditionalType"; +})(ScopeBoundary = exports.ScopeBoundary || (exports.ScopeBoundary = {})); +var ScopeBoundarySelector; +(function (ScopeBoundarySelector) { + ScopeBoundarySelector[ScopeBoundarySelector["Function"] = 1] = "Function"; + ScopeBoundarySelector[ScopeBoundarySelector["Block"] = 3] = "Block"; + ScopeBoundarySelector[ScopeBoundarySelector["Type"] = 7] = "Type"; + ScopeBoundarySelector[ScopeBoundarySelector["InferType"] = 8] = "InferType"; +})(ScopeBoundarySelector = exports.ScopeBoundarySelector || (exports.ScopeBoundarySelector = {})); +function isScopeBoundary(node) { + return isFunctionScopeBoundary(node) || isBlockScopeBoundary(node) || isTypeScopeBoundary(node); +} +exports.isScopeBoundary = isScopeBoundary; +function isTypeScopeBoundary(node) { + switch (node.kind) { + case ts.SyntaxKind.InterfaceDeclaration: + case ts.SyntaxKind.TypeAliasDeclaration: + case ts.SyntaxKind.MappedType: + return 4; + case ts.SyntaxKind.ConditionalType: + return 8; + default: + return 0; + } +} +exports.isTypeScopeBoundary = isTypeScopeBoundary; +function isFunctionScopeBoundary(node) { + switch (node.kind) { + case ts.SyntaxKind.FunctionExpression: + case ts.SyntaxKind.ArrowFunction: + case ts.SyntaxKind.Constructor: + case ts.SyntaxKind.ModuleDeclaration: + case ts.SyntaxKind.ClassDeclaration: + case ts.SyntaxKind.ClassExpression: + case ts.SyntaxKind.EnumDeclaration: + case ts.SyntaxKind.MethodDeclaration: + case ts.SyntaxKind.FunctionDeclaration: + case ts.SyntaxKind.GetAccessor: + case ts.SyntaxKind.SetAccessor: + case ts.SyntaxKind.MethodSignature: + case ts.SyntaxKind.CallSignature: + case ts.SyntaxKind.ConstructSignature: + case ts.SyntaxKind.ConstructorType: + case ts.SyntaxKind.FunctionType: + return 1; + case ts.SyntaxKind.SourceFile: + return ts.isExternalModule(node) ? 1 : 0; + default: + return 0; + } +} +exports.isFunctionScopeBoundary = isFunctionScopeBoundary; +function isBlockScopeBoundary(node) { + switch (node.kind) { + case ts.SyntaxKind.Block: + const parent = node.parent; + return parent.kind !== ts.SyntaxKind.CatchClause && + (parent.kind === ts.SyntaxKind.SourceFile || + !isFunctionScopeBoundary(parent)) + ? 2 + : 0; + case ts.SyntaxKind.ForStatement: + case ts.SyntaxKind.ForInStatement: + case ts.SyntaxKind.ForOfStatement: + case ts.SyntaxKind.CaseBlock: + case ts.SyntaxKind.CatchClause: + case ts.SyntaxKind.WithStatement: + return 2; + default: + return 0; + } +} +exports.isBlockScopeBoundary = isBlockScopeBoundary; +function hasOwnThisReference(node) { + switch (node.kind) { + case ts.SyntaxKind.ClassDeclaration: + case ts.SyntaxKind.ClassExpression: + case ts.SyntaxKind.FunctionExpression: + return true; + case ts.SyntaxKind.FunctionDeclaration: + return node.body !== undefined; + case ts.SyntaxKind.MethodDeclaration: + case ts.SyntaxKind.GetAccessor: + case ts.SyntaxKind.SetAccessor: + return node.parent.kind === ts.SyntaxKind.ObjectLiteralExpression; + default: + return false; + } +} +exports.hasOwnThisReference = hasOwnThisReference; +function isFunctionWithBody(node) { + switch (node.kind) { + case ts.SyntaxKind.GetAccessor: + case ts.SyntaxKind.SetAccessor: + case ts.SyntaxKind.FunctionDeclaration: + case ts.SyntaxKind.MethodDeclaration: + case ts.SyntaxKind.Constructor: + return node.body !== undefined; + case ts.SyntaxKind.FunctionExpression: + case ts.SyntaxKind.ArrowFunction: + return true; + default: + return false; + } +} +exports.isFunctionWithBody = isFunctionWithBody; +function forEachToken(node, cb, sourceFile = node.getSourceFile()) { + return (function iterate(child) { + if (isTokenKind(child.kind)) + return cb(child); + if (child.kind !== ts.SyntaxKind.JSDocComment) + return child.getChildren(sourceFile).forEach(iterate); + })(node); +} +exports.forEachToken = forEachToken; +function forEachTokenWithTrivia(node, cb, sourceFile = node.getSourceFile()) { + const fullText = sourceFile.text; + const scanner = ts.createScanner(sourceFile.languageVersion, false, sourceFile.languageVariant, fullText); + return forEachToken(node, (token) => { + const tokenStart = token.kind === ts.SyntaxKind.JsxText || token.pos === token.end ? token.pos : token.getStart(sourceFile); + if (tokenStart !== token.pos) { + scanner.setTextPos(token.pos); + let kind = scanner.scan(); + let pos = scanner.getTokenPos(); + while (pos < tokenStart) { + const textPos = scanner.getTextPos(); + cb(fullText, kind, { pos, end: textPos }, token.parent); + if (textPos === tokenStart) + break; + kind = scanner.scan(); + pos = scanner.getTokenPos(); + } + } + return cb(fullText, token.kind, { end: token.end, pos: tokenStart }, token.parent); + }, sourceFile); +} +exports.forEachTokenWithTrivia = forEachTokenWithTrivia; +function forEachComment(node, cb, sourceFile = node.getSourceFile()) { + const fullText = sourceFile.text; + const notJsx = sourceFile.languageVariant !== ts.LanguageVariant.JSX; + return forEachToken(node, (token) => { + if (token.pos === token.end) + return; + if (token.kind !== ts.SyntaxKind.JsxText) + ts.forEachLeadingCommentRange(fullText, token.pos === 0 ? (ts.getShebang(fullText) || '').length : token.pos, commentCallback); + if (notJsx || canHaveTrailingTrivia(token)) + return ts.forEachTrailingCommentRange(fullText, token.end, commentCallback); + }, sourceFile); + function commentCallback(pos, end, kind) { + cb(fullText, { pos, end, kind }); + } +} +exports.forEachComment = forEachComment; +function canHaveTrailingTrivia(token) { + switch (token.kind) { + case ts.SyntaxKind.CloseBraceToken: + return token.parent.kind !== ts.SyntaxKind.JsxExpression || !isJsxElementOrFragment(token.parent.parent); + case ts.SyntaxKind.GreaterThanToken: + switch (token.parent.kind) { + case ts.SyntaxKind.JsxOpeningElement: + return token.end !== token.parent.end; + case ts.SyntaxKind.JsxOpeningFragment: + return false; + case ts.SyntaxKind.JsxSelfClosingElement: + return token.end !== token.parent.end || + !isJsxElementOrFragment(token.parent.parent); + case ts.SyntaxKind.JsxClosingElement: + case ts.SyntaxKind.JsxClosingFragment: + return !isJsxElementOrFragment(token.parent.parent.parent); + } + } + return true; +} +function isJsxElementOrFragment(node) { + return node.kind === ts.SyntaxKind.JsxElement || node.kind === ts.SyntaxKind.JsxFragment; +} +function getLineRanges(sourceFile) { + const lineStarts = sourceFile.getLineStarts(); + const result = []; + const length = lineStarts.length; + const sourceText = sourceFile.text; + let pos = 0; + for (let i = 1; i < length; ++i) { + const end = lineStarts[i]; + let lineEnd = end; + for (; lineEnd > pos; --lineEnd) + if (!ts.isLineBreak(sourceText.charCodeAt(lineEnd - 1))) + break; + result.push({ + pos, + end, + contentLength: lineEnd - pos, + }); + pos = end; + } + result.push({ + pos, + end: sourceFile.end, + contentLength: sourceFile.end - pos, + }); + return result; +} +exports.getLineRanges = getLineRanges; +function getLineBreakStyle(sourceFile) { + const lineStarts = sourceFile.getLineStarts(); + return lineStarts.length === 1 || lineStarts[1] < 2 || sourceFile.text[lineStarts[1] - 2] !== '\r' + ? '\n' + : '\r\n'; +} +exports.getLineBreakStyle = getLineBreakStyle; +let cachedScanner; +function scanToken(text, languageVersion) { + if (cachedScanner === undefined) { + cachedScanner = ts.createScanner(languageVersion, false, undefined, text); + } + else { + cachedScanner.setScriptTarget(languageVersion); + cachedScanner.setText(text); + } + cachedScanner.scan(); + return cachedScanner; +} +function isValidIdentifier(text, languageVersion = ts.ScriptTarget.Latest) { + const scan = scanToken(text, languageVersion); + return scan.isIdentifier() && scan.getTextPos() === text.length && scan.getTokenPos() === 0; +} +exports.isValidIdentifier = isValidIdentifier; +function charSize(ch) { + return ch >= 0x10000 ? 2 : 1; +} +function isValidPropertyAccess(text, languageVersion = ts.ScriptTarget.Latest) { + if (text.length === 0) + return false; + let ch = text.codePointAt(0); + if (!ts.isIdentifierStart(ch, languageVersion)) + return false; + for (let i = charSize(ch); i < text.length; i += charSize(ch)) { + ch = text.codePointAt(i); + if (!ts.isIdentifierPart(ch, languageVersion)) + return false; + } + return true; +} +exports.isValidPropertyAccess = isValidPropertyAccess; +function isValidPropertyName(text, languageVersion = ts.ScriptTarget.Latest) { + if (isValidPropertyAccess(text, languageVersion)) + return true; + const scan = scanToken(text, languageVersion); + return scan.getTextPos() === text.length && + scan.getToken() === ts.SyntaxKind.NumericLiteral && scan.getTokenValue() === text; +} +exports.isValidPropertyName = isValidPropertyName; +function isValidNumericLiteral(text, languageVersion = ts.ScriptTarget.Latest) { + const scan = scanToken(text, languageVersion); + return scan.getToken() === ts.SyntaxKind.NumericLiteral && scan.getTextPos() === text.length && scan.getTokenPos() === 0; +} +exports.isValidNumericLiteral = isValidNumericLiteral; +function isValidJsxIdentifier(text, languageVersion = ts.ScriptTarget.Latest) { + if (text.length === 0) + return false; + let ch = text.codePointAt(0); + if (!ts.isIdentifierStart(ch, languageVersion)) + return false; + for (let i = charSize(ch); i < text.length; i += charSize(ch)) { + ch = text.codePointAt(i); + if (!ts.isIdentifierPart(ch, languageVersion) && ch !== 45) + return false; + } + return true; +} +exports.isValidJsxIdentifier = isValidJsxIdentifier; +function isNumericPropertyName(name) { + return String(+name) === name; +} +exports.isNumericPropertyName = isNumericPropertyName; +function isSameLine(sourceFile, pos1, pos2) { + return ts.getLineAndCharacterOfPosition(sourceFile, pos1).line === ts.getLineAndCharacterOfPosition(sourceFile, pos2).line; +} +exports.isSameLine = isSameLine; +var SideEffectOptions; +(function (SideEffectOptions) { + SideEffectOptions[SideEffectOptions["None"] = 0] = "None"; + SideEffectOptions[SideEffectOptions["TaggedTemplate"] = 1] = "TaggedTemplate"; + SideEffectOptions[SideEffectOptions["Constructor"] = 2] = "Constructor"; + SideEffectOptions[SideEffectOptions["JsxElement"] = 4] = "JsxElement"; +})(SideEffectOptions = exports.SideEffectOptions || (exports.SideEffectOptions = {})); +function hasSideEffects(node, options) { + switch (node.kind) { + case ts.SyntaxKind.CallExpression: + case ts.SyntaxKind.PostfixUnaryExpression: + case ts.SyntaxKind.AwaitExpression: + case ts.SyntaxKind.YieldExpression: + case ts.SyntaxKind.DeleteExpression: + return true; + case ts.SyntaxKind.TypeAssertionExpression: + case ts.SyntaxKind.AsExpression: + case ts.SyntaxKind.ParenthesizedExpression: + case ts.SyntaxKind.NonNullExpression: + case ts.SyntaxKind.VoidExpression: + case ts.SyntaxKind.TypeOfExpression: + case ts.SyntaxKind.PropertyAccessExpression: + case ts.SyntaxKind.SpreadElement: + case ts.SyntaxKind.PartiallyEmittedExpression: + return hasSideEffects(node.expression, options); + case ts.SyntaxKind.BinaryExpression: + return isAssignmentKind(node.operatorToken.kind) || + hasSideEffects(node.left, options) || + hasSideEffects(node.right, options); + case ts.SyntaxKind.PrefixUnaryExpression: + switch (node.operator) { + case ts.SyntaxKind.PlusPlusToken: + case ts.SyntaxKind.MinusMinusToken: + return true; + default: + return hasSideEffects(node.operand, options); + } + case ts.SyntaxKind.ElementAccessExpression: + return hasSideEffects(node.expression, options) || + node.argumentExpression !== undefined && + hasSideEffects(node.argumentExpression, options); + case ts.SyntaxKind.ConditionalExpression: + return hasSideEffects(node.condition, options) || + hasSideEffects(node.whenTrue, options) || + hasSideEffects(node.whenFalse, options); + case ts.SyntaxKind.NewExpression: + if (options & 2 || hasSideEffects(node.expression, options)) + return true; + if (node.arguments !== undefined) + for (const child of node.arguments) + if (hasSideEffects(child, options)) + return true; + return false; + case ts.SyntaxKind.TaggedTemplateExpression: + if (options & 1 || hasSideEffects(node.tag, options)) + return true; + if (node.template.kind === ts.SyntaxKind.NoSubstitutionTemplateLiteral) + return false; + node = node.template; + case ts.SyntaxKind.TemplateExpression: + for (const child of node.templateSpans) + if (hasSideEffects(child.expression, options)) + return true; + return false; + case ts.SyntaxKind.ClassExpression: + return classExpressionHasSideEffects(node, options); + case ts.SyntaxKind.ArrayLiteralExpression: + for (const child of node.elements) + if (hasSideEffects(child, options)) + return true; + return false; + case ts.SyntaxKind.ObjectLiteralExpression: + for (const child of node.properties) { + if (child.name !== undefined && child.name.kind === ts.SyntaxKind.ComputedPropertyName && + hasSideEffects(child.name.expression, options)) + return true; + switch (child.kind) { + case ts.SyntaxKind.PropertyAssignment: + if (hasSideEffects(child.initializer, options)) + return true; + break; + case ts.SyntaxKind.SpreadAssignment: + if (hasSideEffects(child.expression, options)) + return true; + } + } + return false; + case ts.SyntaxKind.JsxExpression: + return node.expression !== undefined && hasSideEffects(node.expression, options); + case ts.SyntaxKind.JsxElement: + case ts.SyntaxKind.JsxFragment: + for (const child of node.children) + if (child.kind !== ts.SyntaxKind.JsxText && hasSideEffects(child, options)) + return true; + if (node.kind === ts.SyntaxKind.JsxFragment) + return false; + node = node.openingElement; + case ts.SyntaxKind.JsxSelfClosingElement: + case ts.SyntaxKind.JsxOpeningElement: + if (options & 4) + return true; + for (const child of node.attributes.properties) { + if (child.kind === ts.SyntaxKind.JsxSpreadAttribute) { + if (hasSideEffects(child.expression, options)) + return true; + } + else if (child.initializer !== undefined && hasSideEffects(child.initializer, options)) { + return true; + } + } + return false; + case ts.SyntaxKind.CommaListExpression: + for (const child of node.elements) + if (hasSideEffects(child, options)) + return true; + return false; + default: + return false; + } +} +exports.hasSideEffects = hasSideEffects; +function classExpressionHasSideEffects(node, options) { + if (node.heritageClauses !== undefined && node.heritageClauses[0].token === ts.SyntaxKind.ExtendsKeyword) + for (const base of node.heritageClauses[0].types) + if (hasSideEffects(base.expression, options)) + return true; + for (const child of node.members) + if (child.name !== undefined && child.name.kind === ts.SyntaxKind.ComputedPropertyName && + hasSideEffects(child.name.expression, options) || + node_1.isPropertyDeclaration(child) && child.initializer !== undefined && + hasSideEffects(child.initializer, options)) + return true; + return false; +} +function getDeclarationOfBindingElement(node) { + let parent = node.parent.parent; + while (parent.kind === ts.SyntaxKind.BindingElement) + parent = parent.parent.parent; + return parent; +} +exports.getDeclarationOfBindingElement = getDeclarationOfBindingElement; +function isExpressionValueUsed(node) { + while (true) { + const parent = node.parent; + switch (parent.kind) { + case ts.SyntaxKind.CallExpression: + case ts.SyntaxKind.NewExpression: + case ts.SyntaxKind.ElementAccessExpression: + case ts.SyntaxKind.WhileStatement: + case ts.SyntaxKind.DoStatement: + case ts.SyntaxKind.WithStatement: + case ts.SyntaxKind.ThrowStatement: + case ts.SyntaxKind.ReturnStatement: + case ts.SyntaxKind.JsxExpression: + case ts.SyntaxKind.JsxSpreadAttribute: + case ts.SyntaxKind.JsxElement: + case ts.SyntaxKind.JsxFragment: + case ts.SyntaxKind.JsxSelfClosingElement: + case ts.SyntaxKind.ComputedPropertyName: + case ts.SyntaxKind.ArrowFunction: + case ts.SyntaxKind.ExportSpecifier: + case ts.SyntaxKind.ExportAssignment: + case ts.SyntaxKind.ImportDeclaration: + case ts.SyntaxKind.ExternalModuleReference: + case ts.SyntaxKind.Decorator: + case ts.SyntaxKind.TaggedTemplateExpression: + case ts.SyntaxKind.TemplateSpan: + case ts.SyntaxKind.ExpressionWithTypeArguments: + case ts.SyntaxKind.TypeOfExpression: + case ts.SyntaxKind.AwaitExpression: + case ts.SyntaxKind.YieldExpression: + case ts.SyntaxKind.LiteralType: + case ts.SyntaxKind.JsxAttributes: + case ts.SyntaxKind.JsxOpeningElement: + case ts.SyntaxKind.JsxClosingElement: + case ts.SyntaxKind.IfStatement: + case ts.SyntaxKind.CaseClause: + case ts.SyntaxKind.SwitchStatement: + return true; + case ts.SyntaxKind.PropertyAccessExpression: + return parent.expression === node; + case ts.SyntaxKind.QualifiedName: + return parent.left === node; + case ts.SyntaxKind.ShorthandPropertyAssignment: + return parent.objectAssignmentInitializer === node || + !isInDestructuringAssignment(parent); + case ts.SyntaxKind.PropertyAssignment: + return parent.initializer === node && !isInDestructuringAssignment(parent); + case ts.SyntaxKind.SpreadAssignment: + case ts.SyntaxKind.SpreadElement: + case ts.SyntaxKind.ArrayLiteralExpression: + return !isInDestructuringAssignment(parent); + case ts.SyntaxKind.ParenthesizedExpression: + case ts.SyntaxKind.AsExpression: + case ts.SyntaxKind.TypeAssertionExpression: + case ts.SyntaxKind.PostfixUnaryExpression: + case ts.SyntaxKind.PrefixUnaryExpression: + case ts.SyntaxKind.NonNullExpression: + node = parent; + break; + case ts.SyntaxKind.ForStatement: + return parent.condition === node; + case ts.SyntaxKind.ForInStatement: + case ts.SyntaxKind.ForOfStatement: + return parent.expression === node; + case ts.SyntaxKind.ConditionalExpression: + if (parent.condition === node) + return true; + node = parent; + break; + case ts.SyntaxKind.PropertyDeclaration: + case ts.SyntaxKind.BindingElement: + case ts.SyntaxKind.VariableDeclaration: + case ts.SyntaxKind.Parameter: + case ts.SyntaxKind.EnumMember: + return parent.initializer === node; + case ts.SyntaxKind.ImportEqualsDeclaration: + return parent.moduleReference === node; + case ts.SyntaxKind.CommaListExpression: + if (parent.elements[parent.elements.length - 1] !== node) + return false; + node = parent; + break; + case ts.SyntaxKind.BinaryExpression: + if (parent.right === node) { + if (parent.operatorToken.kind === ts.SyntaxKind.CommaToken) { + node = parent; + break; + } + return true; + } + switch (parent.operatorToken.kind) { + case ts.SyntaxKind.CommaToken: + case ts.SyntaxKind.EqualsToken: + return false; + case ts.SyntaxKind.EqualsEqualsEqualsToken: + case ts.SyntaxKind.EqualsEqualsToken: + case ts.SyntaxKind.ExclamationEqualsEqualsToken: + case ts.SyntaxKind.ExclamationEqualsToken: + case ts.SyntaxKind.InstanceOfKeyword: + case ts.SyntaxKind.PlusToken: + case ts.SyntaxKind.MinusToken: + case ts.SyntaxKind.AsteriskToken: + case ts.SyntaxKind.SlashToken: + case ts.SyntaxKind.PercentToken: + case ts.SyntaxKind.AsteriskAsteriskToken: + case ts.SyntaxKind.GreaterThanToken: + case ts.SyntaxKind.GreaterThanGreaterThanToken: + case ts.SyntaxKind.GreaterThanGreaterThanGreaterThanToken: + case ts.SyntaxKind.GreaterThanEqualsToken: + case ts.SyntaxKind.LessThanToken: + case ts.SyntaxKind.LessThanLessThanToken: + case ts.SyntaxKind.LessThanEqualsToken: + case ts.SyntaxKind.AmpersandToken: + case ts.SyntaxKind.BarToken: + case ts.SyntaxKind.CaretToken: + case ts.SyntaxKind.BarBarToken: + case ts.SyntaxKind.AmpersandAmpersandToken: + case ts.SyntaxKind.InKeyword: + return true; + default: + node = parent; + } + break; + default: + return false; + } + } +} +exports.isExpressionValueUsed = isExpressionValueUsed; +function isInDestructuringAssignment(node) { + switch (node.kind) { + case ts.SyntaxKind.ShorthandPropertyAssignment: + if (node.objectAssignmentInitializer !== undefined) + return true; + case ts.SyntaxKind.PropertyAssignment: + case ts.SyntaxKind.SpreadAssignment: + node = node.parent; + break; + case ts.SyntaxKind.SpreadElement: + if (node.parent.kind !== ts.SyntaxKind.ArrayLiteralExpression) + return false; + node = node.parent; + } + while (true) { + switch (node.parent.kind) { + case ts.SyntaxKind.BinaryExpression: + return node.parent.left === node && + node.parent.operatorToken.kind === ts.SyntaxKind.EqualsToken; + case ts.SyntaxKind.ForOfStatement: + return node.parent.initializer === node; + case ts.SyntaxKind.ArrayLiteralExpression: + case ts.SyntaxKind.ObjectLiteralExpression: + node = node.parent; + break; + case ts.SyntaxKind.SpreadAssignment: + case ts.SyntaxKind.PropertyAssignment: + node = node.parent.parent; + break; + case ts.SyntaxKind.SpreadElement: + if (node.parent.parent.kind !== ts.SyntaxKind.ArrayLiteralExpression) + return false; + node = node.parent.parent; + break; + default: + return false; + } + } +} +var AccessKind; +(function (AccessKind) { + AccessKind[AccessKind["None"] = 0] = "None"; + AccessKind[AccessKind["Read"] = 1] = "Read"; + AccessKind[AccessKind["Write"] = 2] = "Write"; + AccessKind[AccessKind["Delete"] = 4] = "Delete"; + AccessKind[AccessKind["ReadWrite"] = 3] = "ReadWrite"; + AccessKind[AccessKind["Modification"] = 6] = "Modification"; +})(AccessKind = exports.AccessKind || (exports.AccessKind = {})); +function getAccessKind(node) { + const parent = node.parent; + switch (parent.kind) { + case ts.SyntaxKind.DeleteExpression: + return 4; + case ts.SyntaxKind.PostfixUnaryExpression: + return 3; + case ts.SyntaxKind.PrefixUnaryExpression: + return parent.operator === ts.SyntaxKind.PlusPlusToken || + parent.operator === ts.SyntaxKind.MinusMinusToken + ? 3 + : 1; + case ts.SyntaxKind.BinaryExpression: + return parent.right === node + ? 1 + : !isAssignmentKind(parent.operatorToken.kind) + ? 1 + : parent.operatorToken.kind === ts.SyntaxKind.EqualsToken + ? 2 + : 3; + case ts.SyntaxKind.ShorthandPropertyAssignment: + return parent.objectAssignmentInitializer === node + ? 1 + : isInDestructuringAssignment(parent) + ? 2 + : 1; + case ts.SyntaxKind.PropertyAssignment: + return parent.name === node + ? 0 + : isInDestructuringAssignment(parent) + ? 2 + : 1; + case ts.SyntaxKind.ArrayLiteralExpression: + case ts.SyntaxKind.SpreadElement: + case ts.SyntaxKind.SpreadAssignment: + return isInDestructuringAssignment(parent) + ? 2 + : 1; + case ts.SyntaxKind.ParenthesizedExpression: + case ts.SyntaxKind.NonNullExpression: + case ts.SyntaxKind.TypeAssertionExpression: + case ts.SyntaxKind.AsExpression: + return getAccessKind(parent); + case ts.SyntaxKind.ForOfStatement: + case ts.SyntaxKind.ForInStatement: + return parent.initializer === node + ? 2 + : 1; + case ts.SyntaxKind.ExpressionWithTypeArguments: + return parent.parent.token === ts.SyntaxKind.ExtendsKeyword && + parent.parent.parent.kind !== ts.SyntaxKind.InterfaceDeclaration + ? 1 + : 0; + case ts.SyntaxKind.ComputedPropertyName: + case ts.SyntaxKind.ExpressionStatement: + case ts.SyntaxKind.TypeOfExpression: + case ts.SyntaxKind.ElementAccessExpression: + case ts.SyntaxKind.ForStatement: + case ts.SyntaxKind.IfStatement: + case ts.SyntaxKind.DoStatement: + case ts.SyntaxKind.WhileStatement: + case ts.SyntaxKind.SwitchStatement: + case ts.SyntaxKind.WithStatement: + case ts.SyntaxKind.ThrowStatement: + case ts.SyntaxKind.CallExpression: + case ts.SyntaxKind.NewExpression: + case ts.SyntaxKind.TaggedTemplateExpression: + case ts.SyntaxKind.JsxExpression: + case ts.SyntaxKind.Decorator: + case ts.SyntaxKind.TemplateSpan: + case ts.SyntaxKind.JsxOpeningElement: + case ts.SyntaxKind.JsxSelfClosingElement: + case ts.SyntaxKind.JsxSpreadAttribute: + case ts.SyntaxKind.VoidExpression: + case ts.SyntaxKind.ReturnStatement: + case ts.SyntaxKind.AwaitExpression: + case ts.SyntaxKind.YieldExpression: + case ts.SyntaxKind.ConditionalExpression: + case ts.SyntaxKind.CaseClause: + case ts.SyntaxKind.JsxElement: + return 1; + case ts.SyntaxKind.ArrowFunction: + return parent.body === node + ? 1 + : 2; + case ts.SyntaxKind.PropertyDeclaration: + case ts.SyntaxKind.VariableDeclaration: + case ts.SyntaxKind.Parameter: + case ts.SyntaxKind.EnumMember: + case ts.SyntaxKind.BindingElement: + case ts.SyntaxKind.JsxAttribute: + return parent.initializer === node + ? 1 + : 0; + case ts.SyntaxKind.PropertyAccessExpression: + return parent.expression === node + ? 1 + : 0; + case ts.SyntaxKind.ExportAssignment: + return parent.isExportEquals + ? 1 + : 0; + } + return 0; +} +exports.getAccessKind = getAccessKind; +function isReassignmentTarget(node) { + return (getAccessKind(node) & 2) !== 0; +} +exports.isReassignmentTarget = isReassignmentTarget; +function canHaveJsDoc(node) { + const kind = node.kind; + switch (kind) { + case ts.SyntaxKind.Parameter: + case ts.SyntaxKind.CallSignature: + case ts.SyntaxKind.ConstructSignature: + case ts.SyntaxKind.MethodSignature: + case ts.SyntaxKind.PropertySignature: + case ts.SyntaxKind.ArrowFunction: + case ts.SyntaxKind.ParenthesizedExpression: + case ts.SyntaxKind.SpreadAssignment: + case ts.SyntaxKind.ShorthandPropertyAssignment: + case ts.SyntaxKind.PropertyAssignment: + case ts.SyntaxKind.FunctionExpression: + case ts.SyntaxKind.FunctionDeclaration: + case ts.SyntaxKind.LabeledStatement: + case ts.SyntaxKind.ExpressionStatement: + case ts.SyntaxKind.VariableStatement: + case ts.SyntaxKind.Constructor: + case ts.SyntaxKind.MethodDeclaration: + case ts.SyntaxKind.PropertyDeclaration: + case ts.SyntaxKind.GetAccessor: + case ts.SyntaxKind.SetAccessor: + case ts.SyntaxKind.ClassDeclaration: + case ts.SyntaxKind.ClassExpression: + case ts.SyntaxKind.InterfaceDeclaration: + case ts.SyntaxKind.TypeAliasDeclaration: + case ts.SyntaxKind.EnumMember: + case ts.SyntaxKind.EnumDeclaration: + case ts.SyntaxKind.ModuleDeclaration: + case ts.SyntaxKind.ImportEqualsDeclaration: + case ts.SyntaxKind.IndexSignature: + case ts.SyntaxKind.FunctionType: + case ts.SyntaxKind.ConstructorType: + case ts.SyntaxKind.JSDocFunctionType: + case ts.SyntaxKind.EndOfFileToken: + case ts.SyntaxKind.ExportDeclaration: + return true; + default: + return false; + } +} +exports.canHaveJsDoc = canHaveJsDoc; +function getJsDoc(node, sourceFile) { + if (node.kind === ts.SyntaxKind.EndOfFileToken) + return parseJsDocWorker(node, sourceFile || node.parent); + const result = []; + for (const child of node.getChildren(sourceFile)) { + if (!node_1.isJsDoc(child)) + break; + result.push(child); + } + return result; +} +exports.getJsDoc = getJsDoc; +function parseJsDocOfNode(node, considerTrailingComments, sourceFile = node.getSourceFile()) { + if (canHaveJsDoc(node) && node.kind !== ts.SyntaxKind.EndOfFileToken) { + const result = getJsDoc(node, sourceFile); + if (result.length !== 0 || !considerTrailingComments) + return result; + } + return parseJsDocWorker(node, sourceFile, considerTrailingComments); +} +exports.parseJsDocOfNode = parseJsDocOfNode; +function parseJsDocWorker(node, sourceFile, considerTrailingComments) { + const nodeStart = node.getStart(sourceFile); + const start = ts[considerTrailingComments && isSameLine(sourceFile, node.pos, nodeStart) + ? 'forEachTrailingCommentRange' + : 'forEachLeadingCommentRange'](sourceFile.text, node.pos, (pos, _end, kind) => kind === ts.SyntaxKind.MultiLineCommentTrivia && sourceFile.text[pos + 2] === '*' ? { pos } : undefined); + if (start === undefined) + return []; + const startPos = start.pos; + const text = sourceFile.text.slice(startPos, nodeStart); + const newSourceFile = ts.createSourceFile('jsdoc.ts', `${text}var a;`, sourceFile.languageVersion); + const result = getJsDoc(newSourceFile.statements[0], newSourceFile); + for (const doc of result) + updateNode(doc, node); + return result; + function updateNode(n, parent) { + n.pos += startPos; + n.end += startPos; + n.parent = parent; + return ts.forEachChild(n, (child) => updateNode(child, n), (children) => { + children.pos += startPos; + children.end += startPos; + for (const child of children) + updateNode(child, n); + }); + } +} +var ImportKind; +(function (ImportKind) { + ImportKind[ImportKind["ImportDeclaration"] = 1] = "ImportDeclaration"; + ImportKind[ImportKind["ImportEquals"] = 2] = "ImportEquals"; + ImportKind[ImportKind["ExportFrom"] = 4] = "ExportFrom"; + ImportKind[ImportKind["DynamicImport"] = 8] = "DynamicImport"; + ImportKind[ImportKind["Require"] = 16] = "Require"; + ImportKind[ImportKind["ImportType"] = 32] = "ImportType"; + ImportKind[ImportKind["All"] = 63] = "All"; + ImportKind[ImportKind["AllImports"] = 59] = "AllImports"; + ImportKind[ImportKind["AllStaticImports"] = 3] = "AllStaticImports"; + ImportKind[ImportKind["AllImportExpressions"] = 24] = "AllImportExpressions"; + ImportKind[ImportKind["AllRequireLike"] = 18] = "AllRequireLike"; + ImportKind[ImportKind["AllNestedImports"] = 56] = "AllNestedImports"; + ImportKind[ImportKind["AllTopLevelImports"] = 7] = "AllTopLevelImports"; +})(ImportKind = exports.ImportKind || (exports.ImportKind = {})); +function findImports(sourceFile, kinds) { + const result = []; + for (const node of findImportLikeNodes(sourceFile, kinds)) { + switch (node.kind) { + case ts.SyntaxKind.ImportDeclaration: + addIfTextualLiteral(node.moduleSpecifier); + break; + case ts.SyntaxKind.ImportEqualsDeclaration: + addIfTextualLiteral(node.moduleReference.expression); + break; + case ts.SyntaxKind.ExportDeclaration: + addIfTextualLiteral(node.moduleSpecifier); + break; + case ts.SyntaxKind.CallExpression: + addIfTextualLiteral(node.arguments[0]); + break; + case ts.SyntaxKind.ImportType: + if (node_1.isLiteralTypeNode(node.argument)) + addIfTextualLiteral(node.argument.literal); + break; + default: + throw new Error('unexpected node'); + } + } + return result; + function addIfTextualLiteral(node) { + if (node_1.isTextualLiteral(node)) + result.push(node); + } +} +exports.findImports = findImports; +function findImportLikeNodes(sourceFile, kinds) { + return new ImportFinder(sourceFile, kinds).find(); +} +exports.findImportLikeNodes = findImportLikeNodes; +class ImportFinder { + constructor(_sourceFile, _options) { + this._sourceFile = _sourceFile; + this._options = _options; + this._result = []; + } + find() { + if (this._sourceFile.isDeclarationFile) + this._options &= ~24; + if (this._options & 7) + this._findImports(this._sourceFile.statements); + if (this._options & 56) + this._findNestedImports(); + return this._result; + } + _findImports(statements) { + for (const statement of statements) { + if (node_1.isImportDeclaration(statement)) { + if (this._options & 1) + this._result.push(statement); + } + else if (node_1.isImportEqualsDeclaration(statement)) { + if (this._options & 2 && + statement.moduleReference.kind === ts.SyntaxKind.ExternalModuleReference) + this._result.push(statement); + } + else if (node_1.isExportDeclaration(statement)) { + if (statement.moduleSpecifier !== undefined && this._options & 4) + this._result.push(statement); + } + else if (node_1.isModuleDeclaration(statement)) { + this._findImportsInModule(statement); + } + } + } + _findImportsInModule(declaration) { + if (declaration.body === undefined) + return; + if (declaration.body.kind === ts.SyntaxKind.ModuleDeclaration) + return this._findImportsInModule(declaration.body); + this._findImports(declaration.body.statements); + } + _findNestedImports() { + let re; + if ((this._options & 56) === 16) { + re = /\brequire\s*[ { + if (kind === ts.SyntaxKind.SingleLineCommentTrivia) { + const text = source.slice(pos, end); + const match = /^\/{2,3}\s*@ts-(no)?check(?:\s|$)/i.exec(text); + if (match !== null) + directive = { pos, end, enabled: match[1] === undefined }; + } + }); + return directive; +} +exports.getCheckJsDirective = getCheckJsDirective; +function isConstAssertion(node) { + return node_1.isTypeReferenceNode(node.type) && + node.type.typeName.kind === ts.SyntaxKind.Identifier && + node.type.typeName.escapedText === 'const'; +} +exports.isConstAssertion = isConstAssertion; +function isInConstContext(node) { + let current = node; + while (true) { + const parent = current.parent; + outer: switch (parent.kind) { + case ts.SyntaxKind.TypeAssertionExpression: + case ts.SyntaxKind.AsExpression: + return isConstAssertion(parent); + case ts.SyntaxKind.PrefixUnaryExpression: + if (current.kind !== ts.SyntaxKind.NumericLiteral) + return false; + switch (parent.operator) { + case ts.SyntaxKind.PlusToken: + case ts.SyntaxKind.MinusToken: + current = parent; + break outer; + default: + return false; + } + case ts.SyntaxKind.PropertyAssignment: + if (parent.initializer !== current) + return false; + current = parent.parent; + break; + case ts.SyntaxKind.ShorthandPropertyAssignment: + current = parent.parent; + break; + case ts.SyntaxKind.ParenthesizedExpression: + case ts.SyntaxKind.ArrayLiteralExpression: + case ts.SyntaxKind.ObjectLiteralExpression: + current = parent; + break; + default: + return false; + } + } +} +exports.isInConstContext = isInConstContext; +function isReadonlyAssignmentDeclaration(node, checker) { + if (!isBindableObjectDefinePropertyCall(node)) + return false; + const descriptorType = checker.getTypeAtLocation(node.arguments[2]); + if (descriptorType.getProperty('value') === undefined) + return descriptorType.getProperty('set') === undefined; + const writableProp = descriptorType.getProperty('writable'); + if (writableProp === undefined) + return false; + const writableType = writableProp.valueDeclaration !== undefined && node_1.isPropertyAssignment(writableProp.valueDeclaration) + ? checker.getTypeAtLocation(writableProp.valueDeclaration.initializer) + : checker.getTypeOfSymbolAtLocation(writableProp, node.arguments[2]); + return type_1.isBooleanLiteralType(writableType, false); +} +exports.isReadonlyAssignmentDeclaration = isReadonlyAssignmentDeclaration; +function isBindableObjectDefinePropertyCall(node) { + return node.arguments.length === 3 && + node_1.isEntityNameExpression(node.arguments[0]) && + node_1.isNumericOrStringLikeLiteral(node.arguments[1]) && + node_1.isPropertyAccessExpression(node.expression) && + node.expression.name.escapedText === 'defineProperty' && + node_1.isIdentifier(node.expression.expression) && + node.expression.expression.escapedText === 'Object'; +} +exports.isBindableObjectDefinePropertyCall = isBindableObjectDefinePropertyCall; +function isWellKnownSymbolLiterally(node) { + return ts.isPropertyAccessExpression(node) && + ts.isIdentifier(node.expression) && + node.expression.escapedText === 'Symbol'; +} +exports.isWellKnownSymbolLiterally = isWellKnownSymbolLiterally; +function getPropertyNameOfWellKnownSymbol(node) { + return { + displayName: `[Symbol.${node.name.text}]`, + symbolName: ('__@' + node.name.text), + }; +} +exports.getPropertyNameOfWellKnownSymbol = getPropertyNameOfWellKnownSymbol; +function getLateBoundPropertyNames(node, checker) { + const result = { + known: true, + names: [], + }; + node = unwrapParentheses(node); + if (isWellKnownSymbolLiterally(node)) { + result.names.push(getPropertyNameOfWellKnownSymbol(node)); + } + else { + const type = checker.getTypeAtLocation(node); + for (const key of type_1.unionTypeParts(checker.getBaseConstraintOfType(type) || type)) { + const propertyName = type_1.getPropertyNameFromType(key); + if (propertyName) { + result.names.push(propertyName); + } + else { + result.known = false; + } + } + } + return result; +} +exports.getLateBoundPropertyNames = getLateBoundPropertyNames; +function getLateBoundPropertyNamesOfPropertyName(node, checker) { + const staticName = getPropertyName(node); + return staticName !== undefined + ? { known: true, names: [{ displayName: staticName, symbolName: ts.escapeLeadingUnderscores(staticName) }] } + : getLateBoundPropertyNames(node.expression, checker); +} +exports.getLateBoundPropertyNamesOfPropertyName = getLateBoundPropertyNamesOfPropertyName; +function getSingleLateBoundPropertyNameOfPropertyName(node, checker) { + const staticName = getPropertyName(node); + if (staticName !== undefined) + return { displayName: staticName, symbolName: ts.escapeLeadingUnderscores(staticName) }; + const { expression } = node; + return isWellKnownSymbolLiterally(expression) + ? getPropertyNameOfWellKnownSymbol(expression) + : type_1.getPropertyNameFromType(checker.getTypeAtLocation(expression)); +} +exports.getSingleLateBoundPropertyNameOfPropertyName = getSingleLateBoundPropertyNameOfPropertyName; +function unwrapParentheses(node) { + while (node.kind === ts.SyntaxKind.ParenthesizedExpression) + node = node.expression; + return node; +} +exports.unwrapParentheses = unwrapParentheses; diff --git a/node_modules/tslint-eslint-rules/package.json b/node_modules/tslint-eslint-rules/package.json new file mode 100644 index 000000000..e8bfc7400 --- /dev/null +++ b/node_modules/tslint-eslint-rules/package.json @@ -0,0 +1,50 @@ +{ + "name": "tslint-eslint-rules", + "version": "5.4.0", + "description": "Improve your TSLint with the missing ESLint Rules", + "main": "index.js", + "scripts": { + "test": "gulp test && gulp self-lint" + }, + "repository": { + "type": "git", + "url": "https://github.com/buzinas/tslint-eslint-rules.git" + }, + "keywords": [ + "eslint", + "tslint", + "custom-rules", + "rules", + "stylish", + "lint", + "linting", + "linter", + "tslint-plugin" + ], + "author": "Vitor Buzinaro ", + "license": "MIT", + "devDependencies": { + "@types/benchmark": "^1.0.30", + "@types/node": "^7.0.12", + "benchmark": "^2.1.3", + "chai": "^3.5.0", + "es6-promise": "^4.0.4", + "gulp": "^3.9.1", + "gulp-sourcemaps": "^1.6.0", + "gulp-spawn-mocha": "^2.2.2", + "gulp-tslint": "^8.0.0", + "gulp-typescript": "^3.1.6", + "tslint": "^5.9.1", + "typescript": "^3.0.1", + "yargs": "^5.0.0" + }, + "peerDependencies": { + "tslint": "^5.0.0", + "typescript": "^2.2.0 || ^3.0.0" + }, + "dependencies": { + "doctrine": "0.7.2", + "tslib": "1.9.0", + "tsutils": "^3.0.0" + } +} \ No newline at end of file diff --git a/package-lock.json b/package-lock.json index b9d9e31ab..0039f537e 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1173,6 +1173,24 @@ "path-type": "^4.0.0" } }, + "doctrine": { + "version": "0.7.2", + "resolved": "https://registry.npmjs.org/doctrine/-/doctrine-0.7.2.tgz", + "integrity": "sha1-fLhgNZujvpDgQLJrcpzkv6ZUxSM=", + "dev": true, + "requires": { + "esutils": "^1.1.6", + "isarray": "0.0.1" + }, + "dependencies": { + "esutils": { + "version": "1.1.6", + "resolved": "https://registry.npmjs.org/esutils/-/esutils-1.1.6.tgz", + "integrity": "sha1-wBzKqa5LiXxtDD4hCuUvPHqEQ3U=", + "dev": true + } + } + }, "dot-prop": { "version": "5.2.0", "resolved": "https://registry.npmjs.org/dot-prop/-/dot-prop-5.2.0.tgz", @@ -1644,6 +1662,12 @@ "integrity": "sha512-VjSeb/lHmkoyd8ryPVIKvOCn4D1koMqY+vqyjjUfc3xyKtP4dYOxM44sZrnqQSzSds3xyOrUTLTC9LVCVgLngw==", "dev": true }, + "isarray": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/isarray/-/isarray-0.0.1.tgz", + "integrity": "sha1-ihis/Kmo9Bd+Cav8YDiTmwXR7t8=", + "dev": true + }, "isexe": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", @@ -2832,6 +2856,34 @@ } } }, + "tslint-eslint-rules": { + "version": "5.4.0", + "resolved": "https://registry.npmjs.org/tslint-eslint-rules/-/tslint-eslint-rules-5.4.0.tgz", + "integrity": "sha512-WlSXE+J2vY/VPgIcqQuijMQiel+UtmXS+4nvK4ZzlDiqBfXse8FAvkNnTcYhnQyOTW5KFM+uRRGXxYhFpuBc6w==", + "dev": true, + "requires": { + "doctrine": "0.7.2", + "tslib": "1.9.0", + "tsutils": "^3.0.0" + }, + "dependencies": { + "tslib": { + "version": "1.9.0", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.9.0.tgz", + "integrity": "sha512-f/qGG2tUkrISBlQZEjEqoZ3B2+npJjIf04H1wuAv9iA8i04Icp+61KRXxFdha22670NJopsZCIjhC3SnjPRKrQ==", + "dev": true + }, + "tsutils": { + "version": "3.17.1", + "resolved": "https://registry.npmjs.org/tsutils/-/tsutils-3.17.1.tgz", + "integrity": "sha512-kzeQ5B8H3w60nFY2g8cJIuH7JDpsALXySGtwGJ0p2LSjLgay3NdIpqq5SoOBe46bKDW2iq25irHCr8wjomUS2g==", + "dev": true, + "requires": { + "tslib": "^1.8.1" + } + } + } + }, "tsutils": { "version": "2.29.0", "resolved": "https://registry.npmjs.org/tsutils/-/tsutils-2.29.0.tgz", diff --git a/package.json b/package.json index 752860cb9..caedc7113 100644 --- a/package.json +++ b/package.json @@ -50,6 +50,7 @@ "nock": "^12.0.3", "removeNPMAbsolutePaths": "2.0.0", "tslint": "^6.1.0", + "tslint-eslint-rules": "^5.4.0", "typescript": "^3.7.5" } } \ No newline at end of file diff --git a/tslint.json b/tslint.json index bffc6bb28..3951a9fb3 100644 --- a/tslint.json +++ b/tslint.json @@ -2,6 +2,9 @@ "extends": [ "tslint" ], + "rulesDirectory": [ + "./node_modules/tslint-eslint-rules/dist/rules/" + ], "rules": { "align": [ true, @@ -17,9 +20,9 @@ "curly": false, "eofline": true, "forin": true, - "indent": [ + "ter-indent": [ true, - "spaces" + 2 ], "jsdoc-format": true, "label-position": true, @@ -138,4 +141,4 @@ "check-type" ] } -} \ No newline at end of file +}