mirror of
https://github.com/denoland/deno.git
synced 2025-10-01 14:41:15 +00:00
feat(lint): add no-process-global
lint rule (#25709)
Closes https://github.com/denoland/deno/issues/25679
This commit is contained in:
parent
f347e779e0
commit
fd860260ad
6 changed files with 17 additions and 12 deletions
|
@ -3,7 +3,8 @@
|
|||
"steps": [
|
||||
{
|
||||
"args": "run main.ts",
|
||||
"output": ""
|
||||
"output": "main.out",
|
||||
"exitCode": 1
|
||||
},
|
||||
{
|
||||
"args": "lint main.ts",
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
error[no-node-globals]: NodeJS globals are not available in Deno
|
||||
--> [WILDCARD]main.ts:3:14
|
||||
|
|
||||
3 | const _foo = process.env.FOO;
|
||||
| ^^^^^^^
|
||||
= hint: Add `import process from "node:process";`
|
||||
3 | const _foo = setImmediate;
|
||||
| ^^^^^^^^^^^^
|
||||
= hint: Add `import { setImmediate } from "node:timers";`
|
||||
|
||||
docs: https://lint.deno.land/rules/no-node-globals
|
||||
|
||||
|
@ -11,9 +11,9 @@ error[no-node-globals]: NodeJS globals are not available in Deno
|
|||
error[no-node-globals]: NodeJS globals are not available in Deno
|
||||
--> [WILDCARD]main.ts:7:14
|
||||
|
|
||||
7 | const _bar = process.env.BAR;
|
||||
| ^^^^^^^
|
||||
= hint: Add `import process from "node:process";`
|
||||
7 | const _bar = setImmediate;
|
||||
| ^^^^^^^^^^^^
|
||||
= hint: Add `import { setImmediate } from "node:timers";`
|
||||
|
||||
docs: https://lint.deno.land/rules/no-node-globals
|
||||
|
||||
|
|
|
@ -0,0 +1,4 @@
|
|||
error: Uncaught (in promise) ReferenceError: setImmediate is not defined
|
||||
const _foo = setImmediate;
|
||||
^
|
||||
at [WILDCARD]main.ts:3:14
|
|
@ -1,7 +1,7 @@
|
|||
import {} from "node:console";
|
||||
|
||||
const _foo = process.env.FOO;
|
||||
const _foo = setImmediate;
|
||||
|
||||
import {} from "node:assert";
|
||||
|
||||
const _bar = process.env.BAR;
|
||||
const _bar = setImmediate;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue