From 5a7ce21ad322e4a40d7d5aa6bb8f60cf1596722f Mon Sep 17 00:00:00 2001 From: Emmanuel Ferdman Date: Mon, 4 Nov 2024 13:20:38 +0200 Subject: [PATCH] refactor: adjust rule code for `no-process-global` to ensure consistency (#1338) Signed-off-by: Emmanuel Ferdman --- schemas/rules.v1.json | 2 +- src/rules/no_process_global.rs | 2 +- www/static/docs.json | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/schemas/rules.v1.json b/schemas/rules.v1.json index 71d178495..32ea51622 100644 --- a/schemas/rules.v1.json +++ b/schemas/rules.v1.json @@ -70,7 +70,7 @@ "no-non-null-assertion", "no-obj-calls", "no-octal", - "no-process-globals", + "no-process-global", "no-prototype-builtins", "no-redeclare", "no-regex-spaces", diff --git a/src/rules/no_process_global.rs b/src/rules/no_process_global.rs index 718571eed..2ded9763b 100644 --- a/src/rules/no_process_global.rs +++ b/src/rules/no_process_global.rs @@ -17,7 +17,7 @@ use deno_ast::SourceRangedForSpanned; #[derive(Debug)] pub struct NoProcessGlobal; -const CODE: &str = "no-process-globals"; +const CODE: &str = "no-process-global"; const MESSAGE: &str = "NodeJS process global is discouraged in Deno"; impl LintRule for NoProcessGlobal { diff --git a/www/static/docs.json b/www/static/docs.json index 014621dcb..3361afd61 100644 --- a/www/static/docs.json +++ b/www/static/docs.json @@ -449,7 +449,7 @@ ] }, { - "code": "no-process-globals", + "code": "no-process-global", "docs": "Disallows the use of NodeJS `process` global.\n\nNodeJS and Deno expose `process` global but they are hard to statically analyze\nby tools, so code should not assume they are available. Instead,\n`import process from \"node:process\"`.\n\n### Invalid:\n\n```typescript\n// foo.ts\nconst foo = process.env.FOO;\n```\n\n### Valid:\n\n```typescript\n// foo.ts\nimport process from \"node:process\";\n\nconst foo = process.env.FOO;\n```\n", "tags": [ "recommended"