Repository: eslint/eslint
File: lib/config/rule-validator.js (JavaScript)

Code before:
        const replacementRuleName = ruleReplacements.rules[ruleName];

        if (pluginName === "@" && replacementRuleName) {

            errorMessage = `${errorMessageHeader}: Rule "${ruleName}" was removed and replaced by "${replacementRuleName}".`;

        } else {

            errorMessage = `${errorMessageHeader}: Could not find "${ruleName}" in plugin "${pluginName}".`;

            // otherwise, let's see if we can find the rule name elsewhere
            for (const [otherPluginName, otherPlugin] of Object.entries(config.plugins)) {
                if (otherPlugin.rules && otherPlugin.rules[ruleName]) {
                    errorMessage += ` Did you mean "${otherPluginName}/${ruleName}"?`;
                    break;
                }
            }

        }

        // falls through to throw error
    }

    const error = new TypeError(errorMessage);

    if (errorMessage === missingPluginError) {
        error.messageTemplate = "config-plugin-missing";
        error.messageData = { pluginName, ruleId };
    }

    throw error;
}

/**
 * The error type when a rule has an invalid `meta.schema`.
 */
class InvalidRuleOptionsSchemaError extends Error {

    /**
     * Creates a new instance.
     * @param {string} ruleId Id of the rule that has an invalid `meta.schema`.
     * @param {Error} processingError Error caught while processing the `meta.schema`.
     */
    constructor(ruleId, processingError) {
        super(
            `Error while processing options validation schema of rule '${ruleId}': ${processingError.message}`,
            { cause: processingError }
        );
        this.code = "ESLINT_INVALID_RULE_OPTIONS_SCHEMA";
    }
}

Review comment (suggestion):
```suggestion
    if (errorMessage === missingPluginErrorMessage) {
```

Code after:
        const replacementRuleName = ruleReplacements.rules[ruleName];

        if (pluginName === "@" && replacementRuleName) {

            errorMessage = `${errorMessageHeader}: Rule "${ruleName}" was removed and replaced by "${replacementRuleName}".`;

        } else {

            errorMessage = `${errorMessageHeader}: Could not find "${ruleName}" in plugin "${pluginName}".`;

            // otherwise, let's see if we can find the rule name elsewhere
            for (const [otherPluginName, otherPlugin] of Object.entries(config.plugins)) {
                if (otherPlugin.rules && otherPlugin.rules[ruleName]) {
                    errorMessage += ` Did you mean "${otherPluginName}/${ruleName}"?`;
                    break;
                }
            }

        }

        // falls through to throw error
    }

    const error = new TypeError(errorMessage);

    if (errorMessage === missingPluginErrorMessage) {
        error.messageTemplate = "config-plugin-missing";
        error.messageData = { pluginName, ruleId };
    }

    throw error;
}

/**
 * The error type when a rule has an invalid `meta.schema`.
 */
class InvalidRuleOptionsSchemaError extends Error {

    /**
     * Creates a new instance.
     * @param {string} ruleId Id of the rule that has an invalid `meta.schema`.
     * @param {Error} processingError Error caught while processing the `meta.schema`.
     */
    constructor(ruleId, processingError) {
        super(
            `Error while processing options validation schema of rule '${ruleId}': ${processingError.message}`,
            { cause: processingError }
        );
        this.code = "ESLINT_INVALID_RULE_OPTIONS_SCHEMA";
    }
}