From dcbd44758cd6f3df0ba3a337f9e1e9922fb9de2d Mon Sep 17 00:00:00 2001 From: cjihrig Date: Fri, 9 Oct 2020 16:48:11 -0400 Subject: [PATCH] tools: update ESLint to 7.11.0 Update ESLint to 7.11.0 PR-URL: https://github.com/nodejs/node/pull/35578 Reviewed-By: Rich Trott Reviewed-By: Luigi Pinca Reviewed-By: Trivikram Kamat --- tools/node_modules/eslint/README.md | 4 +- .../lib/rules/function-paren-newline.js | 2 +- .../eslint/lib/rules/max-lines.js | 8 + .../eslint/lib/rules/no-extra-parens.js | 17 +- .../node_modules/@types/color-name/LICENSE | 21 -- .../node_modules/@types/color-name/README.md | 16 - .../@types/color-name/package.json | 28 -- .../eslint/node_modules/acorn/dist/acorn.js | 4 +- .../eslint/node_modules/acorn/dist/acorn.mjs | 4 +- .../eslint/node_modules/acorn/package.json | 4 +- .../node_modules/ansi-styles/package.json | 3 +- .../chalk/node_modules/ansi-styles/readme.md | 16 +- .../node_modules/eslint-visitor-keys/LICENSE | 201 +++++++++++++ .../eslint-visitor-keys/README.md | 98 ++++++ .../eslint-visitor-keys/lib/index.js | 81 +++++ .../eslint-visitor-keys/lib/visitor-keys.json | 284 ++++++++++++++++++ .../eslint-visitor-keys/package.json | 48 +++ .../eslint-visitor-keys/package.json | 7 +- .../node_modules/eslint-visitor-keys/LICENSE | 201 +++++++++++++ .../eslint-visitor-keys/README.md | 98 ++++++ .../eslint-visitor-keys/lib/index.js | 81 +++++ .../eslint-visitor-keys/lib/visitor-keys.json | 284 ++++++++++++++++++ .../eslint-visitor-keys/package.json | 48 +++ tools/node_modules/eslint/package.json | 5 +- 24 files changed, 1469 insertions(+), 94 deletions(-) delete mode 100644 tools/node_modules/eslint/node_modules/@types/color-name/LICENSE delete mode 100644 tools/node_modules/eslint/node_modules/@types/color-name/README.md delete mode 100644 tools/node_modules/eslint/node_modules/@types/color-name/package.json create mode 100644 tools/node_modules/eslint/node_modules/eslint-utils/node_modules/eslint-visitor-keys/LICENSE create mode 100644 tools/node_modules/eslint/node_modules/eslint-utils/node_modules/eslint-visitor-keys/README.md create mode 100644 tools/node_modules/eslint/node_modules/eslint-utils/node_modules/eslint-visitor-keys/lib/index.js create mode 100644 tools/node_modules/eslint/node_modules/eslint-utils/node_modules/eslint-visitor-keys/lib/visitor-keys.json create mode 100644 tools/node_modules/eslint/node_modules/eslint-utils/node_modules/eslint-visitor-keys/package.json create mode 100644 tools/node_modules/eslint/node_modules/espree/node_modules/eslint-visitor-keys/LICENSE create mode 100644 tools/node_modules/eslint/node_modules/espree/node_modules/eslint-visitor-keys/README.md create mode 100644 tools/node_modules/eslint/node_modules/espree/node_modules/eslint-visitor-keys/lib/index.js create mode 100644 tools/node_modules/eslint/node_modules/espree/node_modules/eslint-visitor-keys/lib/visitor-keys.json create mode 100644 tools/node_modules/eslint/node_modules/espree/node_modules/eslint-visitor-keys/package.json diff --git a/tools/node_modules/eslint/README.md b/tools/node_modules/eslint/README.md index 1f778efdf4b8d1..8095aca2aacdc3 100644 --- a/tools/node_modules/eslint/README.md +++ b/tools/node_modules/eslint/README.md @@ -1,4 +1,4 @@ -[![NPM version](https://img.shields.io/npm/v/eslint.svg)](https://www.npmjs.com/package/eslint) +[![npm version](https://img.shields.io/npm/v/eslint.svg)](https://www.npmjs.com/package/eslint) [![Downloads](https://img.shields.io/npm/dm/eslint.svg)](https://www.npmjs.com/package/eslint) [![Build Status](https://github.com/eslint/eslint/workflows/CI/badge.svg)](https://github.com/eslint/eslint/actions) [![FOSSA Status](https://app.fossa.io/api/projects/git%2Bhttps%3A%2F%2Fgithub.com%2Feslint%2Feslint.svg?type=shield)](https://app.fossa.io/projects/git%2Bhttps%3A%2F%2Fgithub.com%2Feslint%2Feslint?ref=badge_shield) @@ -251,7 +251,7 @@ The following companies, organizations, and individuals support ESLint's ongoing

Gold Sponsors

Salesforce Airbnb Microsoft FOSS Fund Sponsorships

Silver Sponsors

Liftoff AMP Project

Bronze Sponsors

-

2021 calendar Buy.Fineproxy.Org Veikkaajat.com Nettikasinot.media My True Media Norgekasino Japanesecasino CasinoTop.com Casino Topp Anagram Solver Kasinot.fi Pelisivut Nettikasinot.org BonusFinder Deutschland Bugsnag Stability Monitoring Mixpanel VPS Server Icons8: free icons, photos, illustrations, and music Discord ThemeIsle Marfeel Fire Stick Tricks

+

