From 29d0840a90a4620dc989bfe43a04f63d6ce1b8e3 Mon Sep 17 00:00:00 2001 From: cjihrig Date: Sun, 25 Oct 2020 10:45:45 -0400 Subject: [PATCH] tools: update ESLint to 7.12.0 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Update ESLint to 7.12.0 PR-URL: https://github.com/nodejs/node/pull/35799 Reviewed-By: Rich Trott Reviewed-By: Juan José Arboleda Reviewed-By: Daijiro Wachi --- tools/node_modules/eslint/README.md | 7 +- .../cascading-config-array-factory.js | 502 -------- .../eslint/lib/cli-engine/cli-engine.js | 33 +- .../lib/cli-engine/config-array-factory.js | 1092 ----------------- .../cli-engine/config-array/config-array.js | 536 -------- .../config-array/config-dependency.js | 128 -- .../config-array/extracted-config.js | 158 --- .../cli-engine/config-array/ignore-pattern.js | 249 ---- .../lib/cli-engine/config-array/index.js | 32 - .../config-array/override-tester.js | 235 ---- .../eslint/lib/cli-engine/file-enumerator.js | 9 +- .../eslint/lib/linter/report-translator.js | 22 +- .../eslint/lib/rules/constructor-super.js | 11 + .../eslint/lib/rules/no-constant-condition.js | 62 +- .../eslint/lib/rules/no-prototype-builtins.js | 8 +- .../eslint/lib/rules/no-script-url.js | 28 +- .../eslint/lib/rules/prefer-destructuring.js | 20 +- .../eslint/lib/rules/prefer-template.js | 36 +- tools/node_modules/eslint/lib/rules/quotes.js | 7 +- .../eslint/lib/rules/space-before-blocks.js | 43 +- .../eslint/lib/rules/utils/ast-utils.js | 29 +- tools/node_modules/eslint/lib/rules/yoda.js | 56 +- .../@eslint/eslintrc/conf/category-list.json | 39 - .../eslintrc/conf/default-cli-options.js | 31 - .../@eslint/eslintrc/conf/eslint-all.js | 32 - .../eslintrc/conf/eslint-recommended.js | 72 -- .../@eslint/eslintrc/conf/replacements.json | 22 - .../lib/cascading-config-array-factory.js | 25 +- .../eslintrc/lib/config-array-factory.js | 29 +- .../@eslint/eslintrc/lib/shared/types.js | 150 +++ .../@eslint/eslintrc/package.json | 4 +- .../eslint/node_modules/ajv/README.md | 40 +- .../node_modules/ajv/dist/ajv.bundle.js | 4 +- .../eslint/node_modules/ajv/dist/ajv.min.js | 4 +- .../node_modules/ajv/lib/compile/formats.js | 4 +- .../eslint/node_modules/ajv/package.json | 2 +- .../eslint/node_modules/ajv/scripts/info | 0 .../node_modules/ajv/scripts/prepare-tests | 0 .../ajv/scripts/publish-built-version | 0 .../node_modules/ajv/scripts/travis-gh-pages | 0 tools/node_modules/eslint/package.json | 4 +- 41 files changed, 487 insertions(+), 3278 deletions(-) delete mode 100644 tools/node_modules/eslint/lib/cli-engine/cascading-config-array-factory.js delete mode 100644 tools/node_modules/eslint/lib/cli-engine/config-array-factory.js delete mode 100644 tools/node_modules/eslint/lib/cli-engine/config-array/config-array.js delete mode 100644 tools/node_modules/eslint/lib/cli-engine/config-array/config-dependency.js delete mode 100644 tools/node_modules/eslint/lib/cli-engine/config-array/extracted-config.js delete mode 100644 tools/node_modules/eslint/lib/cli-engine/config-array/ignore-pattern.js delete mode 100644 tools/node_modules/eslint/lib/cli-engine/config-array/index.js delete mode 100644 tools/node_modules/eslint/lib/cli-engine/config-array/override-tester.js delete mode 100644 tools/node_modules/eslint/node_modules/@eslint/eslintrc/conf/category-list.json delete mode 100644 tools/node_modules/eslint/node_modules/@eslint/eslintrc/conf/default-cli-options.js delete mode 100644 tools/node_modules/eslint/node_modules/@eslint/eslintrc/conf/eslint-all.js delete mode 100644 tools/node_modules/eslint/node_modules/@eslint/eslintrc/conf/eslint-recommended.js delete mode 100644 tools/node_modules/eslint/node_modules/@eslint/eslintrc/conf/replacements.json create mode 100644 tools/node_modules/eslint/node_modules/@eslint/eslintrc/lib/shared/types.js mode change 100755 => 100644 tools/node_modules/eslint/node_modules/ajv/scripts/info mode change 100755 => 100644 tools/node_modules/eslint/node_modules/ajv/scripts/prepare-tests mode change 100755 => 100644 tools/node_modules/eslint/node_modules/ajv/scripts/publish-built-version mode change 100755 => 100644 tools/node_modules/eslint/node_modules/ajv/scripts/travis-gh-pages diff --git a/tools/node_modules/eslint/README.md b/tools/node_modules/eslint/README.md index 8095aca2aacdc3..2d1b8eafe7955d 100644 --- a/tools/node_modules/eslint/README.md +++ b/tools/node_modules/eslint/README.md @@ -248,10 +248,11 @@ The following companies, organizations, and individuals support ESLint's ongoing -

Gold Sponsors

-

Salesforce Airbnb Microsoft FOSS Fund Sponsorships

Silver Sponsors

+

Platinum Sponsors

+

Automattic

Gold Sponsors

+

Shopify Salesforce Airbnb Microsoft FOSS Fund Sponsorships

Silver Sponsors

Liftoff AMP Project

Bronze Sponsors

-

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

+

