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

Code before:
            return ast;
        }
    };
}

/**
 * Function to replace `SourceCode.prototype.getComments`.
 * @returns {void}
 * @throws {Error} Deprecation message.
 */
function getCommentsDeprecation() {
    throw new Error(
        "`SourceCode#getComments()` is deprecated and will be removed in a future major version. Use `getCommentsBefore()`, `getCommentsAfter()`, and `getCommentsInside()` instead."
    );
}

/**
 * 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

Review comment (suggestion):
```suggestion
            `"${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`,
```

Code after:
            return ast;
        }
    };
}

/**
 * Function to replace `SourceCode.prototype.getComments`.
 * @returns {void}
 * @throws {Error} Deprecation message.
 */
function getCommentsDeprecation() {
    throw new Error(
        "`SourceCode#getComments()` is deprecated and will be removed in a future major version. Use `getCommentsBefore()`, `getCommentsAfter()`, and `getCommentsInside()` instead."
    );
}

/**
 * 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