Skip to content

Commit

Permalink
Review
Browse files Browse the repository at this point in the history
  • Loading branch information
littledivy committed Sep 18, 2024
1 parent 1e31990 commit 03cafd1
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
11 changes: 6 additions & 5 deletions docs/rules/no_process_global.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
Disallows the use of NodeJS process global.
Disallows the use of NodeJS `process` global.

NodeJS and Deno expose process global but they are hard to statically analyze by
tools, so code should not assume they are available. Instead, import process
from "node:process" instead.
NodeJS and Deno expose `process` global but they are hard to statically analyze
by tools, so code should not assume they are available. Instead,
`import process
from "node:process"`.

### Invalid:

```typescript
// foo.ts
const foo = process.env.FOO; // process is not a global object in deno
const foo = process.env.FOO;
```

### Valid:
Expand Down
2 changes: 1 addition & 1 deletion www/static/docs.json
Original file line number Diff line number Diff line change
Expand Up @@ -450,7 +450,7 @@
},
{
"code": "no-process-globals",
"docs": "Disallows the use of NodeJS process global.\n\nNodeJS and Deno expose process global but they are hard to statically analyze by\ntools, so code should not assume they are available. Instead, import process\nfrom \"node:process\" instead.\n\n### Invalid:\n\n```typescript\n// foo.ts\nconst foo = process.env.FOO; // process is not a global object in deno\n```\n\n### Valid:\n\n```typescript\n// foo.ts\nimport process from \"node:process\";\n\nconst foo = process.env.FOO;\n```\n",
"docs": "Disallows the use of NodeJS `process` global.\n\nNodeJS and Deno expose `process` global but they are hard to statically analyze by\ntools, so code should not assume they are available. Instead, `import process\nfrom \"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"
]
Expand Down

0 comments on commit 03cafd1

Please sign in to comment.