Writers Per Hour 2021 calendar Buy.Fineproxy.Org Veikkaajat.com Anagram Solver 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/cli-engine/cascading-config-array-factory.js b/tools/node_modules/eslint/lib/cli-engine/cascading-config-array-factory.js deleted file mode 100644 index df49c27772ac83..00000000000000 --- a/tools/node_modules/eslint/lib/cli-engine/cascading-config-array-factory.js +++ /dev/null @@ -1,502 +0,0 @@ -/* - * STOP!!! DO NOT MODIFY. - * - * This file is part of the ongoing work to move the eslintrc-style config - * system into the @eslint/eslintrc package. This file needs to remain - * unchanged in order for this work to proceed. - * - * If you think you need to change this file, please contact @nzakas first. - * - * Thanks in advance for your cooperation. - */ - -/** - * @fileoverview `CascadingConfigArrayFactory` class. - * - * `CascadingConfigArrayFactory` class has a responsibility: - * - * 1. Handles cascading of config files. - * - * It provides two methods: - * - * - `getConfigArrayForFile(filePath)` - * Get the corresponded configuration of a given file. This method doesn't - * throw even if the given file didn't exist. - * - `clearCache()` - * Clear the internal cache. You have to call this method when - * `additionalPluginPool` was updated if `baseConfig` or `cliConfig` depends - * on the additional plugins. (`CLIEngine#addPlugin()` method calls this.) - * - * @author Toru Nagashima - */ -"use strict"; - -//------------------------------------------------------------------------------ -// Requirements -//------------------------------------------------------------------------------ - -const os = require("os"); -const path = require("path"); -const { validateConfigArray } = require("../shared/config-validator"); -const { emitDeprecationWarning } = require("../shared/deprecation-warnings"); -const { ConfigArrayFactory } = require("./config-array-factory"); -const { ConfigArray, ConfigDependency, IgnorePattern } = require("./config-array"); -const loadRules = require("./load-rules"); -const debug = require("debug")("eslint:cascading-config-array-factory"); - -//------------------------------------------------------------------------------ -// Helpers -//------------------------------------------------------------------------------ - -// Define types for VSCode IntelliSense. -/** @typedef {import("../shared/types").ConfigData} ConfigData */ -/** @typedef {import("../shared/types").Parser} Parser */ -/** @typedef {import("../shared/types").Plugin} Plugin */ -/** @typedef {ReturnType} ConfigArray */ - -/** - * @typedef {Object} CascadingConfigArrayFactoryOptions - * @property {Map} [additionalPluginPool] The map for additional plugins. - * @property {ConfigData} [baseConfig] The config by `baseConfig` option. - * @property {ConfigData} [cliConfig] The config by CLI options (`--env`, `--global`, `--ignore-pattern`, `--parser`, `--parser-options`, `--plugin`, and `--rule`). CLI options overwrite the setting in config files. - * @property {string} [cwd] The base directory to start lookup. - * @property {string} [ignorePath] The path to the alternative file of `.eslintignore`. - * @property {string[]} [rulePaths] The value of `--rulesdir` option. - * @property {string} [specificConfigPath] The value of `--config` option. - * @property {boolean} [useEslintrc] if `false` then it doesn't load config files. - */ - -/** - * @typedef {Object} CascadingConfigArrayFactoryInternalSlots - * @property {ConfigArray} baseConfigArray The config array of `baseConfig` option. - * @property {ConfigData} baseConfigData The config data of `baseConfig` option. This is used to reset `baseConfigArray`. - * @property {ConfigArray} cliConfigArray The config array of CLI options. - * @property {ConfigData} cliConfigData The config data of CLI options. This is used to reset `cliConfigArray`. - * @property {ConfigArrayFactory} configArrayFactory The factory for config arrays. - * @property {Map} configCache The cache from directory paths to config arrays. - * @property {string} cwd The base directory to start lookup. - * @property {WeakMap} finalizeCache The cache from config arrays to finalized config arrays. - * @property {string} [ignorePath] The path to the alternative file of `.eslintignore`. - * @property {string[]|null} rulePaths The value of `--rulesdir` option. This is used to reset `baseConfigArray`. - * @property {string|null} specificConfigPath The value of `--config` option. This is used to reset `cliConfigArray`. - * @property {boolean} useEslintrc if `false` then it doesn't load config files. - */ - -/** @type {WeakMap} */ -const internalSlotsMap = new WeakMap(); - -/** - * Create the config array from `baseConfig` and `rulePaths`. - * @param {CascadingConfigArrayFactoryInternalSlots} slots The slots. - * @returns {ConfigArray} The config array of the base configs. - */ -function createBaseConfigArray({ - configArrayFactory, - baseConfigData, - rulePaths, - cwd -}) { - const baseConfigArray = configArrayFactory.create( - baseConfigData, - { name: "BaseConfig" } - ); - - /* - * Create the config array element for the default ignore patterns. - * This element has `ignorePattern` property that ignores the default - * patterns in the current working directory. - */ - baseConfigArray.unshift(configArrayFactory.create( - { ignorePatterns: IgnorePattern.DefaultPatterns }, - { name: "DefaultIgnorePattern" } - )[0]); - - /* - * Load rules `--rulesdir` option as a pseudo plugin. - * Use a pseudo plugin to define rules of `--rulesdir`, so we can validate - * the rule's options with only information in the config array. - */ - if (rulePaths && rulePaths.length > 0) { - baseConfigArray.push({ - type: "config", - name: "--rulesdir", - filePath: "", - plugins: { - "": new ConfigDependency({ - definition: { - rules: rulePaths.reduce( - (map, rulesPath) => Object.assign( - map, - loadRules(rulesPath, cwd) - ), - {} - ) - }, - filePath: "", - id: "", - importerName: "--rulesdir", - importerPath: "" - }) - } - }); - } - - return baseConfigArray; -} - -/** - * Create the config array from CLI options. - * @param {CascadingConfigArrayFactoryInternalSlots} slots The slots. - * @returns {ConfigArray} The config array of the base configs. - */ -function createCLIConfigArray({ - cliConfigData, - configArrayFactory, - cwd, - ignorePath, - specificConfigPath -}) { - const cliConfigArray = configArrayFactory.create( - cliConfigData, - { name: "CLIOptions" } - ); - - cliConfigArray.unshift( - ...(ignorePath - ? configArrayFactory.loadESLintIgnore(ignorePath) - : configArrayFactory.loadDefaultESLintIgnore()) - ); - - if (specificConfigPath) { - cliConfigArray.unshift( - ...configArrayFactory.loadFile( - specificConfigPath, - { name: "--config", basePath: cwd } - ) - ); - } - - return cliConfigArray; -} - -/** - * The error type when there are files matched by a glob, but all of them have been ignored. - */ -class ConfigurationNotFoundError extends Error { - - // eslint-disable-next-line jsdoc/require-description - /** - * @param {string} directoryPath The directory path. - */ - constructor(directoryPath) { - super(`No ESLint configuration found in ${directoryPath}.`); - this.messageTemplate = "no-config-found"; - this.messageData = { directoryPath }; - } -} - -/** - * This class provides the functionality that enumerates every file which is - * matched by given glob patterns and that configuration. - */ -class CascadingConfigArrayFactory { - - /** - * Initialize this enumerator. - * @param {CascadingConfigArrayFactoryOptions} options The options. - */ - constructor({ - additionalPluginPool = new Map(), - baseConfig: baseConfigData = null, - cliConfig: cliConfigData = null, - cwd = process.cwd(), - ignorePath, - resolvePluginsRelativeTo, - rulePaths = [], - specificConfigPath = null, - useEslintrc = true - } = {}) { - const configArrayFactory = new ConfigArrayFactory({ - additionalPluginPool, - cwd, - resolvePluginsRelativeTo - }); - - internalSlotsMap.set(this, { - baseConfigArray: createBaseConfigArray({ - baseConfigData, - configArrayFactory, - cwd, - rulePaths - }), - baseConfigData, - cliConfigArray: createCLIConfigArray({ - cliConfigData, - configArrayFactory, - cwd, - ignorePath, - specificConfigPath - }), - cliConfigData, - configArrayFactory, - configCache: new Map(), - cwd, - finalizeCache: new WeakMap(), - ignorePath, - rulePaths, - specificConfigPath, - useEslintrc - }); - } - - /** - * The path to the current working directory. - * This is used by tests. - * @type {string} - */ - get cwd() { - const { cwd } = internalSlotsMap.get(this); - - return cwd; - } - - /** - * Get the config array of a given file. - * If `filePath` was not given, it returns the config which contains only - * `baseConfigData` and `cliConfigData`. - * @param {string} [filePath] The file path to a file. - * @param {Object} [options] The options. - * @param {boolean} [options.ignoreNotFoundError] If `true` then it doesn't throw `ConfigurationNotFoundError`. - * @returns {ConfigArray} The config array of the file. - */ - getConfigArrayForFile(filePath, { ignoreNotFoundError = false } = {}) { - const { - baseConfigArray, - cliConfigArray, - cwd - } = internalSlotsMap.get(this); - - if (!filePath) { - return new ConfigArray(...baseConfigArray, ...cliConfigArray); - } - - const directoryPath = path.dirname(path.resolve(cwd, filePath)); - - debug(`Load config files for ${directoryPath}.`); - - return this._finalizeConfigArray( - this._loadConfigInAncestors(directoryPath), - directoryPath, - ignoreNotFoundError - ); - } - - /** - * Set the config data to override all configs. - * Require to call `clearCache()` method after this method is called. - * @param {ConfigData} configData The config data to override all configs. - * @returns {void} - */ - setOverrideConfig(configData) { - const slots = internalSlotsMap.get(this); - - slots.cliConfigData = configData; - } - - /** - * Clear config cache. - * @returns {void} - */ - clearCache() { - const slots = internalSlotsMap.get(this); - - slots.baseConfigArray = createBaseConfigArray(slots); - slots.cliConfigArray = createCLIConfigArray(slots); - slots.configCache.clear(); - } - - /** - * Load and normalize config files from the ancestor directories. - * @param {string} directoryPath The path to a leaf directory. - * @param {boolean} configsExistInSubdirs `true` if configurations exist in subdirectories. - * @returns {ConfigArray} The loaded config. - * @private - */ - _loadConfigInAncestors(directoryPath, configsExistInSubdirs = false) { - const { - baseConfigArray, - configArrayFactory, - configCache, - cwd, - useEslintrc - } = internalSlotsMap.get(this); - - if (!useEslintrc) { - return baseConfigArray; - } - - let configArray = configCache.get(directoryPath); - - // Hit cache. - if (configArray) { - debug(`Cache hit: ${directoryPath}.`); - return configArray; - } - debug(`No cache found: ${directoryPath}.`); - - const homePath = os.homedir(); - - // Consider this is root. - if (directoryPath === homePath && cwd !== homePath) { - debug("Stop traversing because of considered root."); - if (configsExistInSubdirs) { - const filePath = ConfigArrayFactory.getPathToConfigFileInDirectory(directoryPath); - - if (filePath) { - emitDeprecationWarning( - filePath, - "ESLINT_PERSONAL_CONFIG_SUPPRESS" - ); - } - } - return this._cacheConfig(directoryPath, baseConfigArray); - } - - // Load the config on this directory. - try { - configArray = configArrayFactory.loadInDirectory(directoryPath); - } catch (error) { - /* istanbul ignore next */ - if (error.code === "EACCES") { - debug("Stop traversing because of 'EACCES' error."); - return this._cacheConfig(directoryPath, baseConfigArray); - } - throw error; - } - - if (configArray.length > 0 && configArray.isRoot()) { - debug("Stop traversing because of 'root:true'."); - configArray.unshift(...baseConfigArray); - return this._cacheConfig(directoryPath, configArray); - } - - // Load from the ancestors and merge it. - const parentPath = path.dirname(directoryPath); - const parentConfigArray = parentPath && parentPath !== directoryPath - ? this._loadConfigInAncestors( - parentPath, - configsExistInSubdirs || configArray.length > 0 - ) - : baseConfigArray; - - if (configArray.length > 0) { - configArray.unshift(...parentConfigArray); - } else { - configArray = parentConfigArray; - } - - // Cache and return. - return this._cacheConfig(directoryPath, configArray); - } - - /** - * Freeze and cache a given config. - * @param {string} directoryPath The path to a directory as a cache key. - * @param {ConfigArray} configArray The config array as a cache value. - * @returns {ConfigArray} The `configArray` (frozen). - */ - _cacheConfig(directoryPath, configArray) { - const { configCache } = internalSlotsMap.get(this); - - Object.freeze(configArray); - configCache.set(directoryPath, configArray); - - return configArray; - } - - /** - * Finalize a given config array. - * Concatenate `--config` and other CLI options. - * @param {ConfigArray} configArray The parent config array. - * @param {string} directoryPath The path to the leaf directory to find config files. - * @param {boolean} ignoreNotFoundError If `true` then it doesn't throw `ConfigurationNotFoundError`. - * @returns {ConfigArray} The loaded config. - * @private - */ - _finalizeConfigArray(configArray, directoryPath, ignoreNotFoundError) { - const { - cliConfigArray, - configArrayFactory, - finalizeCache, - useEslintrc - } = internalSlotsMap.get(this); - - let finalConfigArray = finalizeCache.get(configArray); - - if (!finalConfigArray) { - finalConfigArray = configArray; - - // Load the personal config if there are no regular config files. - if ( - useEslintrc && - configArray.every(c => !c.filePath) && - cliConfigArray.every(c => !c.filePath) // `--config` option can be a file. - ) { - const homePath = os.homedir(); - - debug("Loading the config file of the home directory:", homePath); - - const personalConfigArray = configArrayFactory.loadInDirectory( - homePath, - { name: "PersonalConfig" } - ); - - if ( - personalConfigArray.length > 0 && - !directoryPath.startsWith(homePath) - ) { - const lastElement = - personalConfigArray[personalConfigArray.length - 1]; - - emitDeprecationWarning( - lastElement.filePath, - "ESLINT_PERSONAL_CONFIG_LOAD" - ); - } - - finalConfigArray = finalConfigArray.concat(personalConfigArray); - } - - // Apply CLI options. - if (cliConfigArray.length > 0) { - finalConfigArray = finalConfigArray.concat(cliConfigArray); - } - - // Validate rule settings and environments. - validateConfigArray(finalConfigArray); - - // Cache it. - Object.freeze(finalConfigArray); - finalizeCache.set(configArray, finalConfigArray); - - debug( - "Configuration was determined: %o on %s", - finalConfigArray, - directoryPath - ); - } - - // At least one element (the default ignore patterns) exists. - if (!ignoreNotFoundError && useEslintrc && finalConfigArray.length <= 1) { - throw new ConfigurationNotFoundError(directoryPath); - } - - return finalConfigArray; - } -} - -//------------------------------------------------------------------------------ -// Public Interface -//------------------------------------------------------------------------------ - -module.exports = { CascadingConfigArrayFactory }; diff --git a/tools/node_modules/eslint/lib/cli-engine/cli-engine.js b/tools/node_modules/eslint/lib/cli-engine/cli-engine.js index 70c6f6f39f7643..9a414061501e2d 100644 --- a/tools/node_modules/eslint/lib/cli-engine/cli-engine.js +++ b/tools/node_modules/eslint/lib/cli-engine/cli-engine.js @@ -19,14 +19,29 @@ const fs = require("fs"); const path = require("path"); const defaultOptions = require("../../conf/default-cli-options"); const pkg = require("../../package.json"); -const ConfigOps = require("@eslint/eslintrc/lib/shared/config-ops"); -const naming = require("@eslint/eslintrc/lib/shared/naming"); -const ModuleResolver = require("../shared/relative-module-resolver"); + + +const { + Legacy: { + ConfigOps, + naming, + CascadingConfigArrayFactory, + IgnorePattern, + getUsedExtractedConfigs + } +} = require("@eslint/eslintrc"); + +/* + * For some reason, ModuleResolver must be included via filepath instead of by + * API exports in order to work properly. That's why this is separated out onto + * its own require() statement. + */ +const ModuleResolver = require("@eslint/eslintrc/lib/shared/relative-module-resolver"); +const { FileEnumerator } = require("./file-enumerator"); + const { Linter } = require("../linter"); const builtInRules = require("../rules"); -const { CascadingConfigArrayFactory } = require("./cascading-config-array-factory"); -const { IgnorePattern, getUsedExtractedConfigs } = require("./config-array"); -const { FileEnumerator } = require("./file-enumerator"); +const loadRules = require("./load-rules"); const hash = require("./hash"); const LintResultCache = require("./lint-result-cache"); @@ -559,7 +574,11 @@ class CLIEngine { resolvePluginsRelativeTo: options.resolvePluginsRelativeTo, rulePaths: options.rulePaths, specificConfigPath: options.configFile, - useEslintrc: options.useEslintrc + useEslintrc: options.useEslintrc, + builtInRules, + loadRules, + eslintRecommendedPath: path.resolve(__dirname, "../../conf/eslint-recommended.js"), + eslintAllPath: path.resolve(__dirname, "../../conf/eslint-all.js") }); const fileEnumerator = new FileEnumerator({ configArrayFactory, diff --git a/tools/node_modules/eslint/lib/cli-engine/config-array-factory.js b/tools/node_modules/eslint/lib/cli-engine/config-array-factory.js deleted file mode 100644 index 2c7a79b491ecb3..00000000000000 --- a/tools/node_modules/eslint/lib/cli-engine/config-array-factory.js +++ /dev/null @@ -1,1092 +0,0 @@ -/* - * STOP!!! DO NOT MODIFY. - * - * This file is part of the ongoing work to move the eslintrc-style config - * system into the @eslint/eslintrc package. This file needs to remain - * unchanged in order for this work to proceed. - * - * If you think you need to change this file, please contact @nzakas first. - * - * Thanks in advance for your cooperation. - */ - -/** - * @fileoverview The factory of `ConfigArray` objects. - * - * This class provides methods to create `ConfigArray` instance. - * - * - `create(configData, options)` - * Create a `ConfigArray` instance from a config data. This is to handle CLI - * options except `--config`. - * - `loadFile(filePath, options)` - * Create a `ConfigArray` instance from a config file. This is to handle - * `--config` option. If the file was not found, throws the following error: - * - If the filename was `*.js`, a `MODULE_NOT_FOUND` error. - * - If the filename was `package.json`, an IO error or an - * `ESLINT_CONFIG_FIELD_NOT_FOUND` error. - * - Otherwise, an IO error such as `ENOENT`. - * - `loadInDirectory(directoryPath, options)` - * Create a `ConfigArray` instance from a config file which is on a given - * directory. This tries to load `.eslintrc.*` or `package.json`. If not - * found, returns an empty `ConfigArray`. - * - `loadESLintIgnore(filePath)` - * Create a `ConfigArray` instance from a config file that is `.eslintignore` - * format. This is to handle `--ignore-path` option. - * - `loadDefaultESLintIgnore()` - * Create a `ConfigArray` instance from `.eslintignore` or `package.json` in - * the current working directory. - * - * `ConfigArrayFactory` class has the responsibility that loads configuration - * files, including loading `extends`, `parser`, and `plugins`. The created - * `ConfigArray` instance has the loaded `extends`, `parser`, and `plugins`. - * - * But this class doesn't handle cascading. `CascadingConfigArrayFactory` class - * handles cascading and hierarchy. - * - * @author Toru Nagashima - */ -"use strict"; - -//------------------------------------------------------------------------------ -// Requirements -//------------------------------------------------------------------------------ - -const fs = require("fs"); -const path = require("path"); -const importFresh = require("import-fresh"); -const stripComments = require("strip-json-comments"); -const { validateConfigSchema } = require("../shared/config-validator"); -const naming = require("@eslint/eslintrc/lib/shared/naming"); -const ModuleResolver = require("../shared/relative-module-resolver"); -const { - ConfigArray, - ConfigDependency, - IgnorePattern, - OverrideTester -} = require("./config-array"); -const debug = require("debug")("eslint:config-array-factory"); - -//------------------------------------------------------------------------------ -// Helpers -//------------------------------------------------------------------------------ - -const eslintRecommendedPath = path.resolve(__dirname, "../../conf/eslint-recommended.js"); -const eslintAllPath = path.resolve(__dirname, "../../conf/eslint-all.js"); -const configFilenames = [ - ".eslintrc.js", - ".eslintrc.cjs", - ".eslintrc.yaml", - ".eslintrc.yml", - ".eslintrc.json", - ".eslintrc", - "package.json" -]; - -// Define types for VSCode IntelliSense. -/** @typedef {import("../shared/types").ConfigData} ConfigData */ -/** @typedef {import("../shared/types").OverrideConfigData} OverrideConfigData */ -/** @typedef {import("../shared/types").Parser} Parser */ -/** @typedef {import("../shared/types").Plugin} Plugin */ -/** @typedef {import("./config-array/config-dependency").DependentParser} DependentParser */ -/** @typedef {import("./config-array/config-dependency").DependentPlugin} DependentPlugin */ -/** @typedef {ConfigArray[0]} ConfigArrayElement */ - -/** - * @typedef {Object} ConfigArrayFactoryOptions - * @property {Map} [additionalPluginPool] The map for additional plugins. - * @property {string} [cwd] The path to the current working directory. - * @property {string} [resolvePluginsRelativeTo] A path to the directory that plugins should be resolved from. Defaults to `cwd`. - */ - -/** - * @typedef {Object} ConfigArrayFactoryInternalSlots - * @property {Map} additionalPluginPool The map for additional plugins. - * @property {string} cwd The path to the current working directory. - * @property {string | undefined} resolvePluginsRelativeTo An absolute path the the directory that plugins should be resolved from. - */ - -/** - * @typedef {Object} ConfigArrayFactoryLoadingContext - * @property {string} filePath The path to the current configuration. - * @property {string} matchBasePath The base path to resolve relative paths in `overrides[].files`, `overrides[].excludedFiles`, and `ignorePatterns`. - * @property {string} name The name of the current configuration. - * @property {string} pluginBasePath The base path to resolve plugins. - * @property {"config" | "ignore" | "implicit-processor"} type The type of the current configuration. This is `"config"` in normal. This is `"ignore"` if it came from `.eslintignore`. This is `"implicit-processor"` if it came from legacy file-extension processors. - */ - -/** - * @typedef {Object} ConfigArrayFactoryLoadingContext - * @property {string} filePath The path to the current configuration. - * @property {string} matchBasePath The base path to resolve relative paths in `overrides[].files`, `overrides[].excludedFiles`, and `ignorePatterns`. - * @property {string} name The name of the current configuration. - * @property {"config" | "ignore" | "implicit-processor"} type The type of the current configuration. This is `"config"` in normal. This is `"ignore"` if it came from `.eslintignore`. This is `"implicit-processor"` if it came from legacy file-extension processors. - */ - -/** @type {WeakMap} */ -const internalSlotsMap = new WeakMap(); - -/** - * Check if a given string is a file path. - * @param {string} nameOrPath A module name or file path. - * @returns {boolean} `true` if the `nameOrPath` is a file path. - */ -function isFilePath(nameOrPath) { - return ( - /^\.{1,2}[/\\]/u.test(nameOrPath) || - path.isAbsolute(nameOrPath) - ); -} - -/** - * Convenience wrapper for synchronously reading file contents. - * @param {string} filePath The filename to read. - * @returns {string} The file contents, with the BOM removed. - * @private - */ -function readFile(filePath) { - return fs.readFileSync(filePath, "utf8").replace(/^\ufeff/u, ""); -} - -/** - * Loads a YAML configuration from a file. - * @param {string} filePath The filename to load. - * @returns {ConfigData} The configuration object from the file. - * @throws {Error} If the file cannot be read. - * @private - */ -function loadYAMLConfigFile(filePath) { - debug(`Loading YAML config file: ${filePath}`); - - // lazy load YAML to improve performance when not used - const yaml = require("js-yaml"); - - try { - - // empty YAML file can be null, so always use - return yaml.safeLoad(readFile(filePath)) || {}; - } catch (e) { - debug(`Error reading YAML file: ${filePath}`); - e.message = `Cannot read config file: ${filePath}\nError: ${e.message}`; - throw e; - } -} - -/** - * Loads a JSON configuration from a file. - * @param {string} filePath The filename to load. - * @returns {ConfigData} The configuration object from the file. - * @throws {Error} If the file cannot be read. - * @private - */ -function loadJSONConfigFile(filePath) { - debug(`Loading JSON config file: ${filePath}`); - - try { - return JSON.parse(stripComments(readFile(filePath))); - } catch (e) { - debug(`Error reading JSON file: ${filePath}`); - e.message = `Cannot read config file: ${filePath}\nError: ${e.message}`; - e.messageTemplate = "failed-to-read-json"; - e.messageData = { - path: filePath, - message: e.message - }; - throw e; - } -} - -/** - * Loads a legacy (.eslintrc) configuration from a file. - * @param {string} filePath The filename to load. - * @returns {ConfigData} The configuration object from the file. - * @throws {Error} If the file cannot be read. - * @private - */ -function loadLegacyConfigFile(filePath) { - debug(`Loading legacy config file: ${filePath}`); - - // lazy load YAML to improve performance when not used - const yaml = require("js-yaml"); - - try { - return yaml.safeLoad(stripComments(readFile(filePath))) || /* istanbul ignore next */ {}; - } catch (e) { - debug("Error reading YAML file: %s\n%o", filePath, e); - e.message = `Cannot read config file: ${filePath}\nError: ${e.message}`; - throw e; - } -} - -/** - * Loads a JavaScript configuration from a file. - * @param {string} filePath The filename to load. - * @returns {ConfigData} The configuration object from the file. - * @throws {Error} If the file cannot be read. - * @private - */ -function loadJSConfigFile(filePath) { - debug(`Loading JS config file: ${filePath}`); - try { - return importFresh(filePath); - } catch (e) { - debug(`Error reading JavaScript file: ${filePath}`); - e.message = `Cannot read config file: ${filePath}\nError: ${e.message}`; - throw e; - } -} - -/** - * Loads a configuration from a package.json file. - * @param {string} filePath The filename to load. - * @returns {ConfigData} The configuration object from the file. - * @throws {Error} If the file cannot be read. - * @private - */ -function loadPackageJSONConfigFile(filePath) { - debug(`Loading package.json config file: ${filePath}`); - try { - const packageData = loadJSONConfigFile(filePath); - - if (!Object.hasOwnProperty.call(packageData, "eslintConfig")) { - throw Object.assign( - new Error("package.json file doesn't have 'eslintConfig' field."), - { code: "ESLINT_CONFIG_FIELD_NOT_FOUND" } - ); - } - - return packageData.eslintConfig; - } catch (e) { - debug(`Error reading package.json file: ${filePath}`); - e.message = `Cannot read config file: ${filePath}\nError: ${e.message}`; - throw e; - } -} - -/** - * Loads a `.eslintignore` from a file. - * @param {string} filePath The filename to load. - * @returns {string[]} The ignore patterns from the file. - * @private - */ -function loadESLintIgnoreFile(filePath) { - debug(`Loading .eslintignore file: ${filePath}`); - - try { - return readFile(filePath) - .split(/\r?\n/gu) - .filter(line => line.trim() !== "" && !line.startsWith("#")); - } catch (e) { - debug(`Error reading .eslintignore file: ${filePath}`); - e.message = `Cannot read .eslintignore file: ${filePath}\nError: ${e.message}`; - throw e; - } -} - -/** - * Creates an error to notify about a missing config to extend from. - * @param {string} configName The name of the missing config. - * @param {string} importerName The name of the config that imported the missing config - * @param {string} messageTemplate The text template to source error strings from. - * @returns {Error} The error object to throw - * @private - */ -function configInvalidError(configName, importerName, messageTemplate) { - return Object.assign( - new Error(`Failed to load config "${configName}" to extend from.`), - { - messageTemplate, - messageData: { configName, importerName } - } - ); -} - -/** - * Loads a configuration file regardless of the source. Inspects the file path - * to determine the correctly way to load the config file. - * @param {string} filePath The path to the configuration. - * @returns {ConfigData|null} The configuration information. - * @private - */ -function loadConfigFile(filePath) { - switch (path.extname(filePath)) { - case ".js": - case ".cjs": - return loadJSConfigFile(filePath); - - case ".json": - if (path.basename(filePath) === "package.json") { - return loadPackageJSONConfigFile(filePath); - } - return loadJSONConfigFile(filePath); - - case ".yaml": - case ".yml": - return loadYAMLConfigFile(filePath); - - default: - return loadLegacyConfigFile(filePath); - } -} - -/** - * Write debug log. - * @param {string} request The requested module name. - * @param {string} relativeTo The file path to resolve the request relative to. - * @param {string} filePath The resolved file path. - * @returns {void} - */ -function writeDebugLogForLoading(request, relativeTo, filePath) { - /* istanbul ignore next */ - if (debug.enabled) { - let nameAndVersion = null; - - try { - const packageJsonPath = ModuleResolver.resolve( - `${request}/package.json`, - relativeTo - ); - const { version = "unknown" } = require(packageJsonPath); - - nameAndVersion = `${request}@${version}`; - } catch (error) { - debug("package.json was not found:", error.message); - nameAndVersion = request; - } - - debug("Loaded: %s (%s)", nameAndVersion, filePath); - } -} - -/** - * Create a new context with default values. - * @param {ConfigArrayFactoryInternalSlots} slots The internal slots. - * @param {"config" | "ignore" | "implicit-processor" | undefined} providedType The type of the current configuration. Default is `"config"`. - * @param {string | undefined} providedName The name of the current configuration. Default is the relative path from `cwd` to `filePath`. - * @param {string | undefined} providedFilePath The path to the current configuration. Default is empty string. - * @param {string | undefined} providedMatchBasePath The type of the current configuration. Default is the directory of `filePath` or `cwd`. - * @returns {ConfigArrayFactoryLoadingContext} The created context. - */ -function createContext( - { cwd, resolvePluginsRelativeTo }, - providedType, - providedName, - providedFilePath, - providedMatchBasePath -) { - const filePath = providedFilePath - ? path.resolve(cwd, providedFilePath) - : ""; - const matchBasePath = - (providedMatchBasePath && path.resolve(cwd, providedMatchBasePath)) || - (filePath && path.dirname(filePath)) || - cwd; - const name = - providedName || - (filePath && path.relative(cwd, filePath)) || - ""; - const pluginBasePath = - resolvePluginsRelativeTo || - (filePath && path.dirname(filePath)) || - cwd; - const type = providedType || "config"; - - return { filePath, matchBasePath, name, pluginBasePath, type }; -} - -/** - * Normalize a given plugin. - * - Ensure the object to have four properties: configs, environments, processors, and rules. - * - Ensure the object to not have other properties. - * @param {Plugin} plugin The plugin to normalize. - * @returns {Plugin} The normalized plugin. - */ -function normalizePlugin(plugin) { - return { - configs: plugin.configs || {}, - environments: plugin.environments || {}, - processors: plugin.processors || {}, - rules: plugin.rules || {} - }; -} - -//------------------------------------------------------------------------------ -// Public Interface -//------------------------------------------------------------------------------ - -/** - * The factory of `ConfigArray` objects. - */ -class ConfigArrayFactory { - - /** - * Initialize this instance. - * @param {ConfigArrayFactoryOptions} [options] The map for additional plugins. - */ - constructor({ - additionalPluginPool = new Map(), - cwd = process.cwd(), - resolvePluginsRelativeTo - } = {}) { - internalSlotsMap.set(this, { - additionalPluginPool, - cwd, - resolvePluginsRelativeTo: - resolvePluginsRelativeTo && - path.resolve(cwd, resolvePluginsRelativeTo) - }); - } - - /** - * Create `ConfigArray` instance from a config data. - * @param {ConfigData|null} configData The config data to create. - * @param {Object} [options] The options. - * @param {string} [options.basePath] The base path to resolve relative paths in `overrides[].files`, `overrides[].excludedFiles`, and `ignorePatterns`. - * @param {string} [options.filePath] The path to this config data. - * @param {string} [options.name] The config name. - * @returns {ConfigArray} Loaded config. - */ - create(configData, { basePath, filePath, name } = {}) { - if (!configData) { - return new ConfigArray(); - } - - const slots = internalSlotsMap.get(this); - const ctx = createContext(slots, "config", name, filePath, basePath); - const elements = this._normalizeConfigData(configData, ctx); - - return new ConfigArray(...elements); - } - - /** - * Load a config file. - * @param {string} filePath The path to a config file. - * @param {Object} [options] The options. - * @param {string} [options.basePath] The base path to resolve relative paths in `overrides[].files`, `overrides[].excludedFiles`, and `ignorePatterns`. - * @param {string} [options.name] The config name. - * @returns {ConfigArray} Loaded config. - */ - loadFile(filePath, { basePath, name } = {}) { - const slots = internalSlotsMap.get(this); - const ctx = createContext(slots, "config", name, filePath, basePath); - - return new ConfigArray(...this._loadConfigData(ctx)); - } - - /** - * Load the config file on a given directory if exists. - * @param {string} directoryPath The path to a directory. - * @param {Object} [options] The options. - * @param {string} [options.basePath] The base path to resolve relative paths in `overrides[].files`, `overrides[].excludedFiles`, and `ignorePatterns`. - * @param {string} [options.name] The config name. - * @returns {ConfigArray} Loaded config. An empty `ConfigArray` if any config doesn't exist. - */ - loadInDirectory(directoryPath, { basePath, name } = {}) { - const slots = internalSlotsMap.get(this); - - for (const filename of configFilenames) { - const ctx = createContext( - slots, - "config", - name, - path.join(directoryPath, filename), - basePath - ); - - if (fs.existsSync(ctx.filePath)) { - let configData; - - try { - configData = loadConfigFile(ctx.filePath); - } catch (error) { - if (!error || error.code !== "ESLINT_CONFIG_FIELD_NOT_FOUND") { - throw error; - } - } - - if (configData) { - debug(`Config file found: ${ctx.filePath}`); - return new ConfigArray( - ...this._normalizeConfigData(configData, ctx) - ); - } - } - } - - debug(`Config file not found on ${directoryPath}`); - return new ConfigArray(); - } - - /** - * Check if a config file on a given directory exists or not. - * @param {string} directoryPath The path to a directory. - * @returns {string | null} The path to the found config file. If not found then null. - */ - static getPathToConfigFileInDirectory(directoryPath) { - for (const filename of configFilenames) { - const filePath = path.join(directoryPath, filename); - - if (fs.existsSync(filePath)) { - if (filename === "package.json") { - try { - loadPackageJSONConfigFile(filePath); - return filePath; - } catch { /* ignore */ } - } else { - return filePath; - } - } - } - return null; - } - - /** - * Load `.eslintignore` file. - * @param {string} filePath The path to a `.eslintignore` file to load. - * @returns {ConfigArray} Loaded config. An empty `ConfigArray` if any config doesn't exist. - */ - loadESLintIgnore(filePath) { - const slots = internalSlotsMap.get(this); - const ctx = createContext( - slots, - "ignore", - void 0, - filePath, - slots.cwd - ); - const ignorePatterns = loadESLintIgnoreFile(ctx.filePath); - - return new ConfigArray( - ...this._normalizeESLintIgnoreData(ignorePatterns, ctx) - ); - } - - /** - * Load `.eslintignore` file in the current working directory. - * @returns {ConfigArray} Loaded config. An empty `ConfigArray` if any config doesn't exist. - */ - loadDefaultESLintIgnore() { - const slots = internalSlotsMap.get(this); - const eslintIgnorePath = path.resolve(slots.cwd, ".eslintignore"); - const packageJsonPath = path.resolve(slots.cwd, "package.json"); - - if (fs.existsSync(eslintIgnorePath)) { - return this.loadESLintIgnore(eslintIgnorePath); - } - if (fs.existsSync(packageJsonPath)) { - const data = loadJSONConfigFile(packageJsonPath); - - if (Object.hasOwnProperty.call(data, "eslintIgnore")) { - if (!Array.isArray(data.eslintIgnore)) { - throw new Error("Package.json eslintIgnore property requires an array of paths"); - } - const ctx = createContext( - slots, - "ignore", - "eslintIgnore in package.json", - packageJsonPath, - slots.cwd - ); - - return new ConfigArray( - ...this._normalizeESLintIgnoreData(data.eslintIgnore, ctx) - ); - } - } - - return new ConfigArray(); - } - - /** - * Load a given config file. - * @param {ConfigArrayFactoryLoadingContext} ctx The loading context. - * @returns {IterableIterator} Loaded config. - * @private - */ - _loadConfigData(ctx) { - return this._normalizeConfigData(loadConfigFile(ctx.filePath), ctx); - } - - /** - * Normalize a given `.eslintignore` data to config array elements. - * @param {string[]} ignorePatterns The patterns to ignore files. - * @param {ConfigArrayFactoryLoadingContext} ctx The loading context. - * @returns {IterableIterator} The normalized config. - * @private - */ - *_normalizeESLintIgnoreData(ignorePatterns, ctx) { - const elements = this._normalizeObjectConfigData( - { ignorePatterns }, - ctx - ); - - // Set `ignorePattern.loose` flag for backward compatibility. - for (const element of elements) { - if (element.ignorePattern) { - element.ignorePattern.loose = true; - } - yield element; - } - } - - /** - * Normalize a given config to an array. - * @param {ConfigData} configData The config data to normalize. - * @param {ConfigArrayFactoryLoadingContext} ctx The loading context. - * @returns {IterableIterator} The normalized config. - * @private - */ - _normalizeConfigData(configData, ctx) { - validateConfigSchema(configData, ctx.name || ctx.filePath); - return this._normalizeObjectConfigData(configData, ctx); - } - - /** - * Normalize a given config to an array. - * @param {ConfigData|OverrideConfigData} configData The config data to normalize. - * @param {ConfigArrayFactoryLoadingContext} ctx The loading context. - * @returns {IterableIterator} The normalized config. - * @private - */ - *_normalizeObjectConfigData(configData, ctx) { - const { files, excludedFiles, ...configBody } = configData; - const criteria = OverrideTester.create( - files, - excludedFiles, - ctx.matchBasePath - ); - const elements = this._normalizeObjectConfigDataBody(configBody, ctx); - - // Apply the criteria to every element. - for (const element of elements) { - - /* - * Merge the criteria. - * This is for the `overrides` entries that came from the - * configurations of `overrides[].extends`. - */ - element.criteria = OverrideTester.and(criteria, element.criteria); - - /* - * Remove `root` property to ignore `root` settings which came from - * `extends` in `overrides`. - */ - if (element.criteria) { - element.root = void 0; - } - - yield element; - } - } - - /** - * Normalize a given config to an array. - * @param {ConfigData} configData The config data to normalize. - * @param {ConfigArrayFactoryLoadingContext} ctx The loading context. - * @returns {IterableIterator} The normalized config. - * @private - */ - *_normalizeObjectConfigDataBody( - { - env, - extends: extend, - globals, - ignorePatterns, - noInlineConfig, - parser: parserName, - parserOptions, - plugins: pluginList, - processor, - reportUnusedDisableDirectives, - root, - rules, - settings, - overrides: overrideList = [] - }, - ctx - ) { - const extendList = Array.isArray(extend) ? extend : [extend]; - const ignorePattern = ignorePatterns && new IgnorePattern( - Array.isArray(ignorePatterns) ? ignorePatterns : [ignorePatterns], - ctx.matchBasePath - ); - - // Flatten `extends`. - for (const extendName of extendList.filter(Boolean)) { - yield* this._loadExtends(extendName, ctx); - } - - // Load parser & plugins. - const parser = parserName && this._loadParser(parserName, ctx); - const plugins = pluginList && this._loadPlugins(pluginList, ctx); - - // Yield pseudo config data for file extension processors. - if (plugins) { - yield* this._takeFileExtensionProcessors(plugins, ctx); - } - - // Yield the config data except `extends` and `overrides`. - yield { - - // Debug information. - type: ctx.type, - name: ctx.name, - filePath: ctx.filePath, - - // Config data. - criteria: null, - env, - globals, - ignorePattern, - noInlineConfig, - parser, - parserOptions, - plugins, - processor, - reportUnusedDisableDirectives, - root, - rules, - settings - }; - - // Flatten `overries`. - for (let i = 0; i < overrideList.length; ++i) { - yield* this._normalizeObjectConfigData( - overrideList[i], - { ...ctx, name: `${ctx.name}#overrides[${i}]` } - ); - } - } - - /** - * Load configs of an element in `extends`. - * @param {string} extendName The name of a base config. - * @param {ConfigArrayFactoryLoadingContext} ctx The loading context. - * @returns {IterableIterator} The normalized config. - * @private - */ - _loadExtends(extendName, ctx) { - debug("Loading {extends:%j} relative to %s", extendName, ctx.filePath); - try { - if (extendName.startsWith("eslint:")) { - return this._loadExtendedBuiltInConfig(extendName, ctx); - } - if (extendName.startsWith("plugin:")) { - return this._loadExtendedPluginConfig(extendName, ctx); - } - return this._loadExtendedShareableConfig(extendName, ctx); - } catch (error) { - error.message += `\nReferenced from: ${ctx.filePath || ctx.name}`; - throw error; - } - } - - /** - * Load configs of an element in `extends`. - * @param {string} extendName The name of a base config. - * @param {ConfigArrayFactoryLoadingContext} ctx The loading context. - * @returns {IterableIterator} The normalized config. - * @private - */ - _loadExtendedBuiltInConfig(extendName, ctx) { - if (extendName === "eslint:recommended") { - return this._loadConfigData({ - ...ctx, - filePath: eslintRecommendedPath, - name: `${ctx.name} » ${extendName}` - }); - } - if (extendName === "eslint:all") { - return this._loadConfigData({ - ...ctx, - filePath: eslintAllPath, - name: `${ctx.name} » ${extendName}` - }); - } - - throw configInvalidError(extendName, ctx.name, "extend-config-missing"); - } - - /** - * Load configs of an element in `extends`. - * @param {string} extendName The name of a base config. - * @param {ConfigArrayFactoryLoadingContext} ctx The loading context. - * @returns {IterableIterator} The normalized config. - * @private - */ - _loadExtendedPluginConfig(extendName, ctx) { - const slashIndex = extendName.lastIndexOf("/"); - - if (slashIndex === -1) { - throw configInvalidError(extendName, ctx.filePath, "plugin-invalid"); - } - - const pluginName = extendName.slice("plugin:".length, slashIndex); - const configName = extendName.slice(slashIndex + 1); - - if (isFilePath(pluginName)) { - throw new Error("'extends' cannot use a file path for plugins."); - } - - const plugin = this._loadPlugin(pluginName, ctx); - const configData = - plugin.definition && - plugin.definition.configs[configName]; - - if (configData) { - return this._normalizeConfigData(configData, { - ...ctx, - filePath: plugin.filePath || ctx.filePath, - name: `${ctx.name} » plugin:${plugin.id}/${configName}` - }); - } - - throw plugin.error || configInvalidError(extendName, ctx.filePath, "extend-config-missing"); - } - - /** - * Load configs of an element in `extends`. - * @param {string} extendName The name of a base config. - * @param {ConfigArrayFactoryLoadingContext} ctx The loading context. - * @returns {IterableIterator} The normalized config. - * @private - */ - _loadExtendedShareableConfig(extendName, ctx) { - const { cwd } = internalSlotsMap.get(this); - const relativeTo = ctx.filePath || path.join(cwd, "__placeholder__.js"); - let request; - - if (isFilePath(extendName)) { - request = extendName; - } else if (extendName.startsWith(".")) { - request = `./${extendName}`; // For backward compatibility. A ton of tests depended on this behavior. - } else { - request = naming.normalizePackageName( - extendName, - "eslint-config" - ); - } - - let filePath; - - try { - filePath = ModuleResolver.resolve(request, relativeTo); - } catch (error) { - /* istanbul ignore else */ - if (error && error.code === "MODULE_NOT_FOUND") { - throw configInvalidError(extendName, ctx.filePath, "extend-config-missing"); - } - throw error; - } - - writeDebugLogForLoading(request, relativeTo, filePath); - return this._loadConfigData({ - ...ctx, - filePath, - name: `${ctx.name} » ${request}` - }); - } - - /** - * Load given plugins. - * @param {string[]} names The plugin names to load. - * @param {ConfigArrayFactoryLoadingContext} ctx The loading context. - * @returns {Record} The loaded parser. - * @private - */ - _loadPlugins(names, ctx) { - return names.reduce((map, name) => { - if (isFilePath(name)) { - throw new Error("Plugins array cannot includes file paths."); - } - const plugin = this._loadPlugin(name, ctx); - - map[plugin.id] = plugin; - - return map; - }, {}); - } - - /** - * Load a given parser. - * @param {string} nameOrPath The package name or the path to a parser file. - * @param {ConfigArrayFactoryLoadingContext} ctx The loading context. - * @returns {DependentParser} The loaded parser. - */ - _loadParser(nameOrPath, ctx) { - debug("Loading parser %j from %s", nameOrPath, ctx.filePath); - - const { cwd } = internalSlotsMap.get(this); - const relativeTo = ctx.filePath || path.join(cwd, "__placeholder__.js"); - - try { - const filePath = ModuleResolver.resolve(nameOrPath, relativeTo); - - writeDebugLogForLoading(nameOrPath, relativeTo, filePath); - - return new ConfigDependency({ - definition: require(filePath), - filePath, - id: nameOrPath, - importerName: ctx.name, - importerPath: ctx.filePath - }); - } catch (error) { - - // If the parser name is "espree", load the espree of ESLint. - if (nameOrPath === "espree") { - debug("Fallback espree."); - return new ConfigDependency({ - definition: require("espree"), - filePath: require.resolve("espree"), - id: nameOrPath, - importerName: ctx.name, - importerPath: ctx.filePath - }); - } - - debug("Failed to load parser '%s' declared in '%s'.", nameOrPath, ctx.name); - error.message = `Failed to load parser '${nameOrPath}' declared in '${ctx.name}': ${error.message}`; - - return new ConfigDependency({ - error, - id: nameOrPath, - importerName: ctx.name, - importerPath: ctx.filePath - }); - } - } - - /** - * Load a given plugin. - * @param {string} name The plugin name to load. - * @param {ConfigArrayFactoryLoadingContext} ctx The loading context. - * @returns {DependentPlugin} The loaded plugin. - * @private - */ - _loadPlugin(name, ctx) { - debug("Loading plugin %j from %s", name, ctx.filePath); - - const { additionalPluginPool } = internalSlotsMap.get(this); - const request = naming.normalizePackageName(name, "eslint-plugin"); - const id = naming.getShorthandName(request, "eslint-plugin"); - const relativeTo = path.join(ctx.pluginBasePath, "__placeholder__.js"); - - if (name.match(/\s+/u)) { - const error = Object.assign( - new Error(`Whitespace found in plugin name '${name}'`), - { - messageTemplate: "whitespace-found", - messageData: { pluginName: request } - } - ); - - return new ConfigDependency({ - error, - id, - importerName: ctx.name, - importerPath: ctx.filePath - }); - } - - // Check for additional pool. - const plugin = - additionalPluginPool.get(request) || - additionalPluginPool.get(id); - - if (plugin) { - return new ConfigDependency({ - definition: normalizePlugin(plugin), - filePath: "", // It's unknown where the plugin came from. - id, - importerName: ctx.name, - importerPath: ctx.filePath - }); - } - - let filePath; - let error; - - try { - filePath = ModuleResolver.resolve(request, relativeTo); - } catch (resolveError) { - error = resolveError; - /* istanbul ignore else */ - if (error && error.code === "MODULE_NOT_FOUND") { - error.messageTemplate = "plugin-missing"; - error.messageData = { - pluginName: request, - resolvePluginsRelativeTo: ctx.pluginBasePath, - importerName: ctx.name - }; - } - } - - if (filePath) { - try { - writeDebugLogForLoading(request, relativeTo, filePath); - - const startTime = Date.now(); - const pluginDefinition = require(filePath); - - debug(`Plugin ${filePath} loaded in: ${Date.now() - startTime}ms`); - - return new ConfigDependency({ - definition: normalizePlugin(pluginDefinition), - filePath, - id, - importerName: ctx.name, - importerPath: ctx.filePath - }); - } catch (loadError) { - error = loadError; - } - } - - debug("Failed to load plugin '%s' declared in '%s'.", name, ctx.name); - error.message = `Failed to load plugin '${name}' declared in '${ctx.name}': ${error.message}`; - return new ConfigDependency({ - error, - id, - importerName: ctx.name, - importerPath: ctx.filePath - }); - } - - /** - * Take file expression processors as config array elements. - * @param {Record} plugins The plugin definitions. - * @param {ConfigArrayFactoryLoadingContext} ctx The loading context. - * @returns {IterableIterator} The config array elements of file expression processors. - * @private - */ - *_takeFileExtensionProcessors(plugins, ctx) { - for (const pluginId of Object.keys(plugins)) { - const processors = - plugins[pluginId] && - plugins[pluginId].definition && - plugins[pluginId].definition.processors; - - if (!processors) { - continue; - } - - for (const processorId of Object.keys(processors)) { - if (processorId.startsWith(".")) { - yield* this._normalizeObjectConfigData( - { - files: [`*${processorId}`], - processor: `${pluginId}/${processorId}` - }, - { - ...ctx, - type: "implicit-processor", - name: `${ctx.name}#processors["${pluginId}/${processorId}"]` - } - ); - } - } - } - } -} - -module.exports = { ConfigArrayFactory, createContext }; diff --git a/tools/node_modules/eslint/lib/cli-engine/config-array/config-array.js b/tools/node_modules/eslint/lib/cli-engine/config-array/config-array.js deleted file mode 100644 index c2ef6c94ab0414..00000000000000 --- a/tools/node_modules/eslint/lib/cli-engine/config-array/config-array.js +++ /dev/null @@ -1,536 +0,0 @@ -/* - * STOP!!! DO NOT MODIFY. - * - * This file is part of the ongoing work to move the eslintrc-style config - * system into the @eslint/eslintrc package. This file needs to remain - * unchanged in order for this work to proceed. - * - * If you think you need to change this file, please contact @nzakas first. - * - * Thanks in advance for your cooperation. - */ - -/** - * @fileoverview `ConfigArray` class. - * - * `ConfigArray` class expresses the full of a configuration. It has the entry - * config file, base config files that were extended, loaded parsers, and loaded - * plugins. - * - * `ConfigArray` class provides three properties and two methods. - * - * - `pluginEnvironments` - * - `pluginProcessors` - * - `pluginRules` - * The `Map` objects that contain the members of all plugins that this - * config array contains. Those map objects don't have mutation methods. - * Those keys are the member ID such as `pluginId/memberName`. - * - `isRoot()` - * If `true` then this configuration has `root:true` property. - * - `extractConfig(filePath)` - * Extract the final configuration for a given file. This means merging - * every config array element which that `criteria` property matched. The - * `filePath` argument must be an absolute path. - * - * `ConfigArrayFactory` provides the loading logic of config files. - * - * @author Toru Nagashima - */ -"use strict"; - -//------------------------------------------------------------------------------ -// Requirements -//------------------------------------------------------------------------------ - -const { ExtractedConfig } = require("./extracted-config"); -const { IgnorePattern } = require("./ignore-pattern"); - -//------------------------------------------------------------------------------ -// Helpers -//------------------------------------------------------------------------------ - -// Define types for VSCode IntelliSense. -/** @typedef {import("../../shared/types").Environment} Environment */ -/** @typedef {import("../../shared/types").GlobalConf} GlobalConf */ -/** @typedef {import("../../shared/types").RuleConf} RuleConf */ -/** @typedef {import("../../shared/types").Rule} Rule */ -/** @typedef {import("../../shared/types").Plugin} Plugin */ -/** @typedef {import("../../shared/types").Processor} Processor */ -/** @typedef {import("./config-dependency").DependentParser} DependentParser */ -/** @typedef {import("./config-dependency").DependentPlugin} DependentPlugin */ -/** @typedef {import("./override-tester")["OverrideTester"]} OverrideTester */ - -/** - * @typedef {Object} ConfigArrayElement - * @property {string} name The name of this config element. - * @property {string} filePath The path to the source file of this config element. - * @property {InstanceType|null} criteria The tester for the `files` and `excludedFiles` of this config element. - * @property {Record|undefined} env The environment settings. - * @property {Record|undefined} globals The global variable settings. - * @property {IgnorePattern|undefined} ignorePattern The ignore patterns. - * @property {boolean|undefined} noInlineConfig The flag that disables directive comments. - * @property {DependentParser|undefined} parser The parser loader. - * @property {Object|undefined} parserOptions The parser options. - * @property {Record|undefined} plugins The plugin loaders. - * @property {string|undefined} processor The processor name to refer plugin's processor. - * @property {boolean|undefined} reportUnusedDisableDirectives The flag to report unused `eslint-disable` comments. - * @property {boolean|undefined} root The flag to express root. - * @property {Record|undefined} rules The rule settings - * @property {Object|undefined} settings The shared settings. - * @property {"config" | "ignore" | "implicit-processor"} type The element type. - */ - -/** - * @typedef {Object} ConfigArrayInternalSlots - * @property {Map} cache The cache to extract configs. - * @property {ReadonlyMap|null} envMap The map from environment ID to environment definition. - * @property {ReadonlyMap|null} processorMap The map from processor ID to environment definition. - * @property {ReadonlyMap|null} ruleMap The map from rule ID to rule definition. - */ - -/** @type {WeakMap} */ -const internalSlotsMap = new class extends WeakMap { - get(key) { - let value = super.get(key); - - if (!value) { - value = { - cache: new Map(), - envMap: null, - processorMap: null, - ruleMap: null - }; - super.set(key, value); - } - - return value; - } -}(); - -/** - * Get the indices which are matched to a given file. - * @param {ConfigArrayElement[]} elements The elements. - * @param {string} filePath The path to a target file. - * @returns {number[]} The indices. - */ -function getMatchedIndices(elements, filePath) { - const indices = []; - - for (let i = elements.length - 1; i >= 0; --i) { - const element = elements[i]; - - if (!element.criteria || (filePath && element.criteria.test(filePath))) { - indices.push(i); - } - } - - return indices; -} - -/** - * Check if a value is a non-null object. - * @param {any} x The value to check. - * @returns {boolean} `true` if the value is a non-null object. - */ -function isNonNullObject(x) { - return typeof x === "object" && x !== null; -} - -/** - * Merge two objects. - * - * Assign every property values of `y` to `x` if `x` doesn't have the property. - * If `x`'s property value is an object, it does recursive. - * @param {Object} target The destination to merge - * @param {Object|undefined} source The source to merge. - * @returns {void} - */ -function mergeWithoutOverwrite(target, source) { - if (!isNonNullObject(source)) { - return; - } - - for (const key of Object.keys(source)) { - if (key === "__proto__") { - continue; - } - - if (isNonNullObject(target[key])) { - mergeWithoutOverwrite(target[key], source[key]); - } else if (target[key] === void 0) { - if (isNonNullObject(source[key])) { - target[key] = Array.isArray(source[key]) ? [] : {}; - mergeWithoutOverwrite(target[key], source[key]); - } else if (source[key] !== void 0) { - target[key] = source[key]; - } - } - } -} - -/** - * The error for plugin conflicts. - */ -class PluginConflictError extends Error { - - /** - * Initialize this error object. - * @param {string} pluginId The plugin ID. - * @param {{filePath:string, importerName:string}[]} plugins The resolved plugins. - */ - constructor(pluginId, plugins) { - super(`Plugin "${pluginId}" was conflicted between ${plugins.map(p => `"${p.importerName}"`).join(" and ")}.`); - this.messageTemplate = "plugin-conflict"; - this.messageData = { pluginId, plugins }; - } -} - -/** - * Merge plugins. - * `target`'s definition is prior to `source`'s. - * @param {Record} target The destination to merge - * @param {Record|undefined} source The source to merge. - * @returns {void} - */ -function mergePlugins(target, source) { - if (!isNonNullObject(source)) { - return; - } - - for (const key of Object.keys(source)) { - if (key === "__proto__") { - continue; - } - const targetValue = target[key]; - const sourceValue = source[key]; - - // Adopt the plugin which was found at first. - if (targetValue === void 0) { - if (sourceValue.error) { - throw sourceValue.error; - } - target[key] = sourceValue; - } else if (sourceValue.filePath !== targetValue.filePath) { - throw new PluginConflictError(key, [ - { - filePath: targetValue.filePath, - importerName: targetValue.importerName - }, - { - filePath: sourceValue.filePath, - importerName: sourceValue.importerName - } - ]); - } - } -} - -/** - * Merge rule configs. - * `target`'s definition is prior to `source`'s. - * @param {Record} target The destination to merge - * @param {Record|undefined} source The source to merge. - * @returns {void} - */ -function mergeRuleConfigs(target, source) { - if (!isNonNullObject(source)) { - return; - } - - for (const key of Object.keys(source)) { - if (key === "__proto__") { - continue; - } - const targetDef = target[key]; - const sourceDef = source[key]; - - // Adopt the rule config which was found at first. - if (targetDef === void 0) { - if (Array.isArray(sourceDef)) { - target[key] = [...sourceDef]; - } else { - target[key] = [sourceDef]; - } - - /* - * If the first found rule config is severity only and the current rule - * config has options, merge the severity and the options. - */ - } else if ( - targetDef.length === 1 && - Array.isArray(sourceDef) && - sourceDef.length >= 2 - ) { - targetDef.push(...sourceDef.slice(1)); - } - } -} - -/** - * Create the extracted config. - * @param {ConfigArray} instance The config elements. - * @param {number[]} indices The indices to use. - * @returns {ExtractedConfig} The extracted config. - */ -function createConfig(instance, indices) { - const config = new ExtractedConfig(); - const ignorePatterns = []; - - // Merge elements. - for (const index of indices) { - const element = instance[index]; - - // Adopt the parser which was found at first. - if (!config.parser && element.parser) { - if (element.parser.error) { - throw element.parser.error; - } - config.parser = element.parser; - } - - // Adopt the processor which was found at first. - if (!config.processor && element.processor) { - config.processor = element.processor; - } - - // Adopt the noInlineConfig which was found at first. - if (config.noInlineConfig === void 0 && element.noInlineConfig !== void 0) { - config.noInlineConfig = element.noInlineConfig; - config.configNameOfNoInlineConfig = element.name; - } - - // Adopt the reportUnusedDisableDirectives which was found at first. - if (config.reportUnusedDisableDirectives === void 0 && element.reportUnusedDisableDirectives !== void 0) { - config.reportUnusedDisableDirectives = element.reportUnusedDisableDirectives; - } - - // Collect ignorePatterns - if (element.ignorePattern) { - ignorePatterns.push(element.ignorePattern); - } - - // Merge others. - mergeWithoutOverwrite(config.env, element.env); - mergeWithoutOverwrite(config.globals, element.globals); - mergeWithoutOverwrite(config.parserOptions, element.parserOptions); - mergeWithoutOverwrite(config.settings, element.settings); - mergePlugins(config.plugins, element.plugins); - mergeRuleConfigs(config.rules, element.rules); - } - - // Create the predicate function for ignore patterns. - if (ignorePatterns.length > 0) { - config.ignores = IgnorePattern.createIgnore(ignorePatterns.reverse()); - } - - return config; -} - -/** - * Collect definitions. - * @template T, U - * @param {string} pluginId The plugin ID for prefix. - * @param {Record} defs The definitions to collect. - * @param {Map} map The map to output. - * @param {function(T): U} [normalize] The normalize function for each value. - * @returns {void} - */ -function collect(pluginId, defs, map, normalize) { - if (defs) { - const prefix = pluginId && `${pluginId}/`; - - for (const [key, value] of Object.entries(defs)) { - map.set( - `${prefix}${key}`, - normalize ? normalize(value) : value - ); - } - } -} - -/** - * Normalize a rule definition. - * @param {Function|Rule} rule The rule definition to normalize. - * @returns {Rule} The normalized rule definition. - */ -function normalizePluginRule(rule) { - return typeof rule === "function" ? { create: rule } : rule; -} - -/** - * Delete the mutation methods from a given map. - * @param {Map} map The map object to delete. - * @returns {void} - */ -function deleteMutationMethods(map) { - Object.defineProperties(map, { - clear: { configurable: true, value: void 0 }, - delete: { configurable: true, value: void 0 }, - set: { configurable: true, value: void 0 } - }); -} - -/** - * Create `envMap`, `processorMap`, `ruleMap` with the plugins in the config array. - * @param {ConfigArrayElement[]} elements The config elements. - * @param {ConfigArrayInternalSlots} slots The internal slots. - * @returns {void} - */ -function initPluginMemberMaps(elements, slots) { - const processed = new Set(); - - slots.envMap = new Map(); - slots.processorMap = new Map(); - slots.ruleMap = new Map(); - - for (const element of elements) { - if (!element.plugins) { - continue; - } - - for (const [pluginId, value] of Object.entries(element.plugins)) { - const plugin = value.definition; - - if (!plugin || processed.has(pluginId)) { - continue; - } - processed.add(pluginId); - - collect(pluginId, plugin.environments, slots.envMap); - collect(pluginId, plugin.processors, slots.processorMap); - collect(pluginId, plugin.rules, slots.ruleMap, normalizePluginRule); - } - } - - deleteMutationMethods(slots.envMap); - deleteMutationMethods(slots.processorMap); - deleteMutationMethods(slots.ruleMap); -} - -/** - * Create `envMap`, `processorMap`, `ruleMap` with the plugins in the config array. - * @param {ConfigArray} instance The config elements. - * @returns {ConfigArrayInternalSlots} The extracted config. - */ -function ensurePluginMemberMaps(instance) { - const slots = internalSlotsMap.get(instance); - - if (!slots.ruleMap) { - initPluginMemberMaps(instance, slots); - } - - return slots; -} - -//------------------------------------------------------------------------------ -// Public Interface -//------------------------------------------------------------------------------ - -/** - * The Config Array. - * - * `ConfigArray` instance contains all settings, parsers, and plugins. - * You need to call `ConfigArray#extractConfig(filePath)` method in order to - * extract, merge and get only the config data which is related to an arbitrary - * file. - * @extends {Array} - */ -class ConfigArray extends Array { - - /** - * Get the plugin environments. - * The returned map cannot be mutated. - * @type {ReadonlyMap} The plugin environments. - */ - get pluginEnvironments() { - return ensurePluginMemberMaps(this).envMap; - } - - /** - * Get the plugin processors. - * The returned map cannot be mutated. - * @type {ReadonlyMap} The plugin processors. - */ - get pluginProcessors() { - return ensurePluginMemberMaps(this).processorMap; - } - - /** - * Get the plugin rules. - * The returned map cannot be mutated. - * @returns {ReadonlyMap} The plugin rules. - */ - get pluginRules() { - return ensurePluginMemberMaps(this).ruleMap; - } - - /** - * Check if this config has `root` flag. - * @returns {boolean} `true` if this config array is root. - */ - isRoot() { - for (let i = this.length - 1; i >= 0; --i) { - const root = this[i].root; - - if (typeof root === "boolean") { - return root; - } - } - return false; - } - - /** - * Extract the config data which is related to a given file. - * @param {string} filePath The absolute path to the target file. - * @returns {ExtractedConfig} The extracted config data. - */ - extractConfig(filePath) { - const { cache } = internalSlotsMap.get(this); - const indices = getMatchedIndices(this, filePath); - const cacheKey = indices.join(","); - - if (!cache.has(cacheKey)) { - cache.set(cacheKey, createConfig(this, indices)); - } - - return cache.get(cacheKey); - } - - /** - * Check if a given path is an additional lint target. - * @param {string} filePath The absolute path to the target file. - * @returns {boolean} `true` if the file is an additional lint target. - */ - isAdditionalTargetPath(filePath) { - for (const { criteria, type } of this) { - if ( - type === "config" && - criteria && - !criteria.endsWithWildcard && - criteria.test(filePath) - ) { - return true; - } - } - return false; - } -} - -const exportObject = { - ConfigArray, - - /** - * Get the used extracted configs. - * CLIEngine will use this method to collect used deprecated rules. - * @param {ConfigArray} instance The config array object to get. - * @returns {ExtractedConfig[]} The used extracted configs. - * @private - */ - getUsedExtractedConfigs(instance) { - const { cache } = internalSlotsMap.get(instance); - - return Array.from(cache.values()); - } -}; - -module.exports = exportObject; diff --git a/tools/node_modules/eslint/lib/cli-engine/config-array/config-dependency.js b/tools/node_modules/eslint/lib/cli-engine/config-array/config-dependency.js deleted file mode 100644 index 9fc67b0105792d..00000000000000 --- a/tools/node_modules/eslint/lib/cli-engine/config-array/config-dependency.js +++ /dev/null @@ -1,128 +0,0 @@ -/* - * STOP!!! DO NOT MODIFY. - * - * This file is part of the ongoing work to move the eslintrc-style config - * system into the @eslint/eslintrc package. This file needs to remain - * unchanged in order for this work to proceed. - * - * If you think you need to change this file, please contact @nzakas first. - * - * Thanks in advance for your cooperation. - */ - -/** - * @fileoverview `ConfigDependency` class. - * - * `ConfigDependency` class expresses a loaded parser or plugin. - * - * If the parser or plugin was loaded successfully, it has `definition` property - * and `filePath` property. Otherwise, it has `error` property. - * - * When `JSON.stringify()` converted a `ConfigDependency` object to a JSON, it - * omits `definition` property. - * - * `ConfigArrayFactory` creates `ConfigDependency` objects when it loads parsers - * or plugins. - * - * @author Toru Nagashima - */ -"use strict"; - -const util = require("util"); - -/** - * The class is to store parsers or plugins. - * This class hides the loaded object from `JSON.stringify()` and `console.log`. - * @template T - */ -class ConfigDependency { - - /** - * Initialize this instance. - * @param {Object} data The dependency data. - * @param {T} [data.definition] The dependency if the loading succeeded. - * @param {Error} [data.error] The error object if the loading failed. - * @param {string} [data.filePath] The actual path to the dependency if the loading succeeded. - * @param {string} data.id The ID of this dependency. - * @param {string} data.importerName The name of the config file which loads this dependency. - * @param {string} data.importerPath The path to the config file which loads this dependency. - */ - constructor({ - definition = null, - error = null, - filePath = null, - id, - importerName, - importerPath - }) { - - /** - * The loaded dependency if the loading succeeded. - * @type {T|null} - */ - this.definition = definition; - - /** - * The error object if the loading failed. - * @type {Error|null} - */ - this.error = error; - - /** - * The loaded dependency if the loading succeeded. - * @type {string|null} - */ - this.filePath = filePath; - - /** - * The ID of this dependency. - * @type {string} - */ - this.id = id; - - /** - * The name of the config file which loads this dependency. - * @type {string} - */ - this.importerName = importerName; - - /** - * The path to the config file which loads this dependency. - * @type {string} - */ - this.importerPath = importerPath; - } - - // eslint-disable-next-line jsdoc/require-description - /** - * @returns {Object} a JSON compatible object. - */ - toJSON() { - const obj = this[util.inspect.custom](); - - // Display `error.message` (`Error#message` is unenumerable). - if (obj.error instanceof Error) { - obj.error = { ...obj.error, message: obj.error.message }; - } - - return obj; - } - - // eslint-disable-next-line jsdoc/require-description - /** - * @returns {Object} an object to display by `console.log()`. - */ - [util.inspect.custom]() { - const { - definition: _ignore, // eslint-disable-line no-unused-vars - ...obj - } = this; - - return obj; - } -} - -/** @typedef {ConfigDependency} DependentParser */ -/** @typedef {ConfigDependency} DependentPlugin */ - -module.exports = { ConfigDependency }; diff --git a/tools/node_modules/eslint/lib/cli-engine/config-array/extracted-config.js b/tools/node_modules/eslint/lib/cli-engine/config-array/extracted-config.js deleted file mode 100644 index fd7cabab3e97b2..00000000000000 --- a/tools/node_modules/eslint/lib/cli-engine/config-array/extracted-config.js +++ /dev/null @@ -1,158 +0,0 @@ -/* - * STOP!!! DO NOT MODIFY. - * - * This file is part of the ongoing work to move the eslintrc-style config - * system into the @eslint/eslintrc package. This file needs to remain - * unchanged in order for this work to proceed. - * - * If you think you need to change this file, please contact @nzakas first. - * - * Thanks in advance for your cooperation. - */ - -/** - * @fileoverview `ExtractedConfig` class. - * - * `ExtractedConfig` class expresses a final configuration for a specific file. - * - * It provides one method. - * - * - `toCompatibleObjectAsConfigFileContent()` - * Convert this configuration to the compatible object as the content of - * config files. It converts the loaded parser and plugins to strings. - * `CLIEngine#getConfigForFile(filePath)` method uses this method. - * - * `ConfigArray#extractConfig(filePath)` creates a `ExtractedConfig` instance. - * - * @author Toru Nagashima - */ -"use strict"; - -const { IgnorePattern } = require("./ignore-pattern"); - -// For VSCode intellisense -/** @typedef {import("../../shared/types").ConfigData} ConfigData */ -/** @typedef {import("../../shared/types").GlobalConf} GlobalConf */ -/** @typedef {import("../../shared/types").SeverityConf} SeverityConf */ -/** @typedef {import("./config-dependency").DependentParser} DependentParser */ -/** @typedef {import("./config-dependency").DependentPlugin} DependentPlugin */ - -/** - * Check if `xs` starts with `ys`. - * @template T - * @param {T[]} xs The array to check. - * @param {T[]} ys The array that may be the first part of `xs`. - * @returns {boolean} `true` if `xs` starts with `ys`. - */ -function startsWith(xs, ys) { - return xs.length >= ys.length && ys.every((y, i) => y === xs[i]); -} - -/** - * The class for extracted config data. - */ -class ExtractedConfig { - constructor() { - - /** - * The config name what `noInlineConfig` setting came from. - * @type {string} - */ - this.configNameOfNoInlineConfig = ""; - - /** - * Environments. - * @type {Record} - */ - this.env = {}; - - /** - * Global variables. - * @type {Record} - */ - this.globals = {}; - - /** - * The glob patterns that ignore to lint. - * @type {(((filePath:string, dot?:boolean) => boolean) & { basePath:string; patterns:string[] }) | undefined} - */ - this.ignores = void 0; - - /** - * The flag that disables directive comments. - * @type {boolean|undefined} - */ - this.noInlineConfig = void 0; - - /** - * Parser definition. - * @type {DependentParser|null} - */ - this.parser = null; - - /** - * Options for the parser. - * @type {Object} - */ - this.parserOptions = {}; - - /** - * Plugin definitions. - * @type {Record} - */ - this.plugins = {}; - - /** - * Processor ID. - * @type {string|null} - */ - this.processor = null; - - /** - * The flag that reports unused `eslint-disable` directive comments. - * @type {boolean|undefined} - */ - this.reportUnusedDisableDirectives = void 0; - - /** - * Rule settings. - * @type {Record} - */ - this.rules = {}; - - /** - * Shared settings. - * @type {Object} - */ - this.settings = {}; - } - - /** - * Convert this config to the compatible object as a config file content. - * @returns {ConfigData} The converted object. - */ - toCompatibleObjectAsConfigFileContent() { - const { - /* eslint-disable no-unused-vars */ - configNameOfNoInlineConfig: _ignore1, - processor: _ignore2, - /* eslint-enable no-unused-vars */ - ignores, - ...config - } = this; - - config.parser = config.parser && config.parser.filePath; - config.plugins = Object.keys(config.plugins).filter(Boolean).reverse(); - config.ignorePatterns = ignores ? ignores.patterns : []; - - // Strip the default patterns from `ignorePatterns`. - if (startsWith(config.ignorePatterns, IgnorePattern.DefaultPatterns)) { - config.ignorePatterns = - config.ignorePatterns.slice(IgnorePattern.DefaultPatterns.length); - } - - return config; - } -} - -module.exports = { ExtractedConfig }; diff --git a/tools/node_modules/eslint/lib/cli-engine/config-array/ignore-pattern.js b/tools/node_modules/eslint/lib/cli-engine/config-array/ignore-pattern.js deleted file mode 100644 index 37d686dd1bb9cf..00000000000000 --- a/tools/node_modules/eslint/lib/cli-engine/config-array/ignore-pattern.js +++ /dev/null @@ -1,249 +0,0 @@ -/* - * STOP!!! DO NOT MODIFY. - * - * This file is part of the ongoing work to move the eslintrc-style config - * system into the @eslint/eslintrc package. This file needs to remain - * unchanged in order for this work to proceed. - * - * If you think you need to change this file, please contact @nzakas first. - * - * Thanks in advance for your cooperation. - */ - -/** - * @fileoverview `IgnorePattern` class. - * - * `IgnorePattern` class has the set of glob patterns and the base path. - * - * It provides two static methods. - * - * - `IgnorePattern.createDefaultIgnore(cwd)` - * Create the default predicate function. - * - `IgnorePattern.createIgnore(ignorePatterns)` - * Create the predicate function from multiple `IgnorePattern` objects. - * - * It provides two properties and a method. - * - * - `patterns` - * The glob patterns that ignore to lint. - * - `basePath` - * The base path of the glob patterns. If absolute paths existed in the - * glob patterns, those are handled as relative paths to the base path. - * - `getPatternsRelativeTo(basePath)` - * Get `patterns` as modified for a given base path. It modifies the - * absolute paths in the patterns as prepending the difference of two base - * paths. - * - * `ConfigArrayFactory` creates `IgnorePattern` objects when it processes - * `ignorePatterns` properties. - * - * @author Toru Nagashima - */ -"use strict"; - -//------------------------------------------------------------------------------ -// Requirements -//------------------------------------------------------------------------------ - -const assert = require("assert"); -const path = require("path"); -const ignore = require("ignore"); -const debug = require("debug")("eslint:ignore-pattern"); - -/** @typedef {ReturnType} Ignore */ - -//------------------------------------------------------------------------------ -// Helpers -//------------------------------------------------------------------------------ - -/** - * Get the path to the common ancestor directory of given paths. - * @param {string[]} sourcePaths The paths to calculate the common ancestor. - * @returns {string} The path to the common ancestor directory. - */ -function getCommonAncestorPath(sourcePaths) { - let result = sourcePaths[0]; - - for (let i = 1; i < sourcePaths.length; ++i) { - const a = result; - const b = sourcePaths[i]; - - // Set the shorter one (it's the common ancestor if one includes the other). - result = a.length < b.length ? a : b; - - // Set the common ancestor. - for (let j = 0, lastSepPos = 0; j < a.length && j < b.length; ++j) { - if (a[j] !== b[j]) { - result = a.slice(0, lastSepPos); - break; - } - if (a[j] === path.sep) { - lastSepPos = j; - } - } - } - - let resolvedResult = result || path.sep; - - // if Windows common ancestor is root of drive must have trailing slash to be absolute. - if (resolvedResult && resolvedResult.endsWith(":") && process.platform === "win32") { - resolvedResult += path.sep; - } - return resolvedResult; -} - -/** - * Make relative path. - * @param {string} from The source path to get relative path. - * @param {string} to The destination path to get relative path. - * @returns {string} The relative path. - */ -function relative(from, to) { - const relPath = path.relative(from, to); - - if (path.sep === "/") { - return relPath; - } - return relPath.split(path.sep).join("/"); -} - -/** - * Get the trailing slash if existed. - * @param {string} filePath The path to check. - * @returns {string} The trailing slash if existed. - */ -function dirSuffix(filePath) { - const isDir = ( - filePath.endsWith(path.sep) || - (process.platform === "win32" && filePath.endsWith("/")) - ); - - return isDir ? "/" : ""; -} - -const DefaultPatterns = Object.freeze(["/**/node_modules/*"]); -const DotPatterns = Object.freeze([".*", "!.eslintrc.*", "!../"]); - -//------------------------------------------------------------------------------ -// Public -//------------------------------------------------------------------------------ - -class IgnorePattern { - - /** - * The default patterns. - * @type {string[]} - */ - static get DefaultPatterns() { - return DefaultPatterns; - } - - /** - * Create the default predicate function. - * @param {string} cwd The current working directory. - * @returns {((filePath:string, dot:boolean) => boolean) & {basePath:string; patterns:string[]}} - * The preficate function. - * The first argument is an absolute path that is checked. - * The second argument is the flag to not ignore dotfiles. - * If the predicate function returned `true`, it means the path should be ignored. - */ - static createDefaultIgnore(cwd) { - return this.createIgnore([new IgnorePattern(DefaultPatterns, cwd)]); - } - - /** - * Create the predicate function from multiple `IgnorePattern` objects. - * @param {IgnorePattern[]} ignorePatterns The list of ignore patterns. - * @returns {((filePath:string, dot?:boolean) => boolean) & {basePath:string; patterns:string[]}} - * The preficate function. - * The first argument is an absolute path that is checked. - * The second argument is the flag to not ignore dotfiles. - * If the predicate function returned `true`, it means the path should be ignored. - */ - static createIgnore(ignorePatterns) { - debug("Create with: %o", ignorePatterns); - - const basePath = getCommonAncestorPath(ignorePatterns.map(p => p.basePath)); - const patterns = [].concat( - ...ignorePatterns.map(p => p.getPatternsRelativeTo(basePath)) - ); - const ig = ignore().add([...DotPatterns, ...patterns]); - const dotIg = ignore().add(patterns); - - debug(" processed: %o", { basePath, patterns }); - - return Object.assign( - (filePath, dot = false) => { - assert(path.isAbsolute(filePath), "'filePath' should be an absolute path."); - const relPathRaw = relative(basePath, filePath); - const relPath = relPathRaw && (relPathRaw + dirSuffix(filePath)); - const adoptedIg = dot ? dotIg : ig; - const result = relPath !== "" && adoptedIg.ignores(relPath); - - debug("Check", { filePath, dot, relativePath: relPath, result }); - return result; - }, - { basePath, patterns } - ); - } - - /** - * Initialize a new `IgnorePattern` instance. - * @param {string[]} patterns The glob patterns that ignore to lint. - * @param {string} basePath The base path of `patterns`. - */ - constructor(patterns, basePath) { - assert(path.isAbsolute(basePath), "'basePath' should be an absolute path."); - - /** - * The glob patterns that ignore to lint. - * @type {string[]} - */ - this.patterns = patterns; - - /** - * The base path of `patterns`. - * @type {string} - */ - this.basePath = basePath; - - /** - * If `true` then patterns which don't start with `/` will match the paths to the outside of `basePath`. Defaults to `false`. - * - * It's set `true` for `.eslintignore`, `package.json`, and `--ignore-path` for backward compatibility. - * It's `false` as-is for `ignorePatterns` property in config files. - * @type {boolean} - */ - this.loose = false; - } - - /** - * Get `patterns` as modified for a given base path. It modifies the - * absolute paths in the patterns as prepending the difference of two base - * paths. - * @param {string} newBasePath The base path. - * @returns {string[]} Modifired patterns. - */ - getPatternsRelativeTo(newBasePath) { - assert(path.isAbsolute(newBasePath), "'newBasePath' should be an absolute path."); - const { basePath, loose, patterns } = this; - - if (newBasePath === basePath) { - return patterns; - } - const prefix = `/${relative(newBasePath, basePath)}`; - - return patterns.map(pattern => { - const negative = pattern.startsWith("!"); - const head = negative ? "!" : ""; - const body = negative ? pattern.slice(1) : pattern; - - if (body.startsWith("/") || body.startsWith("../")) { - return `${head}${prefix}${body}`; - } - return loose ? pattern : `${head}${prefix}/**/${body}`; - }); - } -} - -module.exports = { IgnorePattern }; diff --git a/tools/node_modules/eslint/lib/cli-engine/config-array/index.js b/tools/node_modules/eslint/lib/cli-engine/config-array/index.js deleted file mode 100644 index 146c6f8927967e..00000000000000 --- a/tools/node_modules/eslint/lib/cli-engine/config-array/index.js +++ /dev/null @@ -1,32 +0,0 @@ -/* - * STOP!!! DO NOT MODIFY. - * - * This file is part of the ongoing work to move the eslintrc-style config - * system into the @eslint/eslintrc package. This file needs to remain - * unchanged in order for this work to proceed. - * - * If you think you need to change this file, please contact @nzakas first. - * - * Thanks in advance for your cooperation. - */ - -/** - * @fileoverview `ConfigArray` class. - * @author Toru Nagashima - */ -"use strict"; - -const { ConfigArray, getUsedExtractedConfigs } = require("./config-array"); -const { ConfigDependency } = require("./config-dependency"); -const { ExtractedConfig } = require("./extracted-config"); -const { IgnorePattern } = require("./ignore-pattern"); -const { OverrideTester } = require("./override-tester"); - -module.exports = { - ConfigArray, - ConfigDependency, - ExtractedConfig, - IgnorePattern, - OverrideTester, - getUsedExtractedConfigs -}; diff --git a/tools/node_modules/eslint/lib/cli-engine/config-array/override-tester.js b/tools/node_modules/eslint/lib/cli-engine/config-array/override-tester.js deleted file mode 100644 index 75dffe2352e9ac..00000000000000 --- a/tools/node_modules/eslint/lib/cli-engine/config-array/override-tester.js +++ /dev/null @@ -1,235 +0,0 @@ -/* - * STOP!!! DO NOT MODIFY. - * - * This file is part of the ongoing work to move the eslintrc-style config - * system into the @eslint/eslintrc package. This file needs to remain - * unchanged in order for this work to proceed. - * - * If you think you need to change this file, please contact @nzakas first. - * - * Thanks in advance for your cooperation. - */ - -/** - * @fileoverview `OverrideTester` class. - * - * `OverrideTester` class handles `files` property and `excludedFiles` property - * of `overrides` config. - * - * It provides one method. - * - * - `test(filePath)` - * Test if a file path matches the pair of `files` property and - * `excludedFiles` property. The `filePath` argument must be an absolute - * path. - * - * `ConfigArrayFactory` creates `OverrideTester` objects when it processes - * `overrides` properties. - * - * @author Toru Nagashima - */ -"use strict"; - -const assert = require("assert"); -const path = require("path"); -const util = require("util"); -const { Minimatch } = require("minimatch"); -const minimatchOpts = { dot: true, matchBase: true }; - -/** - * @typedef {Object} Pattern - * @property {InstanceType[] | null} includes The positive matchers. - * @property {InstanceType[] | null} excludes The negative matchers. - */ - -/** - * Normalize a given pattern to an array. - * @param {string|string[]|undefined} patterns A glob pattern or an array of glob patterns. - * @returns {string[]|null} Normalized patterns. - * @private - */ -function normalizePatterns(patterns) { - if (Array.isArray(patterns)) { - return patterns.filter(Boolean); - } - if (typeof patterns === "string" && patterns) { - return [patterns]; - } - return []; -} - -/** - * Create the matchers of given patterns. - * @param {string[]} patterns The patterns. - * @returns {InstanceType[] | null} The matchers. - */ -function toMatcher(patterns) { - if (patterns.length === 0) { - return null; - } - return patterns.map(pattern => { - if (/^\.[/\\]/u.test(pattern)) { - return new Minimatch( - pattern.slice(2), - - // `./*.js` should not match with `subdir/foo.js` - { ...minimatchOpts, matchBase: false } - ); - } - return new Minimatch(pattern, minimatchOpts); - }); -} - -/** - * Convert a given matcher to string. - * @param {Pattern} matchers The matchers. - * @returns {string} The string expression of the matcher. - */ -function patternToJson({ includes, excludes }) { - return { - includes: includes && includes.map(m => m.pattern), - excludes: excludes && excludes.map(m => m.pattern) - }; -} - -/** - * The class to test given paths are matched by the patterns. - */ -class OverrideTester { - - /** - * Create a tester with given criteria. - * If there are no criteria, returns `null`. - * @param {string|string[]} files The glob patterns for included files. - * @param {string|string[]} excludedFiles The glob patterns for excluded files. - * @param {string} basePath The path to the base directory to test paths. - * @returns {OverrideTester|null} The created instance or `null`. - */ - static create(files, excludedFiles, basePath) { - const includePatterns = normalizePatterns(files); - const excludePatterns = normalizePatterns(excludedFiles); - let endsWithWildcard = false; - - if (includePatterns.length === 0) { - return null; - } - - // Rejects absolute paths or relative paths to parents. - for (const pattern of includePatterns) { - if (path.isAbsolute(pattern) || pattern.includes("..")) { - throw new Error(`Invalid override pattern (expected relative path not containing '..'): ${pattern}`); - } - if (pattern.endsWith("*")) { - endsWithWildcard = true; - } - } - for (const pattern of excludePatterns) { - if (path.isAbsolute(pattern) || pattern.includes("..")) { - throw new Error(`Invalid override pattern (expected relative path not containing '..'): ${pattern}`); - } - } - - const includes = toMatcher(includePatterns); - const excludes = toMatcher(excludePatterns); - - return new OverrideTester( - [{ includes, excludes }], - basePath, - endsWithWildcard - ); - } - - /** - * Combine two testers by logical and. - * If either of the testers was `null`, returns the other tester. - * The `basePath` property of the two must be the same value. - * @param {OverrideTester|null} a A tester. - * @param {OverrideTester|null} b Another tester. - * @returns {OverrideTester|null} Combined tester. - */ - static and(a, b) { - if (!b) { - return a && new OverrideTester( - a.patterns, - a.basePath, - a.endsWithWildcard - ); - } - if (!a) { - return new OverrideTester( - b.patterns, - b.basePath, - b.endsWithWildcard - ); - } - - assert.strictEqual(a.basePath, b.basePath); - return new OverrideTester( - a.patterns.concat(b.patterns), - a.basePath, - a.endsWithWildcard || b.endsWithWildcard - ); - } - - /** - * Initialize this instance. - * @param {Pattern[]} patterns The matchers. - * @param {string} basePath The base path. - * @param {boolean} endsWithWildcard If `true` then a pattern ends with `*`. - */ - constructor(patterns, basePath, endsWithWildcard = false) { - - /** @type {Pattern[]} */ - this.patterns = patterns; - - /** @type {string} */ - this.basePath = basePath; - - /** @type {boolean} */ - this.endsWithWildcard = endsWithWildcard; - } - - /** - * Test if a given path is matched or not. - * @param {string} filePath The absolute path to the target file. - * @returns {boolean} `true` if the path was matched. - */ - test(filePath) { - if (typeof filePath !== "string" || !path.isAbsolute(filePath)) { - throw new Error(`'filePath' should be an absolute path, but got ${filePath}.`); - } - const relativePath = path.relative(this.basePath, filePath); - - return this.patterns.every(({ includes, excludes }) => ( - (!includes || includes.some(m => m.match(relativePath))) && - (!excludes || !excludes.some(m => m.match(relativePath))) - )); - } - - // eslint-disable-next-line jsdoc/require-description - /** - * @returns {Object} a JSON compatible object. - */ - toJSON() { - if (this.patterns.length === 1) { - return { - ...patternToJson(this.patterns[0]), - basePath: this.basePath - }; - } - return { - AND: this.patterns.map(patternToJson), - basePath: this.basePath - }; - } - - // eslint-disable-next-line jsdoc/require-description - /** - * @returns {Object} an object to display by `console.log()`. - */ - [util.inspect.custom]() { - return this.toJSON(); - } -} - -module.exports = { OverrideTester }; diff --git a/tools/node_modules/eslint/lib/cli-engine/file-enumerator.js b/tools/node_modules/eslint/lib/cli-engine/file-enumerator.js index 7c433d32f44b1c..446342a1a93293 100644 --- a/tools/node_modules/eslint/lib/cli-engine/file-enumerator.js +++ b/tools/node_modules/eslint/lib/cli-engine/file-enumerator.js @@ -40,8 +40,13 @@ const getGlobParent = require("glob-parent"); const isGlob = require("is-glob"); const { escapeRegExp } = require("lodash"); const { Minimatch } = require("minimatch"); -const { IgnorePattern } = require("./config-array"); -const { CascadingConfigArrayFactory } = require("./cascading-config-array-factory"); + +const { + Legacy: { + IgnorePattern, + CascadingConfigArrayFactory + } +} = require("@eslint/eslintrc"); const debug = require("debug")("eslint:file-enumerator"); //------------------------------------------------------------------------------ diff --git a/tools/node_modules/eslint/lib/linter/report-translator.js b/tools/node_modules/eslint/lib/linter/report-translator.js index eef5165585b21d..bed5af81e5dcec 100644 --- a/tools/node_modules/eslint/lib/linter/report-translator.js +++ b/tools/node_modules/eslint/lib/linter/report-translator.js @@ -196,15 +196,19 @@ function mapSuggestions(descriptor, sourceCode, messages) { return []; } - return descriptor.suggest.map(suggestInfo => { - const computedDesc = suggestInfo.desc || messages[suggestInfo.messageId]; - - return { - ...suggestInfo, - desc: interpolate(computedDesc, suggestInfo.data), - fix: normalizeFixes(suggestInfo, sourceCode) - }; - }); + return descriptor.suggest + .map(suggestInfo => { + const computedDesc = suggestInfo.desc || messages[suggestInfo.messageId]; + + return { + ...suggestInfo, + desc: interpolate(computedDesc, suggestInfo.data), + fix: normalizeFixes(suggestInfo, sourceCode) + }; + }) + + // Remove suggestions that didn't provide a fix + .filter(({ fix }) => fix); } /** diff --git a/tools/node_modules/eslint/lib/rules/constructor-super.js b/tools/node_modules/eslint/lib/rules/constructor-super.js index 8787fc569a4f15..dfec18fb65a4b1 100644 --- a/tools/node_modules/eslint/lib/rules/constructor-super.js +++ b/tools/node_modules/eslint/lib/rules/constructor-super.js @@ -79,6 +79,17 @@ function isPossibleConstructor(node) { return false; case "LogicalExpression": + + /* + * If the && operator short-circuits, the left side was falsy and therefore not a constructor, and if + * it doesn't short-circuit, it takes the value from the right side, so the right side must always be a + * possible constructor. A future improvement could verify that the left side could be truthy by + * excluding falsy literals. + */ + if (node.operator === "&&") { + return isPossibleConstructor(node.right); + } + return ( isPossibleConstructor(node.left) || isPossibleConstructor(node.right) diff --git a/tools/node_modules/eslint/lib/rules/no-constant-condition.js b/tools/node_modules/eslint/lib/rules/no-constant-condition.js index 5e5838641028fe..790d5ea88111b7 100644 --- a/tools/node_modules/eslint/lib/rules/no-constant-condition.js +++ b/tools/node_modules/eslint/lib/rules/no-constant-condition.js @@ -9,9 +9,6 @@ // Helpers //------------------------------------------------------------------------------ -const EQUALITY_OPERATORS = ["===", "!==", "==", "!="]; -const RELATIONAL_OPERATORS = [">", "<", ">=", "<=", "in", "instanceof"]; - //------------------------------------------------------------------------------ // Rule Definition //------------------------------------------------------------------------------ @@ -56,6 +53,35 @@ module.exports = { // Helpers //-------------------------------------------------------------------------- + /** + * Returns literal's value converted to the Boolean type + * @param {ASTNode} node any `Literal` node + * @returns {boolean | null} `true` when node is truthy, `false` when node is falsy, + * `null` when it cannot be determined. + */ + function getBooleanValue(node) { + if (node.value === null) { + + /* + * it might be a null literal or bigint/regex literal in unsupported environments . + * https://github.com/estree/estree/blob/14df8a024956ea289bd55b9c2226a1d5b8a473ee/es5.md#regexpliteral + * https://github.com/estree/estree/blob/14df8a024956ea289bd55b9c2226a1d5b8a473ee/es2020.md#bigintliteral + */ + + if (node.raw === "null") { + return false; + } + + // regex is always truthy + if (typeof node.regex === "object") { + return true; + } + + return null; + } + + return !!node.value; + } /** * Checks if a branch node of LogicalExpression short circuits the whole condition @@ -66,15 +92,23 @@ module.exports = { function isLogicalIdentity(node, operator) { switch (node.type) { case "Literal": - return (operator === "||" && node.value === true) || - (operator === "&&" && node.value === false); + return (operator === "||" && getBooleanValue(node) === true) || + (operator === "&&" && getBooleanValue(node) === false); case "UnaryExpression": return (operator === "&&" && node.operator === "void"); case "LogicalExpression": - return isLogicalIdentity(node.left, node.operator) || - isLogicalIdentity(node.right, node.operator); + + /* + * handles `a && false || b` + * `false` is an identity element of `&&` but not `||` + */ + return operator === node.operator && + ( + isLogicalIdentity(node.left, node.operator) || + isLogicalIdentity(node.right, node.operator) + ); // no default } @@ -129,21 +163,9 @@ module.exports = { const isLeftConstant = isConstant(node.left, inBooleanPosition); const isRightConstant = isConstant(node.right, inBooleanPosition); const isLeftShortCircuit = (isLeftConstant && isLogicalIdentity(node.left, node.operator)); - const isRightShortCircuit = (isRightConstant && isLogicalIdentity(node.right, node.operator)); + const isRightShortCircuit = (inBooleanPosition && isRightConstant && isLogicalIdentity(node.right, node.operator)); return (isLeftConstant && isRightConstant) || - ( - - // in the case of an "OR", we need to know if the right constant value is truthy - node.operator === "||" && - isRightConstant && - node.right.value && - ( - !node.parent || - node.parent.type !== "BinaryExpression" || - !(EQUALITY_OPERATORS.includes(node.parent.operator) || RELATIONAL_OPERATORS.includes(node.parent.operator)) - ) - ) || isLeftShortCircuit || isRightShortCircuit; } diff --git a/tools/node_modules/eslint/lib/rules/no-prototype-builtins.js b/tools/node_modules/eslint/lib/rules/no-prototype-builtins.js index ccec86c30da072..c5e4d49259b84a 100644 --- a/tools/node_modules/eslint/lib/rules/no-prototype-builtins.js +++ b/tools/node_modules/eslint/lib/rules/no-prototype-builtins.js @@ -46,15 +46,15 @@ module.exports = { */ function disallowBuiltIns(node) { - // TODO: just use `astUtils.getStaticPropertyName(node.callee)` const callee = astUtils.skipChainExpression(node.callee); - if (callee.type !== "MemberExpression" || callee.computed) { + if (callee.type !== "MemberExpression") { return; } - const propName = callee.property.name; - if (DISALLOWED_PROPS.indexOf(propName) > -1) { + const propName = astUtils.getStaticPropertyName(callee); + + if (propName !== null && DISALLOWED_PROPS.indexOf(propName) > -1) { context.report({ messageId: "prototypeBuildIn", loc: callee.property.loc, diff --git a/tools/node_modules/eslint/lib/rules/no-script-url.js b/tools/node_modules/eslint/lib/rules/no-script-url.js index 2078fc1dcea122..0c82052440372f 100644 --- a/tools/node_modules/eslint/lib/rules/no-script-url.js +++ b/tools/node_modules/eslint/lib/rules/no-script-url.js @@ -7,6 +7,8 @@ "use strict"; +const astUtils = require("./utils/ast-utils"); + //------------------------------------------------------------------------------ // Rule Definition //------------------------------------------------------------------------------ @@ -31,18 +33,30 @@ module.exports = { create(context) { + /** + * Check whether a node's static value starts with "javascript:" or not. + * And report an error for unexpected script URL. + * @param {ASTNode} node node to check + * @returns {void} + */ + function check(node) { + const value = astUtils.getStaticStringValue(node); + + if (typeof value === "string" && value.toLowerCase().indexOf("javascript:") === 0) { + context.report({ node, messageId: "unexpectedScriptURL" }); + } + } return { - Literal(node) { if (node.value && typeof node.value === "string") { - const value = node.value.toLowerCase(); - - if (value.indexOf("javascript:") === 0) { - context.report({ node, messageId: "unexpectedScriptURL" }); - } + check(node); + } + }, + TemplateLiteral(node) { + if (!(node.parent && node.parent.type === "TaggedTemplateExpression")) { + check(node); } } }; - } }; diff --git a/tools/node_modules/eslint/lib/rules/prefer-destructuring.js b/tools/node_modules/eslint/lib/rules/prefer-destructuring.js index 66e412fd3e3922..b2d3c8a0b0193e 100644 --- a/tools/node_modules/eslint/lib/rules/prefer-destructuring.js +++ b/tools/node_modules/eslint/lib/rules/prefer-destructuring.js @@ -4,6 +4,18 @@ */ "use strict"; +//------------------------------------------------------------------------------ +// Requirements +//------------------------------------------------------------------------------ + +const astUtils = require("./utils/ast-utils"); + +//------------------------------------------------------------------------------ +// Helpers +//------------------------------------------------------------------------------ + +const PRECEDENCE_OF_ASSIGNMENT_EXPR = astUtils.getPrecedence({ type: "AssignmentExpression" }); + //------------------------------------------------------------------------------ // Rule Definition //------------------------------------------------------------------------------ @@ -185,9 +197,15 @@ module.exports = { return null; } + let objectText = sourceCode.getText(rightNode.object); + + if (astUtils.getPrecedence(rightNode.object) < PRECEDENCE_OF_ASSIGNMENT_EXPR) { + objectText = `(${objectText})`; + } + return fixer.replaceText( node, - `{${rightNode.property.name}} = ${sourceCode.getText(rightNode.object)}` + `{${rightNode.property.name}} = ${objectText}` ); } diff --git a/tools/node_modules/eslint/lib/rules/prefer-template.js b/tools/node_modules/eslint/lib/rules/prefer-template.js index e8f980ebd38c6f..cb967660a62b86 100644 --- a/tools/node_modules/eslint/lib/rules/prefer-template.js +++ b/tools/node_modules/eslint/lib/rules/prefer-template.js @@ -39,33 +39,25 @@ function getTopConcatBinaryExpression(node) { } /** - * Determines whether a given node is a octal escape sequence + * Checks whether or not a node contains a string literal with an octal or non-octal decimal escape sequence * @param {ASTNode} node A node to check - * @returns {boolean} `true` if the node is an octal escape sequence + * @returns {boolean} `true` if at least one string literal within the node contains + * an octal or non-octal decimal escape sequence */ -function isOctalEscapeSequence(node) { - - // No need to check TemplateLiterals – would throw error with octal escape - const isStringLiteral = node.type === "Literal" && typeof node.value === "string"; - - if (!isStringLiteral) { - return false; +function hasOctalOrNonOctalDecimalEscapeSequence(node) { + if (isConcatenation(node)) { + return ( + hasOctalOrNonOctalDecimalEscapeSequence(node.left) || + hasOctalOrNonOctalDecimalEscapeSequence(node.right) + ); } - return astUtils.hasOctalEscapeSequence(node.raw); -} - -/** - * Checks whether or not a node contains a octal escape sequence - * @param {ASTNode} node A node to check - * @returns {boolean} `true` if the node contains an octal escape sequence - */ -function hasOctalEscapeSequence(node) { - if (isConcatenation(node)) { - return hasOctalEscapeSequence(node.left) || hasOctalEscapeSequence(node.right); + // No need to check TemplateLiterals – would throw parsing error + if (node.type === "Literal" && typeof node.value === "string") { + return astUtils.hasOctalOrNonOctalDecimalEscapeSequence(node.raw); } - return isOctalEscapeSequence(node); + return false; } /** @@ -237,7 +229,7 @@ module.exports = { function fixNonStringBinaryExpression(fixer, node) { const topBinaryExpr = getTopConcatBinaryExpression(node.parent); - if (hasOctalEscapeSequence(topBinaryExpr)) { + if (hasOctalOrNonOctalDecimalEscapeSequence(topBinaryExpr)) { return null; } diff --git a/tools/node_modules/eslint/lib/rules/quotes.js b/tools/node_modules/eslint/lib/rules/quotes.js index d1f4443b9033c9..da7e127493eaa1 100644 --- a/tools/node_modules/eslint/lib/rules/quotes.js +++ b/tools/node_modules/eslint/lib/rules/quotes.js @@ -282,9 +282,12 @@ module.exports = { description: settings.description }, fix(fixer) { - if (quoteOption === "backtick" && astUtils.hasOctalEscapeSequence(rawVal)) { + if (quoteOption === "backtick" && astUtils.hasOctalOrNonOctalDecimalEscapeSequence(rawVal)) { - // An octal escape sequence in a template literal would produce syntax error, even in non-strict mode. + /* + * An octal or non-octal decimal escape sequence in a template literal would + * produce syntax error, even in non-strict mode. + */ return null; } diff --git a/tools/node_modules/eslint/lib/rules/space-before-blocks.js b/tools/node_modules/eslint/lib/rules/space-before-blocks.js index 9b56481bf355fb..87ef9bfd88013c 100644 --- a/tools/node_modules/eslint/lib/rules/space-before-blocks.js +++ b/tools/node_modules/eslint/lib/rules/space-before-blocks.js @@ -5,8 +5,31 @@ "use strict"; +//------------------------------------------------------------------------------ +// Requirements +//------------------------------------------------------------------------------ + const astUtils = require("./utils/ast-utils"); +//------------------------------------------------------------------------------ +// Helpers +//------------------------------------------------------------------------------ + +/** + * Checks whether the given node represents the body of a function. + * @param {ASTNode} node the node to check. + * @returns {boolean} `true` if the node is function body. + */ +function isFunctionBody(node) { + const parent = node.parent; + + return ( + node.type === "BlockStatement" && + astUtils.isFunction(parent) && + parent.body === node + ); +} + //------------------------------------------------------------------------------ // Rule Definition //------------------------------------------------------------------------------ @@ -82,13 +105,16 @@ module.exports = { } /** - * Checks whether or not a given token is an arrow operator (=>) or a keyword - * in order to avoid to conflict with `arrow-spacing` and `keyword-spacing`. - * @param {Token} token A token to check. - * @returns {boolean} `true` if the token is an arrow operator. + * Checks whether the spacing before the given block is already controlled by another rule: + * - `arrow-spacing` checks spaces after `=>`. + * - `keyword-spacing` checks spaces after keywords in certain contexts. + * @param {Token} precedingToken first token before the block. + * @param {ASTNode|Token} node `BlockStatement` node or `{` token of a `SwitchStatement` node. + * @returns {boolean} `true` if requiring or disallowing spaces before the given block could produce conflicts with other rules. */ - function isConflicted(token) { - return (token.type === "Punctuator" && token.value === "=>") || token.type === "Keyword"; + function isConflicted(precedingToken, node) { + return astUtils.isArrowToken(precedingToken) || + astUtils.isKeywordToken(precedingToken) && !isFunctionBody(node); } /** @@ -99,13 +125,12 @@ module.exports = { function checkPrecedingSpace(node) { const precedingToken = sourceCode.getTokenBefore(node); - if (precedingToken && !isConflicted(precedingToken) && astUtils.isTokenOnSameLine(precedingToken, node)) { + if (precedingToken && !isConflicted(precedingToken, node) && astUtils.isTokenOnSameLine(precedingToken, node)) { const hasSpace = sourceCode.isSpaceBetweenTokens(precedingToken, node); - const parent = context.getAncestors().pop(); let requireSpace; let requireNoSpace; - if (parent.type === "FunctionExpression" || parent.type === "FunctionDeclaration") { + if (isFunctionBody(node)) { requireSpace = alwaysFunctions; requireNoSpace = neverFunctions; } else if (node.type === "ClassBody") { diff --git a/tools/node_modules/eslint/lib/rules/utils/ast-utils.js b/tools/node_modules/eslint/lib/rules/utils/ast-utils.js index fb8beb25211ee7..1fd6340df7c7e4 100644 --- a/tools/node_modules/eslint/lib/rules/utils/ast-utils.js +++ b/tools/node_modules/eslint/lib/rules/utils/ast-utils.js @@ -38,7 +38,9 @@ const LINEBREAKS = new Set(["\r\n", "\r", "\n", "\u2028", "\u2029"]); const STATEMENT_LIST_PARENTS = new Set(["Program", "BlockStatement", "SwitchCase"]); const DECIMAL_INTEGER_PATTERN = /^(?:0|0[0-7]*[89]\d*|[1-9](?:_?\d)*)$/u; -const OCTAL_ESCAPE_PATTERN = /^(?:[^\\]|\\[^0-7]|\\0(?![0-9]))*\\(?:[1-7]|0[0-9])/u; + +// Tests the presence of at least one LegacyOctalEscapeSequence or NonOctalDecimalEscapeSequence in a raw string +const OCTAL_OR_NON_OCTAL_DECIMAL_ESCAPE_PATTERN = /^(?:[^\\]|\\.)*\\(?:[1-9]|0[0-9])/su; const LOGICAL_ASSIGNMENT_OPERATORS = new Set(["&&=", "||=", "??="]); @@ -1611,6 +1613,17 @@ module.exports = { } case "LogicalExpression": + + /* + * If the && operator short-circuits, the left side was falsy and therefore not an error, and if it + * doesn't short-circuit, it takes the value from the right side, so the right side must always be + * a plausible error. A future improvement could verify that the left side could be truthy by + * excluding falsy literals. + */ + if (node.operator === "&&") { + return module.exports.couldBeError(node.right); + } + return module.exports.couldBeError(node.left) || module.exports.couldBeError(node.right); case "ConditionalExpression": @@ -1766,17 +1779,19 @@ module.exports = { }, /** - * Determines whether the given raw string contains an octal escape sequence. + * Determines whether the given raw string contains an octal escape sequence + * or a non-octal decimal escape sequence ("\8", "\9"). * - * "\1", "\2" ... "\7" - * "\00", "\01" ... "\09" + * "\1", "\2" ... "\7", "\8", "\9" + * "\00", "\01" ... "\07", "\08", "\09" * * "\0", when not followed by a digit, is not an octal escape sequence. * @param {string} rawString A string in its raw representation. - * @returns {boolean} `true` if the string contains at least one octal escape sequence. + * @returns {boolean} `true` if the string contains at least one octal escape sequence + * or at least one non-octal decimal escape sequence. */ - hasOctalEscapeSequence(rawString) { - return OCTAL_ESCAPE_PATTERN.test(rawString); + hasOctalOrNonOctalDecimalEscapeSequence(rawString) { + return OCTAL_OR_NON_OCTAL_DECIMAL_ESCAPE_PATTERN.test(rawString); }, isLogicalExpression, diff --git a/tools/node_modules/eslint/lib/rules/yoda.js b/tools/node_modules/eslint/lib/rules/yoda.js index 87dd5ed6c5736d..2fca7571113ecf 100644 --- a/tools/node_modules/eslint/lib/rules/yoda.js +++ b/tools/node_modules/eslint/lib/rules/yoda.js @@ -265,36 +265,37 @@ module.exports = { * @returns {string} A string representation of the node with the sides and operator flipped */ function getFlippedString(node) { - const tokenBefore = sourceCode.getTokenBefore(node); const operatorToken = sourceCode.getFirstTokenBetween( node.left, node.right, token => token.value === node.operator ); - const textBeforeOperator = sourceCode - .getText() - .slice( - sourceCode.getTokenBefore(operatorToken).range[1], - operatorToken.range[0] - ); - const textAfterOperator = sourceCode - .getText() - .slice( - operatorToken.range[1], - sourceCode.getTokenAfter(operatorToken).range[0] - ); - const leftText = sourceCode - .getText() - .slice( - node.range[0], - sourceCode.getTokenBefore(operatorToken).range[1] - ); + const lastLeftToken = sourceCode.getTokenBefore(operatorToken); const firstRightToken = sourceCode.getTokenAfter(operatorToken); - const rightText = sourceCode - .getText() - .slice(firstRightToken.range[0], node.range[1]); + const source = sourceCode.getText(); + + const leftText = source.slice( + node.range[0], + lastLeftToken.range[1] + ); + const textBeforeOperator = source.slice( + lastLeftToken.range[1], + operatorToken.range[0] + ); + const textAfterOperator = source.slice( + operatorToken.range[1], + firstRightToken.range[0] + ); + const rightText = source.slice( + firstRightToken.range[0], + node.range[1] + ); + + const tokenBefore = sourceCode.getTokenBefore(node); + const tokenAfter = sourceCode.getTokenAfter(node); let prefix = ""; + let suffix = ""; if ( tokenBefore && @@ -304,13 +305,22 @@ module.exports = { prefix = " "; } + if ( + tokenAfter && + node.range[1] === tokenAfter.range[0] && + !astUtils.canTokensBeAdjacent(lastLeftToken, tokenAfter) + ) { + suffix = " "; + } + return ( prefix + rightText + textBeforeOperator + OPERATOR_FLIP_MAP[operatorToken.value] + textAfterOperator + - leftText + leftText + + suffix ); } diff --git a/tools/node_modules/eslint/node_modules/@eslint/eslintrc/conf/category-list.json b/tools/node_modules/eslint/node_modules/@eslint/eslintrc/conf/category-list.json deleted file mode 100644 index cd3b816b6570a2..00000000000000 --- a/tools/node_modules/eslint/node_modules/@eslint/eslintrc/conf/category-list.json +++ /dev/null @@ -1,39 +0,0 @@ -{ - "categories": [ - { "name": "Possible Errors", "description": "These rules relate to possible syntax or logic errors in JavaScript code:" }, - { "name": "Best Practices", "description": "These rules relate to better ways of doing things to help you avoid problems:" }, - { "name": "Strict Mode", "description": "These rules relate to strict mode directives:" }, - { "name": "Variables", "description": "These rules relate to variable declarations:" }, - { "name": "Stylistic Issues", "description": "These rules relate to style guidelines, and are therefore quite subjective:" }, - { "name": "ECMAScript 6", "description": "These rules relate to ES6, also known as ES2015:" } - ], - "deprecated": { - "name": "Deprecated", - "description": "These rules have been deprecated in accordance with the deprecation policy, and replaced by newer rules:", - "rules": [] - }, - "removed": { - "name": "Removed", - "description": "These rules from older versions of ESLint (before the deprecation policy existed) have been replaced by newer rules:", - "rules": [ - { "removed": "generator-star", "replacedBy": ["generator-star-spacing"] }, - { "removed": "global-strict", "replacedBy": ["strict"] }, - { "removed": "no-arrow-condition", "replacedBy": ["no-confusing-arrow", "no-constant-condition"] }, - { "removed": "no-comma-dangle", "replacedBy": ["comma-dangle"] }, - { "removed": "no-empty-class", "replacedBy": ["no-empty-character-class"] }, - { "removed": "no-empty-label", "replacedBy": ["no-labels"] }, - { "removed": "no-extra-strict", "replacedBy": ["strict"] }, - { "removed": "no-reserved-keys", "replacedBy": ["quote-props"] }, - { "removed": "no-space-before-semi", "replacedBy": ["semi-spacing"] }, - { "removed": "no-wrap-func", "replacedBy": ["no-extra-parens"] }, - { "removed": "space-after-function-name", "replacedBy": ["space-before-function-paren"] }, - { "removed": "space-after-keywords", "replacedBy": ["keyword-spacing"] }, - { "removed": "space-before-function-parentheses", "replacedBy": ["space-before-function-paren"] }, - { "removed": "space-before-keywords", "replacedBy": ["keyword-spacing"] }, - { "removed": "space-in-brackets", "replacedBy": ["object-curly-spacing", "array-bracket-spacing"] }, - { "removed": "space-return-throw-case", "replacedBy": ["keyword-spacing"] }, - { "removed": "space-unary-word-ops", "replacedBy": ["space-unary-ops"] }, - { "removed": "spaced-line-comment", "replacedBy": ["spaced-comment"] } - ] - } -} diff --git a/tools/node_modules/eslint/node_modules/@eslint/eslintrc/conf/default-cli-options.js b/tools/node_modules/eslint/node_modules/@eslint/eslintrc/conf/default-cli-options.js deleted file mode 100644 index e09a829d17cee2..00000000000000 --- a/tools/node_modules/eslint/node_modules/@eslint/eslintrc/conf/default-cli-options.js +++ /dev/null @@ -1,31 +0,0 @@ -/** - * @fileoverview Default CLIEngineOptions. - * @author Ian VanSchooten - */ - -"use strict"; - -module.exports = { - configFile: null, - baseConfig: false, - rulePaths: [], - useEslintrc: true, - envs: [], - globals: [], - extensions: null, - ignore: true, - ignorePath: void 0, - cache: false, - - /* - * in order to honor the cacheFile option if specified - * this option should not have a default value otherwise - * it will always be used - */ - cacheLocation: "", - cacheFile: ".eslintcache", - fix: false, - allowInlineConfig: true, - reportUnusedDisableDirectives: void 0, - globInputPaths: true -}; diff --git a/tools/node_modules/eslint/node_modules/@eslint/eslintrc/conf/eslint-all.js b/tools/node_modules/eslint/node_modules/@eslint/eslintrc/conf/eslint-all.js deleted file mode 100644 index cdd8a3e4711d00..00000000000000 --- a/tools/node_modules/eslint/node_modules/@eslint/eslintrc/conf/eslint-all.js +++ /dev/null @@ -1,32 +0,0 @@ -/** - * @fileoverview Config to enable all rules. - * @author Robert Fletcher - */ - -"use strict"; - -//------------------------------------------------------------------------------ -// Requirements -//------------------------------------------------------------------------------ - -// FIXME: "../lib/rules" doesn't exist in this package -const builtInRules = require("../lib/rules"); - -//------------------------------------------------------------------------------ -// Helpers -//------------------------------------------------------------------------------ - -const allRules = {}; - -for (const [ruleId, rule] of builtInRules) { - if (!rule.meta.deprecated) { - allRules[ruleId] = "error"; - } -} - -//------------------------------------------------------------------------------ -// Public Interface -//------------------------------------------------------------------------------ - -/** @type {import("../lib/shared/types").ConfigData} */ -module.exports = { rules: allRules }; diff --git a/tools/node_modules/eslint/node_modules/@eslint/eslintrc/conf/eslint-recommended.js b/tools/node_modules/eslint/node_modules/@eslint/eslintrc/conf/eslint-recommended.js deleted file mode 100644 index 2137685fb7c63e..00000000000000 --- a/tools/node_modules/eslint/node_modules/@eslint/eslintrc/conf/eslint-recommended.js +++ /dev/null @@ -1,72 +0,0 @@ -/** - * @fileoverview Configuration applied when a user configuration extends from - * eslint:recommended. - * @author Nicholas C. Zakas - */ - -"use strict"; - -/* eslint sort-keys: ["error", "asc"] */ - -/** @type {import("../lib/shared/types").ConfigData} */ -module.exports = { - rules: { - "constructor-super": "error", - "for-direction": "error", - "getter-return": "error", - "no-async-promise-executor": "error", - "no-case-declarations": "error", - "no-class-assign": "error", - "no-compare-neg-zero": "error", - "no-cond-assign": "error", - "no-const-assign": "error", - "no-constant-condition": "error", - "no-control-regex": "error", - "no-debugger": "error", - "no-delete-var": "error", - "no-dupe-args": "error", - "no-dupe-class-members": "error", - "no-dupe-else-if": "error", - "no-dupe-keys": "error", - "no-duplicate-case": "error", - "no-empty": "error", - "no-empty-character-class": "error", - "no-empty-pattern": "error", - "no-ex-assign": "error", - "no-extra-boolean-cast": "error", - "no-extra-semi": "error", - "no-fallthrough": "error", - "no-func-assign": "error", - "no-global-assign": "error", - "no-import-assign": "error", - "no-inner-declarations": "error", - "no-invalid-regexp": "error", - "no-irregular-whitespace": "error", - "no-misleading-character-class": "error", - "no-mixed-spaces-and-tabs": "error", - "no-new-symbol": "error", - "no-obj-calls": "error", - "no-octal": "error", - "no-prototype-builtins": "error", - "no-redeclare": "error", - "no-regex-spaces": "error", - "no-self-assign": "error", - "no-setter-return": "error", - "no-shadow-restricted-names": "error", - "no-sparse-arrays": "error", - "no-this-before-super": "error", - "no-undef": "error", - "no-unexpected-multiline": "error", - "no-unreachable": "error", - "no-unsafe-finally": "error", - "no-unsafe-negation": "error", - "no-unused-labels": "error", - "no-unused-vars": "error", - "no-useless-catch": "error", - "no-useless-escape": "error", - "no-with": "error", - "require-yield": "error", - "use-isnan": "error", - "valid-typeof": "error" - } -}; diff --git a/tools/node_modules/eslint/node_modules/@eslint/eslintrc/conf/replacements.json b/tools/node_modules/eslint/node_modules/@eslint/eslintrc/conf/replacements.json deleted file mode 100644 index c047811e602d41..00000000000000 --- a/tools/node_modules/eslint/node_modules/@eslint/eslintrc/conf/replacements.json +++ /dev/null @@ -1,22 +0,0 @@ -{ - "rules": { - "generator-star": ["generator-star-spacing"], - "global-strict": ["strict"], - "no-arrow-condition": ["no-confusing-arrow", "no-constant-condition"], - "no-comma-dangle": ["comma-dangle"], - "no-empty-class": ["no-empty-character-class"], - "no-empty-label": ["no-labels"], - "no-extra-strict": ["strict"], - "no-reserved-keys": ["quote-props"], - "no-space-before-semi": ["semi-spacing"], - "no-wrap-func": ["no-extra-parens"], - "space-after-function-name": ["space-before-function-paren"], - "space-after-keywords": ["keyword-spacing"], - "space-before-function-parentheses": ["space-before-function-paren"], - "space-before-keywords": ["keyword-spacing"], - "space-in-brackets": ["object-curly-spacing", "array-bracket-spacing", "computed-property-spacing"], - "space-return-throw-case": ["keyword-spacing"], - "space-unary-word-ops": ["space-unary-ops"], - "spaced-line-comment": ["spaced-comment"] - } -} diff --git a/tools/node_modules/eslint/node_modules/@eslint/eslintrc/lib/cascading-config-array-factory.js b/tools/node_modules/eslint/node_modules/@eslint/eslintrc/lib/cascading-config-array-factory.js index a6933964e9341b..5f0da057e96a51 100644 --- a/tools/node_modules/eslint/node_modules/@eslint/eslintrc/lib/cascading-config-array-factory.js +++ b/tools/node_modules/eslint/node_modules/@eslint/eslintrc/lib/cascading-config-array-factory.js @@ -36,9 +36,10 @@ const debug = require("debug")("eslintrc:cascading-config-array-factory"); //------------------------------------------------------------------------------ // Define types for VSCode IntelliSense. -/** @typedef {import("../shared/types").ConfigData} ConfigData */ -/** @typedef {import("../shared/types").Parser} Parser */ -/** @typedef {import("../shared/types").Plugin} Plugin */ +/** @typedef {import("./shared/types").ConfigData} ConfigData */ +/** @typedef {import("./shared/types").Parser} Parser */ +/** @typedef {import("./shared/types").Plugin} Plugin */ +/** @typedef {import("./shared/types").Rule} Rule */ /** @typedef {ReturnType} ConfigArray */ /** @@ -51,6 +52,11 @@ const debug = require("debug")("eslintrc:cascading-config-array-factory"); * @property {string[]} [rulePaths] The value of `--rulesdir` option. * @property {string} [specificConfigPath] The value of `--config` option. * @property {boolean} [useEslintrc] if `false` then it doesn't load config files. + * @property {Function} loadRules The function to use to load rules. + * @property {Map} builtInRules The rules that are built in to ESLint. + * @property {Object} [resolver=ModuleResolver] The module resolver object. + * @property {string} eslintAllPath The path to the definitions for eslint:all. + * @property {string} eslintRecommendedPath The path to the definitions for eslint:recommended. */ /** @@ -67,6 +73,11 @@ const debug = require("debug")("eslintrc:cascading-config-array-factory"); * @property {string[]|null} rulePaths The value of `--rulesdir` option. This is used to reset `baseConfigArray`. * @property {string|null} specificConfigPath The value of `--config` option. This is used to reset `cliConfigArray`. * @property {boolean} useEslintrc if `false` then it doesn't load config files. + * @property {Function} loadRules The function to use to load rules. + * @property {Map} builtInRules The rules that are built in to ESLint. + * @property {Object} [resolver=ModuleResolver] The module resolver object. + * @property {string} eslintAllPath The path to the definitions for eslint:all. + * @property {string} eslintRecommendedPath The path to the definitions for eslint:recommended. */ /** @type {WeakMap} */ @@ -205,14 +216,18 @@ class CascadingConfigArrayFactory { useEslintrc = true, builtInRules = new Map(), loadRules, - resolver + resolver, + eslintRecommendedPath, + eslintAllPath } = {}) { const configArrayFactory = new ConfigArrayFactory({ additionalPluginPool, cwd, resolvePluginsRelativeTo, builtInRules, - resolver + resolver, + eslintRecommendedPath, + eslintAllPath }); internalSlotsMap.set(this, { diff --git a/tools/node_modules/eslint/node_modules/@eslint/eslintrc/lib/config-array-factory.js b/tools/node_modules/eslint/node_modules/@eslint/eslintrc/lib/config-array-factory.js index 97f8b5cb2d562e..6494a041cb8dd0 100644 --- a/tools/node_modules/eslint/node_modules/@eslint/eslintrc/lib/config-array-factory.js +++ b/tools/node_modules/eslint/node_modules/@eslint/eslintrc/lib/config-array-factory.js @@ -58,8 +58,6 @@ const debug = require("debug")("eslintrc:config-array-factory"); // Helpers //------------------------------------------------------------------------------ -const eslintRecommendedPath = path.resolve(__dirname, "../../eslint/conf/eslint-recommended.js"); -const eslintAllPath = path.resolve(__dirname, "../../eslint/conf/eslint-all.js"); const configFilenames = [ ".eslintrc.js", ".eslintrc.cjs", @@ -71,10 +69,11 @@ const configFilenames = [ ]; // Define types for VSCode IntelliSense. -/** @typedef {import("../shared/types").ConfigData} ConfigData */ -/** @typedef {import("../shared/types").OverrideConfigData} OverrideConfigData */ -/** @typedef {import("../shared/types").Parser} Parser */ -/** @typedef {import("../shared/types").Plugin} Plugin */ +/** @typedef {import("./shared/types").ConfigData} ConfigData */ +/** @typedef {import("./shared/types").OverrideConfigData} OverrideConfigData */ +/** @typedef {import("./shared/types").Parser} Parser */ +/** @typedef {import("./shared/types").Plugin} Plugin */ +/** @typedef {import("./shared/types").Rule} Rule */ /** @typedef {import("./config-array/config-dependency").DependentParser} DependentParser */ /** @typedef {import("./config-array/config-dependency").DependentPlugin} DependentPlugin */ /** @typedef {ConfigArray[0]} ConfigArrayElement */ @@ -84,6 +83,10 @@ const configFilenames = [ * @property {Map} [additionalPluginPool] The map for additional plugins. * @property {string} [cwd] The path to the current working directory. * @property {string} [resolvePluginsRelativeTo] A path to the directory that plugins should be resolved from. Defaults to `cwd`. + * @property {Map} builtInRules The rules that are built in to ESLint. + * @property {Object} [resolver=ModuleResolver] The module resolver object. + * @property {string} eslintAllPath The path to the definitions for eslint:all. + * @property {string} eslintRecommendedPath The path to the definitions for eslint:recommended. */ /** @@ -91,6 +94,10 @@ const configFilenames = [ * @property {Map} additionalPluginPool The map for additional plugins. * @property {string} cwd The path to the current working directory. * @property {string | undefined} resolvePluginsRelativeTo An absolute path the the directory that plugins should be resolved from. + * @property {Map} builtInRules The rules that are built in to ESLint. + * @property {Object} [resolver=ModuleResolver] The module resolver object. + * @property {string} eslintAllPath The path to the definitions for eslint:all. + * @property {string} eslintRecommendedPath The path to the definitions for eslint:recommended. */ /** @@ -414,7 +421,9 @@ class ConfigArrayFactory { cwd = process.cwd(), resolvePluginsRelativeTo, builtInRules, - resolver = ModuleResolver + resolver = ModuleResolver, + eslintAllPath, + eslintRecommendedPath } = {}) { internalSlotsMap.set(this, { additionalPluginPool, @@ -423,7 +432,9 @@ class ConfigArrayFactory { resolvePluginsRelativeTo && path.resolve(cwd, resolvePluginsRelativeTo), builtInRules, - resolver + resolver, + eslintAllPath, + eslintRecommendedPath }); } @@ -781,6 +792,8 @@ class ConfigArrayFactory { * @private */ _loadExtendedBuiltInConfig(extendName, ctx) { + const { eslintAllPath, eslintRecommendedPath } = internalSlotsMap.get(this); + if (extendName === "eslint:recommended") { return this._loadConfigData({ ...ctx, diff --git a/tools/node_modules/eslint/node_modules/@eslint/eslintrc/lib/shared/types.js b/tools/node_modules/eslint/node_modules/@eslint/eslintrc/lib/shared/types.js new file mode 100644 index 00000000000000..d4ac14e26df453 --- /dev/null +++ b/tools/node_modules/eslint/node_modules/@eslint/eslintrc/lib/shared/types.js @@ -0,0 +1,150 @@ +/** + * @fileoverview Define common types for input completion. + * @author Toru Nagashima + */ +"use strict"; + +/** @type {any} */ +module.exports = {}; + +/** @typedef {boolean | "off" | "readable" | "readonly" | "writable" | "writeable"} GlobalConf */ +/** @typedef {0 | 1 | 2 | "off" | "warn" | "error"} SeverityConf */ +/** @typedef {SeverityConf | [SeverityConf, ...any[]]} RuleConf */ + +/** + * @typedef {Object} EcmaFeatures + * @property {boolean} [globalReturn] Enabling `return` statements at the top-level. + * @property {boolean} [jsx] Enabling JSX syntax. + * @property {boolean} [impliedStrict] Enabling strict mode always. + */ + +/** + * @typedef {Object} ParserOptions + * @property {EcmaFeatures} [ecmaFeatures] The optional features. + * @property {3|5|6|7|8|9|10|11|12|2015|2016|2017|2018|2019|2020|2021} [ecmaVersion] The ECMAScript version (or revision number). + * @property {"script"|"module"} [sourceType] The source code type. + */ + +/** + * @typedef {Object} ConfigData + * @property {Record} [env] The environment settings. + * @property {string | string[]} [extends] The path to other config files or the package name of shareable configs. + * @property {Record} [globals] The global variable settings. + * @property {string | string[]} [ignorePatterns] The glob patterns that ignore to lint. + * @property {boolean} [noInlineConfig] The flag that disables directive comments. + * @property {OverrideConfigData[]} [overrides] The override settings per kind of files. + * @property {string} [parser] The path to a parser or the package name of a parser. + * @property {ParserOptions} [parserOptions] The parser options. + * @property {string[]} [plugins] The plugin specifiers. + * @property {string} [processor] The processor specifier. + * @property {boolean} [reportUnusedDisableDirectives] The flag to report unused `eslint-disable` comments. + * @property {boolean} [root] The root flag. + * @property {Record} [rules] The rule settings. + * @property {Object} [settings] The shared settings. + */ + +/** + * @typedef {Object} OverrideConfigData + * @property {Record} [env] The environment settings. + * @property {string | string[]} [excludedFiles] The glob pattarns for excluded files. + * @property {string | string[]} [extends] The path to other config files or the package name of shareable configs. + * @property {string | string[]} files The glob patterns for target files. + * @property {Record} [globals] The global variable settings. + * @property {boolean} [noInlineConfig] The flag that disables directive comments. + * @property {OverrideConfigData[]} [overrides] The override settings per kind of files. + * @property {string} [parser] The path to a parser or the package name of a parser. + * @property {ParserOptions} [parserOptions] The parser options. + * @property {string[]} [plugins] The plugin specifiers. + * @property {string} [processor] The processor specifier. + * @property {boolean} [reportUnusedDisableDirectives] The flag to report unused `eslint-disable` comments. + * @property {Record} [rules] The rule settings. + * @property {Object} [settings] The shared settings. + */ + +/** + * @typedef {Object} ParseResult + * @property {Object} ast The AST. + * @property {ScopeManager} [scopeManager] The scope manager of the AST. + * @property {Record} [services] The services that the parser provides. + * @property {Record} [visitorKeys] The visitor keys of the AST. + */ + +/** + * @typedef {Object} Parser + * @property {(text:string, options:ParserOptions) => Object} parse The definition of global variables. + * @property {(text:string, options:ParserOptions) => ParseResult} [parseForESLint] The parser options that will be enabled under this environment. + */ + +/** + * @typedef {Object} Environment + * @property {Record} [globals] The definition of global variables. + * @property {ParserOptions} [parserOptions] The parser options that will be enabled under this environment. + */ + +/** + * @typedef {Object} LintMessage + * @property {number} column The 1-based column number. + * @property {number} [endColumn] The 1-based column number of the end location. + * @property {number} [endLine] The 1-based line number of the end location. + * @property {boolean} fatal If `true` then this is a fatal error. + * @property {{range:[number,number], text:string}} [fix] Information for autofix. + * @property {number} line The 1-based line number. + * @property {string} message The error message. + * @property {string|null} ruleId The ID of the rule which makes this message. + * @property {0|1|2} severity The severity of this message. + * @property {Array<{desc?: string, messageId?: string, fix: {range: [number, number], text: string}}>} [suggestions] Information for suggestions. + */ + +/** + * @typedef {Object} SuggestionResult + * @property {string} desc A short description. + * @property {string} [messageId] Id referencing a message for the description. + * @property {{ text: string, range: number[] }} fix fix result info + */ + +/** + * @typedef {Object} Processor + * @property {(text:string, filename:string) => Array} [preprocess] The function to extract code blocks. + * @property {(messagesList:LintMessage[][], filename:string) => LintMessage[]} [postprocess] The function to merge messages. + * @property {boolean} [supportsAutofix] If `true` then it means the processor supports autofix. + */ + +/** + * @typedef {Object} RuleMetaDocs + * @property {string} category The category of the rule. + * @property {string} description The description of the rule. + * @property {boolean} recommended If `true` then the rule is included in `eslint:recommended` preset. + * @property {string} url The URL of the rule documentation. + */ + +/** + * @typedef {Object} RuleMeta + * @property {boolean} [deprecated] If `true` then the rule has been deprecated. + * @property {RuleMetaDocs} docs The document information of the rule. + * @property {"code"|"whitespace"} [fixable] The autofix type. + * @property {Record} [messages] The messages the rule reports. + * @property {string[]} [replacedBy] The IDs of the alternative rules. + * @property {Array|Object} schema The option schema of the rule. + * @property {"problem"|"suggestion"|"layout"} type The rule type. + */ + +/** + * @typedef {Object} Rule + * @property {Function} create The factory of the rule. + * @property {RuleMeta} meta The meta data of the rule. + */ + +/** + * @typedef {Object} Plugin + * @property {Record} [configs] The definition of plugin configs. + * @property {Record} [environments] The definition of plugin environments. + * @property {Record} [processors] The definition of plugin processors. + * @property {Record} [rules] The definition of plugin rules. + */ + +/** + * Information of deprecated rules. + * @typedef {Object} DeprecatedRuleInfo + * @property {string} ruleId The rule ID. + * @property {string[]} replacedBy The rule IDs that replace this deprecated rule. + */ diff --git a/tools/node_modules/eslint/node_modules/@eslint/eslintrc/package.json b/tools/node_modules/eslint/node_modules/@eslint/eslintrc/package.json index da4e526248392c..106b9b07d22edc 100644 --- a/tools/node_modules/eslint/node_modules/@eslint/eslintrc/package.json +++ b/tools/node_modules/eslint/node_modules/@eslint/eslintrc/package.json @@ -60,7 +60,7 @@ "generate-release": "eslint-generate-release", "lint": "eslint .", "publish-release": "eslint-publish-release", - "test": "mocha tests/lib/shared" + "test": "mocha -R progress -c tests/lib/shared" }, - "version": "0.1.3" + "version": "0.2.0" } \ No newline at end of file diff --git a/tools/node_modules/eslint/node_modules/ajv/README.md b/tools/node_modules/eslint/node_modules/ajv/README.md index 9edaf433f661ff..a97edd4934a23b 100644 --- a/tools/node_modules/eslint/node_modules/ajv/README.md +++ b/tools/node_modules/eslint/node_modules/ajv/README.md @@ -6,6 +6,7 @@ The fastest JSON Schema validator for Node.js and browser. Supports draft-04/06/ [![Build Status](https://travis-ci.org/epoberezkin/ajv.svg?branch=master)](https://travis-ci.org/epoberezkin/ajv) [![npm](https://img.shields.io/npm/v/ajv.svg)](https://www.npmjs.com/package/ajv) +[![npm (beta)](https://img.shields.io/npm/v/ajv/beta)](https://www.npmjs.com/package/ajv/v/7.0.0-beta.0) [![npm downloads](https://img.shields.io/npm/dm/ajv.svg)](https://www.npmjs.com/package/ajv) [![Coverage Status](https://coveralls.io/repos/epoberezkin/ajv/badge.svg?branch=master&service=github)](https://coveralls.io/github/epoberezkin/ajv?branch=master) [![Gitter](https://img.shields.io/gitter/room/ajv-validator/ajv.svg)](https://gitter.im/ajv-validator/ajv) @@ -13,6 +14,32 @@ The fastest JSON Schema validator for Node.js and browser. Supports draft-04/06/ ## Please [sponsor Ajv](https://github.com/sponsors/epoberezkin) +## Ajv v7 beta is released + +[Ajv version 7.0.0-beta.0](https://github.com/ajv-validator/ajv/tree/v7-beta) is released with these changes: + +- to reduce the mistakes in JSON schemas and unexpected validation results, [strict mode](./docs/strict-mode.md) is added - it prohibits ignored or ambiguous JSON Schema elements. +- to make code injection from untrusted schemas impossible, [code generation](./docs/codegen.md) is fully re-written to be safe. +- to simplify Ajv extensions, the new keyword API that is used by pre-defined keywords is available to user-defined keywords - it is much easier to define any keywords now, especially with subschemas. +- schemas are compiled to ES6 code (ES5 code generation is supported with an option). +- to improve reliability and maintainability the code is migrated to TypeScript. + +**Please note**: + +- the support for JSON-Schema draft-04 is removed - if you have schemas using "id" attributes you have to replace them with "\$id" (or continue using version 6 that will be supported until 02/28/2021). +- all formats are separated to ajv-formats package - they have to be explicitely added if you use them. + +See [release notes](https://github.com/ajv-validator/ajv/releases/tag/v7.0.0-beta.0) for the details. + +To install the new version: + +```bash +npm install ajv@beta +``` + +See [Getting started with v7](https://github.com/ajv-validator/ajv/tree/v7-beta#usage) for code example. + + ## Mozilla MOSS grant and OpenJS Foundation [](https://www.mozilla.org/en-US/moss/)     [](https://openjsf.org/blog/2020/08/14/ajv-joins-openjs-foundation-as-an-incubation-project/) @@ -1431,18 +1458,11 @@ Please see [Contributing guidelines](https://github.com/epoberezkin/ajv/blob/mas ## Changes history -See https://github.com/epoberezkin/ajv/releases - -__Please note__: [Changes in version 6.0.0](https://github.com/epoberezkin/ajv/releases/tag/v6.0.0). - -[Version 5.0.0](https://github.com/epoberezkin/ajv/releases/tag/5.0.0). - -[Version 4.0.0](https://github.com/epoberezkin/ajv/releases/tag/4.0.0). - -[Version 3.0.0](https://github.com/epoberezkin/ajv/releases/tag/3.0.0). +See https://github.com/ajv-validator/ajv/releases -[Version 2.0.0](https://github.com/epoberezkin/ajv/releases/tag/2.0.0). +__Please note__: [Changes in version 7.0.0-beta](https://github.com/ajv-validator/ajv/releases/tag/v7.0.0-beta.0) +[Version 6.0.0](https://github.com/ajv-validator/ajv/releases/tag/v6.0.0). ## Open-source software support diff --git a/tools/node_modules/eslint/node_modules/ajv/dist/ajv.bundle.js b/tools/node_modules/eslint/node_modules/ajv/dist/ajv.bundle.js index 014fc2620ca2f9..e58c8eb4fedc96 100644 --- a/tools/node_modules/eslint/node_modules/ajv/dist/ajv.bundle.js +++ b/tools/node_modules/eslint/node_modules/ajv/dist/ajv.bundle.js @@ -170,8 +170,8 @@ var URITEMPLATE = /^(?:(?:[^\x00-\x20"'<>%\\^`{|}]|%[0-9a-f]{2})|\{[+#./;?&=,!@| // For the source: https://gist.github.com/dperini/729294 // For test cases: https://mathiasbynens.be/demo/url-regex // @todo Delete current URL in favour of the commented out URL rule when this issue is fixed https://github.com/eslint/eslint/issues/7983. -// var URL = /^(?:(?:https?|ftp):\/\/)(?:\S+(?::\S*)?@)?(?:(?!10(?:\.\d{1,3}){3})(?!127(?:\.\d{1,3}){3})(?!169\.254(?:\.\d{1,3}){2})(?!192\.168(?:\.\d{1,3}){2})(?!172\.(?:1[6-9]|2\d|3[0-1])(?:\.\d{1,3}){2})(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5])){2}(?:\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]))|(?:(?:[a-z\u{00a1}-\u{ffff}0-9]+-?)*[a-z\u{00a1}-\u{ffff}0-9]+)(?:\.(?:[a-z\u{00a1}-\u{ffff}0-9]+-?)*[a-z\u{00a1}-\u{ffff}0-9]+)*(?:\.(?:[a-z\u{00a1}-\u{ffff}]{2,})))(?::\d{2,5})?(?:\/[^\s]*)?$/iu; -var URL = /^(?:(?:http[s\u017F]?|ftp):\/\/)(?:(?:[\0-\x08\x0E-\x1F!-\x9F\xA1-\u167F\u1681-\u1FFF\u200B-\u2027\u202A-\u202E\u2030-\u205E\u2060-\u2FFF\u3001-\uD7FF\uE000-\uFEFE\uFF00-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+(?::(?:[\0-\x08\x0E-\x1F!-\x9F\xA1-\u167F\u1681-\u1FFF\u200B-\u2027\u202A-\u202E\u2030-\u205E\u2060-\u2FFF\u3001-\uD7FF\uE000-\uFEFE\uFF00-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])*)?@)?(?:(?!10(?:\.[0-9]{1,3}){3})(?!127(?:\.[0-9]{1,3}){3})(?!169\.254(?:\.[0-9]{1,3}){2})(?!192\.168(?:\.[0-9]{1,3}){2})(?!172\.(?:1[6-9]|2[0-9]|3[01])(?:\.[0-9]{1,3}){2})(?:[1-9][0-9]?|1[0-9][0-9]|2[01][0-9]|22[0-3])(?:\.(?:1?[0-9]{1,2}|2[0-4][0-9]|25[0-5])){2}(?:\.(?:[1-9][0-9]?|1[0-9][0-9]|2[0-4][0-9]|25[0-4]))|(?:(?:(?:[0-9KSa-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+-?)*(?:[0-9KSa-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+)(?:\.(?:(?:[0-9KSa-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+-?)*(?:[0-9KSa-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+)*(?:\.(?:(?:[KSa-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]){2,})))(?::[0-9]{2,5})?(?:\/(?:[\0-\x08\x0E-\x1F!-\x9F\xA1-\u167F\u1681-\u1FFF\u200B-\u2027\u202A-\u202E\u2030-\u205E\u2060-\u2FFF\u3001-\uD7FF\uE000-\uFEFE\uFF00-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])*)?$/i; +// var URL = /^(?:(?:https?|ftp):\/\/)(?:\S+(?::\S*)?@)?(?:(?!10(?:\.\d{1,3}){3})(?!127(?:\.\d{1,3}){3})(?!169\.254(?:\.\d{1,3}){2})(?!192\.168(?:\.\d{1,3}){2})(?!172\.(?:1[6-9]|2\d|3[0-1])(?:\.\d{1,3}){2})(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5])){2}(?:\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]))|(?:(?:[a-z\u{00a1}-\u{ffff}0-9]+-)*[a-z\u{00a1}-\u{ffff}0-9]+)(?:\.(?:[a-z\u{00a1}-\u{ffff}0-9]+-)*[a-z\u{00a1}-\u{ffff}0-9]+)*(?:\.(?:[a-z\u{00a1}-\u{ffff}]{2,})))(?::\d{2,5})?(?:\/[^\s]*)?$/iu; +var URL = /^(?:(?:http[s\u017F]?|ftp):\/\/)(?:(?:[\0-\x08\x0E-\x1F!-\x9F\xA1-\u167F\u1681-\u1FFF\u200B-\u2027\u202A-\u202E\u2030-\u205E\u2060-\u2FFF\u3001-\uD7FF\uE000-\uFEFE\uFF00-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+(?::(?:[\0-\x08\x0E-\x1F!-\x9F\xA1-\u167F\u1681-\u1FFF\u200B-\u2027\u202A-\u202E\u2030-\u205E\u2060-\u2FFF\u3001-\uD7FF\uE000-\uFEFE\uFF00-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])*)?@)?(?:(?!10(?:\.[0-9]{1,3}){3})(?!127(?:\.[0-9]{1,3}){3})(?!169\.254(?:\.[0-9]{1,3}){2})(?!192\.168(?:\.[0-9]{1,3}){2})(?!172\.(?:1[6-9]|2[0-9]|3[01])(?:\.[0-9]{1,3}){2})(?:[1-9][0-9]?|1[0-9][0-9]|2[01][0-9]|22[0-3])(?:\.(?:1?[0-9]{1,2}|2[0-4][0-9]|25[0-5])){2}(?:\.(?:[1-9][0-9]?|1[0-9][0-9]|2[0-4][0-9]|25[0-4]))|(?:(?:(?:[0-9a-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+-)*(?:[0-9a-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+)(?:\.(?:(?:[0-9a-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+-)*(?:[0-9a-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+)*(?:\.(?:(?:[a-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]){2,})))(?::[0-9]{2,5})?(?:\/(?:[\0-\x08\x0E-\x1F!-\x9F\xA1-\u167F\u1681-\u1FFF\u200B-\u2027\u202A-\u202E\u2030-\u205E\u2060-\u2FFF\u3001-\uD7FF\uE000-\uFEFE\uFF00-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])*)?$/i; var UUID = /^(?:urn:uuid:)?[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/i; var JSON_POINTER = /^(?:\/(?:[^~/]|~0|~1)*)*$/; var JSON_POINTER_URI_FRAGMENT = /^#(?:\/(?:[a-z0-9_\-.!$&'()*+,;:=@]|%[0-9a-f]{2}|~0|~1)*)*$/i; diff --git a/tools/node_modules/eslint/node_modules/ajv/dist/ajv.min.js b/tools/node_modules/eslint/node_modules/ajv/dist/ajv.min.js index d02ec10a7feaee..7a60eb8a2bd81f 100644 --- a/tools/node_modules/eslint/node_modules/ajv/dist/ajv.min.js +++ b/tools/node_modules/eslint/node_modules/ajv/dist/ajv.min.js @@ -1,3 +1,3 @@ -/* ajv 6.12.5: Another JSON Schema Validator */ -!function(e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):("undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this).Ajv=e()}(function(){return function o(i,n,l){function c(r,e){if(!n[r]){if(!i[r]){var t="function"==typeof require&&require;if(!e&&t)return t(r,!0);if(u)return u(r,!0);var a=new Error("Cannot find module '"+r+"'");throw a.code="MODULE_NOT_FOUND",a}var s=n[r]={exports:{}};i[r][0].call(s.exports,function(e){return c(i[r][1][e]||e)},s,s.exports,o,i,n,l)}return n[r].exports}for(var u="function"==typeof require&&require,e=0;e%\\^`{|}]|%[0-9a-f]{2})|\{[+#./;?&=,!@|]?(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?(?:,(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?)*\})*$/i,u=/^(?:(?:http[s\u017F]?|ftp):\/\/)(?:(?:[\0-\x08\x0E-\x1F!-\x9F\xA1-\u167F\u1681-\u1FFF\u200B-\u2027\u202A-\u202E\u2030-\u205E\u2060-\u2FFF\u3001-\uD7FF\uE000-\uFEFE\uFF00-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+(?::(?:[\0-\x08\x0E-\x1F!-\x9F\xA1-\u167F\u1681-\u1FFF\u200B-\u2027\u202A-\u202E\u2030-\u205E\u2060-\u2FFF\u3001-\uD7FF\uE000-\uFEFE\uFF00-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])*)?@)?(?:(?!10(?:\.[0-9]{1,3}){3})(?!127(?:\.[0-9]{1,3}){3})(?!169\.254(?:\.[0-9]{1,3}){2})(?!192\.168(?:\.[0-9]{1,3}){2})(?!172\.(?:1[6-9]|2[0-9]|3[01])(?:\.[0-9]{1,3}){2})(?:[1-9][0-9]?|1[0-9][0-9]|2[01][0-9]|22[0-3])(?:\.(?:1?[0-9]{1,2}|2[0-4][0-9]|25[0-5])){2}(?:\.(?:[1-9][0-9]?|1[0-9][0-9]|2[0-4][0-9]|25[0-4]))|(?:(?:(?:[0-9KSa-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+-?)*(?:[0-9KSa-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+)(?:\.(?:(?:[0-9KSa-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+-?)*(?:[0-9KSa-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+)*(?:\.(?:(?:[KSa-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]){2,})))(?::[0-9]{2,5})?(?:\/(?:[\0-\x08\x0E-\x1F!-\x9F\xA1-\u167F\u1681-\u1FFF\u200B-\u2027\u202A-\u202E\u2030-\u205E\u2060-\u2FFF\u3001-\uD7FF\uE000-\uFEFE\uFF00-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])*)?$/i,h=/^(?:urn:uuid:)?[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/i,d=/^(?:\/(?:[^~/]|~0|~1)*)*$/,p=/^#(?:\/(?:[a-z0-9_\-.!$&'()*+,;:=@]|%[0-9a-f]{2}|~0|~1)*)*$/i,f=/^(?:0|[1-9][0-9]*)(?:#|(?:\/(?:[^~/]|~0|~1)*)*)$/;function m(e){return a.copy(m[e="full"==e?"full":"fast"])}function v(e){var r=e.match(o);if(!r)return!1;var t,a=+r[2],s=+r[3];return 1<=a&&a<=12&&1<=s&&s<=(2!=a||((t=+r[1])%4!=0||t%100==0&&t%400!=0)?i[a]:29)}function y(e,r){var t=e.match(n);if(!t)return!1;var a=t[1],s=t[2],o=t[3];return(a<=23&&s<=59&&o<=59||23==a&&59==s&&60==o)&&(!r||t[5])}(r.exports=m).fast={date:/^\d\d\d\d-[0-1]\d-[0-3]\d$/,time:/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,"date-time":/^\d\d\d\d-[0-1]\d-[0-3]\d[t\s](?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,uri:/^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/)?[^\s]*$/i,"uri-reference":/^(?:(?:[a-z][a-z0-9+\-.]*:)?\/?\/)?(?:[^\\\s#][^\s#]*)?(?:#[^\\\s]*)?$/i,"uri-template":c,url:u,email:/^[a-z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?)*$/i,hostname:s,ipv4:/^(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)$/,ipv6:/^\s*(?:(?:(?:[0-9a-f]{1,4}:){7}(?:[0-9a-f]{1,4}|:))|(?:(?:[0-9a-f]{1,4}:){6}(?::[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(?:(?:[0-9a-f]{1,4}:){5}(?:(?:(?::[0-9a-f]{1,4}){1,2})|:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(?:(?:[0-9a-f]{1,4}:){4}(?:(?:(?::[0-9a-f]{1,4}){1,3})|(?:(?::[0-9a-f]{1,4})?:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?:(?:[0-9a-f]{1,4}:){3}(?:(?:(?::[0-9a-f]{1,4}){1,4})|(?:(?::[0-9a-f]{1,4}){0,2}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?:(?:[0-9a-f]{1,4}:){2}(?:(?:(?::[0-9a-f]{1,4}){1,5})|(?:(?::[0-9a-f]{1,4}){0,3}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?:(?:[0-9a-f]{1,4}:){1}(?:(?:(?::[0-9a-f]{1,4}){1,6})|(?:(?::[0-9a-f]{1,4}){0,4}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?::(?:(?:(?::[0-9a-f]{1,4}){1,7})|(?:(?::[0-9a-f]{1,4}){0,5}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))(?:%.+)?\s*$/i,regex:w,uuid:h,"json-pointer":d,"json-pointer-uri-fragment":p,"relative-json-pointer":f},m.full={date:v,time:y,"date-time":function(e){var r=e.split(g);return 2==r.length&&v(r[0])&&y(r[1],!0)},uri:function(e){return P.test(e)&&l.test(e)},"uri-reference":/^(?:[a-z][a-z0-9+\-.]*:)?(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'"()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?(?:\?(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i,"uri-template":c,url:u,email:/^[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?$/i,hostname:s,ipv4:/^(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)$/,ipv6:/^\s*(?:(?:(?:[0-9a-f]{1,4}:){7}(?:[0-9a-f]{1,4}|:))|(?:(?:[0-9a-f]{1,4}:){6}(?::[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(?:(?:[0-9a-f]{1,4}:){5}(?:(?:(?::[0-9a-f]{1,4}){1,2})|:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(?:(?:[0-9a-f]{1,4}:){4}(?:(?:(?::[0-9a-f]{1,4}){1,3})|(?:(?::[0-9a-f]{1,4})?:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?:(?:[0-9a-f]{1,4}:){3}(?:(?:(?::[0-9a-f]{1,4}){1,4})|(?:(?::[0-9a-f]{1,4}){0,2}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?:(?:[0-9a-f]{1,4}:){2}(?:(?:(?::[0-9a-f]{1,4}){1,5})|(?:(?::[0-9a-f]{1,4}){0,3}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?:(?:[0-9a-f]{1,4}:){1}(?:(?:(?::[0-9a-f]{1,4}){1,6})|(?:(?::[0-9a-f]{1,4}){0,4}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?::(?:(?:(?::[0-9a-f]{1,4}){1,7})|(?:(?::[0-9a-f]{1,4}){0,5}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))(?:%.+)?\s*$/i,regex:w,uuid:h,"json-pointer":d,"json-pointer-uri-fragment":p,"relative-json-pointer":f};var g=/t|\s/i;var P=/\/|:/;var E=/[^\\]\\Z/;function w(e){if(E.test(e))return!1;try{return new RegExp(e),!0}catch(e){return!1}}},{"./util":10}],5:[function(e,r,t){"use strict";var R=e("./resolve"),$=e("./util"),j=e("./error_classes"),D=e("fast-json-stable-stringify"),O=e("../dotjs/validate"),I=$.ucs2length,A=e("fast-deep-equal"),k=j.Validation;function C(e,c,u,r){var d=this,p=this._opts,h=[void 0],f={},l=[],t={},m=[],a={},v=[],s=function(e,r,t){var a=L.call(this,e,r,t);return 0<=a?{index:a,compiling:!0}:{index:a=this._compilations.length,compiling:!(this._compilations[a]={schema:e,root:r,baseId:t})}}.call(this,e,c=c||{schema:e,refVal:h,refs:f},r),o=this._compilations[s.index];if(s.compiling)return o.callValidate=P;var y=this._formats,g=this.RULES;try{var i=E(e,c,u,r);o.validate=i;var n=o.callValidate;return n&&(n.schema=i.schema,n.errors=null,n.refs=i.refs,n.refVal=i.refVal,n.root=i.root,n.$async=i.$async,p.sourceCode&&(n.source=i.source)),i}finally{(function(e,r,t){var a=L.call(this,e,r,t);0<=a&&this._compilations.splice(a,1)}).call(this,e,c,r)}function P(){var e=o.validate,r=e.apply(this,arguments);return P.errors=e.errors,r}function E(e,r,t,a){var s=!r||r&&r.schema==e;if(r.schema!=c.schema)return C.call(d,e,r,t,a);var o=!0===e.$async,i=O({isTop:!0,schema:e,isRoot:s,baseId:a,root:r,schemaPath:"",errSchemaPath:"#",errorPath:'""',MissingRefError:j.MissingRef,RULES:g,validate:O,util:$,resolve:R,resolveRef:w,usePattern:_,useDefault:F,useCustomRule:x,opts:p,formats:y,logger:d.logger,self:d}),i=Q(h,z)+Q(l,N)+Q(m,q)+Q(v,T)+i;p.processCode&&(i=p.processCode(i,e));try{var n=new Function("self","RULES","formats","root","refVal","defaults","customRules","equal","ucs2length","ValidationError",i)(d,g,y,c,h,m,v,A,I,k);h[0]=n}catch(e){throw d.logger.error("Error compiling schema, function code:",i),e}return n.schema=e,n.errors=null,n.refs=f,n.refVal=h,n.root=s?n:r,o&&(n.$async=!0),!0===p.sourceCode&&(n.source={code:i,patterns:l,defaults:m}),n}function w(e,r,t){r=R.url(e,r);var a,s,o=f[r];if(void 0!==o)return S(a=h[o],s="refVal["+o+"]");if(!t&&c.refs){var i=c.refs[r];if(void 0!==i)return S(a=c.refVal[i],s=b(r,a))}s=b(r);var n,l=R.call(d,E,c,r);if(void 0!==l||(n=u&&u[r])&&(l=R.inlineRef(n,p.inlineRefs)?n:C.call(d,n,c,u,e)),void 0!==l)return S(h[f[r]]=l,s);delete f[r]}function b(e,r){var t=h.length;return h[t]=r,"refVal"+(f[e]=t)}function S(e,r){return"object"==typeof e||"boolean"==typeof e?{code:r,schema:e,inline:!0}:{code:r,$async:e&&!!e.$async}}function _(e){var r=t[e];return void 0===r&&(r=t[e]=l.length,l[r]=e),"pattern"+r}function F(e){switch(typeof e){case"boolean":case"number":return""+e;case"string":return $.toQuotedString(e);case"object":if(null===e)return"null";var r=D(e),t=a[r];return void 0===t&&(t=a[r]=m.length,m[t]=e),"default"+t}}function x(e,r,t,a){if(!1!==d._opts.validateSchema){var s=e.definition.dependencies;if(s&&!s.every(function(e){return Object.prototype.hasOwnProperty.call(t,e)}))throw new Error("parent schema must have all required keywords: "+s.join(","));var o=e.definition.validateSchema;if(o)if(!o(r)){var i="keyword schema is invalid: "+d.errorsText(o.errors);if("log"!=d._opts.validateSchema)throw new Error(i);d.logger.error(i)}}var n,l=e.definition.compile,c=e.definition.inline,u=e.definition.macro;if(l)n=l.call(d,r,t,a);else if(u)n=u.call(d,r,t,a),!1!==p.validateSchema&&d.validateSchema(n,!0);else if(c)n=c.call(d,a,e.keyword,r,t);else if(!(n=e.definition.validate))return;if(void 0===n)throw new Error('custom keyword "'+e.keyword+'"failed to compile');var h=v.length;return{code:"customRule"+h,validate:v[h]=n}}}function L(e,r,t){for(var a=0;a",_=P?">":"<",F=void 0;if(!y&&"number"!=typeof d&&void 0!==d)throw new Error(r+" must be number");if(!b&&void 0!==w&&"number"!=typeof w&&"boolean"!=typeof w)throw new Error(E+" must be number or boolean");b?(o="exclIsNumber"+u,i="' + "+(n="op"+u)+" + '",c+=" var schemaExcl"+u+" = "+(t=e.util.getData(w.$data,h,e.dataPathArr))+"; ",F=E,(l=l||[]).push(c+=" var "+(a="exclusive"+u)+"; var "+(s="exclType"+u)+" = typeof "+(t="schemaExcl"+u)+"; if ("+s+" != 'boolean' && "+s+" != 'undefined' && "+s+" != 'number') { "),c="",!1!==e.createErrors?(c+=" { keyword: '"+(F||"_exclusiveLimit")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(f)+" , params: {} ",!1!==e.opts.messages&&(c+=" , message: '"+E+" should be boolean' "),e.opts.verbose&&(c+=" , schema: validate.schema"+p+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+v+" "),c+=" } "):c+=" {} ",x=c,c=l.pop(),c+=!e.compositeRule&&m?e.async?" throw new ValidationError(["+x+"]); ":" validate.errors = ["+x+"]; return false; ":" var err = "+x+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",c+=" } else if ( ",y&&(c+=" ("+g+" !== undefined && typeof "+g+" != 'number') || "),c+=" "+s+" == 'number' ? ( ("+a+" = "+g+" === undefined || "+t+" "+S+"= "+g+") ? "+v+" "+_+"= "+t+" : "+v+" "+_+" "+g+" ) : ( ("+a+" = "+t+" === true) ? "+v+" "+_+"= "+g+" : "+v+" "+_+" "+g+" ) || "+v+" !== "+v+") { var op"+u+" = "+a+" ? '"+S+"' : '"+S+"='; ",void 0===d&&(f=e.errSchemaPath+"/"+(F=E),g=t,y=b)):(i=S,(o="number"==typeof w)&&y?(n="'"+i+"'",c+=" if ( ",y&&(c+=" ("+g+" !== undefined && typeof "+g+" != 'number') || "),c+=" ( "+g+" === undefined || "+w+" "+S+"= "+g+" ? "+v+" "+_+"= "+w+" : "+v+" "+_+" "+g+" ) || "+v+" !== "+v+") { "):(o&&void 0===d?(a=!0,f=e.errSchemaPath+"/"+(F=E),g=w,_+="="):(o&&(g=Math[P?"min":"max"](w,d)),w===(!o||g)?(a=!0,f=e.errSchemaPath+"/"+(F=E),_+="="):(a=!1,i+="=")),n="'"+i+"'",c+=" if ( ",y&&(c+=" ("+g+" !== undefined && typeof "+g+" != 'number') || "),c+=" "+v+" "+_+" "+g+" || "+v+" !== "+v+") { ")),F=F||r,(l=l||[]).push(c),c="",!1!==e.createErrors?(c+=" { keyword: '"+(F||"_limit")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(f)+" , params: { comparison: "+n+", limit: "+g+", exclusive: "+a+" } ",!1!==e.opts.messages&&(c+=" , message: 'should be "+i+" ",c+=y?"' + "+g:g+"'"),e.opts.verbose&&(c+=" , schema: ",c+=y?"validate.schema"+p:""+d,c+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+v+" "),c+=" } "):c+=" {} ";var x=c;return c=l.pop(),c+=!e.compositeRule&&m?e.async?" throw new ValidationError(["+x+"]); ":" validate.errors = ["+x+"]; return false; ":" var err = "+x+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",c+=" } ",m&&(c+=" else { "),c}},{}],14:[function(e,r,t){"use strict";r.exports=function(e,r){var t=" ",a=e.level,s=e.dataLevel,o=e.schema[r],i=e.schemaPath+e.util.getProperty(r),n=e.errSchemaPath+"/"+r,l=!e.opts.allErrors,c="data"+(s||""),u=e.opts.$data&&o&&o.$data,h=u?(t+=" var schema"+a+" = "+e.util.getData(o.$data,s,e.dataPathArr)+"; ","schema"+a):o;if(!u&&"number"!=typeof o)throw new Error(r+" must be number");t+="if ( ",u&&(t+=" ("+h+" !== undefined && typeof "+h+" != 'number') || ");var d=r,p=p||[];p.push(t+=" "+c+".length "+("maxItems"==r?">":"<")+" "+h+") { "),t="",!1!==e.createErrors?(t+=" { keyword: '"+(d||"_limitItems")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(n)+" , params: { limit: "+h+" } ",!1!==e.opts.messages&&(t+=" , message: 'should NOT have ",t+="maxItems"==r?"more":"fewer",t+=" than ",t+=u?"' + "+h+" + '":""+o,t+=" items' "),e.opts.verbose&&(t+=" , schema: ",t+=u?"validate.schema"+i:""+o,t+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+c+" "),t+=" } "):t+=" {} ";var f=t,t=p.pop();return t+=!e.compositeRule&&l?e.async?" throw new ValidationError(["+f+"]); ":" validate.errors = ["+f+"]; return false; ":" var err = "+f+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",t+="} ",l&&(t+=" else { "),t}},{}],15:[function(e,r,t){"use strict";r.exports=function(e,r){var t=" ",a=e.level,s=e.dataLevel,o=e.schema[r],i=e.schemaPath+e.util.getProperty(r),n=e.errSchemaPath+"/"+r,l=!e.opts.allErrors,c="data"+(s||""),u=e.opts.$data&&o&&o.$data,h=u?(t+=" var schema"+a+" = "+e.util.getData(o.$data,s,e.dataPathArr)+"; ","schema"+a):o;if(!u&&"number"!=typeof o)throw new Error(r+" must be number");t+="if ( ",u&&(t+=" ("+h+" !== undefined && typeof "+h+" != 'number') || "),t+=!1===e.opts.unicode?" "+c+".length ":" ucs2length("+c+") ";var d=r,p=p||[];p.push(t+=" "+("maxLength"==r?">":"<")+" "+h+") { "),t="",!1!==e.createErrors?(t+=" { keyword: '"+(d||"_limitLength")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(n)+" , params: { limit: "+h+" } ",!1!==e.opts.messages&&(t+=" , message: 'should NOT be ",t+="maxLength"==r?"longer":"shorter",t+=" than ",t+=u?"' + "+h+" + '":""+o,t+=" characters' "),e.opts.verbose&&(t+=" , schema: ",t+=u?"validate.schema"+i:""+o,t+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+c+" "),t+=" } "):t+=" {} ";var f=t,t=p.pop();return t+=!e.compositeRule&&l?e.async?" throw new ValidationError(["+f+"]); ":" validate.errors = ["+f+"]; return false; ":" var err = "+f+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",t+="} ",l&&(t+=" else { "),t}},{}],16:[function(e,r,t){"use strict";r.exports=function(e,r){var t=" ",a=e.level,s=e.dataLevel,o=e.schema[r],i=e.schemaPath+e.util.getProperty(r),n=e.errSchemaPath+"/"+r,l=!e.opts.allErrors,c="data"+(s||""),u=e.opts.$data&&o&&o.$data,h=u?(t+=" var schema"+a+" = "+e.util.getData(o.$data,s,e.dataPathArr)+"; ","schema"+a):o;if(!u&&"number"!=typeof o)throw new Error(r+" must be number");t+="if ( ",u&&(t+=" ("+h+" !== undefined && typeof "+h+" != 'number') || ");var d=r,p=p||[];p.push(t+=" Object.keys("+c+").length "+("maxProperties"==r?">":"<")+" "+h+") { "),t="",!1!==e.createErrors?(t+=" { keyword: '"+(d||"_limitProperties")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(n)+" , params: { limit: "+h+" } ",!1!==e.opts.messages&&(t+=" , message: 'should NOT have ",t+="maxProperties"==r?"more":"fewer",t+=" than ",t+=u?"' + "+h+" + '":""+o,t+=" properties' "),e.opts.verbose&&(t+=" , schema: ",t+=u?"validate.schema"+i:""+o,t+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+c+" "),t+=" } "):t+=" {} ";var f=t,t=p.pop();return t+=!e.compositeRule&&l?e.async?" throw new ValidationError(["+f+"]); ":" validate.errors = ["+f+"]; return false; ":" var err = "+f+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",t+="} ",l&&(t+=" else { "),t}},{}],17:[function(e,r,t){"use strict";r.exports=function(e,r){var t=" ",a=e.schema[r],s=e.schemaPath+e.util.getProperty(r),o=e.errSchemaPath+"/"+r,i=!e.opts.allErrors,n=e.util.copy(e),l="";n.level++;var c="valid"+n.level,u=n.baseId,h=!0,d=a;if(d)for(var p,f=-1,m=d.length-1;f "+_+") { ",x=c+"["+_+"]",d.schema=$,d.schemaPath=i+"["+_+"]",d.errSchemaPath=n+"/"+_,d.errorPath=e.util.getPathExpr(e.errorPath,_,e.opts.jsonPointers,!0),d.dataPathArr[v]=_,R=e.validate(d),d.baseId=g,e.util.varOccurences(R,y)<2?t+=" "+e.util.varReplace(R,y,x)+" ":t+=" var "+y+" = "+x+"; "+R+" ",t+=" } ",l&&(t+=" if ("+f+") { ",p+="}"))}"object"==typeof b&&(e.opts.strictKeywords?"object"==typeof b&&0 "+o.length+") { for (var "+m+" = "+o.length+"; "+m+" < "+c+".length; "+m+"++) { ",d.errorPath=e.util.getPathExpr(e.errorPath,m,e.opts.jsonPointers,!0),x=c+"["+m+"]",d.dataPathArr[v]=m,R=e.validate(d),d.baseId=g,e.util.varOccurences(R,y)<2?t+=" "+e.util.varReplace(R,y,x)+" ":t+=" var "+y+" = "+x+"; "+R+" ",l&&(t+=" if (!"+f+") break; "),t+=" } } ",l&&(t+=" if ("+f+") { ",p+="}"))}else{(e.opts.strictKeywords?"object"==typeof o&&0 1e-"+e.opts.multipleOfPrecision+" ":" division"+a+" !== parseInt(division"+a+") ",t+=" ) ",u&&(t+=" ) ");var d=d||[];d.push(t+=" ) { "),t="",!1!==e.createErrors?(t+=" { keyword: 'multipleOf' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(n)+" , params: { multipleOf: "+h+" } ",!1!==e.opts.messages&&(t+=" , message: 'should be multiple of ",t+=u?"' + "+h:h+"'"),e.opts.verbose&&(t+=" , schema: ",t+=u?"validate.schema"+i:""+o,t+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+c+" "),t+=" } "):t+=" {} ";var p=t,t=d.pop();return t+=!e.compositeRule&&l?e.async?" throw new ValidationError(["+p+"]); ":" validate.errors = ["+p+"]; return false; ":" var err = "+p+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",t+="} ",l&&(t+=" else { "),t}},{}],30:[function(e,r,t){"use strict";r.exports=function(e,r){var t=" ",a=e.level,s=e.dataLevel,o=e.schema[r],i=e.schemaPath+e.util.getProperty(r),n=e.errSchemaPath+"/"+r,l=!e.opts.allErrors,c="data"+(s||""),u="errs__"+a,h=e.util.copy(e);h.level++;var d,p,f,m,v="valid"+h.level;return(e.opts.strictKeywords?"object"==typeof o&&0 1) { ",t=e.schema.items&&e.schema.items.type,a=Array.isArray(t),!t||"object"==t||"array"==t||a&&(0<=t.indexOf("object")||0<=t.indexOf("array"))?i+=" outer: for (;i--;) { for (j = i; j--;) { if (equal("+p+"[i], "+p+"[j])) { "+f+" = false; break outer; } } } ":(i+=" var itemIndices = {}, item; for (;i--;) { var item = "+p+"[i]; ",i+=" if ("+e.util["checkDataType"+(a?"s":"")](t,"item",e.opts.strictNumbers,!0)+") continue; ",a&&(i+=" if (typeof item == 'string') item = '\"' + item; "),i+=" if (typeof itemIndices[item] == 'number') { "+f+" = false; j = itemIndices[item]; break; } itemIndices[item] = i; } "),i+=" } ",m&&(i+=" } "),(s=s||[]).push(i+=" if (!"+f+") { "),i="",!1!==e.createErrors?(i+=" { keyword: 'uniqueItems' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(h)+" , params: { i: i, j: j } ",!1!==e.opts.messages&&(i+=" , message: 'should NOT have duplicate items (items ## ' + j + ' and ' + i + ' are identical)' "),e.opts.verbose&&(i+=" , schema: ",i+=m?"validate.schema"+u:""+c,i+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+p+" "),i+=" } "):i+=" {} ",o=i,i=s.pop(),i+=!e.compositeRule&&d?e.async?" throw new ValidationError(["+o+"]); ":" validate.errors = ["+o+"]; return false; ":" var err = "+o+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",i+=" } ",d&&(i+=" else { ")):d&&(i+=" if (true) { "),i}},{}],38:[function(e,r,t){"use strict";r.exports=function(a,e){var r="",t=!0===a.schema.$async,s=a.util.schemaHasRulesExcept(a.schema,a.RULES.all,"$ref"),o=a.self._getId(a.schema);if(a.opts.strictKeywords){var i=a.util.schemaUnknownRules(a.schema,a.RULES.keywords);if(i){var n="unknown keyword: "+i;if("log"!==a.opts.strictKeywords)throw new Error(n);a.logger.warn(n)}}if(a.isTop&&(r+=" var validate = ",t&&(a.async=!0,r+="async "),r+="function(data, dataPath, parentData, parentDataProperty, rootData) { 'use strict'; ",o&&(a.opts.sourceCode||a.opts.processCode)&&(r+=" /*# sourceURL="+o+" */ ")),"boolean"==typeof a.schema||!s&&!a.schema.$ref){var l=a.level,c=a.dataLevel,u=a.schema[e="false schema"],h=a.schemaPath+a.util.getProperty(e),d=a.errSchemaPath+"/"+e,p=!a.opts.allErrors,f="data"+(c||""),m="valid"+l;return!1===a.schema?(a.isTop?p=!0:r+=" var "+m+" = false; ",(U=U||[]).push(r),r="",!1!==a.createErrors?(r+=" { keyword: 'false schema' , dataPath: (dataPath || '') + "+a.errorPath+" , schemaPath: "+a.util.toQuotedString(d)+" , params: {} ",!1!==a.opts.messages&&(r+=" , message: 'boolean schema is false' "),a.opts.verbose&&(r+=" , schema: false , parentSchema: validate.schema"+a.schemaPath+" , data: "+f+" "),r+=" } "):r+=" {} ",D=r,r=U.pop(),r+=!a.compositeRule&&p?a.async?" throw new ValidationError(["+D+"]); ":" validate.errors = ["+D+"]; return false; ":" var err = "+D+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; "):r+=a.isTop?t?" return data; ":" validate.errors = null; return true; ":" var "+m+" = true; ",a.isTop&&(r+=" }; return validate; "),r}if(a.isTop){var v=a.isTop,l=a.level=0,c=a.dataLevel=0,f="data";if(a.rootId=a.resolve.fullPath(a.self._getId(a.root.schema)),a.baseId=a.baseId||a.rootId,delete a.isTop,a.dataPathArr=[""],void 0!==a.schema.default&&a.opts.useDefaults&&a.opts.strictDefaults){var y="default is ignored in the schema root";if("log"!==a.opts.strictDefaults)throw new Error(y);a.logger.warn(y)}r+=" var vErrors = null; ",r+=" var errors = 0; ",r+=" if (rootData === undefined) rootData = data; "}else{l=a.level,f="data"+((c=a.dataLevel)||"");if(o&&(a.baseId=a.resolve.url(a.baseId,o)),t&&!a.async)throw new Error("async schema in sync schema");r+=" var errs_"+l+" = errors;"}var g,m="valid"+l,p=!a.opts.allErrors,P="",E="",w=a.schema.type,b=Array.isArray(w);if(w&&a.opts.nullable&&!0===a.schema.nullable&&(b?-1==w.indexOf("null")&&(w=w.concat("null")):"null"!=w&&(w=[w,"null"],b=!0)),b&&1==w.length&&(w=w[0],b=!1),a.schema.$ref&&s){if("fail"==a.opts.extendRefs)throw new Error('$ref: validation keywords used in schema at path "'+a.errSchemaPath+'" (see option extendRefs)');!0!==a.opts.extendRefs&&(s=!1,a.logger.warn('$ref: keywords ignored in schema at path "'+a.errSchemaPath+'"'))}if(a.schema.$comment&&a.opts.$comment&&(r+=" "+a.RULES.all.$comment.code(a,"$comment")),w){a.opts.coerceTypes&&(g=a.util.coerceToTypes(a.opts.coerceTypes,w));var S=a.RULES.types[w];if(g||b||!0===S||S&&!Z(S)){h=a.schemaPath+".type",d=a.errSchemaPath+"/type",h=a.schemaPath+".type",d=a.errSchemaPath+"/type";if(r+=" if ("+a.util[b?"checkDataTypes":"checkDataType"](w,f,a.opts.strictNumbers,!0)+") { ",g){var _="dataType"+l,F="coerced"+l;r+=" var "+_+" = typeof "+f+"; var "+F+" = undefined; ","array"==a.opts.coerceTypes&&(r+=" if ("+_+" == 'object' && Array.isArray("+f+") && "+f+".length == 1) { "+f+" = "+f+"[0]; "+_+" = typeof "+f+"; if ("+a.util.checkDataType(a.schema.type,f,a.opts.strictNumbers)+") "+F+" = "+f+"; } "),r+=" if ("+F+" !== undefined) ; ";var x=g;if(x)for(var R,$=-1,j=x.length-1;$= 0x80 (not a basic code point)","invalid-input":"Invalid input"},k=Math.floor,C=String.fromCharCode;function L(e){throw new RangeError(i[e])}function n(e,r){var t=e.split("@"),a="";return 1>1,e+=k(e/r);455k((A-a)/h))&&L("overflow"),a+=p*h;var f=d<=o?1:o+26<=d?26:d-o;if(pk(A/m)&&L("overflow"),h*=m}var v=r.length+1,o=z(a-u,v,0==u);k(a/v)>A-s&&L("overflow"),s+=k(a/v),a%=v,r.splice(a++,0,s)}return String.fromCodePoint.apply(String,r)}function c(e){var r=[],t=(e=N(e)).length,a=128,s=0,o=72,i=!0,n=!1,l=void 0;try{for(var c,u=e[Symbol.iterator]();!(i=(c=u.next()).done);i=!0){var h=c.value;h<128&&r.push(C(h))}}catch(e){n=!0,l=e}finally{try{!i&&u.return&&u.return()}finally{if(n)throw l}}var d=r.length,p=d;for(d&&r.push("-");pk((A-s)/w)&&L("overflow"),s+=(f-a)*w,a=f;var b=!0,S=!1,_=void 0;try{for(var F,x=e[Symbol.iterator]();!(b=(F=x.next()).done);b=!0){var R=F.value;if(RA&&L("overflow"),R==a){for(var $=s,j=36;;j+=36){var D=j<=o?1:o+26<=j?26:j-o;if($>6|192).toString(16).toUpperCase()+"%"+(63&r|128).toString(16).toUpperCase():"%"+(r>>12|224).toString(16).toUpperCase()+"%"+(r>>6&63|128).toString(16).toUpperCase()+"%"+(63&r|128).toString(16).toUpperCase()}function p(e){for(var r="",t=0,a=e.length;tA-Z\\x5E-\\x7E]",'[\\"\\\\]')),Y=new RegExp(M,"g"),W=new RegExp("(?:(?:%[EFef][0-9A-Fa-f]%[0-9A-Fa-f][0-9A-Fa-f]%[0-9A-Fa-f][0-9A-Fa-f])|(?:%[89A-Fa-f][0-9A-Fa-f]%[0-9A-Fa-f][0-9A-Fa-f])|(?:%[0-9A-Fa-f][0-9A-Fa-f]))","g"),X=new RegExp(J("[^]","[A-Za-z0-9\\!\\$\\%\\'\\*\\+\\-\\^\\_\\`\\{\\|\\}\\~]","[\\.]",'[\\"]',G),"g"),ee=new RegExp(J("[^]",M,"[\\!\\$\\'\\(\\)\\*\\+\\,\\;\\:\\@]"),"g"),re=ee;function te(e){var r=p(e);return r.match(Y)?r:e}var ae={scheme:"mailto",parse:function(e,r){var t=e,a=t.to=t.path?t.path.split(","):[];if(t.path=void 0,t.query){for(var s=!1,o={},i=t.query.split("&"),n=0,l=i.length;n%\\^`{|}]|%[0-9a-f]{2})|\{[+#./;?&=,!@|]?(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?(?:,(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?)*\})*$/i,u=/^(?:(?:http[s\u017F]?|ftp):\/\/)(?:(?:[\0-\x08\x0E-\x1F!-\x9F\xA1-\u167F\u1681-\u1FFF\u200B-\u2027\u202A-\u202E\u2030-\u205E\u2060-\u2FFF\u3001-\uD7FF\uE000-\uFEFE\uFF00-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+(?::(?:[\0-\x08\x0E-\x1F!-\x9F\xA1-\u167F\u1681-\u1FFF\u200B-\u2027\u202A-\u202E\u2030-\u205E\u2060-\u2FFF\u3001-\uD7FF\uE000-\uFEFE\uFF00-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])*)?@)?(?:(?!10(?:\.[0-9]{1,3}){3})(?!127(?:\.[0-9]{1,3}){3})(?!169\.254(?:\.[0-9]{1,3}){2})(?!192\.168(?:\.[0-9]{1,3}){2})(?!172\.(?:1[6-9]|2[0-9]|3[01])(?:\.[0-9]{1,3}){2})(?:[1-9][0-9]?|1[0-9][0-9]|2[01][0-9]|22[0-3])(?:\.(?:1?[0-9]{1,2}|2[0-4][0-9]|25[0-5])){2}(?:\.(?:[1-9][0-9]?|1[0-9][0-9]|2[0-4][0-9]|25[0-4]))|(?:(?:(?:[0-9a-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+-)*(?:[0-9a-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+)(?:\.(?:(?:[0-9a-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+-)*(?:[0-9a-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+)*(?:\.(?:(?:[a-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]){2,})))(?::[0-9]{2,5})?(?:\/(?:[\0-\x08\x0E-\x1F!-\x9F\xA1-\u167F\u1681-\u1FFF\u200B-\u2027\u202A-\u202E\u2030-\u205E\u2060-\u2FFF\u3001-\uD7FF\uE000-\uFEFE\uFF00-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])*)?$/i,h=/^(?:urn:uuid:)?[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/i,d=/^(?:\/(?:[^~/]|~0|~1)*)*$/,p=/^#(?:\/(?:[a-z0-9_\-.!$&'()*+,;:=@]|%[0-9a-f]{2}|~0|~1)*)*$/i,f=/^(?:0|[1-9][0-9]*)(?:#|(?:\/(?:[^~/]|~0|~1)*)*)$/;function m(e){return a.copy(m[e="full"==e?"full":"fast"])}function v(e){var r=e.match(o);if(!r)return!1;var t,a=+r[2],s=+r[3];return 1<=a&&a<=12&&1<=s&&s<=(2!=a||((t=+r[1])%4!=0||t%100==0&&t%400!=0)?i[a]:29)}function y(e,r){var t=e.match(n);if(!t)return!1;var a=t[1],s=t[2],o=t[3];return(a<=23&&s<=59&&o<=59||23==a&&59==s&&60==o)&&(!r||t[5])}(r.exports=m).fast={date:/^\d\d\d\d-[0-1]\d-[0-3]\d$/,time:/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,"date-time":/^\d\d\d\d-[0-1]\d-[0-3]\d[t\s](?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,uri:/^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/)?[^\s]*$/i,"uri-reference":/^(?:(?:[a-z][a-z0-9+\-.]*:)?\/?\/)?(?:[^\\\s#][^\s#]*)?(?:#[^\\\s]*)?$/i,"uri-template":c,url:u,email:/^[a-z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?)*$/i,hostname:s,ipv4:/^(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)$/,ipv6:/^\s*(?:(?:(?:[0-9a-f]{1,4}:){7}(?:[0-9a-f]{1,4}|:))|(?:(?:[0-9a-f]{1,4}:){6}(?::[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(?:(?:[0-9a-f]{1,4}:){5}(?:(?:(?::[0-9a-f]{1,4}){1,2})|:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(?:(?:[0-9a-f]{1,4}:){4}(?:(?:(?::[0-9a-f]{1,4}){1,3})|(?:(?::[0-9a-f]{1,4})?:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?:(?:[0-9a-f]{1,4}:){3}(?:(?:(?::[0-9a-f]{1,4}){1,4})|(?:(?::[0-9a-f]{1,4}){0,2}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?:(?:[0-9a-f]{1,4}:){2}(?:(?:(?::[0-9a-f]{1,4}){1,5})|(?:(?::[0-9a-f]{1,4}){0,3}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?:(?:[0-9a-f]{1,4}:){1}(?:(?:(?::[0-9a-f]{1,4}){1,6})|(?:(?::[0-9a-f]{1,4}){0,4}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?::(?:(?:(?::[0-9a-f]{1,4}){1,7})|(?:(?::[0-9a-f]{1,4}){0,5}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))(?:%.+)?\s*$/i,regex:w,uuid:h,"json-pointer":d,"json-pointer-uri-fragment":p,"relative-json-pointer":f},m.full={date:v,time:y,"date-time":function(e){var r=e.split(g);return 2==r.length&&v(r[0])&&y(r[1],!0)},uri:function(e){return P.test(e)&&l.test(e)},"uri-reference":/^(?:[a-z][a-z0-9+\-.]*:)?(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'"()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?(?:\?(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i,"uri-template":c,url:u,email:/^[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?$/i,hostname:s,ipv4:/^(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)$/,ipv6:/^\s*(?:(?:(?:[0-9a-f]{1,4}:){7}(?:[0-9a-f]{1,4}|:))|(?:(?:[0-9a-f]{1,4}:){6}(?::[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(?:(?:[0-9a-f]{1,4}:){5}(?:(?:(?::[0-9a-f]{1,4}){1,2})|:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(?:(?:[0-9a-f]{1,4}:){4}(?:(?:(?::[0-9a-f]{1,4}){1,3})|(?:(?::[0-9a-f]{1,4})?:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?:(?:[0-9a-f]{1,4}:){3}(?:(?:(?::[0-9a-f]{1,4}){1,4})|(?:(?::[0-9a-f]{1,4}){0,2}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?:(?:[0-9a-f]{1,4}:){2}(?:(?:(?::[0-9a-f]{1,4}){1,5})|(?:(?::[0-9a-f]{1,4}){0,3}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?:(?:[0-9a-f]{1,4}:){1}(?:(?:(?::[0-9a-f]{1,4}){1,6})|(?:(?::[0-9a-f]{1,4}){0,4}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?::(?:(?:(?::[0-9a-f]{1,4}){1,7})|(?:(?::[0-9a-f]{1,4}){0,5}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))(?:%.+)?\s*$/i,regex:w,uuid:h,"json-pointer":d,"json-pointer-uri-fragment":p,"relative-json-pointer":f};var g=/t|\s/i;var P=/\/|:/;var E=/[^\\]\\Z/;function w(e){if(E.test(e))return!1;try{return new RegExp(e),!0}catch(e){return!1}}},{"./util":10}],5:[function(e,r,t){"use strict";var R=e("./resolve"),$=e("./util"),j=e("./error_classes"),D=e("fast-json-stable-stringify"),O=e("../dotjs/validate"),I=$.ucs2length,A=e("fast-deep-equal"),k=j.Validation;function C(e,c,u,r){var d=this,p=this._opts,h=[void 0],f={},l=[],t={},m=[],a={},v=[],s=function(e,r,t){var a=L.call(this,e,r,t);return 0<=a?{index:a,compiling:!0}:{index:a=this._compilations.length,compiling:!(this._compilations[a]={schema:e,root:r,baseId:t})}}.call(this,e,c=c||{schema:e,refVal:h,refs:f},r),o=this._compilations[s.index];if(s.compiling)return o.callValidate=P;var y=this._formats,g=this.RULES;try{var i=E(e,c,u,r);o.validate=i;var n=o.callValidate;return n&&(n.schema=i.schema,n.errors=null,n.refs=i.refs,n.refVal=i.refVal,n.root=i.root,n.$async=i.$async,p.sourceCode&&(n.source=i.source)),i}finally{(function(e,r,t){var a=L.call(this,e,r,t);0<=a&&this._compilations.splice(a,1)}).call(this,e,c,r)}function P(){var e=o.validate,r=e.apply(this,arguments);return P.errors=e.errors,r}function E(e,r,t,a){var s=!r||r&&r.schema==e;if(r.schema!=c.schema)return C.call(d,e,r,t,a);var o=!0===e.$async,i=O({isTop:!0,schema:e,isRoot:s,baseId:a,root:r,schemaPath:"",errSchemaPath:"#",errorPath:'""',MissingRefError:j.MissingRef,RULES:g,validate:O,util:$,resolve:R,resolveRef:w,usePattern:_,useDefault:F,useCustomRule:x,opts:p,formats:y,logger:d.logger,self:d}),i=Q(h,z)+Q(l,N)+Q(m,q)+Q(v,T)+i;p.processCode&&(i=p.processCode(i,e));try{var n=new Function("self","RULES","formats","root","refVal","defaults","customRules","equal","ucs2length","ValidationError",i)(d,g,y,c,h,m,v,A,I,k);h[0]=n}catch(e){throw d.logger.error("Error compiling schema, function code:",i),e}return n.schema=e,n.errors=null,n.refs=f,n.refVal=h,n.root=s?n:r,o&&(n.$async=!0),!0===p.sourceCode&&(n.source={code:i,patterns:l,defaults:m}),n}function w(e,r,t){r=R.url(e,r);var a,s,o=f[r];if(void 0!==o)return S(a=h[o],s="refVal["+o+"]");if(!t&&c.refs){var i=c.refs[r];if(void 0!==i)return S(a=c.refVal[i],s=b(r,a))}s=b(r);var n,l=R.call(d,E,c,r);if(void 0!==l||(n=u&&u[r])&&(l=R.inlineRef(n,p.inlineRefs)?n:C.call(d,n,c,u,e)),void 0!==l)return S(h[f[r]]=l,s);delete f[r]}function b(e,r){var t=h.length;return h[t]=r,"refVal"+(f[e]=t)}function S(e,r){return"object"==typeof e||"boolean"==typeof e?{code:r,schema:e,inline:!0}:{code:r,$async:e&&!!e.$async}}function _(e){var r=t[e];return void 0===r&&(r=t[e]=l.length,l[r]=e),"pattern"+r}function F(e){switch(typeof e){case"boolean":case"number":return""+e;case"string":return $.toQuotedString(e);case"object":if(null===e)return"null";var r=D(e),t=a[r];return void 0===t&&(t=a[r]=m.length,m[t]=e),"default"+t}}function x(e,r,t,a){if(!1!==d._opts.validateSchema){var s=e.definition.dependencies;if(s&&!s.every(function(e){return Object.prototype.hasOwnProperty.call(t,e)}))throw new Error("parent schema must have all required keywords: "+s.join(","));var o=e.definition.validateSchema;if(o)if(!o(r)){var i="keyword schema is invalid: "+d.errorsText(o.errors);if("log"!=d._opts.validateSchema)throw new Error(i);d.logger.error(i)}}var n,l=e.definition.compile,c=e.definition.inline,u=e.definition.macro;if(l)n=l.call(d,r,t,a);else if(u)n=u.call(d,r,t,a),!1!==p.validateSchema&&d.validateSchema(n,!0);else if(c)n=c.call(d,a,e.keyword,r,t);else if(!(n=e.definition.validate))return;if(void 0===n)throw new Error('custom keyword "'+e.keyword+'"failed to compile');var h=v.length;return{code:"customRule"+h,validate:v[h]=n}}}function L(e,r,t){for(var a=0;a",_=P?">":"<",F=void 0;if(!y&&"number"!=typeof d&&void 0!==d)throw new Error(r+" must be number");if(!b&&void 0!==w&&"number"!=typeof w&&"boolean"!=typeof w)throw new Error(E+" must be number or boolean");b?(o="exclIsNumber"+u,i="' + "+(n="op"+u)+" + '",c+=" var schemaExcl"+u+" = "+(t=e.util.getData(w.$data,h,e.dataPathArr))+"; ",F=E,(l=l||[]).push(c+=" var "+(a="exclusive"+u)+"; var "+(s="exclType"+u)+" = typeof "+(t="schemaExcl"+u)+"; if ("+s+" != 'boolean' && "+s+" != 'undefined' && "+s+" != 'number') { "),c="",!1!==e.createErrors?(c+=" { keyword: '"+(F||"_exclusiveLimit")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(f)+" , params: {} ",!1!==e.opts.messages&&(c+=" , message: '"+E+" should be boolean' "),e.opts.verbose&&(c+=" , schema: validate.schema"+p+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+v+" "),c+=" } "):c+=" {} ",x=c,c=l.pop(),c+=!e.compositeRule&&m?e.async?" throw new ValidationError(["+x+"]); ":" validate.errors = ["+x+"]; return false; ":" var err = "+x+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",c+=" } else if ( ",y&&(c+=" ("+g+" !== undefined && typeof "+g+" != 'number') || "),c+=" "+s+" == 'number' ? ( ("+a+" = "+g+" === undefined || "+t+" "+S+"= "+g+") ? "+v+" "+_+"= "+t+" : "+v+" "+_+" "+g+" ) : ( ("+a+" = "+t+" === true) ? "+v+" "+_+"= "+g+" : "+v+" "+_+" "+g+" ) || "+v+" !== "+v+") { var op"+u+" = "+a+" ? '"+S+"' : '"+S+"='; ",void 0===d&&(f=e.errSchemaPath+"/"+(F=E),g=t,y=b)):(i=S,(o="number"==typeof w)&&y?(n="'"+i+"'",c+=" if ( ",y&&(c+=" ("+g+" !== undefined && typeof "+g+" != 'number') || "),c+=" ( "+g+" === undefined || "+w+" "+S+"= "+g+" ? "+v+" "+_+"= "+w+" : "+v+" "+_+" "+g+" ) || "+v+" !== "+v+") { "):(o&&void 0===d?(a=!0,f=e.errSchemaPath+"/"+(F=E),g=w,_+="="):(o&&(g=Math[P?"min":"max"](w,d)),w===(!o||g)?(a=!0,f=e.errSchemaPath+"/"+(F=E),_+="="):(a=!1,i+="=")),n="'"+i+"'",c+=" if ( ",y&&(c+=" ("+g+" !== undefined && typeof "+g+" != 'number') || "),c+=" "+v+" "+_+" "+g+" || "+v+" !== "+v+") { ")),F=F||r,(l=l||[]).push(c),c="",!1!==e.createErrors?(c+=" { keyword: '"+(F||"_limit")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(f)+" , params: { comparison: "+n+", limit: "+g+", exclusive: "+a+" } ",!1!==e.opts.messages&&(c+=" , message: 'should be "+i+" ",c+=y?"' + "+g:g+"'"),e.opts.verbose&&(c+=" , schema: ",c+=y?"validate.schema"+p:""+d,c+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+v+" "),c+=" } "):c+=" {} ";var x=c;return c=l.pop(),c+=!e.compositeRule&&m?e.async?" throw new ValidationError(["+x+"]); ":" validate.errors = ["+x+"]; return false; ":" var err = "+x+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",c+=" } ",m&&(c+=" else { "),c}},{}],14:[function(e,r,t){"use strict";r.exports=function(e,r){var t=" ",a=e.level,s=e.dataLevel,o=e.schema[r],i=e.schemaPath+e.util.getProperty(r),n=e.errSchemaPath+"/"+r,l=!e.opts.allErrors,c="data"+(s||""),u=e.opts.$data&&o&&o.$data,h=u?(t+=" var schema"+a+" = "+e.util.getData(o.$data,s,e.dataPathArr)+"; ","schema"+a):o;if(!u&&"number"!=typeof o)throw new Error(r+" must be number");t+="if ( ",u&&(t+=" ("+h+" !== undefined && typeof "+h+" != 'number') || ");var d=r,p=p||[];p.push(t+=" "+c+".length "+("maxItems"==r?">":"<")+" "+h+") { "),t="",!1!==e.createErrors?(t+=" { keyword: '"+(d||"_limitItems")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(n)+" , params: { limit: "+h+" } ",!1!==e.opts.messages&&(t+=" , message: 'should NOT have ",t+="maxItems"==r?"more":"fewer",t+=" than ",t+=u?"' + "+h+" + '":""+o,t+=" items' "),e.opts.verbose&&(t+=" , schema: ",t+=u?"validate.schema"+i:""+o,t+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+c+" "),t+=" } "):t+=" {} ";var f=t,t=p.pop();return t+=!e.compositeRule&&l?e.async?" throw new ValidationError(["+f+"]); ":" validate.errors = ["+f+"]; return false; ":" var err = "+f+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",t+="} ",l&&(t+=" else { "),t}},{}],15:[function(e,r,t){"use strict";r.exports=function(e,r){var t=" ",a=e.level,s=e.dataLevel,o=e.schema[r],i=e.schemaPath+e.util.getProperty(r),n=e.errSchemaPath+"/"+r,l=!e.opts.allErrors,c="data"+(s||""),u=e.opts.$data&&o&&o.$data,h=u?(t+=" var schema"+a+" = "+e.util.getData(o.$data,s,e.dataPathArr)+"; ","schema"+a):o;if(!u&&"number"!=typeof o)throw new Error(r+" must be number");t+="if ( ",u&&(t+=" ("+h+" !== undefined && typeof "+h+" != 'number') || "),t+=!1===e.opts.unicode?" "+c+".length ":" ucs2length("+c+") ";var d=r,p=p||[];p.push(t+=" "+("maxLength"==r?">":"<")+" "+h+") { "),t="",!1!==e.createErrors?(t+=" { keyword: '"+(d||"_limitLength")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(n)+" , params: { limit: "+h+" } ",!1!==e.opts.messages&&(t+=" , message: 'should NOT be ",t+="maxLength"==r?"longer":"shorter",t+=" than ",t+=u?"' + "+h+" + '":""+o,t+=" characters' "),e.opts.verbose&&(t+=" , schema: ",t+=u?"validate.schema"+i:""+o,t+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+c+" "),t+=" } "):t+=" {} ";var f=t,t=p.pop();return t+=!e.compositeRule&&l?e.async?" throw new ValidationError(["+f+"]); ":" validate.errors = ["+f+"]; return false; ":" var err = "+f+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",t+="} ",l&&(t+=" else { "),t}},{}],16:[function(e,r,t){"use strict";r.exports=function(e,r){var t=" ",a=e.level,s=e.dataLevel,o=e.schema[r],i=e.schemaPath+e.util.getProperty(r),n=e.errSchemaPath+"/"+r,l=!e.opts.allErrors,c="data"+(s||""),u=e.opts.$data&&o&&o.$data,h=u?(t+=" var schema"+a+" = "+e.util.getData(o.$data,s,e.dataPathArr)+"; ","schema"+a):o;if(!u&&"number"!=typeof o)throw new Error(r+" must be number");t+="if ( ",u&&(t+=" ("+h+" !== undefined && typeof "+h+" != 'number') || ");var d=r,p=p||[];p.push(t+=" Object.keys("+c+").length "+("maxProperties"==r?">":"<")+" "+h+") { "),t="",!1!==e.createErrors?(t+=" { keyword: '"+(d||"_limitProperties")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(n)+" , params: { limit: "+h+" } ",!1!==e.opts.messages&&(t+=" , message: 'should NOT have ",t+="maxProperties"==r?"more":"fewer",t+=" than ",t+=u?"' + "+h+" + '":""+o,t+=" properties' "),e.opts.verbose&&(t+=" , schema: ",t+=u?"validate.schema"+i:""+o,t+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+c+" "),t+=" } "):t+=" {} ";var f=t,t=p.pop();return t+=!e.compositeRule&&l?e.async?" throw new ValidationError(["+f+"]); ":" validate.errors = ["+f+"]; return false; ":" var err = "+f+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",t+="} ",l&&(t+=" else { "),t}},{}],17:[function(e,r,t){"use strict";r.exports=function(e,r){var t=" ",a=e.schema[r],s=e.schemaPath+e.util.getProperty(r),o=e.errSchemaPath+"/"+r,i=!e.opts.allErrors,n=e.util.copy(e),l="";n.level++;var c="valid"+n.level,u=n.baseId,h=!0,d=a;if(d)for(var p,f=-1,m=d.length-1;f "+_+") { ",x=c+"["+_+"]",d.schema=$,d.schemaPath=i+"["+_+"]",d.errSchemaPath=n+"/"+_,d.errorPath=e.util.getPathExpr(e.errorPath,_,e.opts.jsonPointers,!0),d.dataPathArr[v]=_,R=e.validate(d),d.baseId=g,e.util.varOccurences(R,y)<2?t+=" "+e.util.varReplace(R,y,x)+" ":t+=" var "+y+" = "+x+"; "+R+" ",t+=" } ",l&&(t+=" if ("+f+") { ",p+="}"))}"object"==typeof b&&(e.opts.strictKeywords?"object"==typeof b&&0 "+o.length+") { for (var "+m+" = "+o.length+"; "+m+" < "+c+".length; "+m+"++) { ",d.errorPath=e.util.getPathExpr(e.errorPath,m,e.opts.jsonPointers,!0),x=c+"["+m+"]",d.dataPathArr[v]=m,R=e.validate(d),d.baseId=g,e.util.varOccurences(R,y)<2?t+=" "+e.util.varReplace(R,y,x)+" ":t+=" var "+y+" = "+x+"; "+R+" ",l&&(t+=" if (!"+f+") break; "),t+=" } } ",l&&(t+=" if ("+f+") { ",p+="}"))}else{(e.opts.strictKeywords?"object"==typeof o&&0 1e-"+e.opts.multipleOfPrecision+" ":" division"+a+" !== parseInt(division"+a+") ",t+=" ) ",u&&(t+=" ) ");var d=d||[];d.push(t+=" ) { "),t="",!1!==e.createErrors?(t+=" { keyword: 'multipleOf' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(n)+" , params: { multipleOf: "+h+" } ",!1!==e.opts.messages&&(t+=" , message: 'should be multiple of ",t+=u?"' + "+h:h+"'"),e.opts.verbose&&(t+=" , schema: ",t+=u?"validate.schema"+i:""+o,t+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+c+" "),t+=" } "):t+=" {} ";var p=t,t=d.pop();return t+=!e.compositeRule&&l?e.async?" throw new ValidationError(["+p+"]); ":" validate.errors = ["+p+"]; return false; ":" var err = "+p+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",t+="} ",l&&(t+=" else { "),t}},{}],30:[function(e,r,t){"use strict";r.exports=function(e,r){var t=" ",a=e.level,s=e.dataLevel,o=e.schema[r],i=e.schemaPath+e.util.getProperty(r),n=e.errSchemaPath+"/"+r,l=!e.opts.allErrors,c="data"+(s||""),u="errs__"+a,h=e.util.copy(e);h.level++;var d,p,f,m,v="valid"+h.level;return(e.opts.strictKeywords?"object"==typeof o&&0 1) { ",t=e.schema.items&&e.schema.items.type,a=Array.isArray(t),!t||"object"==t||"array"==t||a&&(0<=t.indexOf("object")||0<=t.indexOf("array"))?i+=" outer: for (;i--;) { for (j = i; j--;) { if (equal("+p+"[i], "+p+"[j])) { "+f+" = false; break outer; } } } ":(i+=" var itemIndices = {}, item; for (;i--;) { var item = "+p+"[i]; ",i+=" if ("+e.util["checkDataType"+(a?"s":"")](t,"item",e.opts.strictNumbers,!0)+") continue; ",a&&(i+=" if (typeof item == 'string') item = '\"' + item; "),i+=" if (typeof itemIndices[item] == 'number') { "+f+" = false; j = itemIndices[item]; break; } itemIndices[item] = i; } "),i+=" } ",m&&(i+=" } "),(s=s||[]).push(i+=" if (!"+f+") { "),i="",!1!==e.createErrors?(i+=" { keyword: 'uniqueItems' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(h)+" , params: { i: i, j: j } ",!1!==e.opts.messages&&(i+=" , message: 'should NOT have duplicate items (items ## ' + j + ' and ' + i + ' are identical)' "),e.opts.verbose&&(i+=" , schema: ",i+=m?"validate.schema"+u:""+c,i+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+p+" "),i+=" } "):i+=" {} ",o=i,i=s.pop(),i+=!e.compositeRule&&d?e.async?" throw new ValidationError(["+o+"]); ":" validate.errors = ["+o+"]; return false; ":" var err = "+o+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",i+=" } ",d&&(i+=" else { ")):d&&(i+=" if (true) { "),i}},{}],38:[function(e,r,t){"use strict";r.exports=function(a,e){var r="",t=!0===a.schema.$async,s=a.util.schemaHasRulesExcept(a.schema,a.RULES.all,"$ref"),o=a.self._getId(a.schema);if(a.opts.strictKeywords){var i=a.util.schemaUnknownRules(a.schema,a.RULES.keywords);if(i){var n="unknown keyword: "+i;if("log"!==a.opts.strictKeywords)throw new Error(n);a.logger.warn(n)}}if(a.isTop&&(r+=" var validate = ",t&&(a.async=!0,r+="async "),r+="function(data, dataPath, parentData, parentDataProperty, rootData) { 'use strict'; ",o&&(a.opts.sourceCode||a.opts.processCode)&&(r+=" /*# sourceURL="+o+" */ ")),"boolean"==typeof a.schema||!s&&!a.schema.$ref){var l=a.level,c=a.dataLevel,u=a.schema[e="false schema"],h=a.schemaPath+a.util.getProperty(e),d=a.errSchemaPath+"/"+e,p=!a.opts.allErrors,f="data"+(c||""),m="valid"+l;return!1===a.schema?(a.isTop?p=!0:r+=" var "+m+" = false; ",(U=U||[]).push(r),r="",!1!==a.createErrors?(r+=" { keyword: 'false schema' , dataPath: (dataPath || '') + "+a.errorPath+" , schemaPath: "+a.util.toQuotedString(d)+" , params: {} ",!1!==a.opts.messages&&(r+=" , message: 'boolean schema is false' "),a.opts.verbose&&(r+=" , schema: false , parentSchema: validate.schema"+a.schemaPath+" , data: "+f+" "),r+=" } "):r+=" {} ",D=r,r=U.pop(),r+=!a.compositeRule&&p?a.async?" throw new ValidationError(["+D+"]); ":" validate.errors = ["+D+"]; return false; ":" var err = "+D+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; "):r+=a.isTop?t?" return data; ":" validate.errors = null; return true; ":" var "+m+" = true; ",a.isTop&&(r+=" }; return validate; "),r}if(a.isTop){var v=a.isTop,l=a.level=0,c=a.dataLevel=0,f="data";if(a.rootId=a.resolve.fullPath(a.self._getId(a.root.schema)),a.baseId=a.baseId||a.rootId,delete a.isTop,a.dataPathArr=[""],void 0!==a.schema.default&&a.opts.useDefaults&&a.opts.strictDefaults){var y="default is ignored in the schema root";if("log"!==a.opts.strictDefaults)throw new Error(y);a.logger.warn(y)}r+=" var vErrors = null; ",r+=" var errors = 0; ",r+=" if (rootData === undefined) rootData = data; "}else{l=a.level,f="data"+((c=a.dataLevel)||"");if(o&&(a.baseId=a.resolve.url(a.baseId,o)),t&&!a.async)throw new Error("async schema in sync schema");r+=" var errs_"+l+" = errors;"}var g,m="valid"+l,p=!a.opts.allErrors,P="",E="",w=a.schema.type,b=Array.isArray(w);if(w&&a.opts.nullable&&!0===a.schema.nullable&&(b?-1==w.indexOf("null")&&(w=w.concat("null")):"null"!=w&&(w=[w,"null"],b=!0)),b&&1==w.length&&(w=w[0],b=!1),a.schema.$ref&&s){if("fail"==a.opts.extendRefs)throw new Error('$ref: validation keywords used in schema at path "'+a.errSchemaPath+'" (see option extendRefs)');!0!==a.opts.extendRefs&&(s=!1,a.logger.warn('$ref: keywords ignored in schema at path "'+a.errSchemaPath+'"'))}if(a.schema.$comment&&a.opts.$comment&&(r+=" "+a.RULES.all.$comment.code(a,"$comment")),w){a.opts.coerceTypes&&(g=a.util.coerceToTypes(a.opts.coerceTypes,w));var S=a.RULES.types[w];if(g||b||!0===S||S&&!Z(S)){h=a.schemaPath+".type",d=a.errSchemaPath+"/type",h=a.schemaPath+".type",d=a.errSchemaPath+"/type";if(r+=" if ("+a.util[b?"checkDataTypes":"checkDataType"](w,f,a.opts.strictNumbers,!0)+") { ",g){var _="dataType"+l,F="coerced"+l;r+=" var "+_+" = typeof "+f+"; var "+F+" = undefined; ","array"==a.opts.coerceTypes&&(r+=" if ("+_+" == 'object' && Array.isArray("+f+") && "+f+".length == 1) { "+f+" = "+f+"[0]; "+_+" = typeof "+f+"; if ("+a.util.checkDataType(a.schema.type,f,a.opts.strictNumbers)+") "+F+" = "+f+"; } "),r+=" if ("+F+" !== undefined) ; ";var x=g;if(x)for(var R,$=-1,j=x.length-1;$= 0x80 (not a basic code point)","invalid-input":"Invalid input"},k=Math.floor,C=String.fromCharCode;function L(e){throw new RangeError(i[e])}function n(e,r){var t=e.split("@"),a="";return 1>1,e+=k(e/r);455k((A-a)/h))&&L("overflow"),a+=p*h;var f=d<=o?1:o+26<=d?26:d-o;if(pk(A/m)&&L("overflow"),h*=m}var v=r.length+1,o=z(a-u,v,0==u);k(a/v)>A-s&&L("overflow"),s+=k(a/v),a%=v,r.splice(a++,0,s)}return String.fromCodePoint.apply(String,r)}function c(e){var r=[],t=(e=N(e)).length,a=128,s=0,o=72,i=!0,n=!1,l=void 0;try{for(var c,u=e[Symbol.iterator]();!(i=(c=u.next()).done);i=!0){var h=c.value;h<128&&r.push(C(h))}}catch(e){n=!0,l=e}finally{try{!i&&u.return&&u.return()}finally{if(n)throw l}}var d=r.length,p=d;for(d&&r.push("-");pk((A-s)/w)&&L("overflow"),s+=(f-a)*w,a=f;var b=!0,S=!1,_=void 0;try{for(var F,x=e[Symbol.iterator]();!(b=(F=x.next()).done);b=!0){var R=F.value;if(RA&&L("overflow"),R==a){for(var $=s,j=36;;j+=36){var D=j<=o?1:o+26<=j?26:j-o;if($>6|192).toString(16).toUpperCase()+"%"+(63&r|128).toString(16).toUpperCase():"%"+(r>>12|224).toString(16).toUpperCase()+"%"+(r>>6&63|128).toString(16).toUpperCase()+"%"+(63&r|128).toString(16).toUpperCase()}function p(e){for(var r="",t=0,a=e.length;tA-Z\\x5E-\\x7E]",'[\\"\\\\]')),Y=new RegExp(K,"g"),W=new RegExp("(?:(?:%[EFef][0-9A-Fa-f]%[0-9A-Fa-f][0-9A-Fa-f]%[0-9A-Fa-f][0-9A-Fa-f])|(?:%[89A-Fa-f][0-9A-Fa-f]%[0-9A-Fa-f][0-9A-Fa-f])|(?:%[0-9A-Fa-f][0-9A-Fa-f]))","g"),X=new RegExp(J("[^]","[A-Za-z0-9\\!\\$\\%\\'\\*\\+\\-\\^\\_\\`\\{\\|\\}\\~]","[\\.]",'[\\"]',G),"g"),ee=new RegExp(J("[^]",K,"[\\!\\$\\'\\(\\)\\*\\+\\,\\;\\:\\@]"),"g"),re=ee;function te(e){var r=p(e);return r.match(Y)?r:e}var ae={scheme:"mailto",parse:function(e,r){var t=e,a=t.to=t.path?t.path.split(","):[];if(t.path=void 0,t.query){for(var s=!1,o={},i=t.query.split("&"),n=0,l=i.length;n%\\^`{|}]|%[0-9a-f]{2})|\{[+#./;?&=,!@| // For the source: https://gist.github.com/dperini/729294 // For test cases: https://mathiasbynens.be/demo/url-regex // @todo Delete current URL in favour of the commented out URL rule when this issue is fixed https://github.com/eslint/eslint/issues/7983. -// var URL = /^(?:(?:https?|ftp):\/\/)(?:\S+(?::\S*)?@)?(?:(?!10(?:\.\d{1,3}){3})(?!127(?:\.\d{1,3}){3})(?!169\.254(?:\.\d{1,3}){2})(?!192\.168(?:\.\d{1,3}){2})(?!172\.(?:1[6-9]|2\d|3[0-1])(?:\.\d{1,3}){2})(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5])){2}(?:\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]))|(?:(?:[a-z\u{00a1}-\u{ffff}0-9]+-?)*[a-z\u{00a1}-\u{ffff}0-9]+)(?:\.(?:[a-z\u{00a1}-\u{ffff}0-9]+-?)*[a-z\u{00a1}-\u{ffff}0-9]+)*(?:\.(?:[a-z\u{00a1}-\u{ffff}]{2,})))(?::\d{2,5})?(?:\/[^\s]*)?$/iu; -var URL = /^(?:(?:http[s\u017F]?|ftp):\/\/)(?:(?:[\0-\x08\x0E-\x1F!-\x9F\xA1-\u167F\u1681-\u1FFF\u200B-\u2027\u202A-\u202E\u2030-\u205E\u2060-\u2FFF\u3001-\uD7FF\uE000-\uFEFE\uFF00-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+(?::(?:[\0-\x08\x0E-\x1F!-\x9F\xA1-\u167F\u1681-\u1FFF\u200B-\u2027\u202A-\u202E\u2030-\u205E\u2060-\u2FFF\u3001-\uD7FF\uE000-\uFEFE\uFF00-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])*)?@)?(?:(?!10(?:\.[0-9]{1,3}){3})(?!127(?:\.[0-9]{1,3}){3})(?!169\.254(?:\.[0-9]{1,3}){2})(?!192\.168(?:\.[0-9]{1,3}){2})(?!172\.(?:1[6-9]|2[0-9]|3[01])(?:\.[0-9]{1,3}){2})(?:[1-9][0-9]?|1[0-9][0-9]|2[01][0-9]|22[0-3])(?:\.(?:1?[0-9]{1,2}|2[0-4][0-9]|25[0-5])){2}(?:\.(?:[1-9][0-9]?|1[0-9][0-9]|2[0-4][0-9]|25[0-4]))|(?:(?:(?:[0-9KSa-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+-?)*(?:[0-9KSa-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+)(?:\.(?:(?:[0-9KSa-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+-?)*(?:[0-9KSa-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+)*(?:\.(?:(?:[KSa-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]){2,})))(?::[0-9]{2,5})?(?:\/(?:[\0-\x08\x0E-\x1F!-\x9F\xA1-\u167F\u1681-\u1FFF\u200B-\u2027\u202A-\u202E\u2030-\u205E\u2060-\u2FFF\u3001-\uD7FF\uE000-\uFEFE\uFF00-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])*)?$/i; +// var URL = /^(?:(?:https?|ftp):\/\/)(?:\S+(?::\S*)?@)?(?:(?!10(?:\.\d{1,3}){3})(?!127(?:\.\d{1,3}){3})(?!169\.254(?:\.\d{1,3}){2})(?!192\.168(?:\.\d{1,3}){2})(?!172\.(?:1[6-9]|2\d|3[0-1])(?:\.\d{1,3}){2})(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5])){2}(?:\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]))|(?:(?:[a-z\u{00a1}-\u{ffff}0-9]+-)*[a-z\u{00a1}-\u{ffff}0-9]+)(?:\.(?:[a-z\u{00a1}-\u{ffff}0-9]+-)*[a-z\u{00a1}-\u{ffff}0-9]+)*(?:\.(?:[a-z\u{00a1}-\u{ffff}]{2,})))(?::\d{2,5})?(?:\/[^\s]*)?$/iu; +var URL = /^(?:(?:http[s\u017F]?|ftp):\/\/)(?:(?:[\0-\x08\x0E-\x1F!-\x9F\xA1-\u167F\u1681-\u1FFF\u200B-\u2027\u202A-\u202E\u2030-\u205E\u2060-\u2FFF\u3001-\uD7FF\uE000-\uFEFE\uFF00-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+(?::(?:[\0-\x08\x0E-\x1F!-\x9F\xA1-\u167F\u1681-\u1FFF\u200B-\u2027\u202A-\u202E\u2030-\u205E\u2060-\u2FFF\u3001-\uD7FF\uE000-\uFEFE\uFF00-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])*)?@)?(?:(?!10(?:\.[0-9]{1,3}){3})(?!127(?:\.[0-9]{1,3}){3})(?!169\.254(?:\.[0-9]{1,3}){2})(?!192\.168(?:\.[0-9]{1,3}){2})(?!172\.(?:1[6-9]|2[0-9]|3[01])(?:\.[0-9]{1,3}){2})(?:[1-9][0-9]?|1[0-9][0-9]|2[01][0-9]|22[0-3])(?:\.(?:1?[0-9]{1,2}|2[0-4][0-9]|25[0-5])){2}(?:\.(?:[1-9][0-9]?|1[0-9][0-9]|2[0-4][0-9]|25[0-4]))|(?:(?:(?:[0-9a-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+-)*(?:[0-9a-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+)(?:\.(?:(?:[0-9a-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+-)*(?:[0-9a-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+)*(?:\.(?:(?:[a-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]){2,})))(?::[0-9]{2,5})?(?:\/(?:[\0-\x08\x0E-\x1F!-\x9F\xA1-\u167F\u1681-\u1FFF\u200B-\u2027\u202A-\u202E\u2030-\u205E\u2060-\u2FFF\u3001-\uD7FF\uE000-\uFEFE\uFF00-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])*)?$/i; var UUID = /^(?:urn:uuid:)?[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/i; var JSON_POINTER = /^(?:\/(?:[^~/]|~0|~1)*)*$/; var JSON_POINTER_URI_FRAGMENT = /^#(?:\/(?:[a-z0-9_\-.!$&'()*+,;:=@]|%[0-9a-f]{2}|~0|~1)*)*$/i; diff --git a/tools/node_modules/eslint/node_modules/ajv/package.json b/tools/node_modules/eslint/node_modules/ajv/package.json index bda64eac7c4623..7e3ecdac6b4659 100644 --- a/tools/node_modules/eslint/node_modules/ajv/package.json +++ b/tools/node_modules/eslint/node_modules/ajv/package.json @@ -102,5 +102,5 @@ }, "tonicExampleFilename": ".tonic_example.js", "typings": "lib/ajv.d.ts", - "version": "6.12.5" + "version": "6.12.6" } \ No newline at end of file diff --git a/tools/node_modules/eslint/node_modules/ajv/scripts/info b/tools/node_modules/eslint/node_modules/ajv/scripts/info old mode 100755 new mode 100644 diff --git a/tools/node_modules/eslint/node_modules/ajv/scripts/prepare-tests b/tools/node_modules/eslint/node_modules/ajv/scripts/prepare-tests old mode 100755 new mode 100644 diff --git a/tools/node_modules/eslint/node_modules/ajv/scripts/publish-built-version b/tools/node_modules/eslint/node_modules/ajv/scripts/publish-built-version old mode 100755 new mode 100644 diff --git a/tools/node_modules/eslint/node_modules/ajv/scripts/travis-gh-pages b/tools/node_modules/eslint/node_modules/ajv/scripts/travis-gh-pages old mode 100755 new mode 100644 diff --git a/tools/node_modules/eslint/package.json b/tools/node_modules/eslint/package.json index e6c38c8798ce4a..8e0da149b15ead 100644 --- a/tools/node_modules/eslint/package.json +++ b/tools/node_modules/eslint/package.json @@ -12,7 +12,7 @@ "bundleDependencies": false, "dependencies": { "@babel/code-frame": "^7.0.0", - "@eslint/eslintrc": "^0.1.3", + "@eslint/eslintrc": "^0.2.0", "ajv": "^6.10.0", "chalk": "^4.0.0", "cross-spawn": "^7.0.2", @@ -155,5 +155,5 @@ "test:cli": "mocha", "webpack": "node Makefile.js webpack" }, - "version": "7.11.0" + "version": "7.12.0" } \ No newline at end of file