📄 deprecation-warnings¶
📊 Analysis Summary¶
| Metric | Count |
|---|---|
| 🔧 Functions | 1 |
| 📦 Imports | 1 |
| 📊 Variables & Constants | 2 |
📚 Table of Contents¶
🛠️ File Location:¶
📂 packages/rule-tester/src/utils/deprecation-warnings.ts
📦 Imports¶
| Name | Source |
|---|---|
path |
node:path |
Variables & Constants¶
| Name | Type | Kind | Value | Exported |
|---|---|---|---|---|
deprecationWarningMessages |
{ readonly ESLINT_LEGACY_ECMAFEATURES... |
const | { ESLINT_LEGACY_ECMAFEATURES: "The 'ecmaFeatures' config file property is dep... |
✗ |
sourceFileErrorCache |
Set<string> |
const | new Set<string>() |
✗ |
Functions¶
emitDeprecationWarning(source: string, errorCode: keyof typeof deprecationWarningMessages): void¶
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.
Parameters:
sourceany: The name of the configuration source to report the warning for.errorCodeany: The warning message to show.
Raw JSDoc
/**
* 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 source The name of the configuration source to report the warning for.
* @param errorCode The warning message to show.
*/
Calls:
JSON.stringifysourceFileErrorCache.hassourceFileErrorCache.addpath.relativeprocess.cwdprocess.emitWarning
Code
export function emitDeprecationWarning(
source: string,
errorCode: keyof typeof deprecationWarningMessages,
): void {
const cacheKey = JSON.stringify({ errorCode, source });
if (sourceFileErrorCache.has(cacheKey)) {
return;
}
sourceFileErrorCache.add(cacheKey);
const rel = path.relative(process.cwd(), source);
const message = deprecationWarningMessages[errorCode];
process.emitWarning(
`${message} (found in "${rel}")`,
'DeprecationWarning',
errorCode,
);
}
Generated by Syntax Scribe