mirror of
https://github.com/denoland/deno.git
synced 2024-11-24 15:19:26 -05: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
4
Cargo.lock
generated
4
Cargo.lock
generated
|
@ -1701,9 +1701,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "deno_lint"
|
||||
version = "0.66.0"
|
||||
version = "0.67.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7f5d2c81b9e0308b43fc76c4ddf72663f590f7ded43e6cb80dfe7b85ab88ea00"
|
||||
checksum = "871b60e32bfb6c110cbb9b0688dbf048f81e5d347fe4ce5a42239263de9dd938"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"deno_ast",
|
||||
|
|
|
@ -69,7 +69,7 @@ deno_config = { version = "=0.34.3", features = ["workspace", "sync"] }
|
|||
deno_core = { workspace = true, features = ["include_js_files_for_snapshotting"] }
|
||||
deno_doc = { version = "0.148.0", features = ["html", "syntect"] }
|
||||
deno_graph = { version = "=0.82.1" }
|
||||
deno_lint = { version = "=0.66.0", features = ["docs"] }
|
||||
deno_lint = { version = "=0.67.0", features = ["docs"] }
|
||||
deno_lockfile.workspace = true
|
||||
deno_npm = "=0.25.1"
|
||||
deno_package_json.workspace = true
|
||||
|
|
|
@ -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…
Reference in a new issue