mirror of
https://github.com/react/react-native-devtools-frontend.git
synced 2026-09-30 01:07:01 +08:00
Add one more deps "@typescript-eslint/utils" to top level to be used in our own custom rules (also needed override if I didn't). Bug: none Change-Id: I130415d1ec5f096ca51200df3eb688dadd963d0f Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/6343232 Reviewed-by: Benedikt Meurer <bmeurer@chromium.org> Commit-Queue: Nikolay Vitkov <nvitkov@chromium.org>
55 lines
1.3 KiB
JavaScript
55 lines
1.3 KiB
JavaScript
// NOTICE: This file is generated by Rollup. To modify it,
|
|
// please instead edit the ESM counterpart and rebuild with Rollup (npm run build).
|
|
'use strict';
|
|
|
|
const process = require('node:process');
|
|
|
|
// Each code must be unique.
|
|
const CODES = {
|
|
COMMONJS_PLUGINS: '001',
|
|
COMMONJS_NODEJS_API: '002',
|
|
RESULT_OUTPUT_PROPERTY: '003',
|
|
GITHUB_FORMATTER: '004',
|
|
CONTEXT_FIX: '005',
|
|
RULE: '006', // either removal or renaming
|
|
REPORT_AMBIGUOUS_POSITION: '007',
|
|
};
|
|
|
|
const emittedWarnings = new Set();
|
|
|
|
/**
|
|
* Use this function for deprecation warnings, instead of `process.emitWarning()`.
|
|
*
|
|
* @param {string} message
|
|
* @param {keyof CODES} codeKey
|
|
* @param {string} detail
|
|
* @returns {void}
|
|
*/
|
|
function emitDeprecationWarning(message, codeKey, detail) {
|
|
const code = CODES[codeKey];
|
|
|
|
const key = JSON.stringify({
|
|
message,
|
|
options: { type: 'DeprecationWarning', code: `stylelint:${code}`, detail },
|
|
});
|
|
|
|
if (emittedWarnings.has(key)) return;
|
|
|
|
emittedWarnings.add(key);
|
|
|
|
process.emitWarning(message, { type: 'DeprecationWarning', code: `stylelint:${code}`, detail });
|
|
}
|
|
|
|
/**
|
|
* Clear the already emitted deprecation warnings.
|
|
* Only useful in tests.
|
|
*
|
|
* @private
|
|
*/
|
|
function clearEmittedDeprecationWarnings() {
|
|
emittedWarnings.clear();
|
|
}
|
|
|
|
exports.clearEmittedDeprecationWarnings = clearEmittedDeprecationWarnings;
|
|
exports.default = emitDeprecationWarning;
|