refactor: remove environment variable functionality notice in warnOnDeprecatedApi() (#4227)

This commit is contained in:
Asher Gomez 2024-01-23 15:02:31 +11:00 committed by GitHub
parent 88b5f471ed
commit f5547f4b2d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 3 additions and 10 deletions

View File

@ -8,7 +8,7 @@ const ALREADY_WARNED_DEPRECATED = new Set<string>();
const ENV_VAR_KEY = "DENO_NO_DEPRECATION_WARNINGS"; const ENV_VAR_KEY = "DENO_NO_DEPRECATION_WARNINGS";
const shouldDisableDeprecatedApiWarning = const shouldDisableDeprecatedApiWarning =
Deno?.permissions.querySync?.({ name: "env", variable: ENV_VAR_KEY }) Deno?.permissions.querySync?.({ name: "env", variable: ENV_VAR_KEY })
.state === "granted" && Deno?.env.get(ENV_VAR_KEY) === "1"; .state === "granted" && Deno?.env.has(ENV_VAR_KEY);
interface WarnDeprecatedApiConfig { interface WarnDeprecatedApiConfig {
/** The name of the deprecated API. */ /** The name of the deprecated API. */
@ -78,11 +78,6 @@ export function warnOnDeprecatedApi(config: WarnDeprecatedApiConfig) {
); );
} }
console.log("%c\u2502", "color: yellow;");
console.log(
"%c\u251c Set `DENO_NO_DEPRECATION_WARNINGS=1` to disable these deprecation warnings.",
"color: yellow;",
);
console.log("%c\u2502", "color: yellow;"); console.log("%c\u2502", "color: yellow;");
console.log("%c\u2514 Stack trace:", "color: yellow;"); console.log("%c\u2514 Stack trace:", "color: yellow;");
for (let i = 0; i < stackLines.length; i++) { for (let i = 0; i < stackLines.length; i++) {

View File

@ -20,11 +20,9 @@ Deno.test("warnDeprecatedApi()", async () => {
Suggestion: Do something else instead. Suggestion: Do something else instead.
Set \`DENO_NO_DEPRECATION_WARNINGS=1\` to disable these deprecation warnings.
Stack trace: Stack trace:
at fn (${import.meta.url}:39:12) at fn (${import.meta.url}:37:12)
at ${import.meta.url}:47:31 at ${import.meta.url}:45:31
Hello, world! Hello, world!
Hello, world! Hello, world!