+/*
+ * STOP!!! DO NOT MODIFY.
+ *
+ * This file is part of the ongoing work to move the eslintrc-style config
+ * system into the @eslint/eslintrc package. This file needs to remain
+ * unchanged in order for this work to proceed.
+ *
+ * If you think you need to change this file, please contact @nzakas first.
+ *
+ * Thanks in advance for your cooperation.
+ */
+
/**
* @fileoverview Validates configs.
* @author Brandon Mills
//------------------------------------------------------------------------------
const
- path = require("path"),
util = require("util"),
- lodash = require("lodash"),
configSchema = require("../../conf/config-schema"),
- BuiltInEnvironments = require("../../conf/environments"),
+ BuiltInEnvironments = require("@eslint/eslintrc/conf/environments"),
BuiltInRules = require("../rules"),
- ConfigOps = require("./config-ops");
+ ConfigOps = require("@eslint/eslintrc/lib/shared/config-ops"),
+ { emitDeprecationWarning } = require("./deprecation-warnings");
const ajv = require("./ajv")();
const ruleValidators = new WeakMap();
// Private
//------------------------------------------------------------------------------
let validateSchema;
-
-// Defitions for deprecation warnings.
-const deprecationWarningMessages = {
- ESLINT_LEGACY_ECMAFEATURES: "The 'ecmaFeatures' config file property is deprecated, and has no effect."
-};
const severityMap = {
error: 2,
warn: 1,
/**
* Validates a `globals` section of a config file
- * @param {Object} globalsConfig The `glboals` section
+ * @param {Object} globalsConfig The `globals` section
* @param {string|null} source The name of the configuration source to report in the event of an error.
* @returns {void}
*/
}).map(message => `\t- ${message}.\n`).join("");
}
-/**
- * Emits a deprecation warning containing a given filepath. A new deprecation warning is emitted
- * for each unique file path, but repeated invocations with the same file path have no effect.
- * No warnings are emitted if the `--no-deprecation` or `--no-warnings` Node runtime flags are active.
- * @param {string} source The name of the configuration source to report the warning for.
- * @param {string} errorCode The warning message to show.
- * @returns {void}
- */
-const emitDeprecationWarning = lodash.memoize((source, errorCode) => {
- const rel = path.relative(process.cwd(), source);
- const message = deprecationWarningMessages[errorCode];
-
- process.emitWarning(
- `${message} (found in "${rel}")`,
- "DeprecationWarning",
- errorCode
- );
-});
-
/**
* Validates the top level properties of the config object.
* @param {Object} config The config object to validate.