diff --git a/tools/node_modules/eslint/README.md b/tools/node_modules/eslint/README.md
index da75b5c149d799..0a802b0c25d0ca 100644
--- a/tools/node_modules/eslint/README.md
+++ b/tools/node_modules/eslint/README.md
@@ -214,6 +214,11 @@ The people who review and implement new features.
薛定谔的猫
+
+
+
+Milos Djermanovic
+
|
@@ -233,11 +238,6 @@ Pig Fang
YeonJuan
-
-
-
-Milos Djermanovic
-
|
@@ -250,9 +250,9 @@ The following companies, organizations, and individuals support ESLint's ongoing
Gold Sponsors
-
Silver Sponsors
+
Silver Sponsors
Bronze Sponsors
-
+
## Technology Sponsors
diff --git a/tools/node_modules/eslint/bin/eslint.js b/tools/node_modules/eslint/bin/eslint.js
index a9f51f1d7d4c57..75b413148695e5 100755
--- a/tools/node_modules/eslint/bin/eslint.js
+++ b/tools/node_modules/eslint/bin/eslint.js
@@ -12,97 +12,135 @@
// to use V8's code cache to speed up instantiation time
require("v8-compile-cache");
-//------------------------------------------------------------------------------
-// Helpers
-//------------------------------------------------------------------------------
-
-const useStdIn = process.argv.includes("--stdin"),
- init = process.argv.includes("--init"),
- debug = process.argv.includes("--debug");
-
// must do this initialization *before* other requires in order to work
-if (debug) {
+if (process.argv.includes("--debug")) {
require("debug").enable("eslint:*,-eslint:code-path");
}
//------------------------------------------------------------------------------
-// Requirements
+// Helpers
//------------------------------------------------------------------------------
-// now we can safely include the other modules that use debug
-const path = require("path"),
- fs = require("fs"),
- cli = require("../lib/cli");
-
-//------------------------------------------------------------------------------
-// Execution
-//------------------------------------------------------------------------------
+/**
+ * Read data from stdin til the end.
+ *
+ * Note: See
+ * - https://github.com/nodejs/node/blob/master/doc/api/process.md#processstdin
+ * - https://github.com/nodejs/node/blob/master/doc/api/process.md#a-note-on-process-io
+ * - https://lists.gnu.org/archive/html/bug-gnu-emacs/2016-01/msg00419.html
+ * - https://github.com/nodejs/node/issues/7439 (historical)
+ *
+ * On Windows using `fs.readFileSync(STDIN_FILE_DESCRIPTOR, "utf8")` seems
+ * to read 4096 bytes before blocking and never drains to read further data.
+ *
+ * The investigation on the Emacs thread indicates:
+ *
+ * > Emacs on MS-Windows uses pipes to communicate with subprocesses; a
+ * > pipe on Windows has a 4K buffer. So as soon as Emacs writes more than
+ * > 4096 bytes to the pipe, the pipe becomes full, and Emacs then waits for
+ * > the subprocess to read its end of the pipe, at which time Emacs will
+ * > write the rest of the stuff.
+ * @returns {Promise} The read text.
+ */
+function readStdin() {
+ return new Promise((resolve, reject) => {
+ let content = "";
+ let chunk = "";
+
+ process.stdin
+ .setEncoding("utf8")
+ .on("readable", () => {
+ while ((chunk = process.stdin.read()) !== null) {
+ content += chunk;
+ }
+ })
+ .on("end", () => resolve(content))
+ .on("error", reject);
+ });
+}
-process.once("uncaughtException", err => {
+/**
+ * Get the error message of a given value.
+ * @param {any} error The value to get.
+ * @returns {string} The error message.
+ */
+function getErrorMessage(error) {
- // lazy load
+ // Lazy loading because those are used only if error happened.
+ const fs = require("fs");
+ const path = require("path");
+ const util = require("util");
const lodash = require("lodash");
- if (typeof err.messageTemplate === "string" && err.messageTemplate.length > 0) {
- const template = lodash.template(fs.readFileSync(path.resolve(__dirname, `../messages/${err.messageTemplate}.txt`), "utf-8"));
- const pkg = require("../package.json");
+ // Foolproof -- thirdparty module might throw non-object.
+ if (typeof error !== "object" || error === null) {
+ return String(error);
+ }
+
+ // Use templates if `error.messageTemplate` is present.
+ if (typeof error.messageTemplate === "string") {
+ try {
+ const templateFilePath = path.resolve(
+ __dirname,
+ `../messages/${error.messageTemplate}.txt`
+ );
+
+ // Use sync API because Node.js should exit at this tick.
+ const templateText = fs.readFileSync(templateFilePath, "utf-8");
+ const template = lodash.template(templateText);
+
+ return template(error.messageData || {});
+ } catch {
+
+ // Ignore template error then fallback to use `error.stack`.
+ }
+ }
- console.error("\nOops! Something went wrong! :(");
- console.error(`\nESLint: ${pkg.version}.\n\n${template(err.messageData || {})}`);
- } else {
- console.error(err.stack);
+ // Use the stacktrace if it's an error object.
+ if (typeof error.stack === "string") {
+ return error.stack;
}
+ // Otherwise, dump the object.
+ return util.format("%o", error);
+}
+
+/**
+ * Catch and report unexpected error.
+ * @param {any} error The thrown error object.
+ * @returns {void}
+ */
+function onFatalError(error) {
process.exitCode = 2;
-});
-
-if (useStdIn) {
-
- /*
- * Note: See
- * - https://github.com/nodejs/node/blob/master/doc/api/process.md#processstdin
- * - https://github.com/nodejs/node/blob/master/doc/api/process.md#a-note-on-process-io
- * - https://lists.gnu.org/archive/html/bug-gnu-emacs/2016-01/msg00419.html
- * - https://github.com/nodejs/node/issues/7439 (historical)
- *
- * On Windows using `fs.readFileSync(STDIN_FILE_DESCRIPTOR, "utf8")` seems
- * to read 4096 bytes before blocking and never drains to read further data.
- *
- * The investigation on the Emacs thread indicates:
- *
- * > Emacs on MS-Windows uses pipes to communicate with subprocesses; a
- * > pipe on Windows has a 4K buffer. So as soon as Emacs writes more than
- * > 4096 bytes to the pipe, the pipe becomes full, and Emacs then waits for
- * > the subprocess to read its end of the pipe, at which time Emacs will
- * > write the rest of the stuff.
- *
- * Using the nodejs code example for reading from stdin.
- */
- let contents = "",
- chunk = "";
-
- process.stdin.setEncoding("utf8");
- process.stdin.on("readable", () => {
-
- // Use a loop to make sure we read all available data.
- while ((chunk = process.stdin.read()) !== null) {
- contents += chunk;
- }
- });
- process.stdin.on("end", () => {
- process.exitCode = cli.execute(process.argv, contents, "utf8");
- });
-} else if (init) {
- const configInit = require("../lib/init/config-initializer");
-
- configInit.initializeConfig().then(() => {
- process.exitCode = 0;
- }).catch(err => {
- process.exitCode = 1;
- console.error(err.message);
- console.error(err.stack);
- });
-} else {
- process.exitCode = cli.execute(process.argv);
+ const { version } = require("../package.json");
+ const message = getErrorMessage(error);
+
+ console.error(`
+Oops! Something went wrong! :(
+
+ESLint: ${version}
+
+${message}`);
}
+
+//------------------------------------------------------------------------------
+// Execution
+//------------------------------------------------------------------------------
+
+(async function main() {
+ process.on("uncaughtException", onFatalError);
+ process.on("unhandledRejection", onFatalError);
+
+ // Call the config initializer if `--init` is present.
+ if (process.argv.includes("--init")) {
+ await require("../lib/init/config-initializer").initializeConfig();
+ return;
+ }
+
+ // Otherwise, call the CLI.
+ process.exitCode = await require("../lib/cli").execute(
+ process.argv,
+ process.argv.includes("--stdin") ? await readStdin() : null
+ );
+}()).catch(onFatalError);
diff --git a/tools/node_modules/eslint/lib/api.js b/tools/node_modules/eslint/lib/api.js
index 40a5cc9fa5ccd4..e4b6643b44780a 100644
--- a/tools/node_modules/eslint/lib/api.js
+++ b/tools/node_modules/eslint/lib/api.js
@@ -6,6 +6,7 @@
"use strict";
const { CLIEngine } = require("./cli-engine");
+const { ESLint } = require("./eslint");
const { Linter } = require("./linter");
const { RuleTester } = require("./rule-tester");
const { SourceCode } = require("./source-code");
@@ -13,6 +14,7 @@ const { SourceCode } = require("./source-code");
module.exports = {
Linter,
CLIEngine,
+ ESLint,
RuleTester,
SourceCode
};
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
index b53f67bd9dce6c..f54605c4db991e 100644
--- 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
@@ -279,6 +279,18 @@ class CascadingConfigArrayFactory {
);
}
+ /**
+ * 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}
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 72d1fa4d5dcd5d..b6aa995beef933 100644
--- a/tools/node_modules/eslint/lib/cli-engine/cli-engine.js
+++ b/tools/node_modules/eslint/lib/cli-engine/cli-engine.js
@@ -39,6 +39,7 @@ const validFixTypes = new Set(["problem", "suggestion", "layout"]);
// For VSCode IntelliSense
/** @typedef {import("../shared/types").ConfigData} ConfigData */
+/** @typedef {import("../shared/types").DeprecatedRuleInfo} DeprecatedRuleInfo */
/** @typedef {import("../shared/types").LintMessage} LintMessage */
/** @typedef {import("../shared/types").ParserOptions} ParserOptions */
/** @typedef {import("../shared/types").Plugin} Plugin */
@@ -50,29 +51,29 @@ const validFixTypes = new Set(["problem", "suggestion", "layout"]);
/**
* The options to configure a CLI engine with.
* @typedef {Object} CLIEngineOptions
- * @property {boolean} allowInlineConfig Enable or disable inline configuration comments.
- * @property {ConfigData} baseConfig Base config object, extended by all configs used with this CLIEngine instance
- * @property {boolean} cache Enable result caching.
- * @property {string} cacheLocation The cache file to use instead of .eslintcache.
- * @property {string} configFile The configuration file to use.
- * @property {string} cwd The value to use for the current working directory.
- * @property {string[]} envs An array of environments to load.
- * @property {string[]|null} extensions An array of file extensions to check.
- * @property {boolean|Function} fix Execute in autofix mode. If a function, should return a boolean.
- * @property {string[]} fixTypes Array of rule types to apply fixes for.
- * @property {string[]} globals An array of global variables to declare.
- * @property {boolean} ignore False disables use of .eslintignore.
- * @property {string} ignorePath The ignore file to use instead of .eslintignore.
- * @property {string|string[]} ignorePattern One or more glob patterns to ignore.
- * @property {boolean} useEslintrc False disables looking for .eslintrc
- * @property {string} parser The name of the parser to use.
- * @property {ParserOptions} parserOptions An object of parserOption settings to use.
- * @property {string[]} plugins An array of plugins to load.
- * @property {Record} rules An object of rules to use.
- * @property {string[]} rulePaths An array of directories to load custom rules from.
- * @property {boolean} reportUnusedDisableDirectives `true` adds reports for unused eslint-disable directives
- * @property {boolean} globInputPaths Set to false to skip glob resolution of input file paths to lint (default: true). If false, each input file paths is assumed to be a non-glob path to an existing file.
- * @property {string} resolvePluginsRelativeTo The folder where plugins should be resolved from, defaulting to the CWD
+ * @property {boolean} [allowInlineConfig] Enable or disable inline configuration comments.
+ * @property {ConfigData} [baseConfig] Base config object, extended by all configs used with this CLIEngine instance
+ * @property {boolean} [cache] Enable result caching.
+ * @property {string} [cacheLocation] The cache file to use instead of .eslintcache.
+ * @property {string} [configFile] The configuration file to use.
+ * @property {string} [cwd] The value to use for the current working directory.
+ * @property {string[]} [envs] An array of environments to load.
+ * @property {string[]|null} [extensions] An array of file extensions to check.
+ * @property {boolean|Function} [fix] Execute in autofix mode. If a function, should return a boolean.
+ * @property {string[]} [fixTypes] Array of rule types to apply fixes for.
+ * @property {string[]} [globals] An array of global variables to declare.
+ * @property {boolean} [ignore] False disables use of .eslintignore.
+ * @property {string} [ignorePath] The ignore file to use instead of .eslintignore.
+ * @property {string|string[]} [ignorePattern] One or more glob patterns to ignore.
+ * @property {boolean} [useEslintrc] False disables looking for .eslintrc
+ * @property {string} [parser] The name of the parser to use.
+ * @property {ParserOptions} [parserOptions] An object of parserOption settings to use.
+ * @property {string[]} [plugins] An array of plugins to load.
+ * @property {Record} [rules] An object of rules to use.
+ * @property {string[]} [rulePaths] An array of directories to load custom rules from.
+ * @property {boolean} [reportUnusedDisableDirectives] `true` adds reports for unused eslint-disable directives
+ * @property {boolean} [globInputPaths] Set to false to skip glob resolution of input file paths to lint (default: true). If false, each input file paths is assumed to be a non-glob path to an existing file.
+ * @property {string} [resolvePluginsRelativeTo] The folder where plugins should be resolved from, defaulting to the CWD
*/
/**
@@ -88,13 +89,6 @@ const validFixTypes = new Set(["problem", "suggestion", "layout"]);
* @property {string} [output] The source code of the file that was linted, with as many fixes applied as possible.
*/
-/**
- * Information of deprecated rules.
- * @typedef {Object} DeprecatedRuleInfo
- * @property {string} ruleId The rule ID.
- * @property {string[]} replacedBy The rule IDs that replace this deprecated rule.
- */
-
/**
* Linting results.
* @typedef {Object} LintReport
@@ -821,16 +815,22 @@ class CLIEngine {
lintResultCache.reconcile();
}
- // Collect used deprecated rules.
- const usedDeprecatedRules = Array.from(
- iterateRuleDeprecationWarnings(lastConfigArrays)
- );
-
debug(`Linting complete in: ${Date.now() - startTime}ms`);
+ let usedDeprecatedRules;
+
return {
results,
...calculateStatsPerRun(results),
- usedDeprecatedRules
+
+ // Initialize it lazily because CLI and `ESLint` API don't use it.
+ get usedDeprecatedRules() {
+ if (!usedDeprecatedRules) {
+ usedDeprecatedRules = Array.from(
+ iterateRuleDeprecationWarnings(lastConfigArrays)
+ );
+ }
+ return usedDeprecatedRules;
+ }
};
}
@@ -858,9 +858,9 @@ class CLIEngine {
const startTime = Date.now();
const resolvedFilename = filename && path.resolve(cwd, filename);
+
// Clear the last used config arrays.
lastConfigArrays.length = 0;
-
if (resolvedFilename && this.isPathIgnored(resolvedFilename)) {
if (warnIgnored) {
results.push(createIgnoreResult(resolvedFilename, cwd));
@@ -892,16 +892,22 @@ class CLIEngine {
}));
}
- // Collect used deprecated rules.
- const usedDeprecatedRules = Array.from(
- iterateRuleDeprecationWarnings(lastConfigArrays)
- );
-
debug(`Linting complete in: ${Date.now() - startTime}ms`);
+ let usedDeprecatedRules;
+
return {
results,
...calculateStatsPerRun(results),
- usedDeprecatedRules
+
+ // Initialize it lazily because CLI and `ESLint` API don't use it.
+ get usedDeprecatedRules() {
+ if (!usedDeprecatedRules) {
+ usedDeprecatedRules = Array.from(
+ iterateRuleDeprecationWarnings(lastConfigArrays)
+ );
+ }
+ return usedDeprecatedRules;
+ }
};
}
@@ -955,11 +961,10 @@ class CLIEngine {
}
/**
- * Returns the formatter representing the given format or null if no formatter
- * with the given name can be found.
+ * Returns the formatter representing the given format or null if the `format` is not a string.
* @param {string} [format] The name of the format to load or the path to a
* custom formatter.
- * @returns {Function} The formatter function or null if not found.
+ * @returns {(Function|null)} The formatter function or null if the `format` is not a string.
*/
getFormatter(format) {
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
index b1429af6ad95cf..fa3fdb3bedd89b 100644
--- a/tools/node_modules/eslint/lib/cli-engine/config-array-factory.js
+++ b/tools/node_modules/eslint/lib/cli-engine/config-array-factory.js
@@ -817,7 +817,7 @@ class ConfigArrayFactory {
if (configData) {
return this._normalizeConfigData(configData, {
...ctx,
- filePath: plugin.filePath,
+ filePath: plugin.filePath || ctx.filePath,
name: `${ctx.name} » plugin:${plugin.id}/${configName}`
});
}
@@ -978,7 +978,7 @@ class ConfigArrayFactory {
if (plugin) {
return new ConfigDependency({
definition: normalizePlugin(plugin),
- filePath: ctx.filePath,
+ filePath: "", // It's unknown where the plugin came from.
id,
importerName: ctx.name,
importerPath: ctx.filePath
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
index b3434198b19201..42a7362737fc7c 100644
--- 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
@@ -107,7 +107,7 @@ function getMatchedIndices(elements, filePath) {
for (let i = elements.length - 1; i >= 0; --i) {
const element = elements[i];
- if (!element.criteria || element.criteria.test(filePath)) {
+ if (!element.criteria || (filePath && element.criteria.test(filePath))) {
indices.push(i);
}
}
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
index 92690b9f8ae342..6eaec4258e1ae4 100644
--- 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
@@ -71,7 +71,13 @@ function getCommonAncestorPath(sourcePaths) {
}
}
- return result || path.sep;
+ 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;
}
/**
diff --git a/tools/node_modules/eslint/lib/cli.js b/tools/node_modules/eslint/lib/cli.js
index 815ce68c22fe2e..ce11878008f108 100644
--- a/tools/node_modules/eslint/lib/cli.js
+++ b/tools/node_modules/eslint/lib/cli.js
@@ -17,105 +17,176 @@
const fs = require("fs"),
path = require("path"),
- { CLIEngine } = require("./cli-engine"),
- options = require("./options"),
+ { promisify } = require("util"),
+ { ESLint } = require("./eslint"),
+ CLIOptions = require("./options"),
log = require("./shared/logging"),
RuntimeInfo = require("./shared/runtime-info");
const debug = require("debug")("eslint:cli");
+//------------------------------------------------------------------------------
+// Types
+//------------------------------------------------------------------------------
+
+/** @typedef {import("./eslint/eslint").ESLintOptions} ESLintOptions */
+/** @typedef {import("./eslint/eslint").LintMessage} LintMessage */
+/** @typedef {import("./eslint/eslint").LintResult} LintResult */
+
//------------------------------------------------------------------------------
// Helpers
//------------------------------------------------------------------------------
+const mkdir = promisify(fs.mkdir);
+const stat = promisify(fs.stat);
+const writeFile = promisify(fs.writeFile);
+
/**
* Predicate function for whether or not to apply fixes in quiet mode.
* If a message is a warning, do not apply a fix.
- * @param {LintResult} lintResult The lint result.
+ * @param {LintMessage} message The lint result.
* @returns {boolean} True if the lint message is an error (and thus should be
* autofixed), false otherwise.
*/
-function quietFixPredicate(lintResult) {
- return lintResult.severity === 2;
+function quietFixPredicate(message) {
+ return message.severity === 2;
}
/**
* Translates the CLI options into the options expected by the CLIEngine.
* @param {Object} cliOptions The CLI options to translate.
- * @returns {CLIEngineOptions} The options object for the CLIEngine.
+ * @returns {ESLintOptions} The options object for the CLIEngine.
* @private
*/
-function translateOptions(cliOptions) {
+function translateOptions({
+ cache,
+ cacheFile,
+ cacheLocation,
+ config,
+ env,
+ errorOnUnmatchedPattern,
+ eslintrc,
+ ext,
+ fix,
+ fixDryRun,
+ fixType,
+ global,
+ ignore,
+ ignorePath,
+ ignorePattern,
+ inlineConfig,
+ parser,
+ parserOptions,
+ plugin,
+ quiet,
+ reportUnusedDisableDirectives,
+ resolvePluginsRelativeTo,
+ rule,
+ rulesdir
+}) {
return {
- envs: cliOptions.env,
- extensions: cliOptions.ext,
- rules: cliOptions.rule,
- plugins: cliOptions.plugin,
- globals: cliOptions.global,
- ignore: cliOptions.ignore,
- ignorePath: cliOptions.ignorePath,
- ignorePattern: cliOptions.ignorePattern,
- configFile: cliOptions.config,
- rulePaths: cliOptions.rulesdir,
- useEslintrc: cliOptions.eslintrc,
- parser: cliOptions.parser,
- parserOptions: cliOptions.parserOptions,
- cache: cliOptions.cache,
- cacheFile: cliOptions.cacheFile,
- cacheLocation: cliOptions.cacheLocation,
- fix: (cliOptions.fix || cliOptions.fixDryRun) && (cliOptions.quiet ? quietFixPredicate : true),
- fixTypes: cliOptions.fixType,
- allowInlineConfig: cliOptions.inlineConfig,
- reportUnusedDisableDirectives: cliOptions.reportUnusedDisableDirectives,
- resolvePluginsRelativeTo: cliOptions.resolvePluginsRelativeTo,
- errorOnUnmatchedPattern: cliOptions.errorOnUnmatchedPattern
+ allowInlineConfig: inlineConfig,
+ cache,
+ cacheLocation: cacheLocation || cacheFile,
+ errorOnUnmatchedPattern,
+ extensions: ext,
+ fix: (fix || fixDryRun) && (quiet ? quietFixPredicate : true),
+ fixTypes: fixType,
+ ignore,
+ ignorePath,
+ overrideConfig: {
+ env: env && env.reduce((obj, name) => {
+ obj[name] = true;
+ return obj;
+ }, {}),
+ globals: global && global.reduce((obj, name) => {
+ if (name.endsWith(":true")) {
+ obj[name.slice(0, -5)] = "writable";
+ } else {
+ obj[name] = "readonly";
+ }
+ return obj;
+ }, {}),
+ ignorePatterns: ignorePattern,
+ parser,
+ parserOptions,
+ plugins: plugin,
+ rules: rule
+ },
+ overrideConfigFile: config,
+ reportUnusedDisableDirectives: reportUnusedDisableDirectives ? "error" : void 0,
+ resolvePluginsRelativeTo,
+ rulePaths: rulesdir,
+ useEslintrc: eslintrc
};
}
+/**
+ * Count error messages.
+ * @param {LintResult[]} results The lint results.
+ * @returns {{errorCount:number;warningCount:number}} The number of error messages.
+ */
+function countErrors(results) {
+ let errorCount = 0;
+ let warningCount = 0;
+
+ for (const result of results) {
+ errorCount += result.errorCount;
+ warningCount += result.warningCount;
+ }
+
+ return { errorCount, warningCount };
+}
+
+/**
+ * Check if a given file path is a directory or not.
+ * @param {string} filePath The path to a file to check.
+ * @returns {Promise} `true` if the given path is a directory.
+ */
+async function isDirectory(filePath) {
+ try {
+ return (await stat(filePath)).isDirectory();
+ } catch (error) {
+ if (error.code === "ENOENT" || error.code === "ENOTDIR") {
+ return false;
+ }
+ throw error;
+ }
+}
+
/**
* Outputs the results of the linting.
- * @param {CLIEngine} engine The CLIEngine to use.
+ * @param {ESLint} engine The ESLint instance to use.
* @param {LintResult[]} results The results to print.
* @param {string} format The name of the formatter to use or the path to the formatter.
* @param {string} outputFile The path for the output file.
- * @returns {boolean} True if the printing succeeds, false if not.
+ * @returns {Promise} True if the printing succeeds, false if not.
* @private
*/
-function printResults(engine, results, format, outputFile) {
+async function printResults(engine, results, format, outputFile) {
let formatter;
- let rulesMeta;
try {
- formatter = engine.getFormatter(format);
+ formatter = await engine.loadFormatter(format);
} catch (e) {
log.error(e.message);
return false;
}
- const output = formatter(results, {
- get rulesMeta() {
- if (!rulesMeta) {
- rulesMeta = {};
- for (const [ruleId, rule] of engine.getRules()) {
- rulesMeta[ruleId] = rule.meta;
- }
- }
- return rulesMeta;
- }
- });
+ const output = formatter.format(results);
if (output) {
if (outputFile) {
const filePath = path.resolve(process.cwd(), outputFile);
- if (fs.existsSync(filePath) && fs.statSync(filePath).isDirectory()) {
+ if (await isDirectory(filePath)) {
log.error("Cannot write to output file path, it is a directory: %s", outputFile);
return false;
}
try {
- fs.mkdirSync(path.dirname(filePath), { recursive: true });
- fs.writeFileSync(filePath, output);
+ await mkdir(path.dirname(filePath), { recursive: true });
+ await writeFile(filePath, output);
} catch (ex) {
log.error("There was a problem writing the output file:\n%s", ex);
return false;
@@ -126,7 +197,6 @@ function printResults(engine, results, format, outputFile) {
}
return true;
-
}
//------------------------------------------------------------------------------
@@ -143,28 +213,33 @@ const cli = {
* Executes the CLI based on an array of arguments that is passed in.
* @param {string|Array|Object} args The arguments to process.
* @param {string} [text] The text to lint (used for TTY).
- * @returns {int} The exit code for the operation.
+ * @returns {Promise} The exit code for the operation.
*/
- execute(args, text) {
+ async execute(args, text) {
if (Array.isArray(args)) {
debug("CLI args: %o", args.slice(2));
}
-
- let currentOptions;
+ let options;
try {
- currentOptions = options.parse(args);
+ options = CLIOptions.parse(args);
} catch (error) {
log.error(error.message);
return 2;
}
- const files = currentOptions._;
+ const files = options._;
const useStdin = typeof text === "string";
- if (currentOptions.version) {
+ if (options.help) {
+ log.info(CLIOptions.generateHelp());
+ return 0;
+ }
+ if (options.version) {
log.info(RuntimeInfo.version());
- } else if (currentOptions.envInfo) {
+ return 0;
+ }
+ if (options.envInfo) {
try {
log.info(RuntimeInfo.environment());
return 0;
@@ -172,7 +247,9 @@ const cli = {
log.error(err.message);
return 2;
}
- } else if (currentOptions.printConfig) {
+ }
+
+ if (options.printConfig) {
if (files.length) {
log.error("The --print-config option must be used with exactly one file name.");
return 2;
@@ -182,58 +259,67 @@ const cli = {
return 2;
}
- const engine = new CLIEngine(translateOptions(currentOptions));
- const fileConfig = engine.getConfigForFile(currentOptions.printConfig);
+ const engine = new ESLint(translateOptions(options));
+ const fileConfig =
+ await engine.calculateConfigForFile(options.printConfig);
log.info(JSON.stringify(fileConfig, null, " "));
return 0;
- } else if (currentOptions.help || (!files.length && !useStdin)) {
- log.info(options.generateHelp());
- } else {
- debug(`Running on ${useStdin ? "text" : "files"}`);
-
- if (currentOptions.fix && currentOptions.fixDryRun) {
- log.error("The --fix option and the --fix-dry-run option cannot be used together.");
- return 2;
- }
+ }
- if (useStdin && currentOptions.fix) {
- log.error("The --fix option is not available for piped-in code; use --fix-dry-run instead.");
- return 2;
- }
+ debug(`Running on ${useStdin ? "text" : "files"}`);
- if (currentOptions.fixType && !currentOptions.fix && !currentOptions.fixDryRun) {
- log.error("The --fix-type option requires either --fix or --fix-dry-run.");
- return 2;
- }
+ if (options.fix && options.fixDryRun) {
+ log.error("The --fix option and the --fix-dry-run option cannot be used together.");
+ return 2;
+ }
+ if (useStdin && options.fix) {
+ log.error("The --fix option is not available for piped-in code; use --fix-dry-run instead.");
+ return 2;
+ }
+ if (options.fixType && !options.fix && !options.fixDryRun) {
+ log.error("The --fix-type option requires either --fix or --fix-dry-run.");
+ return 2;
+ }
- const engine = new CLIEngine(translateOptions(currentOptions));
- const report = useStdin ? engine.executeOnText(text, currentOptions.stdinFilename, true) : engine.executeOnFiles(files);
+ const engine = new ESLint(translateOptions(options));
+ let results;
- if (currentOptions.fix) {
- debug("Fix mode enabled - applying fixes");
- CLIEngine.outputFixes(report);
- }
+ if (useStdin) {
+ results = await engine.lintText(text, {
+ filePath: options.stdinFilename,
+ warnIgnored: true
+ });
+ } else {
+ results = await engine.lintFiles(files);
+ }
- if (currentOptions.quiet) {
- debug("Quiet mode enabled - filtering out warnings");
- report.results = CLIEngine.getErrorResults(report.results);
- }
+ if (options.fix) {
+ debug("Fix mode enabled - applying fixes");
+ await ESLint.outputFixes(results);
+ }
- if (printResults(engine, report.results, currentOptions.format, currentOptions.outputFile)) {
- const tooManyWarnings = currentOptions.maxWarnings >= 0 && report.warningCount > currentOptions.maxWarnings;
+ if (options.quiet) {
+ debug("Quiet mode enabled - filtering out warnings");
+ results = ESLint.getErrorResults(results);
+ }
- if (!report.errorCount && tooManyWarnings) {
- log.error("ESLint found too many warnings (maximum: %s).", currentOptions.maxWarnings);
- }
+ if (await printResults(engine, results, options.format, options.outputFile)) {
+ const { errorCount, warningCount } = countErrors(results);
+ const tooManyWarnings =
+ options.maxWarnings >= 0 && warningCount > options.maxWarnings;
- return (report.errorCount || tooManyWarnings) ? 1 : 0;
+ if (!errorCount && tooManyWarnings) {
+ log.error(
+ "ESLint found too many warnings (maximum: %s).",
+ options.maxWarnings
+ );
}
- return 2;
+ return (errorCount || tooManyWarnings) ? 1 : 0;
}
- return 0;
+ return 2;
}
};
diff --git a/tools/node_modules/eslint/lib/eslint/eslint.js b/tools/node_modules/eslint/lib/eslint/eslint.js
new file mode 100644
index 00000000000000..d195aab09f1918
--- /dev/null
+++ b/tools/node_modules/eslint/lib/eslint/eslint.js
@@ -0,0 +1,656 @@
+/**
+ * @fileoverview Main API Class
+ * @author Kai Cataldo
+ * @author Toru Nagashima
+ */
+
+"use strict";
+
+//------------------------------------------------------------------------------
+// Requirements
+//------------------------------------------------------------------------------
+
+const path = require("path");
+const fs = require("fs");
+const { promisify } = require("util");
+const { CLIEngine, getCLIEngineInternalSlots } = require("../cli-engine/cli-engine");
+const BuiltinRules = require("../rules");
+const { getRuleSeverity } = require("../shared/config-ops");
+const { version } = require("../../package.json");
+
+//------------------------------------------------------------------------------
+// Typedefs
+//------------------------------------------------------------------------------
+
+/** @typedef {import("../cli-engine/cli-engine").LintReport} CLIEngineLintReport */
+/** @typedef {import("../shared/types").DeprecatedRuleInfo} DeprecatedRuleInfo */
+/** @typedef {import("../shared/types").ConfigData} ConfigData */
+/** @typedef {import("../shared/types").LintMessage} LintMessage */
+/** @typedef {import("../shared/types").Plugin} Plugin */
+/** @typedef {import("../shared/types").Rule} Rule */
+/** @typedef {import("./load-formatter").Formatter} Formatter */
+
+/**
+ * The options with which to configure the ESLint instance.
+ * @typedef {Object} ESLintOptions
+ * @property {boolean} [allowInlineConfig] Enable or disable inline configuration comments.
+ * @property {ConfigData} [baseConfig] Base config object, extended by all configs used with this instance
+ * @property {boolean} [cache] Enable result caching.
+ * @property {string} [cacheLocation] The cache file to use instead of .eslintcache.
+ * @property {string} [cwd] The value to use for the current working directory.
+ * @property {boolean} [errorOnUnmatchedPattern] If `false` then `ESLint#lintFiles()` doesn't throw even if no target files found. Defaults to `true`.
+ * @property {string[]} [extensions] An array of file extensions to check.
+ * @property {boolean|Function} [fix] Execute in autofix mode. If a function, should return a boolean.
+ * @property {string[]} [fixTypes] Array of rule types to apply fixes for.
+ * @property {boolean} [globInputPaths] Set to false to skip glob resolution of input file paths to lint (default: true). If false, each input file paths is assumed to be a non-glob path to an existing file.
+ * @property {boolean} [ignore] False disables use of .eslintignore.
+ * @property {string} [ignorePath] The ignore file to use instead of .eslintignore.
+ * @property {ConfigData} [overrideConfig] Override config object, overrides all configs used with this instance
+ * @property {string} [overrideConfigFile] The configuration file to use.
+ * @property {Record} [plugins] An array of plugin implementations.
+ * @property {"error" | "warn" | "off"} [reportUnusedDisableDirectives] the severity to report unused eslint-disable directives.
+ * @property {string} [resolvePluginsRelativeTo] The folder where plugins should be resolved from, defaulting to the CWD.
+ * @property {string[]} [rulePaths] An array of directories to load custom rules from.
+ * @property {boolean} [useEslintrc] False disables looking for .eslintrc.* files.
+ */
+
+/**
+ * A rules metadata object.
+ * @typedef {Object} RulesMeta
+ * @property {string} id The plugin ID.
+ * @property {Object} definition The plugin definition.
+ */
+
+/**
+ * A linting result.
+ * @typedef {Object} LintResult
+ * @property {string} filePath The path to the file that was linted.
+ * @property {LintMessage[]} messages All of the messages for the result.
+ * @property {number} errorCount Number of errors for the result.
+ * @property {number} warningCount Number of warnings for the result.
+ * @property {number} fixableErrorCount Number of fixable errors for the result.
+ * @property {number} fixableWarningCount Number of fixable warnings for the result.
+ * @property {string} [source] The source code of the file that was linted.
+ * @property {string} [output] The source code of the file that was linted, with as many fixes applied as possible.
+ * @property {DeprecatedRuleInfo[]} usedDeprecatedRules The list of used deprecated rules.
+ */
+
+/**
+ * Private members for the `ESLint` instance.
+ * @typedef {Object} ESLintPrivateMembers
+ * @property {CLIEngine} cliEngine The wrapped CLIEngine instance.
+ * @property {ESLintOptions} options The options used to instantiate the ESLint instance.
+ */
+
+//------------------------------------------------------------------------------
+// Helpers
+//------------------------------------------------------------------------------
+
+const writeFile = promisify(fs.writeFile);
+
+/**
+ * The map with which to store private class members.
+ * @type {WeakMap}
+ */
+const privateMembersMap = new WeakMap();
+
+/**
+ * Check if a given value is a non-empty string or not.
+ * @param {any} x The value to check.
+ * @returns {boolean} `true` if `x` is a non-empty string.
+ */
+function isNonEmptyString(x) {
+ return typeof x === "string" && x.trim() !== "";
+}
+
+/**
+ * Check if a given value is an array of non-empty stringss or not.
+ * @param {any} x The value to check.
+ * @returns {boolean} `true` if `x` is an array of non-empty stringss.
+ */
+function isArrayOfNonEmptyString(x) {
+ return Array.isArray(x) && x.every(isNonEmptyString);
+}
+
+/**
+ * Check if a given value is a valid fix type or not.
+ * @param {any} x The value to check.
+ * @returns {boolean} `true` if `x` is valid fix type.
+ */
+function isFixType(x) {
+ return x === "problem" || x === "suggestion" || x === "layout";
+}
+
+/**
+ * Check if a given value is an array of fix types or not.
+ * @param {any} x The value to check.
+ * @returns {boolean} `true` if `x` is an array of fix types.
+ */
+function isFixTypeArray(x) {
+ return Array.isArray(x) && x.every(isFixType);
+}
+
+/**
+ * The error for invalid options.
+ */
+class ESLintInvalidOptionsError extends Error {
+ constructor(messages) {
+ super(`Invalid Options:\n- ${messages.join("\n- ")}`);
+ this.code = "ESLINT_INVALID_OPTIONS";
+ Error.captureStackTrace(this, ESLintInvalidOptionsError);
+ }
+}
+
+/**
+ * Validates and normalizes options for the wrapped CLIEngine instance.
+ * @param {ESLintOptions} options The options to process.
+ * @returns {ESLintOptions} The normalized options.
+ */
+function processOptions({
+ allowInlineConfig = true, // ← we cannot use `overrideConfig.noInlineConfig` instead because `allowInlineConfig` has side-effect that suppress warnings that show inline configs are ignored.
+ baseConfig = null,
+ cache = false,
+ cacheLocation = ".eslintcache",
+ cwd = process.cwd(),
+ errorOnUnmatchedPattern = true,
+ extensions = null, // ← should be null by default because if it's an array then it suppresses RFC20 feature.
+ fix = false,
+ fixTypes = null, // ← should be null by default because if it's an array then it suppresses rules that don't have the `meta.type` property.
+ globInputPaths = true,
+ ignore = true,
+ ignorePath = null, // ← should be null by default because if it's a string then it may throw ENOENT.
+ overrideConfig = null,
+ overrideConfigFile = null,
+ plugins = {},
+ reportUnusedDisableDirectives = null, // ← should be null by default because if it's a string then it overrides the 'reportUnusedDisableDirectives' setting in config files. And we cannot use `overrideConfig.reportUnusedDisableDirectives` instead because we cannot configure the `error` severity with that.
+ resolvePluginsRelativeTo = null, // ← should be null by default because if it's a string then it suppresses RFC47 feature.
+ rulePaths = [],
+ useEslintrc = true,
+ ...unknownOptions
+}) {
+ const errors = [];
+ const unknownOptionKeys = Object.keys(unknownOptions);
+
+ if (unknownOptionKeys.length >= 1) {
+ errors.push(`Unknown options: ${unknownOptionKeys.join(", ")}`);
+ if (unknownOptionKeys.includes("cacheFile")) {
+ errors.push("'cacheFile' has been removed. Please use the 'cacheLocation' option instead.");
+ }
+ if (unknownOptionKeys.includes("configFile")) {
+ errors.push("'configFile' has been removed. Please use the 'overrideConfigFile' option instead.");
+ }
+ if (unknownOptionKeys.includes("envs")) {
+ errors.push("'envs' has been removed. Please use the 'overrideConfig.env' option instead.");
+ }
+ if (unknownOptionKeys.includes("globals")) {
+ errors.push("'globals' has been removed. Please use the 'overrideConfig.globals' option instead.");
+ }
+ if (unknownOptionKeys.includes("ignorePattern")) {
+ errors.push("'ignorePattern' has been removed. Please use the 'overrideConfig.ignorePatterns' option instead.");
+ }
+ if (unknownOptionKeys.includes("parser")) {
+ errors.push("'parser' has been removed. Please use the 'overrideConfig.parser' option instead.");
+ }
+ if (unknownOptionKeys.includes("parserOptions")) {
+ errors.push("'parserOptions' has been removed. Please use the 'overrideConfig.parserOptions' option instead.");
+ }
+ if (unknownOptionKeys.includes("rules")) {
+ errors.push("'rules' has been removed. Please use the 'overrideConfig.rules' option instead.");
+ }
+ }
+ if (typeof allowInlineConfig !== "boolean") {
+ errors.push("'allowInlineConfig' must be a boolean.");
+ }
+ if (typeof baseConfig !== "object") {
+ errors.push("'baseConfig' must be an object or null.");
+ }
+ if (typeof cache !== "boolean") {
+ errors.push("'cache' must be a boolean.");
+ }
+ if (!isNonEmptyString(cacheLocation)) {
+ errors.push("'cacheLocation' must be a non-empty string.");
+ }
+ if (!isNonEmptyString(cwd) || !path.isAbsolute(cwd)) {
+ errors.push("'cwd' must be an absolute path.");
+ }
+ if (typeof errorOnUnmatchedPattern !== "boolean") {
+ errors.push("'errorOnUnmatchedPattern' must be a boolean.");
+ }
+ if (!isArrayOfNonEmptyString(extensions) && extensions !== null) {
+ errors.push("'extensions' must be an array of non-empty strings or null.");
+ }
+ if (typeof fix !== "boolean" && typeof fix !== "function") {
+ errors.push("'fix' must be a boolean or a function.");
+ }
+ if (fixTypes !== null && !isFixTypeArray(fixTypes)) {
+ errors.push("'fixTypes' must be an array of any of \"problem\", \"suggestion\", and \"layout\".");
+ }
+ if (typeof globInputPaths !== "boolean") {
+ errors.push("'globInputPaths' must be a boolean.");
+ }
+ if (typeof ignore !== "boolean") {
+ errors.push("'ignore' must be a boolean.");
+ }
+ if (!isNonEmptyString(ignorePath) && ignorePath !== null) {
+ errors.push("'ignorePath' must be a non-empty string or null.");
+ }
+ if (typeof overrideConfig !== "object") {
+ errors.push("'overrideConfig' must be an object or null.");
+ }
+ if (!isNonEmptyString(overrideConfigFile) && overrideConfigFile !== null) {
+ errors.push("'overrideConfigFile' must be a non-empty string or null.");
+ }
+ if (typeof plugins !== "object") {
+ errors.push("'plugins' must be an object or null.");
+ } else if (plugins !== null && Object.keys(plugins).includes("")) {
+ errors.push("'plugins' must not include an empty string.");
+ }
+ if (Array.isArray(plugins)) {
+ errors.push("'plugins' doesn't add plugins to configuration to load. Please use the 'overrideConfig.plugins' option instead.");
+ }
+ if (
+ reportUnusedDisableDirectives !== "error" &&
+ reportUnusedDisableDirectives !== "warn" &&
+ reportUnusedDisableDirectives !== "off" &&
+ reportUnusedDisableDirectives !== null
+ ) {
+ errors.push("'reportUnusedDisableDirectives' must be any of \"error\", \"warn\", \"off\", and null.");
+ }
+ if (
+ !isNonEmptyString(resolvePluginsRelativeTo) &&
+ resolvePluginsRelativeTo !== null
+ ) {
+ errors.push("'resolvePluginsRelativeTo' must be a non-empty string or null.");
+ }
+ if (!isArrayOfNonEmptyString(rulePaths)) {
+ errors.push("'rulePaths' must be an array of non-empty strings.");
+ }
+ if (typeof useEslintrc !== "boolean") {
+ errors.push("'useElintrc' must be a boolean.");
+ }
+
+ if (errors.length > 0) {
+ throw new ESLintInvalidOptionsError(errors);
+ }
+
+ return {
+ allowInlineConfig,
+ baseConfig,
+ cache,
+ cacheLocation,
+ configFile: overrideConfigFile,
+ cwd,
+ errorOnUnmatchedPattern,
+ extensions,
+ fix,
+ fixTypes,
+ globInputPaths,
+ ignore,
+ ignorePath,
+ reportUnusedDisableDirectives,
+ resolvePluginsRelativeTo,
+ rulePaths,
+ useEslintrc
+ };
+}
+
+/**
+ * Check if a value has one or more properties and that value is not undefined.
+ * @param {any} obj The value to check.
+ * @returns {boolean} `true` if `obj` has one or more properties that that value is not undefined.
+ */
+function hasDefinedProperty(obj) {
+ if (typeof obj === "object" && obj !== null) {
+ for (const key in obj) {
+ if (typeof obj[key] !== "undefined") {
+ return true;
+ }
+ }
+ }
+ return false;
+}
+
+/**
+ * Create rulesMeta object.
+ * @param {Map} rules a map of rules from which to generate the object.
+ * @returns {Object} metadata for all enabled rules.
+ */
+function createRulesMeta(rules) {
+ return Array.from(rules).reduce((retVal, [id, rule]) => {
+ retVal[id] = rule.meta;
+ return retVal;
+ }, {});
+}
+
+/** @type {WeakMap} */
+const usedDeprecatedRulesCache = new WeakMap();
+
+/**
+ * Create used deprecated rule list.
+ * @param {CLIEngine} cliEngine The CLIEngine instance.
+ * @param {string} maybeFilePath The absolute path to a lint target file or `""`.
+ * @returns {DeprecatedRuleInfo[]} The used deprecated rule list.
+ */
+function getOrFindUsedDeprecatedRules(cliEngine, maybeFilePath) {
+ const {
+ configArrayFactory,
+ options: { cwd }
+ } = getCLIEngineInternalSlots(cliEngine);
+ const filePath = path.isAbsolute(maybeFilePath)
+ ? maybeFilePath
+ : path.join(cwd, "__placeholder__.js");
+ const configArray = configArrayFactory.getConfigArrayForFile(filePath);
+ const config = configArray.extractConfig(filePath);
+
+ // Most files use the same config, so cache it.
+ if (!usedDeprecatedRulesCache.has(config)) {
+ const pluginRules = configArray.pluginRules;
+ const retv = [];
+
+ for (const [ruleId, ruleConf] of Object.entries(config.rules)) {
+ if (getRuleSeverity(ruleConf) === 0) {
+ continue;
+ }
+ const rule = pluginRules.get(ruleId) || BuiltinRules.get(ruleId);
+ const meta = rule && rule.meta;
+
+ if (meta && meta.deprecated) {
+ retv.push({ ruleId, replacedBy: meta.replacedBy || [] });
+ }
+ }
+
+ usedDeprecatedRulesCache.set(config, Object.freeze(retv));
+ }
+
+ return usedDeprecatedRulesCache.get(config);
+}
+
+/**
+ * Processes the linting results generated by a CLIEngine linting report to
+ * match the ESLint class's API.
+ * @param {CLIEngine} cliEngine The CLIEngine instance.
+ * @param {CLIEngineLintReport} report The CLIEngine linting report to process.
+ * @returns {LintResult[]} The processed linting results.
+ */
+function processCLIEngineLintReport(cliEngine, { results }) {
+ const descriptor = {
+ configurable: true,
+ enumerable: true,
+ get() {
+ return getOrFindUsedDeprecatedRules(cliEngine, this.filePath);
+ }
+ };
+
+ for (const result of results) {
+ Object.defineProperty(result, "usedDeprecatedRules", descriptor);
+ }
+
+ return results;
+}
+
+/**
+ * An Array.prototype.sort() compatible compare function to order results by their file path.
+ * @param {LintResult} a The first lint result.
+ * @param {LintResult} b The second lint result.
+ * @returns {number} An integer representing the order in which the two results should occur.
+ */
+function compareResultsByFilePath(a, b) {
+ if (a.filePath < b.filePath) {
+ return -1;
+ }
+
+ if (a.filePath > b.filePath) {
+ return 1;
+ }
+
+ return 0;
+}
+
+class ESLint {
+
+ /**
+ * Creates a new instance of the main ESLint API.
+ * @param {ESLintOptions} options The options for this instance.
+ */
+ constructor(options = {}) {
+ const processedOptions = processOptions(options);
+ const cliEngine = new CLIEngine(processedOptions);
+ const {
+ additionalPluginPool,
+ configArrayFactory,
+ lastConfigArrays
+ } = getCLIEngineInternalSlots(cliEngine);
+ let updated = false;
+
+ /*
+ * Address `plugins` to add plugin implementations.
+ * Operate the `additionalPluginPool` internal slot directly to avoid
+ * using `addPlugin(id, plugin)` method that resets cache everytime.
+ */
+ if (options.plugins) {
+ for (const [id, plugin] of Object.entries(options.plugins)) {
+ additionalPluginPool.set(id, plugin);
+ updated = true;
+ }
+ }
+
+ /*
+ * Address `overrideConfig` to set override config.
+ * Operate the `configArrayFactory` internal slot directly because this
+ * functionality doesn't exist as the public API of CLIEngine.
+ */
+ if (hasDefinedProperty(options.overrideConfig)) {
+ configArrayFactory.setOverrideConfig(options.overrideConfig);
+ updated = true;
+ }
+
+ // Update caches.
+ if (updated) {
+ configArrayFactory.clearCache();
+ lastConfigArrays[0] = configArrayFactory.getConfigArrayForFile();
+ }
+
+ // Initialize private properties.
+ privateMembersMap.set(this, {
+ cliEngine,
+ options: processedOptions
+ });
+ }
+
+ /**
+ * The version text.
+ * @type {string}
+ */
+ static get version() {
+ return version;
+ }
+
+ /**
+ * Outputs fixes from the given results to files.
+ * @param {LintResult[]} results The lint results.
+ * @returns {Promise} Returns a promise that is used to track side effects.
+ */
+ static async outputFixes(results) {
+ if (!Array.isArray(results)) {
+ throw new Error("'results' must be an array");
+ }
+
+ await Promise.all(
+ results
+ .filter(result => {
+ if (typeof result !== "object" || result === null) {
+ throw new Error("'results' must include only objects");
+ }
+ return (
+ typeof result.output === "string" &&
+ path.isAbsolute(result.filePath)
+ );
+ })
+ .map(r => writeFile(r.filePath, r.output))
+ );
+ }
+
+ /**
+ * Returns results that only contains errors.
+ * @param {LintResult[]} results The results to filter.
+ * @returns {LintResult[]} The filtered results.
+ */
+ static getErrorResults(results) {
+ return CLIEngine.getErrorResults(results);
+ }
+
+ /**
+ * Executes the current configuration on an array of file and directory names.
+ * @param {string[]} patterns An array of file and directory names.
+ * @returns {Promise} The results of linting the file patterns given.
+ */
+ async lintFiles(patterns) {
+ if (!isNonEmptyString(patterns) && !isArrayOfNonEmptyString(patterns)) {
+ throw new Error("'patterns' must be a non-empty string or an array of non-empty strings");
+ }
+ const { cliEngine } = privateMembersMap.get(this);
+
+ return processCLIEngineLintReport(
+ cliEngine,
+ cliEngine.executeOnFiles(patterns)
+ );
+ }
+
+ /**
+ * Executes the current configuration on text.
+ * @param {string} code A string of JavaScript code to lint.
+ * @param {Object} [options] The options.
+ * @param {string} [options.filePath] The path to the file of the source code.
+ * @param {boolean} [options.warnIgnored] When set to true, warn if given filePath is an ignored path.
+ * @returns {Promise} The results of linting the string of code given.
+ */
+ async lintText(code, options = {}) {
+ if (typeof code !== "string") {
+ throw new Error("'code' must be a string");
+ }
+ if (typeof options !== "object") {
+ throw new Error("'options' must be an object, null, or undefined");
+ }
+ const {
+ filePath,
+ warnIgnored = false,
+ ...unknownOptions
+ } = options || {};
+
+ for (const key of Object.keys(unknownOptions)) {
+ throw new Error(`'options' must not include the unknown option '${key}'`);
+ }
+ if (filePath !== void 0 && !isNonEmptyString(filePath)) {
+ throw new Error("'options.filePath' must be a non-empty string or undefined");
+ }
+ if (typeof warnIgnored !== "boolean") {
+ throw new Error("'options.warnIgnored' must be a boolean or undefined");
+ }
+
+ const { cliEngine } = privateMembersMap.get(this);
+
+ return processCLIEngineLintReport(
+ cliEngine,
+ cliEngine.executeOnText(code, filePath, warnIgnored)
+ );
+ }
+
+ /**
+ * Returns the formatter representing the given formatter name.
+ * @param {string} [name] The name of the formattter to load.
+ * The following values are allowed:
+ * - `undefined` ... Load `stylish` builtin formatter.
+ * - A builtin formatter name ... Load the builtin formatter.
+ * - A thirdparty formatter name:
+ * - `foo` → `eslint-formatter-foo`
+ * - `@foo` → `@foo/eslint-formatter`
+ * - `@foo/bar` → `@foo/eslint-formatter-bar`
+ * - A file path ... Load the file.
+ * @returns {Promise} A promise resolving to the formatter object.
+ * This promise will be rejected if the given formatter was not found or not
+ * a function.
+ */
+ async loadFormatter(name = "stylish") {
+ if (typeof name !== "string") {
+ throw new Error("'name' must be a string");
+ }
+
+ const { cliEngine } = privateMembersMap.get(this);
+ const formatter = cliEngine.getFormatter(name);
+
+ if (typeof formatter !== "function") {
+ throw new Error(`Formatter must be a function, but got a ${typeof formatter}.`);
+ }
+
+ return {
+
+ /**
+ * The main formatter method.
+ * @param {LintResults[]} results The lint results to format.
+ * @returns {string} The formatted lint results.
+ */
+ format(results) {
+ let rulesMeta = null;
+
+ results.sort(compareResultsByFilePath);
+
+ return formatter(results, {
+ get rulesMeta() {
+ if (!rulesMeta) {
+ rulesMeta = createRulesMeta(cliEngine.getRules());
+ }
+
+ return rulesMeta;
+ }
+ });
+ }
+ };
+ }
+
+ /**
+ * Returns a configuration object for the given file based on the CLI options.
+ * This is the same logic used by the ESLint CLI executable to determine
+ * configuration for each file it processes.
+ * @param {string} filePath The path of the file to retrieve a config object for.
+ * @returns {Promise} A configuration object for the file.
+ */
+ async calculateConfigForFile(filePath) {
+ if (!isNonEmptyString(filePath)) {
+ throw new Error("'filePath' must be a non-empty string");
+ }
+ const { cliEngine } = privateMembersMap.get(this);
+
+ return cliEngine.getConfigForFile(filePath);
+ }
+
+ /**
+ * Checks if a given path is ignored by ESLint.
+ * @param {string} filePath The path of the file to check.
+ * @returns {Promise} Whether or not the given path is ignored.
+ */
+ async isPathIgnored(filePath) {
+ if (!isNonEmptyString(filePath)) {
+ throw new Error("'filePath' must be a non-empty string");
+ }
+ const { cliEngine } = privateMembersMap.get(this);
+
+ return cliEngine.isPathIgnored(filePath);
+ }
+}
+
+//------------------------------------------------------------------------------
+// Public Interface
+//------------------------------------------------------------------------------
+
+module.exports = {
+ ESLint,
+
+ /**
+ * Get the private class members of a given ESLint instance for tests.
+ * @param {ESLint} instance The ESLint instance to get.
+ * @returns {ESLintPrivateMembers} The instance's private class members.
+ */
+ getESLintPrivateMembers(instance) {
+ return privateMembersMap.get(instance);
+ }
+};
diff --git a/tools/node_modules/eslint/lib/eslint/index.js b/tools/node_modules/eslint/lib/eslint/index.js
new file mode 100644
index 00000000000000..c9185ee0eba0a5
--- /dev/null
+++ b/tools/node_modules/eslint/lib/eslint/index.js
@@ -0,0 +1,7 @@
+"use strict";
+
+const { ESLint } = require("./eslint");
+
+module.exports = {
+ ESLint
+};
diff --git a/tools/node_modules/eslint/lib/init/autoconfig.js b/tools/node_modules/eslint/lib/init/autoconfig.js
index 64be3d2a84f49b..2b0aa12ac13df6 100644
--- a/tools/node_modules/eslint/lib/init/autoconfig.js
+++ b/tools/node_modules/eslint/lib/init/autoconfig.js
@@ -301,7 +301,7 @@ class Registry {
ruleSetIdx += 1;
if (cb) {
- cb(totalFilesLinting); // eslint-disable-line callback-return
+ cb(totalFilesLinting); // eslint-disable-line node/callback-return
}
});
@@ -316,10 +316,10 @@ class Registry {
/**
* Extract rule configuration into eslint:recommended where possible.
*
- * This will return a new config with `"extends": "eslint:recommended"` and
+ * This will return a new config with `["extends": [ ..., "eslint:recommended"]` and
* only the rules which have configurations different from the recommended config.
* @param {Object} config config object
- * @returns {Object} config object using `"extends": "eslint:recommended"`
+ * @returns {Object} config object using `"extends": ["eslint:recommended"]`
*/
function extendFromRecommended(config) {
const newConfig = Object.assign({}, config);
@@ -333,7 +333,7 @@ function extendFromRecommended(config) {
delete newConfig.rules[ruleId];
}
});
- newConfig.extends = RECOMMENDED_CONFIG_NAME;
+ newConfig.extends.unshift(RECOMMENDED_CONFIG_NAME);
return newConfig;
}
diff --git a/tools/node_modules/eslint/lib/init/config-initializer.js b/tools/node_modules/eslint/lib/init/config-initializer.js
index 28dfad194a7e6f..70f0a250ad1dd6 100644
--- a/tools/node_modules/eslint/lib/init/config-initializer.js
+++ b/tools/node_modules/eslint/lib/init/config-initializer.js
@@ -15,6 +15,7 @@ const util = require("util"),
inquirer = require("inquirer"),
ProgressBar = require("progress"),
semver = require("semver"),
+ espree = require("espree"),
recConfig = require("../../conf/eslint-recommended"),
ConfigOps = require("../shared/config-ops"),
log = require("../shared/logging"),
@@ -31,8 +32,6 @@ const debug = require("debug")("eslint:config-initializer");
// Private
//------------------------------------------------------------------------------
-const DEFAULT_ECMA_VERSION = 2018;
-
/* istanbul ignore next: hard to test fs function */
/**
* Create .eslintrc file in the current working directory
@@ -265,8 +264,7 @@ function processAnswers(answers) {
extends: []
};
- // set the latest ECMAScript version
- config.parserOptions.ecmaVersion = DEFAULT_ECMA_VERSION;
+ config.parserOptions.ecmaVersion = espree.latestEcmaVersion;
config.env.es6 = true;
config.globals = {
Atomics: "readonly",
diff --git a/tools/node_modules/eslint/lib/init/source-code-utils.js b/tools/node_modules/eslint/lib/init/source-code-utils.js
index dfc170a65cf71b..dca6541d1ed328 100644
--- a/tools/node_modules/eslint/lib/init/source-code-utils.js
+++ b/tools/node_modules/eslint/lib/init/source-code-utils.js
@@ -23,7 +23,7 @@ const { CLIEngine } = require("../cli-engine");
* TODO1: Expose the API that enumerates target files.
* TODO2: Extract the creation logic of `SourceCode` from `Linter` class.
*/
-const { getCLIEngineInternalSlots } = require("../cli-engine/cli-engine"); // eslint-disable-line no-restricted-modules
+const { getCLIEngineInternalSlots } = require("../cli-engine/cli-engine"); // eslint-disable-line node/no-restricted-require
const debug = require("debug")("eslint:source-code-utils");
@@ -97,7 +97,7 @@ function getSourceCodeOfFiles(patterns, options, callback) {
sourceCodes[filename] = sourceCode;
}
if (callback) {
- callback(filenames.length); // eslint-disable-line callback-return
+ callback(filenames.length); // eslint-disable-line node/callback-return
}
});
diff --git a/tools/node_modules/eslint/lib/options.js b/tools/node_modules/eslint/lib/options.js
index 98dc04b6eb3968..1681f1dbd1d733 100644
--- a/tools/node_modules/eslint/lib/options.js
+++ b/tools/node_modules/eslint/lib/options.js
@@ -46,7 +46,6 @@ module.exports = optionator({
{
option: "ext",
type: "[String]",
- default: ".js",
description: "Specify JavaScript file extensions"
},
{
diff --git a/tools/node_modules/eslint/lib/rule-tester/rule-tester.js b/tools/node_modules/eslint/lib/rule-tester/rule-tester.js
index 1c1737152c1b19..77df1def893ccc 100644
--- a/tools/node_modules/eslint/lib/rule-tester/rule-tester.js
+++ b/tools/node_modules/eslint/lib/rule-tester/rule-tester.js
@@ -563,7 +563,12 @@ class RuleTester {
output = SourceCodeFixer.applyFixes(code, messages).output;
const errorMessageInFix = linter.verify(output, config, filename).find(m => m.fatal);
- assert(!errorMessageInFix, `A fatal parsing error occurred in autofix: ${errorMessageInFix && errorMessageInFix.message}`);
+ assert(!errorMessageInFix, [
+ "A fatal parsing error occurred in autofix.",
+ `Error: ${errorMessageInFix && errorMessageInFix.message}`,
+ "Autofix output:",
+ output
+ ].join("\n"));
} else {
output = code;
}
diff --git a/tools/node_modules/eslint/lib/rules/array-callback-return.js b/tools/node_modules/eslint/lib/rules/array-callback-return.js
index eb38965024f05d..62ba7b72d87257 100644
--- a/tools/node_modules/eslint/lib/rules/array-callback-return.js
+++ b/tools/node_modules/eslint/lib/rules/array-callback-return.js
@@ -29,22 +29,6 @@ function isReachable(segment) {
return segment.reachable;
}
-/**
- * Gets a readable location.
- *
- * - FunctionExpression -> the function name or `function` keyword.
- * - ArrowFunctionExpression -> `=>` token.
- * @param {ASTNode} node A function node to get.
- * @param {SourceCode} sourceCode A source code to get tokens.
- * @returns {ASTNode|Token} The node or the token of a location.
- */
-function getLocation(node, sourceCode) {
- if (node.type === "ArrowFunctionExpression") {
- return sourceCode.getTokenBefore(node.body);
- }
- return node.id || node;
-}
-
/**
* Checks a given node is a MemberExpression node which has the specified name's
* property.
@@ -179,6 +163,7 @@ module.exports = {
create(context) {
const options = context.options[0] || { allowImplicit: false, checkForEach: false };
+ const sourceCode = context.getSourceCode();
let funcInfo = {
arrayMethodName: null,
@@ -217,12 +202,12 @@ module.exports = {
}
if (messageId) {
- let name = astUtils.getFunctionNameWithKind(funcInfo.node);
+ let name = astUtils.getFunctionNameWithKind(node);
name = messageId === "expectedNoReturnValue" ? lodash.upperFirst(name) : name;
context.report({
node,
- loc: getLocation(node, context.getSourceCode()).loc.start,
+ loc: astUtils.getFunctionHeadLoc(node, sourceCode),
messageId,
data: { name }
});
diff --git a/tools/node_modules/eslint/lib/rules/callback-return.js b/tools/node_modules/eslint/lib/rules/callback-return.js
index c5263cde46b752..5df792d436341e 100644
--- a/tools/node_modules/eslint/lib/rules/callback-return.js
+++ b/tools/node_modules/eslint/lib/rules/callback-return.js
@@ -10,6 +10,10 @@
module.exports = {
meta: {
+ deprecated: true,
+
+ replacedBy: ["node/callback-return"],
+
type: "suggestion",
docs: {
diff --git a/tools/node_modules/eslint/lib/rules/comma-style.js b/tools/node_modules/eslint/lib/rules/comma-style.js
index bc22f05dd3892c..f1a23d63b786a0 100644
--- a/tools/node_modules/eslint/lib/rules/comma-style.js
+++ b/tools/node_modules/eslint/lib/rules/comma-style.js
@@ -146,10 +146,7 @@ module.exports = {
// lone comma
context.report({
node: reportItem,
- loc: {
- line: commaToken.loc.end.line,
- column: commaToken.loc.start.column
- },
+ loc: commaToken.loc,
messageId: "unexpectedLineBeforeAndAfterComma",
fix: getFixerFunction(styleType, previousItemToken, commaToken, currentItemToken)
});
@@ -158,6 +155,7 @@ module.exports = {
context.report({
node: reportItem,
+ loc: commaToken.loc,
messageId: "expectedCommaFirst",
fix: getFixerFunction(style, previousItemToken, commaToken, currentItemToken)
});
@@ -166,10 +164,7 @@ module.exports = {
context.report({
node: reportItem,
- loc: {
- line: commaToken.loc.end.line,
- column: commaToken.loc.end.column
- },
+ loc: commaToken.loc,
messageId: "expectedCommaLast",
fix: getFixerFunction(style, previousItemToken, commaToken, currentItemToken)
});
diff --git a/tools/node_modules/eslint/lib/rules/func-call-spacing.js b/tools/node_modules/eslint/lib/rules/func-call-spacing.js
index e2edd4282da578..dccdd0a40c6d76 100644
--- a/tools/node_modules/eslint/lib/rules/func-call-spacing.js
+++ b/tools/node_modules/eslint/lib/rules/func-call-spacing.js
@@ -63,7 +63,8 @@ module.exports = {
},
messages: {
- unexpected: "Unexpected newline between function name and paren.",
+ unexpectedWhitespace: "Unexpected whitespace between function name and paren.",
+ unexpectedNewline: "Unexpected newline between function name and paren.",
missing: "Missing space between function name and paren."
}
},
@@ -116,7 +117,7 @@ module.exports = {
context.report({
node,
loc: leftToken.loc.start,
- messageId: "unexpected",
+ messageId: "unexpectedWhitespace",
fix(fixer) {
/*
@@ -143,7 +144,7 @@ module.exports = {
context.report({
node,
loc: leftToken.loc.start,
- messageId: "unexpected",
+ messageId: "unexpectedNewline",
fix(fixer) {
return fixer.replaceTextRange([leftToken.range[1], rightToken.range[0]], " ");
}
diff --git a/tools/node_modules/eslint/lib/rules/getter-return.js b/tools/node_modules/eslint/lib/rules/getter-return.js
index e1468a5b19f88d..c54ebfb4ffb8cd 100644
--- a/tools/node_modules/eslint/lib/rules/getter-return.js
+++ b/tools/node_modules/eslint/lib/rules/getter-return.js
@@ -25,17 +25,6 @@ function isReachable(segment) {
return segment.reachable;
}
-/**
- * Gets a readable location.
- *
- * - FunctionExpression -> the function name or `function` keyword.
- * @param {ASTNode} node A function node to get.
- * @returns {ASTNode|Token} The node or the token of a location.
- */
-function getId(node) {
- return node.id || node;
-}
-
//------------------------------------------------------------------------------
// Rule Definition
//------------------------------------------------------------------------------
@@ -75,6 +64,7 @@ module.exports = {
create(context) {
const options = context.options[0] || { allowImplicit: false };
+ const sourceCode = context.getSourceCode();
let funcInfo = {
upper: null,
@@ -99,7 +89,7 @@ module.exports = {
) {
context.report({
node,
- loc: getId(node).loc.start,
+ loc: astUtils.getFunctionHeadLoc(node, sourceCode),
messageId: funcInfo.hasReturn ? "expectedAlways" : "expected",
data: {
name: astUtils.getFunctionNameWithKind(funcInfo.node)
diff --git a/tools/node_modules/eslint/lib/rules/global-require.js b/tools/node_modules/eslint/lib/rules/global-require.js
index 4af3a6a4669a79..9bd073b88546d6 100644
--- a/tools/node_modules/eslint/lib/rules/global-require.js
+++ b/tools/node_modules/eslint/lib/rules/global-require.js
@@ -48,6 +48,10 @@ function isShadowed(scope, node) {
module.exports = {
meta: {
+ deprecated: true,
+
+ replacedBy: ["node/global-require"],
+
type: "suggestion",
docs: {
diff --git a/tools/node_modules/eslint/lib/rules/handle-callback-err.js b/tools/node_modules/eslint/lib/rules/handle-callback-err.js
index 640946699e7bea..8ad63bbd53a77b 100644
--- a/tools/node_modules/eslint/lib/rules/handle-callback-err.js
+++ b/tools/node_modules/eslint/lib/rules/handle-callback-err.js
@@ -11,6 +11,10 @@
module.exports = {
meta: {
+ deprecated: true,
+
+ replacedBy: ["node/handle-callback-err"],
+
type: "suggestion",
docs: {
diff --git a/tools/node_modules/eslint/lib/rules/key-spacing.js b/tools/node_modules/eslint/lib/rules/key-spacing.js
index c405043794c7d1..57abb00b06e8a4 100644
--- a/tools/node_modules/eslint/lib/rules/key-spacing.js
+++ b/tools/node_modules/eslint/lib/rules/key-spacing.js
@@ -45,7 +45,7 @@ function isSingleLine(node) {
/**
* Checks whether the properties on a single line.
* @param {ASTNode[]} properties List of Property AST nodes.
- * @returns {boolean} True if all properies is on a single line.
+ * @returns {boolean} True if all properties is on a single line.
*/
function isSingleLineProperties(properties) {
const [firstProp] = properties,
diff --git a/tools/node_modules/eslint/lib/rules/new-cap.js b/tools/node_modules/eslint/lib/rules/new-cap.js
index 7cce968c5aed0e..0faf45efb92daf 100644
--- a/tools/node_modules/eslint/lib/rules/new-cap.js
+++ b/tools/node_modules/eslint/lib/rules/new-cap.js
@@ -235,7 +235,7 @@ module.exports = {
callee = callee.property;
}
- context.report({ node, loc: callee.loc.start, messageId });
+ context.report({ node, loc: callee.loc, messageId });
}
//--------------------------------------------------------------------------
diff --git a/tools/node_modules/eslint/lib/rules/newline-per-chained-call.js b/tools/node_modules/eslint/lib/rules/newline-per-chained-call.js
index 8ad88386c0f61d..4254fec185ef88 100644
--- a/tools/node_modules/eslint/lib/rules/newline-per-chained-call.js
+++ b/tools/node_modules/eslint/lib/rules/newline-per-chained-call.js
@@ -90,16 +90,19 @@ module.exports = {
}
if (depth > ignoreChainWithDepth && astUtils.isTokenOnSameLine(callee.object, callee.property)) {
+ const firstTokenAfterObject = sourceCode.getTokenAfter(callee.object, astUtils.isNotClosingParenToken);
+
context.report({
node: callee.property,
- loc: callee.property.loc.start,
+ loc: {
+ start: firstTokenAfterObject.loc.start,
+ end: callee.loc.end
+ },
messageId: "expected",
data: {
callee: getPropertyText(callee)
},
fix(fixer) {
- const firstTokenAfterObject = sourceCode.getTokenAfter(callee.object, astUtils.isNotClosingParenToken);
-
return fixer.insertTextBefore(firstTokenAfterObject, "\n");
}
});
diff --git a/tools/node_modules/eslint/lib/rules/no-buffer-constructor.js b/tools/node_modules/eslint/lib/rules/no-buffer-constructor.js
index bf4c8891ad1adf..5dce047b92312e 100644
--- a/tools/node_modules/eslint/lib/rules/no-buffer-constructor.js
+++ b/tools/node_modules/eslint/lib/rules/no-buffer-constructor.js
@@ -10,6 +10,10 @@
module.exports = {
meta: {
+ deprecated: true,
+
+ replacedBy: ["node/no-deprecated-api"],
+
type: "problem",
docs: {
diff --git a/tools/node_modules/eslint/lib/rules/no-empty-function.js b/tools/node_modules/eslint/lib/rules/no-empty-function.js
index c74321158b3464..c512f8cd5f4500 100644
--- a/tools/node_modules/eslint/lib/rules/no-empty-function.js
+++ b/tools/node_modules/eslint/lib/rules/no-empty-function.js
@@ -151,7 +151,7 @@ module.exports = {
) {
context.report({
node,
- loc: node.body.loc.start,
+ loc: node.body.loc,
messageId: "unexpected",
data: { name }
});
diff --git a/tools/node_modules/eslint/lib/rules/no-extra-parens.js b/tools/node_modules/eslint/lib/rules/no-extra-parens.js
index a3dd5bab699da3..7cbb7522ebedfa 100644
--- a/tools/node_modules/eslint/lib/rules/no-extra-parens.js
+++ b/tools/node_modules/eslint/lib/rules/no-extra-parens.js
@@ -560,7 +560,11 @@ module.exports = {
tokensToIgnore.add(secondToken);
}
- if (hasExcessParens(node)) {
+ const hasExtraParens = node.parent.type === "ExportDefaultDeclaration"
+ ? hasExcessParensWithPrecedence(node, PRECEDENCE_OF_ASSIGNMENT_EXPR)
+ : hasExcessParens(node);
+
+ if (hasExtraParens) {
report(node);
}
}
diff --git a/tools/node_modules/eslint/lib/rules/no-inner-declarations.js b/tools/node_modules/eslint/lib/rules/no-inner-declarations.js
index e1c29e0a3b4f3f..0768bc61149cec 100644
--- a/tools/node_modules/eslint/lib/rules/no-inner-declarations.js
+++ b/tools/node_modules/eslint/lib/rules/no-inner-declarations.js
@@ -5,10 +5,19 @@
"use strict";
+//------------------------------------------------------------------------------
+// Requirements
+//------------------------------------------------------------------------------
+
+const astUtils = require("./utils/ast-utils");
+
//------------------------------------------------------------------------------
// Rule Definition
//------------------------------------------------------------------------------
+const validParent = new Set(["Program", "ExportNamedDeclaration", "ExportDefaultDeclaration"]);
+const validBlockStatementParent = new Set(["FunctionDeclaration", "FunctionExpression", "ArrowFunctionExpression"]);
+
module.exports = {
meta: {
type: "problem",
@@ -33,54 +42,37 @@ module.exports = {
create(context) {
- /**
- * Find the nearest Program or Function ancestor node.
- * @returns {Object} Ancestor's type and distance from node.
- */
- function nearestBody() {
- const ancestors = context.getAncestors();
- let ancestor = ancestors.pop(),
- generation = 1;
-
- while (ancestor && ["Program", "FunctionDeclaration",
- "FunctionExpression", "ArrowFunctionExpression"
- ].indexOf(ancestor.type) < 0) {
- generation += 1;
- ancestor = ancestors.pop();
- }
-
- return {
-
- // Type of containing ancestor
- type: ancestor.type,
-
- // Separation between ancestor and node
- distance: generation
- };
- }
-
/**
* Ensure that a given node is at a program or function body's root.
* @param {ASTNode} node Declaration node to check.
* @returns {void}
*/
function check(node) {
- const body = nearestBody(),
- valid = ((body.type === "Program" && body.distance === 1) ||
- body.distance === 2);
-
- if (!valid) {
- context.report({
- node,
- messageId: "moveDeclToRoot",
- data: {
- type: (node.type === "FunctionDeclaration" ? "function" : "variable"),
- body: (body.type === "Program" ? "program" : "function body")
- }
- });
+ const parent = node.parent;
+
+ if (
+ parent.type === "BlockStatement" && validBlockStatementParent.has(parent.parent.type)
+ ) {
+ return;
+ }
+
+ if (validParent.has(parent.type)) {
+ return;
}
+
+ const upperFunction = astUtils.getUpperFunction(parent);
+
+ context.report({
+ node,
+ messageId: "moveDeclToRoot",
+ data: {
+ type: (node.type === "FunctionDeclaration" ? "function" : "variable"),
+ body: (upperFunction === null ? "program" : "function body")
+ }
+ });
}
+
return {
FunctionDeclaration: check,
diff --git a/tools/node_modules/eslint/lib/rules/no-lone-blocks.js b/tools/node_modules/eslint/lib/rules/no-lone-blocks.js
index d7069887b8e460..290784b82ea2fb 100644
--- a/tools/node_modules/eslint/lib/rules/no-lone-blocks.js
+++ b/tools/node_modules/eslint/lib/rules/no-lone-blocks.js
@@ -49,7 +49,7 @@ module.exports = {
}
/**
- * Checks for any ocurrence of a BlockStatement in a place where lists of statements can appear
+ * Checks for any occurrence of a BlockStatement in a place where lists of statements can appear
* @param {ASTNode} node The node to check
* @returns {boolean} True if the node is a lone block.
*/
diff --git a/tools/node_modules/eslint/lib/rules/no-mixed-requires.js b/tools/node_modules/eslint/lib/rules/no-mixed-requires.js
index 8e988e32c24f84..bfe9b7aa97858a 100644
--- a/tools/node_modules/eslint/lib/rules/no-mixed-requires.js
+++ b/tools/node_modules/eslint/lib/rules/no-mixed-requires.js
@@ -11,6 +11,10 @@
module.exports = {
meta: {
+ deprecated: true,
+
+ replacedBy: ["node/no-mixed-requires"],
+
type: "suggestion",
docs: {
diff --git a/tools/node_modules/eslint/lib/rules/no-new-object.js b/tools/node_modules/eslint/lib/rules/no-new-object.js
index f3e99c9bd13502..e9f915db5eaa91 100644
--- a/tools/node_modules/eslint/lib/rules/no-new-object.js
+++ b/tools/node_modules/eslint/lib/rules/no-new-object.js
@@ -5,6 +5,12 @@
"use strict";
+//------------------------------------------------------------------------------
+// Requirements
+//------------------------------------------------------------------------------
+
+const astUtils = require("./utils/ast-utils");
+
//------------------------------------------------------------------------------
// Rule Definition
//------------------------------------------------------------------------------
@@ -28,10 +34,17 @@ module.exports = {
},
create(context) {
-
return {
-
NewExpression(node) {
+ const variable = astUtils.getVariableByName(
+ context.getScope(),
+ node.callee.name
+ );
+
+ if (variable && variable.identifiers.length > 0) {
+ return;
+ }
+
if (node.callee.name === "Object") {
context.report({
node,
@@ -40,6 +53,5 @@ module.exports = {
}
}
};
-
}
};
diff --git a/tools/node_modules/eslint/lib/rules/no-new-require.js b/tools/node_modules/eslint/lib/rules/no-new-require.js
index df12a424e3527e..7f81e83fd782c3 100644
--- a/tools/node_modules/eslint/lib/rules/no-new-require.js
+++ b/tools/node_modules/eslint/lib/rules/no-new-require.js
@@ -11,6 +11,10 @@
module.exports = {
meta: {
+ deprecated: true,
+
+ replacedBy: ["node/no-new-require"],
+
type: "suggestion",
docs: {
diff --git a/tools/node_modules/eslint/lib/rules/no-path-concat.js b/tools/node_modules/eslint/lib/rules/no-path-concat.js
index 9fa8b852fe8358..77a03a7f952b04 100644
--- a/tools/node_modules/eslint/lib/rules/no-path-concat.js
+++ b/tools/node_modules/eslint/lib/rules/no-path-concat.js
@@ -10,6 +10,10 @@
module.exports = {
meta: {
+ deprecated: true,
+
+ replacedBy: ["node/no-path-concat"],
+
type: "suggestion",
docs: {
diff --git a/tools/node_modules/eslint/lib/rules/no-process-env.js b/tools/node_modules/eslint/lib/rules/no-process-env.js
index 0f8d7f8a339d0e..24bb9f9971d5c9 100644
--- a/tools/node_modules/eslint/lib/rules/no-process-env.js
+++ b/tools/node_modules/eslint/lib/rules/no-process-env.js
@@ -10,6 +10,10 @@
module.exports = {
meta: {
+ deprecated: true,
+
+ replacedBy: ["node/no-process-env"],
+
type: "suggestion",
docs: {
diff --git a/tools/node_modules/eslint/lib/rules/no-process-exit.js b/tools/node_modules/eslint/lib/rules/no-process-exit.js
index 29871660cc6ee1..9c70ea8808b4c4 100644
--- a/tools/node_modules/eslint/lib/rules/no-process-exit.js
+++ b/tools/node_modules/eslint/lib/rules/no-process-exit.js
@@ -10,6 +10,10 @@
module.exports = {
meta: {
+ deprecated: true,
+
+ replacedBy: ["node/no-process-exit"],
+
type: "suggestion",
docs: {
diff --git a/tools/node_modules/eslint/lib/rules/no-restricted-modules.js b/tools/node_modules/eslint/lib/rules/no-restricted-modules.js
index abd8d5cbe29381..61834ceeb444d3 100644
--- a/tools/node_modules/eslint/lib/rules/no-restricted-modules.js
+++ b/tools/node_modules/eslint/lib/rules/no-restricted-modules.js
@@ -40,6 +40,10 @@ const arrayOfStringsOrObjects = {
module.exports = {
meta: {
+ deprecated: true,
+
+ replacedBy: ["node/no-restricted-require"],
+
type: "suggestion",
docs: {
diff --git a/tools/node_modules/eslint/lib/rules/no-sync.js b/tools/node_modules/eslint/lib/rules/no-sync.js
index d8111059631734..9790d1f94bb20c 100644
--- a/tools/node_modules/eslint/lib/rules/no-sync.js
+++ b/tools/node_modules/eslint/lib/rules/no-sync.js
@@ -13,6 +13,10 @@
module.exports = {
meta: {
+ deprecated: true,
+
+ replacedBy: ["node/no-sync"],
+
type: "suggestion",
docs: {
diff --git a/tools/node_modules/eslint/lib/rules/no-unexpected-multiline.js b/tools/node_modules/eslint/lib/rules/no-unexpected-multiline.js
index eb72008a2947e7..b5ec20de4b20a3 100644
--- a/tools/node_modules/eslint/lib/rules/no-unexpected-multiline.js
+++ b/tools/node_modules/eslint/lib/rules/no-unexpected-multiline.js
@@ -53,7 +53,11 @@ module.exports = {
const nodeExpressionEnd = sourceCode.getTokenBefore(openParen);
if (openParen.loc.start.line !== nodeExpressionEnd.loc.end.line) {
- context.report({ node, loc: openParen.loc.start, messageId, data: { char: openParen.value } });
+ context.report({
+ node,
+ loc: openParen.loc,
+ messageId
+ });
}
}
@@ -71,18 +75,24 @@ module.exports = {
},
TaggedTemplateExpression(node) {
- if (node.tag.loc.end.line === node.quasi.loc.start.line) {
- return;
- }
-
- // handle generics type parameters on template tags
- const tokenBefore = sourceCode.getTokenBefore(node.quasi);
-
- if (tokenBefore.loc.end.line === node.quasi.loc.start.line) {
- return;
+ const { quasi } = node;
+
+ // handles common tags, parenthesized tags, and typescript's generic type arguments
+ const tokenBefore = sourceCode.getTokenBefore(quasi);
+
+ if (tokenBefore.loc.end.line !== quasi.loc.start.line) {
+ context.report({
+ node,
+ loc: {
+ start: quasi.loc.start,
+ end: {
+ line: quasi.loc.start.line,
+ column: quasi.loc.start.column + 1
+ }
+ },
+ messageId: "taggedTemplate"
+ });
}
-
- context.report({ node, loc: node.loc.start, messageId: "taggedTemplate" });
},
CallExpression(node) {
diff --git a/tools/node_modules/eslint/lib/rules/no-useless-concat.js b/tools/node_modules/eslint/lib/rules/no-useless-concat.js
index aa46742abdd5ca..cfc60c8fb51a24 100644
--- a/tools/node_modules/eslint/lib/rules/no-useless-concat.js
+++ b/tools/node_modules/eslint/lib/rules/no-useless-concat.js
@@ -105,7 +105,7 @@ module.exports = {
context.report({
node,
- loc: operatorToken.loc.start,
+ loc: operatorToken.loc,
messageId: "unexpectedConcat"
});
}
diff --git a/tools/node_modules/eslint/lib/rules/space-before-function-paren.js b/tools/node_modules/eslint/lib/rules/space-before-function-paren.js
index af609c2e7c72fa..1021a110cfd3f0 100644
--- a/tools/node_modules/eslint/lib/rules/space-before-function-paren.js
+++ b/tools/node_modules/eslint/lib/rules/space-before-function-paren.js
@@ -127,7 +127,10 @@ module.exports = {
if (hasSpacing && functionConfig === "never") {
context.report({
node,
- loc: leftToken.loc.end,
+ loc: {
+ start: leftToken.loc.end,
+ end: rightToken.loc.start
+ },
messageId: "unexpectedSpace",
fix(fixer) {
const comments = sourceCode.getCommentsBefore(rightToken);
@@ -145,7 +148,7 @@ module.exports = {
} else if (!hasSpacing && functionConfig === "always") {
context.report({
node,
- loc: leftToken.loc.end,
+ loc: rightToken.loc,
messageId: "missingSpace",
fix: fixer => fixer.insertTextAfter(leftToken, " ")
});
diff --git a/tools/node_modules/eslint/lib/rules/yoda.js b/tools/node_modules/eslint/lib/rules/yoda.js
index c4ff3f81938595..f1159e5255df79 100644
--- a/tools/node_modules/eslint/lib/rules/yoda.js
+++ b/tools/node_modules/eslint/lib/rules/yoda.js
@@ -20,7 +20,7 @@ const astUtils = require("./utils/ast-utils");
* @returns {boolean} Whether or not it is a comparison operator.
*/
function isComparisonOperator(operator) {
- return (/^(==|===|!=|!==|<|>|<=|>=)$/u).test(operator);
+ return /^(==|===|!=|!==|<|>|<=|>=)$/u.test(operator);
}
/**
@@ -29,7 +29,7 @@ function isComparisonOperator(operator) {
* @returns {boolean} Whether or not it is an equality operator.
*/
function isEqualityOperator(operator) {
- return (/^(==|===)$/u).test(operator);
+ return /^(==|===)$/u.test(operator);
}
/**
@@ -50,10 +50,12 @@ function isRangeTestOperator(operator) {
* real literal and should be treated as such.
*/
function isNegativeNumericLiteral(node) {
- return (node.type === "UnaryExpression" &&
+ return (
+ node.type === "UnaryExpression" &&
node.operator === "-" &&
node.prefix &&
- astUtils.isNumericLiteral(node.argument));
+ astUtils.isNumericLiteral(node.argument)
+ );
}
/**
@@ -71,25 +73,21 @@ function isStaticTemplateLiteral(node) {
* @returns {boolean} True if the node should be treated as a single Literal node.
*/
function looksLikeLiteral(node) {
- return isNegativeNumericLiteral(node) ||
- isStaticTemplateLiteral(node);
+ return isNegativeNumericLiteral(node) || isStaticTemplateLiteral(node);
}
/**
* Attempts to derive a Literal node from nodes that are treated like literals.
* @param {ASTNode} node Node to normalize.
- * @param {number} [defaultValue] The default value to be returned if the node
- * is not a Literal.
* @returns {ASTNode} One of the following options.
* 1. The original node if the node is already a Literal
* 2. A normalized Literal node with the negative number as the value if the
* node represents a negative number literal.
* 3. A normalized Literal node with the string as the value if the node is
* a Template Literal without expression.
- * 4. The Literal node which has the `defaultValue` argument if it exists.
- * 5. Otherwise `null`.
+ * 4. Otherwise `null`.
*/
-function getNormalizedLiteral(node, defaultValue) {
+function getNormalizedLiteral(node) {
if (node.type === "Literal") {
return node;
}
@@ -110,14 +108,6 @@ function getNormalizedLiteral(node, defaultValue) {
};
}
- if (defaultValue) {
- return {
- type: "Literal",
- value: defaultValue,
- raw: String(defaultValue)
- };
- }
-
return null;
}
@@ -183,7 +173,7 @@ module.exports = {
type: "suggestion",
docs: {
- description: "require or disallow \"Yoda\" conditions",
+ description: 'require or disallow "Yoda" conditions',
category: "Best Practices",
recommended: false,
url: "https://eslint.org/docs/rules/yoda"
@@ -211,16 +201,19 @@ module.exports = {
fixable: "code",
messages: {
- expected: "Expected literal to be on the {{expectedSide}} side of {{operator}}."
+ expected:
+ "Expected literal to be on the {{expectedSide}} side of {{operator}}."
}
},
create(context) {
// Default to "never" (!always) if no option
- const always = (context.options[0] === "always");
- const exceptRange = (context.options[1] && context.options[1].exceptRange);
- const onlyEquality = (context.options[1] && context.options[1].onlyEquality);
+ const always = context.options[0] === "always";
+ const exceptRange =
+ context.options[1] && context.options[1].exceptRange;
+ const onlyEquality =
+ context.options[1] && context.options[1].onlyEquality;
const sourceCode = context.getSourceCode();
@@ -243,13 +236,23 @@ module.exports = {
* @returns {boolean} Whether node is a "between" range test.
*/
function isBetweenTest() {
- let leftLiteral, rightLiteral;
+ if (node.operator === "&&" && same(left.right, right.left)) {
+ const leftLiteral = getNormalizedLiteral(left.left);
+ const rightLiteral = getNormalizedLiteral(right.right);
+
+ if (leftLiteral === null && rightLiteral === null) {
+ return false;
+ }
- return (node.operator === "&&" &&
- (leftLiteral = getNormalizedLiteral(left.left)) &&
- (rightLiteral = getNormalizedLiteral(right.right, Number.POSITIVE_INFINITY)) &&
- leftLiteral.value <= rightLiteral.value &&
- same(left.right, right.left));
+ if (rightLiteral === null || leftLiteral === null) {
+ return true;
+ }
+
+ if (leftLiteral.value <= rightLiteral.value) {
+ return true;
+ }
+ }
+ return false;
}
/**
@@ -257,13 +260,24 @@ module.exports = {
* @returns {boolean} Whether node is an "outside" range test.
*/
function isOutsideTest() {
- let leftLiteral, rightLiteral;
+ if (node.operator === "||" && same(left.left, right.right)) {
+ const leftLiteral = getNormalizedLiteral(left.right);
+ const rightLiteral = getNormalizedLiteral(right.left);
+
+ if (leftLiteral === null && rightLiteral === null) {
+ return false;
+ }
+
+ if (rightLiteral === null || leftLiteral === null) {
+ return true;
+ }
+
+ if (leftLiteral.value <= rightLiteral.value) {
+ return true;
+ }
+ }
- return (node.operator === "||" &&
- (leftLiteral = getNormalizedLiteral(left.right, Number.NEGATIVE_INFINITY)) &&
- (rightLiteral = getNormalizedLiteral(right.left)) &&
- leftLiteral.value <= rightLiteral.value &&
- same(left.left, right.right));
+ return false;
}
/**
@@ -276,13 +290,15 @@ module.exports = {
return astUtils.isParenthesised(sourceCode, node);
}
- return (node.type === "LogicalExpression" &&
+ return (
+ node.type === "LogicalExpression" &&
left.type === "BinaryExpression" &&
right.type === "BinaryExpression" &&
isRangeTestOperator(left.operator) &&
isRangeTestOperator(right.operator) &&
(isBetweenTest() || isOutsideTest()) &&
- isParenWrapped());
+ isParenWrapped()
+ );
}
const OPERATOR_FLIP_MAP = {
@@ -303,21 +319,52 @@ module.exports = {
*/
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 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 firstRightToken = sourceCode.getTokenAfter(operatorToken);
- const rightText = sourceCode.getText().slice(firstRightToken.range[0], node.range[1]);
+ const rightText = sourceCode
+ .getText()
+ .slice(firstRightToken.range[0], node.range[1]);
let prefix = "";
- if (tokenBefore && tokenBefore.range[1] === node.range[0] &&
- !astUtils.canTokensBeAdjacent(tokenBefore, firstRightToken)) {
+ if (
+ tokenBefore &&
+ tokenBefore.range[1] === node.range[0] &&
+ !astUtils.canTokensBeAdjacent(tokenBefore, firstRightToken)
+ ) {
prefix = " ";
}
- return prefix + rightText + textBeforeOperator + OPERATOR_FLIP_MAP[operatorToken.value] + textAfterOperator + leftText;
+ return (
+ prefix +
+ rightText +
+ textBeforeOperator +
+ OPERATOR_FLIP_MAP[operatorToken.value] +
+ textAfterOperator +
+ leftText
+ );
}
//--------------------------------------------------------------------------
@@ -331,8 +378,12 @@ module.exports = {
// If `expectedLiteral` is not a literal, and `expectedNonLiteral` is a literal, raise an error.
if (
- (expectedNonLiteral.type === "Literal" || looksLikeLiteral(expectedNonLiteral)) &&
- !(expectedLiteral.type === "Literal" || looksLikeLiteral(expectedLiteral)) &&
+ (expectedNonLiteral.type === "Literal" ||
+ looksLikeLiteral(expectedNonLiteral)) &&
+ !(
+ expectedLiteral.type === "Literal" ||
+ looksLikeLiteral(expectedLiteral)
+ ) &&
!(!isEqualityOperator(node.operator) && onlyEquality) &&
isComparisonOperator(node.operator) &&
!(exceptRange && isRangeTest(context.getAncestors().pop()))
@@ -344,12 +395,11 @@ module.exports = {
operator: node.operator,
expectedSide: always ? "left" : "right"
},
- fix: fixer => fixer.replaceText(node, getFlippedString(node))
+ fix: fixer =>
+ fixer.replaceText(node, getFlippedString(node))
});
}
-
}
};
-
}
};
diff --git a/tools/node_modules/eslint/lib/shared/relative-module-resolver.js b/tools/node_modules/eslint/lib/shared/relative-module-resolver.js
index fa6cca72361df5..80335c5cfca7c8 100644
--- a/tools/node_modules/eslint/lib/shared/relative-module-resolver.js
+++ b/tools/node_modules/eslint/lib/shared/relative-module-resolver.js
@@ -11,6 +11,7 @@ const Module = require("module");
* `Module.createRequire` is added in v12.2.0. It supports URL as well.
* We only support the case where the argument is a filepath, not a URL.
*/
+// eslint-disable-next-line node/no-unsupported-features/node-builtins, node/no-deprecated-api
const createRequire = Module.createRequire || Module.createRequireFromPath;
module.exports = {
diff --git a/tools/node_modules/eslint/lib/shared/types.js b/tools/node_modules/eslint/lib/shared/types.js
index bf37327fa240ca..bbd95d1b37862f 100644
--- a/tools/node_modules/eslint/lib/shared/types.js
+++ b/tools/node_modules/eslint/lib/shared/types.js
@@ -141,3 +141,10 @@ module.exports = {};
* @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/@babel/helper-validator-identifier/lib/identifier.js b/tools/node_modules/eslint/node_modules/@babel/helper-validator-identifier/lib/identifier.js
index 92043ce6630710..51ec76370ccfc6 100644
--- a/tools/node_modules/eslint/node_modules/@babel/helper-validator-identifier/lib/identifier.js
+++ b/tools/node_modules/eslint/node_modules/@babel/helper-validator-identifier/lib/identifier.js
@@ -73,5 +73,5 @@ function isIdentifierName(name) {
}
}
- return true;
+ return !isFirst;
}
\ No newline at end of file
diff --git a/tools/node_modules/eslint/node_modules/@babel/helper-validator-identifier/package.json b/tools/node_modules/eslint/node_modules/@babel/helper-validator-identifier/package.json
index bdc69e6c6f8926..da8c4e12d40ff7 100644
--- a/tools/node_modules/eslint/node_modules/@babel/helper-validator-identifier/package.json
+++ b/tools/node_modules/eslint/node_modules/@babel/helper-validator-identifier/package.json
@@ -7,7 +7,7 @@
"unicode-13.0.0": "^0.8.0"
},
"exports": "./lib/index.js",
- "gitHead": "8d5e422be27251cfaadf8dd2536b31b4a5024b02",
+ "gitHead": "5b97e77e030cf3853a147fdff81844ea4026219d",
"license": "MIT",
"main": "./lib/index.js",
"name": "@babel/helper-validator-identifier",
@@ -18,5 +18,5 @@
"type": "git",
"url": "https://github.com/babel/babel/tree/master/packages/babel-helper-validator-identifier"
},
- "version": "7.9.0"
+ "version": "7.9.5"
}
\ 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 9bd1f571872a26..e13fdec2939c92 100644
--- a/tools/node_modules/eslint/node_modules/ajv/README.md
+++ b/tools/node_modules/eslint/node_modules/ajv/README.md
@@ -8,8 +8,49 @@ The fastest JSON Schema validator for Node.js and browser. Supports draft-04/06/
[![npm](https://img.shields.io/npm/v/ajv.svg)](https://www.npmjs.com/package/ajv)
[![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)
-[![Greenkeeper badge](https://badges.greenkeeper.io/epoberezkin/ajv.svg)](https://greenkeeper.io/)
[![Gitter](https://img.shields.io/gitter/room/ajv-validator/ajv.svg)](https://gitter.im/ajv-validator/ajv)
+[![GitHub Sponsors](https://img.shields.io/badge/$-sponsors-brightgreen)](https://github.com/sponsors/epoberezkin)
+
+## Please [sponsor Ajv](https://github.com/sponsors/epoberezkin)
+
+Dear Ajv users! ❤️
+
+I ask you to support the development of Ajv with donations. 🙏
+
+Since 2015 Ajv has become widely used, thanks to your help and contributions:
+
+- **90** contributors 🏗
+- **5,000** dependent npm packages ⚙️
+- **7,000** github stars, from GitHub users [all over the world](https://www.google.com/maps/d/u/0/viewer?mid=1MGRV8ciFUGIbO1l0EKFWNJGYE7iSkDxP&ll=-3.81666561775622e-14%2C4.821737100000007&z=2) ⭐️
+- **5,000,000** dependent repositories on GitHub 🚀
+- **120,000,000** npm downloads per month! 💯
+
+Your donations will fund futher development - small and large improvements, support of the next versions of JSON Schema specification, and, possibly, the code should be migrated to TypeScript to make it more maintainable.
+
+I will greatly appreciate anything you can help with to make it happen:
+
+- a **personal** donation - from $2 ☕️
+- your **company** donation - from $10 🍔
+- a **sponsorship** to get promoted on Ajv or related packages - from $50 💰
+- an **introduction** to a sponsor who would benefit from the promotion on Ajv page 🤝
+
+| Please [make donations via my GitHub sponsors page](https://github.com/sponsors/epoberezkin)
‼️ **GitHub will DOUBLE them** ‼️ |
+|---|
+
+#### Open Collective sponsors
+
+
+
+
+
+
+
+
+
+
+
+
+
## Using version 6
@@ -273,7 +314,7 @@ The following formats are implemented for string validation with "format" keywor
__Please note__: JSON Schema draft-07 also defines formats `iri`, `iri-reference`, `idn-hostname` and `idn-email` for URLs, hostnames and emails with international characters. Ajv does not implement these formats. If you create Ajv plugin that implements them please make a PR to mention this plugin here.
-There are two modes of format validation: `fast` and `full`. This mode affects formats `date`, `time`, `date-time`, `uri`, `uri-reference`, `email`, and `hostname`. See [Options](#options) for details.
+There are two modes of format validation: `fast` and `full`. This mode affects formats `date`, `time`, `date-time`, `uri`, `uri-reference`, and `email`. See [Options](#options) for details.
You can add additional formats and replace any of the formats above using [addFormat](#api-addformat) method.
@@ -1340,7 +1381,7 @@ If you have published a useful plugin please submit a PR to add it to the next s
- [ajv-keywords](https://github.com/epoberezkin/ajv-keywords) - plugin with custom validation keywords (select, typeof, etc.)
- [ajv-merge-patch](https://github.com/epoberezkin/ajv-merge-patch) - plugin with keywords $merge and $patch
- [ajv-pack](https://github.com/epoberezkin/ajv-pack) - produces a compact module exporting validation functions
-
+- [ajv-formats-draft2019](https://github.com/luzlab/ajv-formats-draft2019) - format validators for draft2019 that aren't already included in ajv (ie. `idn-hostname`, `idn-email`, `iri`, `iri-reference` and `duration`).
## Some packages using Ajv
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 157af21a92cda5..1c72a75ecfc321 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.0: Another JSON Schema Validator */
-!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{("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)*)*$/,f=/^#(?:\/(?:[a-z0-9_\-.!$&'()*+,;:=@]|%[0-9a-f]{2}|~0|~1)*)*$/i,p=/^(?: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":f,"relative-json-pointer":p},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":f,"relative-json-pointer":p};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 j=e("./resolve"),O=e("./util"),I=e("./error_classes"),A=e("fast-json-stable-stringify"),C=e("../dotjs/validate"),k=O.ucs2length,L=e("fast-deep-equal"),z=I.Validation;function T(e,r,t){var a=s.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})}}function q(e,r,t){var a=s.call(this,e,r,t);0<=a&&this._compilations.splice(a,1)}function s(e,r,t){for(var a=0;a",y=d?">":"<",g=void 0;if(m){var P=e.util.getData(p.$data,o,e.dataPathArr),E="exclusive"+s,w="exclType"+s,b="exclIsNumber"+s,S="' + "+(x="op"+s)+" + '";a+=" var schemaExcl"+s+" = "+P+"; ";var _;g=f;(_=_||[]).push(a+=" var "+E+"; var "+w+" = typeof "+(P="schemaExcl"+s)+"; if ("+w+" != 'boolean' && "+w+" != 'undefined' && "+w+" != 'number') { "),a="",!1!==e.createErrors?(a+=" { keyword: '"+(g||"_exclusiveLimit")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(l)+" , params: {} ",!1!==e.opts.messages&&(a+=" , message: '"+f+" should be boolean' "),e.opts.verbose&&(a+=" , schema: validate.schema"+n+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+u+" "),a+=" } "):a+=" {} ";var F=a;a=_.pop(),a+=!e.compositeRule&&c?e.async?" throw new ValidationError(["+F+"]); ":" validate.errors = ["+F+"]; return false; ":" var err = "+F+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",a+=" } else if ( ",h&&(a+=" ("+t+" !== undefined && typeof "+t+" != 'number') || "),a+=" "+w+" == 'number' ? ( ("+E+" = "+t+" === undefined || "+P+" "+v+"= "+t+") ? "+u+" "+y+"= "+P+" : "+u+" "+y+" "+t+" ) : ( ("+E+" = "+P+" === true) ? "+u+" "+y+"= "+t+" : "+u+" "+y+" "+t+" ) || "+u+" !== "+u+") { var op"+s+" = "+E+" ? '"+v+"' : '"+v+"='; ",void 0===i&&(l=e.errSchemaPath+"/"+(g=f),t=P,h=m)}else{S=v;if((b="number"==typeof p)&&h){var x="'"+S+"'";a+=" if ( ",h&&(a+=" ("+t+" !== undefined && typeof "+t+" != 'number') || "),a+=" ( "+t+" === undefined || "+p+" "+v+"= "+t+" ? "+u+" "+y+"= "+p+" : "+u+" "+y+" "+t+" ) || "+u+" !== "+u+") { "}else{b&&void 0===i?(E=!0,l=e.errSchemaPath+"/"+(g=f),t=p,y+="="):(b&&(t=Math[d?"min":"max"](p,i)),p===(!b||t)?(E=!0,l=e.errSchemaPath+"/"+(g=f),y+="="):(E=!1,S+="="));x="'"+S+"'";a+=" if ( ",h&&(a+=" ("+t+" !== undefined && typeof "+t+" != 'number') || "),a+=" "+u+" "+y+" "+t+" || "+u+" !== "+u+") { "}}g=g||r,(_=_||[]).push(a),a="",!1!==e.createErrors?(a+=" { keyword: '"+(g||"_limit")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(l)+" , params: { comparison: "+x+", limit: "+t+", exclusive: "+E+" } ",!1!==e.opts.messages&&(a+=" , message: 'should be "+S+" ",a+=h?"' + "+t:t+"'"),e.opts.verbose&&(a+=" , schema: ",a+=h?"validate.schema"+n:""+i,a+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+u+" "),a+=" } "):a+=" {} ";F=a;return a=_.pop(),a+=!e.compositeRule&&c?e.async?" throw new ValidationError(["+F+"]); ":" validate.errors = ["+F+"]; return false; ":" var err = "+F+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",a+=" } ",c&&(a+=" else { "),a}},{}],14:[function(e,r,t){"use strict";r.exports=function(e,r){var t,a=" ",s=e.level,o=e.dataLevel,i=e.schema[r],n=e.schemaPath+e.util.getProperty(r),l=e.errSchemaPath+"/"+r,c=!e.opts.allErrors,u="data"+(o||""),h=e.opts.$data&&i&&i.$data;t=h?(a+=" var schema"+s+" = "+e.util.getData(i.$data,o,e.dataPathArr)+"; ","schema"+s):i,a+="if ( ",h&&(a+=" ("+t+" !== undefined && typeof "+t+" != 'number') || ");var d=r,f=f||[];f.push(a+=" "+u+".length "+("maxItems"==r?">":"<")+" "+t+") { "),a="",!1!==e.createErrors?(a+=" { keyword: '"+(d||"_limitItems")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(l)+" , params: { limit: "+t+" } ",!1!==e.opts.messages&&(a+=" , message: 'should NOT have ",a+="maxItems"==r?"more":"fewer",a+=" than ",a+=h?"' + "+t+" + '":""+i,a+=" items' "),e.opts.verbose&&(a+=" , schema: ",a+=h?"validate.schema"+n:""+i,a+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+u+" "),a+=" } "):a+=" {} ";var p=a;return a=f.pop(),a+=!e.compositeRule&&c?e.async?" throw new ValidationError(["+p+"]); ":" validate.errors = ["+p+"]; return false; ":" var err = "+p+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",a+="} ",c&&(a+=" else { "),a}},{}],15:[function(e,r,t){"use strict";r.exports=function(e,r){var t,a=" ",s=e.level,o=e.dataLevel,i=e.schema[r],n=e.schemaPath+e.util.getProperty(r),l=e.errSchemaPath+"/"+r,c=!e.opts.allErrors,u="data"+(o||""),h=e.opts.$data&&i&&i.$data;t=h?(a+=" var schema"+s+" = "+e.util.getData(i.$data,o,e.dataPathArr)+"; ","schema"+s):i,a+="if ( ",h&&(a+=" ("+t+" !== undefined && typeof "+t+" != 'number') || "),a+=!1===e.opts.unicode?" "+u+".length ":" ucs2length("+u+") ";var d=r,f=f||[];f.push(a+=" "+("maxLength"==r?">":"<")+" "+t+") { "),a="",!1!==e.createErrors?(a+=" { keyword: '"+(d||"_limitLength")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(l)+" , params: { limit: "+t+" } ",!1!==e.opts.messages&&(a+=" , message: 'should NOT be ",a+="maxLength"==r?"longer":"shorter",a+=" than ",a+=h?"' + "+t+" + '":""+i,a+=" characters' "),e.opts.verbose&&(a+=" , schema: ",a+=h?"validate.schema"+n:""+i,a+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+u+" "),a+=" } "):a+=" {} ";var p=a;return a=f.pop(),a+=!e.compositeRule&&c?e.async?" throw new ValidationError(["+p+"]); ":" validate.errors = ["+p+"]; return false; ":" var err = "+p+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",a+="} ",c&&(a+=" else { "),a}},{}],16:[function(e,r,t){"use strict";r.exports=function(e,r){var t,a=" ",s=e.level,o=e.dataLevel,i=e.schema[r],n=e.schemaPath+e.util.getProperty(r),l=e.errSchemaPath+"/"+r,c=!e.opts.allErrors,u="data"+(o||""),h=e.opts.$data&&i&&i.$data;t=h?(a+=" var schema"+s+" = "+e.util.getData(i.$data,o,e.dataPathArr)+"; ","schema"+s):i,a+="if ( ",h&&(a+=" ("+t+" !== undefined && typeof "+t+" != 'number') || ");var d=r,f=f||[];f.push(a+=" Object.keys("+u+").length "+("maxProperties"==r?">":"<")+" "+t+") { "),a="",!1!==e.createErrors?(a+=" { keyword: '"+(d||"_limitProperties")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(l)+" , params: { limit: "+t+" } ",!1!==e.opts.messages&&(a+=" , message: 'should NOT have ",a+="maxProperties"==r?"more":"fewer",a+=" than ",a+=h?"' + "+t+" + '":""+i,a+=" properties' "),e.opts.verbose&&(a+=" , schema: ",a+=h?"validate.schema"+n:""+i,a+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+u+" "),a+=" } "):a+=" {} ";var p=a;return a=f.pop(),a+=!e.compositeRule&&c?e.async?" throw new ValidationError(["+p+"]); ":" validate.errors = ["+p+"]; return false; ":" var err = "+p+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",a+="} ",c&&(a+=" else { "),a}},{}],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 f,p=-1,m=d.length-1;p "+F+") { ";var $=c+"["+F+"]";d.schema=_,d.schemaPath=i+"["+F+"]",d.errSchemaPath=n+"/"+F,d.errorPath=e.util.getPathExpr(e.errorPath,F,e.opts.jsonPointers,!0),d.dataPathArr[v]=F;var R=e.validate(d);d.baseId=g,e.util.varOccurences(R,y)<2?t+=" "+e.util.varReplace(R,y,$)+" ":t+=" var "+y+" = "+$+"; "+R+" ",t+=" } ",l&&(t+=" if ("+p+") { ",f+="}")}if("object"==typeof P&&(e.opts.strictKeywords?"object"==typeof P&&0 "+o.length+") { for (var "+m+" = "+o.length+"; "+m+" < "+c+".length; "+m+"++) { ",d.errorPath=e.util.getPathExpr(e.errorPath,m,e.opts.jsonPointers,!0);$=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,$)+" ":t+=" var "+y+" = "+$+"; "+R+" ",l&&(t+=" if (!"+p+") break; "),t+=" } } ",l&&(t+=" if ("+p+") { ",f+="}")}}else if(e.opts.strictKeywords?"object"==typeof o&&0 1e-"+e.opts.multipleOfPrecision+" ":" division"+s+" !== parseInt(division"+s+") ",a+=" ) ",h&&(a+=" ) ");var d=d||[];d.push(a+=" ) { "),a="",!1!==e.createErrors?(a+=" { keyword: 'multipleOf' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(l)+" , params: { multipleOf: "+t+" } ",!1!==e.opts.messages&&(a+=" , message: 'should be multiple of ",a+=h?"' + "+t:t+"'"),e.opts.verbose&&(a+=" , schema: ",a+=h?"validate.schema"+n:""+i,a+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+u+" "),a+=" } "):a+=" {} ";var f=a;return a=d.pop(),a+=!e.compositeRule&&c?e.async?" throw new ValidationError(["+f+"]); ":" validate.errors = ["+f+"]; return false; ":" var err = "+f+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",a+="} ",c&&(a+=" else { "),a}},{}],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="valid"+h.level;if(e.opts.strictKeywords?"object"==typeof o&&0 1) { ";var f=e.schema.items&&e.schema.items.type,p=Array.isArray(f);if(!f||"object"==f||"array"==f||p&&(0<=f.indexOf("object")||0<=f.indexOf("array")))a+=" outer: for (;i--;) { for (j = i; j--;) { if (equal("+u+"[i], "+u+"[j])) { "+h+" = false; break outer; } } } ";else a+=" var itemIndices = {}, item; for (;i--;) { var item = "+u+"[i]; ",a+=" if ("+e.util["checkDataType"+(p?"s":"")](f,"item",!0)+") continue; ",p&&(a+=" if (typeof item == 'string') item = '\"' + item; "),a+=" if (typeof itemIndices[item] == 'number') { "+h+" = false; j = itemIndices[item]; break; } itemIndices[item] = i; } ";a+=" } ",d&&(a+=" } ");var m=m||[];m.push(a+=" if (!"+h+") { "),a="",!1!==e.createErrors?(a+=" { keyword: 'uniqueItems' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(l)+" , params: { i: i, j: j } ",!1!==e.opts.messages&&(a+=" , message: 'should NOT have duplicate items (items ## ' + j + ' and ' + i + ' are identical)' "),e.opts.verbose&&(a+=" , schema: ",a+=d?"validate.schema"+n:""+i,a+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+u+" "),a+=" } "):a+=" {} ";var v=a;a=m.pop(),a+=!e.compositeRule&&c?e.async?" throw new ValidationError(["+v+"]); ":" validate.errors = ["+v+"]; return false; ":" var err = "+v+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",a+=" } ",c&&(a+=" else { ")}else c&&(a+=" if (true) { ");return a}},{}],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,f=!a.opts.allErrors,p="data"+(c||""),m="valid"+l;if(!1===a.schema){a.isTop?f=!0:r+=" var "+m+" = false; ",(Z=Z||[]).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: "+p+" "),r+=" } "):r+=" {} ";var v=r;r=Z.pop(),r+=!a.compositeRule&&f?a.async?" throw new ValidationError(["+v+"]); ":" validate.errors = ["+v+"]; return false; ":" var err = "+v+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; "}else r+=a.isTop?t?" return data; ":" validate.errors = null; return true; ":" var "+m+" = true; ";return a.isTop&&(r+=" }; return validate; "),r}if(a.isTop){var y=a.isTop;l=a.level=0,c=a.dataLevel=0,p="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],void 0!==a.schema.default&&a.opts.useDefaults&&a.opts.strictDefaults){var g="default is ignored in the schema root";if("log"!==a.opts.strictDefaults)throw new Error(g);a.logger.warn(g)}r+=" var vErrors = null; ",r+=" var errors = 0; ",r+=" if (rootData === undefined) rootData = data; "}else{l=a.level,p="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;"}m="valid"+l,f=!a.opts.allErrors;var 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){if(a.opts.coerceTypes)var S=a.util.coerceToTypes(a.opts.coerceTypes,w);var _=a.RULES.types[w];if(S||b||!0===_||_&&!G(_)){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,p,!0)+") { ",S){var F="dataType"+l,x="coerced"+l;r+=" var "+F+" = typeof "+p+"; ","array"==a.opts.coerceTypes&&(r+=" if ("+F+" == 'object' && Array.isArray("+p+")) "+F+" = 'array'; "),r+=" var "+x+" = undefined; ";var $="",R=S;if(R)for(var D,j=-1,O=R.length-1;j= 0x80 (not a basic code point)","invalid-input":"Invalid input"},C=Math.floor,k=String.fromCharCode;function L(e){throw new RangeError(i[e])}function n(e,r){var t=e.split("@"),a="";return 1>1,e+=C(e/r);455C((A-s)/h))&&L("overflow"),s+=f*h;var p=d<=i?1:i+26<=d?26:d-i;if(fC(A/m)&&L("overflow"),h*=m}var v=t.length+1;i=q(s-u,v,0==u),C(s/v)>A-o&&L("overflow"),o+=C(s/v),s%=v,t.splice(s++,0,o)}return String.fromCodePoint.apply(String,t)}function c(e){var r=[],t=(e=z(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(k(h))}}catch(e){n=!0,l=e}finally{try{!i&&u.return&&u.return()}finally{if(n)throw l}}var d=r.length,f=d;for(d&&r.push("-");fC((A-s)/w)&&L("overflow"),s+=(p-a)*w,a=p;var b=!0,S=!1,_=void 0;try{for(var F,x=e[Symbol.iterator]();!(b=(F=x.next()).done);b=!0){var $=F.value;if($A&&L("overflow"),$==a){for(var R=s,D=36;;D+=36){var j=D<=o?1:o+26<=D?26:D-o;if(R>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 f(e){for(var r="",t=0,a=e.length;tA-Z\\x5E-\\x7E]",'[\\"\\\\]')),M=new RegExp(V,"g"),B=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"),G=new RegExp(J("[^]","[A-Za-z0-9\\!\\$\\%\\'\\*\\+\\-\\^\\_\\`\\{\\|\\}\\~]","[\\.]",'[\\"]',K),"g"),Y=new RegExp(J("[^]",V,"[\\!\\$\\'\\(\\)\\*\\+\\,\\;\\:\\@]"),"g"),W=Y;function X(e){var r=f(e);return r.match(M)?r:e}var ee={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-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)*)*$/,f=/^#(?:\/(?:[a-z0-9_\-.!$&'()*+,;:=@]|%[0-9a-f]{2}|~0|~1)*)*$/i,p=/^(?: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":f,"relative-json-pointer":p},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":f,"relative-json-pointer":p};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 $=e("./resolve"),R=e("./util"),D=e("./error_classes"),j=e("fast-json-stable-stringify"),O=e("../dotjs/validate"),I=R.ucs2length,A=e("fast-deep-equal"),C=D.Validation;function k(e,c,u,r){var d=this,f=this._opts,h=[void 0],p={},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:p},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,f.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 k.call(d,e,r,t,a);var o,i=!0===e.$async,n=O({isTop:!0,schema:e,isRoot:s,baseId:a,root:r,schemaPath:"",errSchemaPath:"#",errorPath:'""',MissingRefError:D.MissingRef,RULES:g,validate:O,util:R,resolve:$,resolveRef:w,usePattern:_,useDefault:F,useCustomRule:x,opts:f,formats:y,logger:d.logger,self:d});n=Q(h,q)+Q(l,z)+Q(m,T)+Q(v,N)+n,f.processCode&&(n=f.processCode(n));try{o=new Function("self","RULES","formats","root","refVal","defaults","customRules","equal","ucs2length","ValidationError",n)(d,g,y,c,h,m,v,A,I,C),h[0]=o}catch(e){throw d.logger.error("Error compiling schema, function code:",n),e}return o.schema=e,o.errors=null,o.refs=p,o.refVal=h,o.root=s?o:r,i&&(o.$async=!0),!0===f.sourceCode&&(o.source={code:n,patterns:l,defaults:m}),o}function w(e,r,t){r=$.url(e,r);var a,s,o=p[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=$.call(d,E,c,r);if(void 0===n){var l=u&&u[r];l&&(n=$.inlineRef(l,f.inlineRefs)?l:k.call(d,l,c,u,e))}if(void 0!==n)return h[p[r]]=n,S(n,s);delete p[r]}function b(e,r){var t=h.length;return h[t]=r,"refVal"+(p[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 R.toQuotedString(e);case"object":if(null===e)return"null";var r=j(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!==f.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",y=d?">":"<",g=void 0;if(m){var P=e.util.getData(p.$data,o,e.dataPathArr),E="exclusive"+s,w="exclType"+s,b="exclIsNumber"+s,S="' + "+(x="op"+s)+" + '";a+=" var schemaExcl"+s+" = "+P+"; ";var _;g=f;(_=_||[]).push(a+=" var "+E+"; var "+w+" = typeof "+(P="schemaExcl"+s)+"; if ("+w+" != 'boolean' && "+w+" != 'undefined' && "+w+" != 'number') { "),a="",!1!==e.createErrors?(a+=" { keyword: '"+(g||"_exclusiveLimit")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(l)+" , params: {} ",!1!==e.opts.messages&&(a+=" , message: '"+f+" should be boolean' "),e.opts.verbose&&(a+=" , schema: validate.schema"+n+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+u+" "),a+=" } "):a+=" {} ";var F=a;a=_.pop(),a+=!e.compositeRule&&c?e.async?" throw new ValidationError(["+F+"]); ":" validate.errors = ["+F+"]; return false; ":" var err = "+F+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",a+=" } else if ( ",h&&(a+=" ("+t+" !== undefined && typeof "+t+" != 'number') || "),a+=" "+w+" == 'number' ? ( ("+E+" = "+t+" === undefined || "+P+" "+v+"= "+t+") ? "+u+" "+y+"= "+P+" : "+u+" "+y+" "+t+" ) : ( ("+E+" = "+P+" === true) ? "+u+" "+y+"= "+t+" : "+u+" "+y+" "+t+" ) || "+u+" !== "+u+") { var op"+s+" = "+E+" ? '"+v+"' : '"+v+"='; ",void 0===i&&(l=e.errSchemaPath+"/"+(g=f),t=P,h=m)}else{S=v;if((b="number"==typeof p)&&h){var x="'"+S+"'";a+=" if ( ",h&&(a+=" ("+t+" !== undefined && typeof "+t+" != 'number') || "),a+=" ( "+t+" === undefined || "+p+" "+v+"= "+t+" ? "+u+" "+y+"= "+p+" : "+u+" "+y+" "+t+" ) || "+u+" !== "+u+") { "}else{b&&void 0===i?(E=!0,l=e.errSchemaPath+"/"+(g=f),t=p,y+="="):(b&&(t=Math[d?"min":"max"](p,i)),p===(!b||t)?(E=!0,l=e.errSchemaPath+"/"+(g=f),y+="="):(E=!1,S+="="));x="'"+S+"'";a+=" if ( ",h&&(a+=" ("+t+" !== undefined && typeof "+t+" != 'number') || "),a+=" "+u+" "+y+" "+t+" || "+u+" !== "+u+") { "}}g=g||r,(_=_||[]).push(a),a="",!1!==e.createErrors?(a+=" { keyword: '"+(g||"_limit")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(l)+" , params: { comparison: "+x+", limit: "+t+", exclusive: "+E+" } ",!1!==e.opts.messages&&(a+=" , message: 'should be "+S+" ",a+=h?"' + "+t:t+"'"),e.opts.verbose&&(a+=" , schema: ",a+=h?"validate.schema"+n:""+i,a+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+u+" "),a+=" } "):a+=" {} ";F=a;return a=_.pop(),a+=!e.compositeRule&&c?e.async?" throw new ValidationError(["+F+"]); ":" validate.errors = ["+F+"]; return false; ":" var err = "+F+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",a+=" } ",c&&(a+=" else { "),a}},{}],14:[function(e,r,t){"use strict";r.exports=function(e,r){var t,a=" ",s=e.level,o=e.dataLevel,i=e.schema[r],n=e.schemaPath+e.util.getProperty(r),l=e.errSchemaPath+"/"+r,c=!e.opts.allErrors,u="data"+(o||""),h=e.opts.$data&&i&&i.$data;t=h?(a+=" var schema"+s+" = "+e.util.getData(i.$data,o,e.dataPathArr)+"; ","schema"+s):i,a+="if ( ",h&&(a+=" ("+t+" !== undefined && typeof "+t+" != 'number') || ");var d=r,f=f||[];f.push(a+=" "+u+".length "+("maxItems"==r?">":"<")+" "+t+") { "),a="",!1!==e.createErrors?(a+=" { keyword: '"+(d||"_limitItems")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(l)+" , params: { limit: "+t+" } ",!1!==e.opts.messages&&(a+=" , message: 'should NOT have ",a+="maxItems"==r?"more":"fewer",a+=" than ",a+=h?"' + "+t+" + '":""+i,a+=" items' "),e.opts.verbose&&(a+=" , schema: ",a+=h?"validate.schema"+n:""+i,a+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+u+" "),a+=" } "):a+=" {} ";var p=a;return a=f.pop(),a+=!e.compositeRule&&c?e.async?" throw new ValidationError(["+p+"]); ":" validate.errors = ["+p+"]; return false; ":" var err = "+p+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",a+="} ",c&&(a+=" else { "),a}},{}],15:[function(e,r,t){"use strict";r.exports=function(e,r){var t,a=" ",s=e.level,o=e.dataLevel,i=e.schema[r],n=e.schemaPath+e.util.getProperty(r),l=e.errSchemaPath+"/"+r,c=!e.opts.allErrors,u="data"+(o||""),h=e.opts.$data&&i&&i.$data;t=h?(a+=" var schema"+s+" = "+e.util.getData(i.$data,o,e.dataPathArr)+"; ","schema"+s):i,a+="if ( ",h&&(a+=" ("+t+" !== undefined && typeof "+t+" != 'number') || "),a+=!1===e.opts.unicode?" "+u+".length ":" ucs2length("+u+") ";var d=r,f=f||[];f.push(a+=" "+("maxLength"==r?">":"<")+" "+t+") { "),a="",!1!==e.createErrors?(a+=" { keyword: '"+(d||"_limitLength")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(l)+" , params: { limit: "+t+" } ",!1!==e.opts.messages&&(a+=" , message: 'should NOT be ",a+="maxLength"==r?"longer":"shorter",a+=" than ",a+=h?"' + "+t+" + '":""+i,a+=" characters' "),e.opts.verbose&&(a+=" , schema: ",a+=h?"validate.schema"+n:""+i,a+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+u+" "),a+=" } "):a+=" {} ";var p=a;return a=f.pop(),a+=!e.compositeRule&&c?e.async?" throw new ValidationError(["+p+"]); ":" validate.errors = ["+p+"]; return false; ":" var err = "+p+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",a+="} ",c&&(a+=" else { "),a}},{}],16:[function(e,r,t){"use strict";r.exports=function(e,r){var t,a=" ",s=e.level,o=e.dataLevel,i=e.schema[r],n=e.schemaPath+e.util.getProperty(r),l=e.errSchemaPath+"/"+r,c=!e.opts.allErrors,u="data"+(o||""),h=e.opts.$data&&i&&i.$data;t=h?(a+=" var schema"+s+" = "+e.util.getData(i.$data,o,e.dataPathArr)+"; ","schema"+s):i,a+="if ( ",h&&(a+=" ("+t+" !== undefined && typeof "+t+" != 'number') || ");var d=r,f=f||[];f.push(a+=" Object.keys("+u+").length "+("maxProperties"==r?">":"<")+" "+t+") { "),a="",!1!==e.createErrors?(a+=" { keyword: '"+(d||"_limitProperties")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(l)+" , params: { limit: "+t+" } ",!1!==e.opts.messages&&(a+=" , message: 'should NOT have ",a+="maxProperties"==r?"more":"fewer",a+=" than ",a+=h?"' + "+t+" + '":""+i,a+=" properties' "),e.opts.verbose&&(a+=" , schema: ",a+=h?"validate.schema"+n:""+i,a+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+u+" "),a+=" } "):a+=" {} ";var p=a;return a=f.pop(),a+=!e.compositeRule&&c?e.async?" throw new ValidationError(["+p+"]); ":" validate.errors = ["+p+"]; return false; ":" var err = "+p+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",a+="} ",c&&(a+=" else { "),a}},{}],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 f,p=-1,m=d.length-1;p "+F+") { ";var $=c+"["+F+"]";d.schema=_,d.schemaPath=i+"["+F+"]",d.errSchemaPath=n+"/"+F,d.errorPath=e.util.getPathExpr(e.errorPath,F,e.opts.jsonPointers,!0),d.dataPathArr[v]=F;var R=e.validate(d);d.baseId=g,e.util.varOccurences(R,y)<2?t+=" "+e.util.varReplace(R,y,$)+" ":t+=" var "+y+" = "+$+"; "+R+" ",t+=" } ",l&&(t+=" if ("+p+") { ",f+="}")}if("object"==typeof P&&(e.opts.strictKeywords?"object"==typeof P&&0 "+o.length+") { for (var "+m+" = "+o.length+"; "+m+" < "+c+".length; "+m+"++) { ",d.errorPath=e.util.getPathExpr(e.errorPath,m,e.opts.jsonPointers,!0);$=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,$)+" ":t+=" var "+y+" = "+$+"; "+R+" ",l&&(t+=" if (!"+p+") break; "),t+=" } } ",l&&(t+=" if ("+p+") { ",f+="}")}}else if(e.opts.strictKeywords?"object"==typeof o&&0 1e-"+e.opts.multipleOfPrecision+" ":" division"+s+" !== parseInt(division"+s+") ",a+=" ) ",h&&(a+=" ) ");var d=d||[];d.push(a+=" ) { "),a="",!1!==e.createErrors?(a+=" { keyword: 'multipleOf' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(l)+" , params: { multipleOf: "+t+" } ",!1!==e.opts.messages&&(a+=" , message: 'should be multiple of ",a+=h?"' + "+t:t+"'"),e.opts.verbose&&(a+=" , schema: ",a+=h?"validate.schema"+n:""+i,a+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+u+" "),a+=" } "):a+=" {} ";var f=a;return a=d.pop(),a+=!e.compositeRule&&c?e.async?" throw new ValidationError(["+f+"]); ":" validate.errors = ["+f+"]; return false; ":" var err = "+f+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",a+="} ",c&&(a+=" else { "),a}},{}],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="valid"+h.level;if(e.opts.strictKeywords?"object"==typeof o&&0 1) { ";var f=e.schema.items&&e.schema.items.type,p=Array.isArray(f);if(!f||"object"==f||"array"==f||p&&(0<=f.indexOf("object")||0<=f.indexOf("array")))a+=" outer: for (;i--;) { for (j = i; j--;) { if (equal("+u+"[i], "+u+"[j])) { "+h+" = false; break outer; } } } ";else a+=" var itemIndices = {}, item; for (;i--;) { var item = "+u+"[i]; ",a+=" if ("+e.util["checkDataType"+(p?"s":"")](f,"item",!0)+") continue; ",p&&(a+=" if (typeof item == 'string') item = '\"' + item; "),a+=" if (typeof itemIndices[item] == 'number') { "+h+" = false; j = itemIndices[item]; break; } itemIndices[item] = i; } ";a+=" } ",d&&(a+=" } ");var m=m||[];m.push(a+=" if (!"+h+") { "),a="",!1!==e.createErrors?(a+=" { keyword: 'uniqueItems' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(l)+" , params: { i: i, j: j } ",!1!==e.opts.messages&&(a+=" , message: 'should NOT have duplicate items (items ## ' + j + ' and ' + i + ' are identical)' "),e.opts.verbose&&(a+=" , schema: ",a+=d?"validate.schema"+n:""+i,a+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+u+" "),a+=" } "):a+=" {} ";var v=a;a=m.pop(),a+=!e.compositeRule&&c?e.async?" throw new ValidationError(["+v+"]); ":" validate.errors = ["+v+"]; return false; ":" var err = "+v+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",a+=" } ",c&&(a+=" else { ")}else c&&(a+=" if (true) { ");return a}},{}],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,f=!a.opts.allErrors,p="data"+(c||""),m="valid"+l;if(!1===a.schema){a.isTop?f=!0:r+=" var "+m+" = false; ",(Z=Z||[]).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: "+p+" "),r+=" } "):r+=" {} ";var v=r;r=Z.pop(),r+=!a.compositeRule&&f?a.async?" throw new ValidationError(["+v+"]); ":" validate.errors = ["+v+"]; return false; ":" var err = "+v+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; "}else r+=a.isTop?t?" return data; ":" validate.errors = null; return true; ":" var "+m+" = true; ";return a.isTop&&(r+=" }; return validate; "),r}if(a.isTop){var y=a.isTop;l=a.level=0,c=a.dataLevel=0,p="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],void 0!==a.schema.default&&a.opts.useDefaults&&a.opts.strictDefaults){var g="default is ignored in the schema root";if("log"!==a.opts.strictDefaults)throw new Error(g);a.logger.warn(g)}r+=" var vErrors = null; ",r+=" var errors = 0; ",r+=" if (rootData === undefined) rootData = data; "}else{l=a.level,p="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;"}m="valid"+l,f=!a.opts.allErrors;var 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){if(a.opts.coerceTypes)var S=a.util.coerceToTypes(a.opts.coerceTypes,w);var _=a.RULES.types[w];if(S||b||!0===_||_&&!G(_)){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,p,!0)+") { ",S){var F="dataType"+l,x="coerced"+l;r+=" var "+F+" = typeof "+p+"; ","array"==a.opts.coerceTypes&&(r+=" if ("+F+" == 'object' && Array.isArray("+p+")) "+F+" = 'array'; "),r+=" var "+x+" = undefined; ";var $="",R=S;if(R)for(var D,j=-1,O=R.length-1;j= 0x80 (not a basic code point)","invalid-input":"Invalid input"},C=Math.floor,k=String.fromCharCode;function L(e){throw new RangeError(i[e])}function n(e,r){var t=e.split("@"),a="";return 1>1,e+=C(e/r);455C((A-s)/h))&&L("overflow"),s+=f*h;var p=d<=i?1:i+26<=d?26:d-i;if(fC(A/m)&&L("overflow"),h*=m}var v=t.length+1;i=q(s-u,v,0==u),C(s/v)>A-o&&L("overflow"),o+=C(s/v),s%=v,t.splice(s++,0,o)}return String.fromCodePoint.apply(String,t)}function c(e){var r=[],t=(e=z(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(k(h))}}catch(e){n=!0,l=e}finally{try{!i&&u.return&&u.return()}finally{if(n)throw l}}var d=r.length,f=d;for(d&&r.push("-");fC((A-s)/w)&&L("overflow"),s+=(p-a)*w,a=p;var b=!0,S=!1,_=void 0;try{for(var F,x=e[Symbol.iterator]();!(b=(F=x.next()).done);b=!0){var $=F.value;if($A&&L("overflow"),$==a){for(var R=s,D=36;;D+=36){var j=D<=o?1:o+26<=D?26:D-o;if(R>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 f(e){for(var r="",t=0,a=e.length;tA-Z\\x5E-\\x7E]",'[\\"\\\\]')),M=new RegExp(V,"g"),B=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"),G=new RegExp(J("[^]","[A-Za-z0-9\\!\\$\\%\\'\\*\\+\\-\\^\\_\\`\\{\\|\\}\\~]","[\\.]",'[\\"]',K),"g"),Y=new RegExp(J("[^]",V,"[\\!\\$\\'\\(\\)\\*\\+\\,\\;\\:\\@]"),"g"),W=Y;function X(e){var r=f(e);return r.match(M)?r:e}var ee={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=8"
+ "node": ">=10"
},
"files": [
"source",
"index.d.ts"
],
+ "funding": "https://github.com/chalk/chalk?sponsor=1",
"homepage": "https://github.com/chalk/chalk#readme",
"keywords": [
"color",
@@ -62,11 +63,15 @@
"bench": "matcha benchmark.js",
"test": "xo && nyc ava && tsd"
},
- "version": "3.0.0",
+ "version": "4.0.0",
"xo": {
"rules": {
"unicorn/prefer-string-slice": "off",
- "unicorn/prefer-includes": "off"
+ "unicorn/prefer-includes": "off",
+ "@typescript-eslint/member-ordering": "off",
+ "no-redeclare": "off",
+ "unicorn/string-content": "off",
+ "unicorn/better-regex": "off"
}
}
}
\ No newline at end of file
diff --git a/tools/node_modules/eslint/node_modules/chalk/readme.md b/tools/node_modules/eslint/node_modules/chalk/readme.md
index 877cb93b7861f7..a0ca245604033b 100644
--- a/tools/node_modules/eslint/node_modules/chalk/readme.md
+++ b/tools/node_modules/eslint/node_modules/chalk/readme.md
@@ -9,11 +9,10 @@
> Terminal string styling done right
-[![Build Status](https://travis-ci.org/chalk/chalk.svg?branch=master)](https://travis-ci.org/chalk/chalk) [![Coverage Status](https://coveralls.io/repos/github/chalk/chalk/badge.svg?branch=master)](https://coveralls.io/github/chalk/chalk?branch=master) [![npm dependents](https://badgen.net/npm/dependents/chalk)](https://www.npmjs.com/package/chalk?activeTab=dependents) [![Downloads](https://badgen.net/npm/dt/chalk)](https://www.npmjs.com/package/chalk) [![](https://img.shields.io/badge/unicorn-approved-ff69b4.svg)](https://www.youtube.com/watch?v=9auOCbH5Ns4) [![XO code style](https://img.shields.io/badge/code_style-XO-5ed9c7.svg)](https://github.com/xojs/xo) ![TypeScript-ready](https://img.shields.io/npm/types/chalk.svg)
+[![Build Status](https://travis-ci.org/chalk/chalk.svg?branch=master)](https://travis-ci.org/chalk/chalk) [![Coverage Status](https://coveralls.io/repos/github/chalk/chalk/badge.svg?branch=master)](https://coveralls.io/github/chalk/chalk?branch=master) [![npm dependents](https://badgen.net/npm/dependents/chalk)](https://www.npmjs.com/package/chalk?activeTab=dependents) [![Downloads](https://badgen.net/npm/dt/chalk)](https://www.npmjs.com/package/chalk) [![](https://img.shields.io/badge/unicorn-approved-ff69b4.svg)](https://www.youtube.com/watch?v=9auOCbH5Ns4) [![XO code style](https://img.shields.io/badge/code_style-XO-5ed9c7.svg)](https://github.com/xojs/xo) ![TypeScript-ready](https://img.shields.io/npm/types/chalk.svg) [![run on repl.it](http://repl.it/badge/github/chalk/chalk)](https://repl.it/github/chalk/chalk)
-
## Highlights
- Expressive API
@@ -24,8 +23,7 @@
- Doesn't extend `String.prototype`
- Clean and focused
- Actively maintained
-- [Used by ~46,000 packages](https://www.npmjs.com/browse/depended/chalk) as of October 1, 2019
-
+- [Used by ~50,000 packages](https://www.npmjs.com/browse/depended/chalk) as of January 1, 2020
## Install
@@ -33,7 +31,6 @@
$ npm install chalk
```
-
## Usage
```js
@@ -107,7 +104,6 @@ console.log(chalk.green('Hello %s'), name);
//=> 'Hello Sindre'
```
-
## API
### chalk.`