Writers Per Hour 2021 calendar Buy.Fineproxy.Org Veikkaajat.com Nettikasinot.media Norgekasino Japanesecasino CasinoTop.com Casino Topp Anagram Solver Kasinot.fi Pelisivut Nettikasinot.org BonusFinder Deutschland Bugsnag Stability Monitoring Mixpanel VPS Server Icons8: free icons, photos, illustrations, and music Discord ThemeIsle Marfeel Fire Stick Tricks

## Technology Sponsors diff --git a/tools/node_modules/eslint/lib/rules/function-paren-newline.js b/tools/node_modules/eslint/lib/rules/function-paren-newline.js index 894c8e331a7168..9d8d67ba14148d 100644 --- a/tools/node_modules/eslint/lib/rules/function-paren-newline.js +++ b/tools/node_modules/eslint/lib/rules/function-paren-newline.js @@ -218,7 +218,7 @@ module.exports = { } case "ArrowFunctionExpression": { - const firstToken = sourceCode.getFirstToken(node); + const firstToken = sourceCode.getFirstToken(node, { skip: (node.async ? 1 : 0) }); if (!astUtils.isOpeningParenToken(firstToken)) { diff --git a/tools/node_modules/eslint/lib/rules/max-lines.js b/tools/node_modules/eslint/lib/rules/max-lines.js index 299377bc2dddfc..a9a793f1dedded 100644 --- a/tools/node_modules/eslint/lib/rules/max-lines.js +++ b/tools/node_modules/eslint/lib/rules/max-lines.js @@ -120,6 +120,14 @@ module.exports = { "Program:exit"() { let lines = sourceCode.lines.map((text, i) => ({ lineNumber: i + 1, text })); + /* + * If file ends with a linebreak, `sourceCode.lines` will have one extra empty line at the end. + * That isn't a real line, so we shouldn't count it. + */ + if (lines.length > 1 && lodash.last(lines).text === "") { + lines.pop(); + } + if (skipBlankLines) { lines = lines.filter(l => l.text.trim() !== ""); } diff --git a/tools/node_modules/eslint/lib/rules/no-extra-parens.js b/tools/node_modules/eslint/lib/rules/no-extra-parens.js index 0077ea4f6988e5..a7b2f79043df1f 100644 --- a/tools/node_modules/eslint/lib/rules/no-extra-parens.js +++ b/tools/node_modules/eslint/lib/rules/no-extra-parens.js @@ -1091,7 +1091,22 @@ module.exports = { }, UnaryExpression: checkArgumentWithPrecedence, - UpdateExpression: checkArgumentWithPrecedence, + UpdateExpression(node) { + if (node.prefix) { + checkArgumentWithPrecedence(node); + } else { + const { argument } = node; + const operatorToken = sourceCode.getLastToken(node); + + if (argument.loc.end.line === operatorToken.loc.start.line) { + checkArgumentWithPrecedence(node); + } else { + if (hasDoubleExcessParens(argument)) { + report(argument); + } + } + } + }, AwaitExpression: checkArgumentWithPrecedence, VariableDeclarator(node) { diff --git a/tools/node_modules/eslint/node_modules/@types/color-name/LICENSE b/tools/node_modules/eslint/node_modules/@types/color-name/LICENSE deleted file mode 100644 index 4b1ad51b2f0efc..00000000000000 --- a/tools/node_modules/eslint/node_modules/@types/color-name/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ - MIT License - - Copyright (c) Microsoft Corporation. All rights reserved. - - 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/tools/node_modules/eslint/node_modules/@types/color-name/README.md b/tools/node_modules/eslint/node_modules/@types/color-name/README.md deleted file mode 100644 index 5c77cba829c5bd..00000000000000 --- a/tools/node_modules/eslint/node_modules/@types/color-name/README.md +++ /dev/null @@ -1,16 +0,0 @@ -# Installation -> `npm install --save @types/color-name` - -# Summary -This package contains type definitions for color-name ( https://github.com/colorjs/color-name ). - -# Details -Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/color-name - -Additional Details - * Last updated: Wed, 13 Feb 2019 16:16:48 GMT - * Dependencies: none - * Global values: none - -# Credits -These definitions were written by Junyoung Clare Jang . diff --git a/tools/node_modules/eslint/node_modules/@types/color-name/package.json b/tools/node_modules/eslint/node_modules/@types/color-name/package.json deleted file mode 100644 index e51c1af26a6c95..00000000000000 --- a/tools/node_modules/eslint/node_modules/@types/color-name/package.json +++ /dev/null @@ -1,28 +0,0 @@ -{ - "bugs": { - "url": "https://github.com/DefinitelyTyped/DefinitelyTyped/issues" - }, - "bundleDependencies": false, - "contributors": [ - { - "name": "Junyoung Clare Jang", - "url": "https://github.com/Ailrun" - } - ], - "dependencies": {}, - "deprecated": false, - "description": "TypeScript definitions for color-name", - "homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped#readme", - "license": "MIT", - "main": "", - "name": "@types/color-name", - "repository": { - "type": "git", - "url": "git+https://github.com/DefinitelyTyped/DefinitelyTyped.git" - }, - "scripts": {}, - "typeScriptVersion": "2.0", - "types": "index", - "typesPublisherContentHash": "e22c6881e2dcf766e32142cbb82d9acf9c08258bdf0da8e76c8a448d1be44ac7", - "version": "1.1.1" -} \ No newline at end of file diff --git a/tools/node_modules/eslint/node_modules/acorn/dist/acorn.js b/tools/node_modules/eslint/node_modules/acorn/dist/acorn.js index cef695f96527df..d204f2669fd275 100644 --- a/tools/node_modules/eslint/node_modules/acorn/dist/acorn.js +++ b/tools/node_modules/eslint/node_modules/acorn/dist/acorn.js @@ -593,7 +593,7 @@ // ## Parser utilities - var literal = /^(?:'((?:\\.|[^'])*?)'|"((?:\\.|[^"])*?)")/; + var literal = /^(?:'((?:\\.|[^'\\])*?)'|"((?:\\.|[^"\\])*?)")/; pp.strictDirective = function(start) { for (;;) { // Try to find string literal. @@ -5022,7 +5022,7 @@ // Acorn is a tiny, fast JavaScript parser written in JavaScript. - var version = "7.1.0"; + var version = "7.4.1"; Parser.acorn = { Parser: Parser, diff --git a/tools/node_modules/eslint/node_modules/acorn/dist/acorn.mjs b/tools/node_modules/eslint/node_modules/acorn/dist/acorn.mjs index 09b4b7477e74fa..b7f19d35fe7517 100644 --- a/tools/node_modules/eslint/node_modules/acorn/dist/acorn.mjs +++ b/tools/node_modules/eslint/node_modules/acorn/dist/acorn.mjs @@ -587,7 +587,7 @@ var pp = Parser.prototype; // ## Parser utilities -var literal = /^(?:'((?:\\.|[^'])*?)'|"((?:\\.|[^"])*?)")/; +var literal = /^(?:'((?:\\.|[^'\\])*?)'|"((?:\\.|[^"\\])*?)")/; pp.strictDirective = function(start) { for (;;) { // Try to find string literal. @@ -5016,7 +5016,7 @@ pp$9.readWord = function() { // Acorn is a tiny, fast JavaScript parser written in JavaScript. -var version = "7.1.0"; +var version = "7.4.1"; Parser.acorn = { Parser: Parser, diff --git a/tools/node_modules/eslint/node_modules/acorn/package.json b/tools/node_modules/eslint/node_modules/acorn/package.json index 960e7b1fdbf09d..aabffb87c4079c 100644 --- a/tools/node_modules/eslint/node_modules/acorn/package.json +++ b/tools/node_modules/eslint/node_modules/acorn/package.json @@ -40,5 +40,5 @@ "prepare": "cd ..; npm run build:main && npm run build:bin" }, "types": "dist/acorn.d.ts", - "version": "7.2.0" -} \ No newline at end of file + "version": "7.4.1" +} diff --git a/tools/node_modules/eslint/node_modules/chalk/node_modules/ansi-styles/package.json b/tools/node_modules/eslint/node_modules/chalk/node_modules/ansi-styles/package.json index 2b0aef0e49e6e8..d276e03d2549c8 100644 --- a/tools/node_modules/eslint/node_modules/chalk/node_modules/ansi-styles/package.json +++ b/tools/node_modules/eslint/node_modules/chalk/node_modules/ansi-styles/package.json @@ -9,7 +9,6 @@ }, "bundleDependencies": false, "dependencies": { - "@types/color-name": "^1.1.1", "color-convert": "^2.0.1" }, "deprecated": false, @@ -62,5 +61,5 @@ "screenshot": "svg-term --command='node screenshot' --out=screenshot.svg --padding=3 --width=55 --height=3 --at=1000 --no-cursor", "test": "xo && ava && tsd" }, - "version": "4.2.1" + "version": "4.3.0" } \ No newline at end of file diff --git a/tools/node_modules/eslint/node_modules/chalk/node_modules/ansi-styles/readme.md b/tools/node_modules/eslint/node_modules/chalk/node_modules/ansi-styles/readme.md index 2a1ef654667d3f..24883de808be6a 100644 --- a/tools/node_modules/eslint/node_modules/chalk/node_modules/ansi-styles/readme.md +++ b/tools/node_modules/eslint/node_modules/chalk/node_modules/ansi-styles/readme.md @@ -145,14 +145,8 @@ style.bgColor.ansi16m.hex('#C0FFEE'); // Hex (RGB) to 16 million color backgroun - [Sindre Sorhus](https://github.com/sindresorhus) - [Josh Junon](https://github.com/qix-) ---- - -
- - Get professional support for this package with a Tidelift subscription - -
- - Tidelift helps make open source sustainable for maintainers while giving companies
assurances about security, maintenance, and licensing for their dependencies. -
-
+## For enterprise + +Available as part of the Tidelift Subscription. + +The maintainers of `ansi-styles` and thousands of other packages are working with Tidelift to deliver commercial support and maintenance for the open source dependencies you use to build your applications. Save time, reduce risk, and improve code health, while paying the maintainers of the exact dependencies you use. [Learn more.](https://tidelift.com/subscription/pkg/npm-ansi-styles?utm_source=npm-ansi-styles&utm_medium=referral&utm_campaign=enterprise&utm_term=repo) diff --git a/tools/node_modules/eslint/node_modules/eslint-utils/node_modules/eslint-visitor-keys/LICENSE b/tools/node_modules/eslint/node_modules/eslint-utils/node_modules/eslint-visitor-keys/LICENSE new file mode 100644 index 00000000000000..17a25538d9bd63 --- /dev/null +++ b/tools/node_modules/eslint/node_modules/eslint-utils/node_modules/eslint-visitor-keys/LICENSE @@ -0,0 +1,201 @@ + 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 contributors + + 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/tools/node_modules/eslint/node_modules/eslint-utils/node_modules/eslint-visitor-keys/README.md b/tools/node_modules/eslint/node_modules/eslint-utils/node_modules/eslint-visitor-keys/README.md new file mode 100644 index 00000000000000..250f5fa31a681d --- /dev/null +++ b/tools/node_modules/eslint/node_modules/eslint-utils/node_modules/eslint-visitor-keys/README.md @@ -0,0 +1,98 @@ +# eslint-visitor-keys + +[![npm version](https://img.shields.io/npm/v/eslint-visitor-keys.svg)](https://www.npmjs.com/package/eslint-visitor-keys) +[![Downloads/month](https://img.shields.io/npm/dm/eslint-visitor-keys.svg)](http://www.npmtrends.com/eslint-visitor-keys) +[![Build Status](https://travis-ci.org/eslint/eslint-visitor-keys.svg?branch=master)](https://travis-ci.org/eslint/eslint-visitor-keys) +[![Dependency Status](https://david-dm.org/eslint/eslint-visitor-keys.svg)](https://david-dm.org/eslint/eslint-visitor-keys) + +Constants and utilities about visitor keys to traverse AST. + +## 💿 Installation + +Use [npm] to install. + +```bash +$ npm install eslint-visitor-keys +``` + +### Requirements + +- [Node.js] 4.0.0 or later. + +## 📖 Usage + +```js +const evk = require("eslint-visitor-keys") +``` + +### evk.KEYS + +> type: `{ [type: string]: string[] | undefined }` + +Visitor keys. This keys are frozen. + +This is an object. Keys are the type of [ESTree] nodes. Their values are an array of property names which have child nodes. + +For example: + +``` +console.log(evk.KEYS.AssignmentExpression) // → ["left", "right"] +``` + +### evk.getKeys(node) + +> type: `(node: object) => string[]` + +Get the visitor keys of a given AST node. + +This is similar to `Object.keys(node)` of ES Standard, but some keys are excluded: `parent`, `leadingComments`, `trailingComments`, and names which start with `_`. + +This will be used to traverse unknown nodes. + +For example: + +``` +const node = { + type: "AssignmentExpression", + left: { type: "Identifier", name: "foo" }, + right: { type: "Literal", value: 0 } +} +console.log(evk.getKeys(node)) // → ["type", "left", "right"] +``` + +### evk.unionWith(additionalKeys) + +> type: `(additionalKeys: object) => { [type: string]: string[] | undefined }` + +Make the union set with `evk.KEYS` and the given keys. + +- The order of keys is, `additionalKeys` is at first, then `evk.KEYS` is concatenated after that. +- It removes duplicated keys as keeping the first one. + +For example: + +``` +console.log(evk.unionWith({ + MethodDefinition: ["decorators"] +})) // → { ..., MethodDefinition: ["decorators", "key", "value"], ... } +``` + +## 📰 Change log + +See [GitHub releases](https://github.com/eslint/eslint-visitor-keys/releases). + +## 🍻 Contributing + +Welcome. See [ESLint contribution guidelines](https://eslint.org/docs/developer-guide/contributing/). + +### Development commands + +- `npm test` runs tests and measures code coverage. +- `npm run lint` checks source codes with ESLint. +- `npm run coverage` opens the code coverage report of the previous test with your default browser. +- `npm run release` publishes this package to [npm] registory. + + +[npm]: https://www.npmjs.com/ +[Node.js]: https://nodejs.org/en/ +[ESTree]: https://github.com/estree/estree diff --git a/tools/node_modules/eslint/node_modules/eslint-utils/node_modules/eslint-visitor-keys/lib/index.js b/tools/node_modules/eslint/node_modules/eslint-utils/node_modules/eslint-visitor-keys/lib/index.js new file mode 100644 index 00000000000000..cd8a3260834dcd --- /dev/null +++ b/tools/node_modules/eslint/node_modules/eslint-utils/node_modules/eslint-visitor-keys/lib/index.js @@ -0,0 +1,81 @@ +/** + * @author Toru Nagashima + * See LICENSE file in root directory for full license. + */ +"use strict"; + +const KEYS = require("./visitor-keys.json"); + +// Types. +const NODE_TYPES = Object.freeze(Object.keys(KEYS)); + +// Freeze the keys. +for (const type of NODE_TYPES) { + Object.freeze(KEYS[type]); +} +Object.freeze(KEYS); + +// List to ignore keys. +const KEY_BLACKLIST = new Set([ + "parent", + "leadingComments", + "trailingComments" +]); + +/** + * Check whether a given key should be used or not. + * @param {string} key The key to check. + * @returns {boolean} `true` if the key should be used. + */ +function filterKey(key) { + return !KEY_BLACKLIST.has(key) && key[0] !== "_"; +} + +//------------------------------------------------------------------------------ +// Public interfaces +//------------------------------------------------------------------------------ + +module.exports = Object.freeze({ + + /** + * Visitor keys. + * @type {{ [type: string]: string[] | undefined }} + */ + KEYS, + + /** + * Get visitor keys of a given node. + * @param {Object} node The AST node to get keys. + * @returns {string[]} Visitor keys of the node. + */ + getKeys(node) { + return Object.keys(node).filter(filterKey); + }, + + // Disable valid-jsdoc rule because it reports syntax error on the type of @returns. + // eslint-disable-next-line valid-jsdoc + /** + * Make the union set with `KEYS` and given keys. + * @param {Object} additionalKeys The additional keys. + * @returns {{ [type: string]: string[] | undefined }} The union set. + */ + unionWith(additionalKeys) { + const retv = Object.assign({}, KEYS); + + for (const type of Object.keys(additionalKeys)) { + if (retv.hasOwnProperty(type)) { + const keys = new Set(additionalKeys[type]); + + for (const key of retv[type]) { + keys.add(key); + } + + retv[type] = Object.freeze(Array.from(keys)); + } else { + retv[type] = Object.freeze(Array.from(additionalKeys[type])); + } + } + + return Object.freeze(retv); + } +}); diff --git a/tools/node_modules/eslint/node_modules/eslint-utils/node_modules/eslint-visitor-keys/lib/visitor-keys.json b/tools/node_modules/eslint/node_modules/eslint-utils/node_modules/eslint-visitor-keys/lib/visitor-keys.json new file mode 100644 index 00000000000000..a33bbc66005b6a --- /dev/null +++ b/tools/node_modules/eslint/node_modules/eslint-utils/node_modules/eslint-visitor-keys/lib/visitor-keys.json @@ -0,0 +1,284 @@ +{ + "AssignmentExpression": [ + "left", + "right" + ], + "AssignmentPattern": [ + "left", + "right" + ], + "ArrayExpression": [ + "elements" + ], + "ArrayPattern": [ + "elements" + ], + "ArrowFunctionExpression": [ + "params", + "body" + ], + "AwaitExpression": [ + "argument" + ], + "BlockStatement": [ + "body" + ], + "BinaryExpression": [ + "left", + "right" + ], + "BreakStatement": [ + "label" + ], + "CallExpression": [ + "callee", + "arguments" + ], + "CatchClause": [ + "param", + "body" + ], + "ChainExpression": [ + "expression" + ], + "ClassBody": [ + "body" + ], + "ClassDeclaration": [ + "id", + "superClass", + "body" + ], + "ClassExpression": [ + "id", + "superClass", + "body" + ], + "ConditionalExpression": [ + "test", + "consequent", + "alternate" + ], + "ContinueStatement": [ + "label" + ], + "DebuggerStatement": [], + "DoWhileStatement": [ + "body", + "test" + ], + "EmptyStatement": [], + "ExportAllDeclaration": [ + "exported", + "source" + ], + "ExportDefaultDeclaration": [ + "declaration" + ], + "ExportNamedDeclaration": [ + "declaration", + "specifiers", + "source" + ], + "ExportSpecifier": [ + "exported", + "local" + ], + "ExpressionStatement": [ + "expression" + ], + "ExperimentalRestProperty": [ + "argument" + ], + "ExperimentalSpreadProperty": [ + "argument" + ], + "ForStatement": [ + "init", + "test", + "update", + "body" + ], + "ForInStatement": [ + "left", + "right", + "body" + ], + "ForOfStatement": [ + "left", + "right", + "body" + ], + "FunctionDeclaration": [ + "id", + "params", + "body" + ], + "FunctionExpression": [ + "id", + "params", + "body" + ], + "Identifier": [], + "IfStatement": [ + "test", + "consequent", + "alternate" + ], + "ImportDeclaration": [ + "specifiers", + "source" + ], + "ImportDefaultSpecifier": [ + "local" + ], + "ImportExpression": [ + "source" + ], + "ImportNamespaceSpecifier": [ + "local" + ], + "ImportSpecifier": [ + "imported", + "local" + ], + "JSXAttribute": [ + "name", + "value" + ], + "JSXClosingElement": [ + "name" + ], + "JSXElement": [ + "openingElement", + "children", + "closingElement" + ], + "JSXEmptyExpression": [], + "JSXExpressionContainer": [ + "expression" + ], + "JSXIdentifier": [], + "JSXMemberExpression": [ + "object", + "property" + ], + "JSXNamespacedName": [ + "namespace", + "name" + ], + "JSXOpeningElement": [ + "name", + "attributes" + ], + "JSXSpreadAttribute": [ + "argument" + ], + "JSXText": [], + "JSXFragment": [ + "openingFragment", + "children", + "closingFragment" + ], + "Literal": [], + "LabeledStatement": [ + "label", + "body" + ], + "LogicalExpression": [ + "left", + "right" + ], + "MemberExpression": [ + "object", + "property" + ], + "MetaProperty": [ + "meta", + "property" + ], + "MethodDefinition": [ + "key", + "value" + ], + "NewExpression": [ + "callee", + "arguments" + ], + "ObjectExpression": [ + "properties" + ], + "ObjectPattern": [ + "properties" + ], + "Program": [ + "body" + ], + "Property": [ + "key", + "value" + ], + "RestElement": [ + "argument" + ], + "ReturnStatement": [ + "argument" + ], + "SequenceExpression": [ + "expressions" + ], + "SpreadElement": [ + "argument" + ], + "Super": [], + "SwitchStatement": [ + "discriminant", + "cases" + ], + "SwitchCase": [ + "test", + "consequent" + ], + "TaggedTemplateExpression": [ + "tag", + "quasi" + ], + "TemplateElement": [], + "TemplateLiteral": [ + "quasis", + "expressions" + ], + "ThisExpression": [], + "ThrowStatement": [ + "argument" + ], + "TryStatement": [ + "block", + "handler", + "finalizer" + ], + "UnaryExpression": [ + "argument" + ], + "UpdateExpression": [ + "argument" + ], + "VariableDeclaration": [ + "declarations" + ], + "VariableDeclarator": [ + "id", + "init" + ], + "WhileStatement": [ + "test", + "body" + ], + "WithStatement": [ + "object", + "body" + ], + "YieldExpression": [ + "argument" + ] +} diff --git a/tools/node_modules/eslint/node_modules/eslint-utils/node_modules/eslint-visitor-keys/package.json b/tools/node_modules/eslint/node_modules/eslint-utils/node_modules/eslint-visitor-keys/package.json new file mode 100644 index 00000000000000..2765f6d5537237 --- /dev/null +++ b/tools/node_modules/eslint/node_modules/eslint-utils/node_modules/eslint-visitor-keys/package.json @@ -0,0 +1,48 @@ +{ + "author": { + "name": "Toru Nagashima", + "url": "https://github.com/mysticatea" + }, + "bugs": { + "url": "https://github.com/eslint/eslint-visitor-keys/issues" + }, + "bundleDependencies": false, + "dependencies": {}, + "deprecated": false, + "description": "Constants and utilities about visitor keys to traverse AST.", + "devDependencies": { + "eslint": "^4.7.2", + "eslint-config-eslint": "^4.0.0", + "eslint-release": "^1.0.0", + "mocha": "^3.5.3", + "nyc": "^11.2.1", + "opener": "^1.4.3" + }, + "engines": { + "node": ">=4" + }, + "files": [ + "lib" + ], + "homepage": "https://github.com/eslint/eslint-visitor-keys#readme", + "keywords": [], + "license": "Apache-2.0", + "main": "lib/index.js", + "name": "eslint-visitor-keys", + "repository": { + "type": "git", + "url": "git+https://github.com/eslint/eslint-visitor-keys.git" + }, + "scripts": { + "coverage": "nyc report --reporter lcov && opener coverage/lcov-report/index.html", + "generate-alpharelease": "eslint-generate-prerelease alpha", + "generate-betarelease": "eslint-generate-prerelease beta", + "generate-rcrelease": "eslint-generate-prerelease rc", + "generate-release": "eslint-generate-release", + "lint": "eslint lib tests/lib", + "pretest": "npm run -s lint", + "publish-release": "eslint-publish-release", + "test": "nyc mocha tests/lib" + }, + "version": "1.3.0" +} \ No newline at end of file diff --git a/tools/node_modules/eslint/node_modules/eslint-visitor-keys/package.json b/tools/node_modules/eslint/node_modules/eslint-visitor-keys/package.json index 12384fc9a4cf8e..0baf3d0826b4b8 100644 --- a/tools/node_modules/eslint/node_modules/eslint-visitor-keys/package.json +++ b/tools/node_modules/eslint/node_modules/eslint-visitor-keys/package.json @@ -19,7 +19,7 @@ "opener": "^1.4.3" }, "engines": { - "node": ">=4" + "node": ">=10" }, "files": [ "lib" @@ -40,9 +40,8 @@ "generate-rcrelease": "eslint-generate-prerelease rc", "generate-release": "eslint-generate-release", "lint": "eslint lib tests/lib", - "pretest": "npm run -s lint", "publish-release": "eslint-publish-release", "test": "nyc mocha tests/lib" }, - "version": "1.2.0" -} \ No newline at end of file + "version": "2.0.0" +} diff --git a/tools/node_modules/eslint/node_modules/espree/node_modules/eslint-visitor-keys/LICENSE b/tools/node_modules/eslint/node_modules/espree/node_modules/eslint-visitor-keys/LICENSE new file mode 100644 index 00000000000000..17a25538d9bd63 --- /dev/null +++ b/tools/node_modules/eslint/node_modules/espree/node_modules/eslint-visitor-keys/LICENSE @@ -0,0 +1,201 @@ + 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 contributors + + 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/tools/node_modules/eslint/node_modules/espree/node_modules/eslint-visitor-keys/README.md b/tools/node_modules/eslint/node_modules/espree/node_modules/eslint-visitor-keys/README.md new file mode 100644 index 00000000000000..250f5fa31a681d --- /dev/null +++ b/tools/node_modules/eslint/node_modules/espree/node_modules/eslint-visitor-keys/README.md @@ -0,0 +1,98 @@ +# eslint-visitor-keys + +[![npm version](https://img.shields.io/npm/v/eslint-visitor-keys.svg)](https://www.npmjs.com/package/eslint-visitor-keys) +[![Downloads/month](https://img.shields.io/npm/dm/eslint-visitor-keys.svg)](http://www.npmtrends.com/eslint-visitor-keys) +[![Build Status](https://travis-ci.org/eslint/eslint-visitor-keys.svg?branch=master)](https://travis-ci.org/eslint/eslint-visitor-keys) +[![Dependency Status](https://david-dm.org/eslint/eslint-visitor-keys.svg)](https://david-dm.org/eslint/eslint-visitor-keys) + +Constants and utilities about visitor keys to traverse AST. + +## 💿 Installation + +Use [npm] to install. + +```bash +$ npm install eslint-visitor-keys +``` + +### Requirements + +- [Node.js] 4.0.0 or later. + +## 📖 Usage + +```js +const evk = require("eslint-visitor-keys") +``` + +### evk.KEYS + +> type: `{ [type: string]: string[] | undefined }` + +Visitor keys. This keys are frozen. + +This is an object. Keys are the type of [ESTree] nodes. Their values are an array of property names which have child nodes. + +For example: + +``` +console.log(evk.KEYS.AssignmentExpression) // → ["left", "right"] +``` + +### evk.getKeys(node) + +> type: `(node: object) => string[]` + +Get the visitor keys of a given AST node. + +This is similar to `Object.keys(node)` of ES Standard, but some keys are excluded: `parent`, `leadingComments`, `trailingComments`, and names which start with `_`. + +This will be used to traverse unknown nodes. + +For example: + +``` +const node = { + type: "AssignmentExpression", + left: { type: "Identifier", name: "foo" }, + right: { type: "Literal", value: 0 } +} +console.log(evk.getKeys(node)) // → ["type", "left", "right"] +``` + +### evk.unionWith(additionalKeys) + +> type: `(additionalKeys: object) => { [type: string]: string[] | undefined }` + +Make the union set with `evk.KEYS` and the given keys. + +- The order of keys is, `additionalKeys` is at first, then `evk.KEYS` is concatenated after that. +- It removes duplicated keys as keeping the first one. + +For example: + +``` +console.log(evk.unionWith({ + MethodDefinition: ["decorators"] +})) // → { ..., MethodDefinition: ["decorators", "key", "value"], ... } +``` + +## 📰 Change log + +See [GitHub releases](https://github.com/eslint/eslint-visitor-keys/releases). + +## 🍻 Contributing + +Welcome. See [ESLint contribution guidelines](https://eslint.org/docs/developer-guide/contributing/). + +### Development commands + +- `npm test` runs tests and measures code coverage. +- `npm run lint` checks source codes with ESLint. +- `npm run coverage` opens the code coverage report of the previous test with your default browser. +- `npm run release` publishes this package to [npm] registory. + + +[npm]: https://www.npmjs.com/ +[Node.js]: https://nodejs.org/en/ +[ESTree]: https://github.com/estree/estree diff --git a/tools/node_modules/eslint/node_modules/espree/node_modules/eslint-visitor-keys/lib/index.js b/tools/node_modules/eslint/node_modules/espree/node_modules/eslint-visitor-keys/lib/index.js new file mode 100644 index 00000000000000..cd8a3260834dcd --- /dev/null +++ b/tools/node_modules/eslint/node_modules/espree/node_modules/eslint-visitor-keys/lib/index.js @@ -0,0 +1,81 @@ +/** + * @author Toru Nagashima + * See LICENSE file in root directory for full license. + */ +"use strict"; + +const KEYS = require("./visitor-keys.json"); + +// Types. +const NODE_TYPES = Object.freeze(Object.keys(KEYS)); + +// Freeze the keys. +for (const type of NODE_TYPES) { + Object.freeze(KEYS[type]); +} +Object.freeze(KEYS); + +// List to ignore keys. +const KEY_BLACKLIST = new Set([ + "parent", + "leadingComments", + "trailingComments" +]); + +/** + * Check whether a given key should be used or not. + * @param {string} key The key to check. + * @returns {boolean} `true` if the key should be used. + */ +function filterKey(key) { + return !KEY_BLACKLIST.has(key) && key[0] !== "_"; +} + +//------------------------------------------------------------------------------ +// Public interfaces +//------------------------------------------------------------------------------ + +module.exports = Object.freeze({ + + /** + * Visitor keys. + * @type {{ [type: string]: string[] | undefined }} + */ + KEYS, + + /** + * Get visitor keys of a given node. + * @param {Object} node The AST node to get keys. + * @returns {string[]} Visitor keys of the node. + */ + getKeys(node) { + return Object.keys(node).filter(filterKey); + }, + + // Disable valid-jsdoc rule because it reports syntax error on the type of @returns. + // eslint-disable-next-line valid-jsdoc + /** + * Make the union set with `KEYS` and given keys. + * @param {Object} additionalKeys The additional keys. + * @returns {{ [type: string]: string[] | undefined }} The union set. + */ + unionWith(additionalKeys) { + const retv = Object.assign({}, KEYS); + + for (const type of Object.keys(additionalKeys)) { + if (retv.hasOwnProperty(type)) { + const keys = new Set(additionalKeys[type]); + + for (const key of retv[type]) { + keys.add(key); + } + + retv[type] = Object.freeze(Array.from(keys)); + } else { + retv[type] = Object.freeze(Array.from(additionalKeys[type])); + } + } + + return Object.freeze(retv); + } +}); diff --git a/tools/node_modules/eslint/node_modules/espree/node_modules/eslint-visitor-keys/lib/visitor-keys.json b/tools/node_modules/eslint/node_modules/espree/node_modules/eslint-visitor-keys/lib/visitor-keys.json new file mode 100644 index 00000000000000..a33bbc66005b6a --- /dev/null +++ b/tools/node_modules/eslint/node_modules/espree/node_modules/eslint-visitor-keys/lib/visitor-keys.json @@ -0,0 +1,284 @@ +{ + "AssignmentExpression": [ + "left", + "right" + ], + "AssignmentPattern": [ + "left", + "right" + ], + "ArrayExpression": [ + "elements" + ], + "ArrayPattern": [ + "elements" + ], + "ArrowFunctionExpression": [ + "params", + "body" + ], + "AwaitExpression": [ + "argument" + ], + "BlockStatement": [ + "body" + ], + "BinaryExpression": [ + "left", + "right" + ], + "BreakStatement": [ + "label" + ], + "CallExpression": [ + "callee", + "arguments" + ], + "CatchClause": [ + "param", + "body" + ], + "ChainExpression": [ + "expression" + ], + "ClassBody": [ + "body" + ], + "ClassDeclaration": [ + "id", + "superClass", + "body" + ], + "ClassExpression": [ + "id", + "superClass", + "body" + ], + "ConditionalExpression": [ + "test", + "consequent", + "alternate" + ], + "ContinueStatement": [ + "label" + ], + "DebuggerStatement": [], + "DoWhileStatement": [ + "body", + "test" + ], + "EmptyStatement": [], + "ExportAllDeclaration": [ + "exported", + "source" + ], + "ExportDefaultDeclaration": [ + "declaration" + ], + "ExportNamedDeclaration": [ + "declaration", + "specifiers", + "source" + ], + "ExportSpecifier": [ + "exported", + "local" + ], + "ExpressionStatement": [ + "expression" + ], + "ExperimentalRestProperty": [ + "argument" + ], + "ExperimentalSpreadProperty": [ + "argument" + ], + "ForStatement": [ + "init", + "test", + "update", + "body" + ], + "ForInStatement": [ + "left", + "right", + "body" + ], + "ForOfStatement": [ + "left", + "right", + "body" + ], + "FunctionDeclaration": [ + "id", + "params", + "body" + ], + "FunctionExpression": [ + "id", + "params", + "body" + ], + "Identifier": [], + "IfStatement": [ + "test", + "consequent", + "alternate" + ], + "ImportDeclaration": [ + "specifiers", + "source" + ], + "ImportDefaultSpecifier": [ + "local" + ], + "ImportExpression": [ + "source" + ], + "ImportNamespaceSpecifier": [ + "local" + ], + "ImportSpecifier": [ + "imported", + "local" + ], + "JSXAttribute": [ + "name", + "value" + ], + "JSXClosingElement": [ + "name" + ], + "JSXElement": [ + "openingElement", + "children", + "closingElement" + ], + "JSXEmptyExpression": [], + "JSXExpressionContainer": [ + "expression" + ], + "JSXIdentifier": [], + "JSXMemberExpression": [ + "object", + "property" + ], + "JSXNamespacedName": [ + "namespace", + "name" + ], + "JSXOpeningElement": [ + "name", + "attributes" + ], + "JSXSpreadAttribute": [ + "argument" + ], + "JSXText": [], + "JSXFragment": [ + "openingFragment", + "children", + "closingFragment" + ], + "Literal": [], + "LabeledStatement": [ + "label", + "body" + ], + "LogicalExpression": [ + "left", + "right" + ], + "MemberExpression": [ + "object", + "property" + ], + "MetaProperty": [ + "meta", + "property" + ], + "MethodDefinition": [ + "key", + "value" + ], + "NewExpression": [ + "callee", + "arguments" + ], + "ObjectExpression": [ + "properties" + ], + "ObjectPattern": [ + "properties" + ], + "Program": [ + "body" + ], + "Property": [ + "key", + "value" + ], + "RestElement": [ + "argument" + ], + "ReturnStatement": [ + "argument" + ], + "SequenceExpression": [ + "expressions" + ], + "SpreadElement": [ + "argument" + ], + "Super": [], + "SwitchStatement": [ + "discriminant", + "cases" + ], + "SwitchCase": [ + "test", + "consequent" + ], + "TaggedTemplateExpression": [ + "tag", + "quasi" + ], + "TemplateElement": [], + "TemplateLiteral": [ + "quasis", + "expressions" + ], + "ThisExpression": [], + "ThrowStatement": [ + "argument" + ], + "TryStatement": [ + "block", + "handler", + "finalizer" + ], + "UnaryExpression": [ + "argument" + ], + "UpdateExpression": [ + "argument" + ], + "VariableDeclaration": [ + "declarations" + ], + "VariableDeclarator": [ + "id", + "init" + ], + "WhileStatement": [ + "test", + "body" + ], + "WithStatement": [ + "object", + "body" + ], + "YieldExpression": [ + "argument" + ] +} diff --git a/tools/node_modules/eslint/node_modules/espree/node_modules/eslint-visitor-keys/package.json b/tools/node_modules/eslint/node_modules/espree/node_modules/eslint-visitor-keys/package.json new file mode 100644 index 00000000000000..2765f6d5537237 --- /dev/null +++ b/tools/node_modules/eslint/node_modules/espree/node_modules/eslint-visitor-keys/package.json @@ -0,0 +1,48 @@ +{ + "author": { + "name": "Toru Nagashima", + "url": "https://github.com/mysticatea" + }, + "bugs": { + "url": "https://github.com/eslint/eslint-visitor-keys/issues" + }, + "bundleDependencies": false, + "dependencies": {}, + "deprecated": false, + "description": "Constants and utilities about visitor keys to traverse AST.", + "devDependencies": { + "eslint": "^4.7.2", + "eslint-config-eslint": "^4.0.0", + "eslint-release": "^1.0.0", + "mocha": "^3.5.3", + "nyc": "^11.2.1", + "opener": "^1.4.3" + }, + "engines": { + "node": ">=4" + }, + "files": [ + "lib" + ], + "homepage": "https://github.com/eslint/eslint-visitor-keys#readme", + "keywords": [], + "license": "Apache-2.0", + "main": "lib/index.js", + "name": "eslint-visitor-keys", + "repository": { + "type": "git", + "url": "git+https://github.com/eslint/eslint-visitor-keys.git" + }, + "scripts": { + "coverage": "nyc report --reporter lcov && opener coverage/lcov-report/index.html", + "generate-alpharelease": "eslint-generate-prerelease alpha", + "generate-betarelease": "eslint-generate-prerelease beta", + "generate-rcrelease": "eslint-generate-prerelease rc", + "generate-release": "eslint-generate-release", + "lint": "eslint lib tests/lib", + "pretest": "npm run -s lint", + "publish-release": "eslint-publish-release", + "test": "nyc mocha tests/lib" + }, + "version": "1.3.0" +} \ No newline at end of file diff --git a/tools/node_modules/eslint/package.json b/tools/node_modules/eslint/package.json index 3db68cf0490688..e6c38c8798ce4a 100644 --- a/tools/node_modules/eslint/package.json +++ b/tools/node_modules/eslint/package.json @@ -22,7 +22,7 @@ "eslint-plugin-markdown": "^1.0.2", "eslint-scope": "^5.1.1", "eslint-utils": "^2.1.0", - "eslint-visitor-keys": "^1.3.0", + "eslint-visitor-keys": "^2.0.0", "espree": "^7.3.0", "esquery": "^1.2.0", "esutils": "^2.0.2", @@ -73,6 +73,7 @@ "eslint-release": "^2.0.0", "eslump": "^2.0.0", "esprima": "^4.0.1", + "fs-teardown": "^0.1.0", "glob": "^7.1.6", "jsdoc": "^3.5.5", "karma": "^4.0.1", @@ -154,5 +155,5 @@ "test:cli": "mocha", "webpack": "node Makefile.js webpack" }, - "version": "7.10.0" + "version": "7.11.0" } \ No newline at end of file