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

Code before:

/**
 * Emit a deprecation warning if function-style format is being used.
 * @param {string} ruleName Name of the rule.
 * @returns {void}
 */
function emitLegacyRuleAPIWarning(ruleName) {
    if (!emitLegacyRuleAPIWarning[`warned-${ruleName}`]) {
        emitLegacyRuleAPIWarning[`warned-${ruleName}`] = true;
        process.emitWarning(
            `"${ruleName}" rule is using the deprecated function-style format and will stop working in ESLint v9. Please use object-style format: https://eslint.org/docs/extend/custom-rules`,
            "DeprecationWarning"
        );
    }
}

/**
 * Emit a deprecation warning if rule has options but is missing the "meta.schema" property
 * @param {string} ruleName Name of the rule.
 * @returns {void}
 */
function emitMissingSchemaWarning(ruleName) {
    if (!emitMissingSchemaWarning[`warned-${ruleName}`]) {
        emitMissingSchemaWarning[`warned-${ruleName}`] = true;
        process.emitWarning(
            `"${ruleName}" rule has options but is missing the "meta.schema" property and will stop working in ESLint v9. Please add a schema: https://eslint.org/docs/extend/custom-rules#options-schemas`,
            "DeprecationWarning"
        );
    }
}

//------------------------------------------------------------------------------
// Public Interface
//------------------------------------------------------------------------------

// default separators for testing
const DESCRIBE = Symbol("describe");
const IT = Symbol("it");
const IT_ONLY = Symbol("itOnly");

/**
 * This is `it` default handler if `it` don't exist.
 * @this {Mocha}
 * @param {string} text The description of the test case.
 * @param {Function} method The logic of the test case.
 * @throws {Error} Any error upon execution of `method`.
 * @returns {any} Returned value of `method`.
 */
function itDefaultHandler(text, method) {
    try {
        return method.call(this);

Review comment (suggestion):
```suggestion
            `"${ruleName}" rule has options but is missing the "meta.schema" property and will stop working in ESLint v9. Please add a schema: https://eslint.org/docs/latest/extend/custom-rules#options-schemas`,
```

Code after:

/**
 * Emit a deprecation warning if function-style format is being used.
 * @param {string} ruleName Name of the rule.
 * @returns {void}
 */
function emitLegacyRuleAPIWarning(ruleName) {
    if (!emitLegacyRuleAPIWarning[`warned-${ruleName}`]) {
        emitLegacyRuleAPIWarning[`warned-${ruleName}`] = true;
        process.emitWarning(
            `"${ruleName}" rule is using the deprecated function-style format and will stop working in ESLint v9. Please use object-style format: https://eslint.org/docs/latest/extend/custom-rules`,
            "DeprecationWarning"
        );
    }
}

/**
 * Emit a deprecation warning if rule has options but is missing the "meta.schema" property
 * @param {string} ruleName Name of the rule.
 * @returns {void}
 */
function emitMissingSchemaWarning(ruleName) {
    if (!emitMissingSchemaWarning[`warned-${ruleName}`]) {
        emitMissingSchemaWarning[`warned-${ruleName}`] = true;
        process.emitWarning(
            `"${ruleName}" rule has options but is missing the "meta.schema" property and will stop working in ESLint v9. Please add a schema: https://eslint.org/docs/latest/extend/custom-rules#options-schemas`,
            "DeprecationWarning"
        );
    }
}

//------------------------------------------------------------------------------
// Public Interface
//------------------------------------------------------------------------------

// default separators for testing
const DESCRIBE = Symbol("describe");
const IT = Symbol("it");
const IT_ONLY = Symbol("itOnly");

/**
 * This is `it` default handler if `it` don't exist.
 * @this {Mocha}
 * @param {string} text The description of the test case.
 * @param {Function} method The logic of the test case.
 * @throws {Error} Any error upon execution of `method`.
 * @returns {any} Returned value of `method`.
 */
function itDefaultHandler(text, method) {
    try {
        return method.call(this);