1
0
Fork 0
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:
Divy Srivastava 2024-09-19 00:20:42 +05:30 committed by GitHub
parent f347e779e0
commit fd860260ad
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 17 additions and 12 deletions

4
Cargo.lock generated
View file

@ -1701,9 +1701,9 @@ dependencies = [
[[package]] [[package]]
name = "deno_lint" name = "deno_lint"
version = "0.66.0" version = "0.67.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7f5d2c81b9e0308b43fc76c4ddf72663f590f7ded43e6cb80dfe7b85ab88ea00" checksum = "871b60e32bfb6c110cbb9b0688dbf048f81e5d347fe4ce5a42239263de9dd938"
dependencies = [ dependencies = [
"anyhow", "anyhow",
"deno_ast", "deno_ast",

View file

@ -69,7 +69,7 @@ deno_config = { version = "=0.34.3", features = ["workspace", "sync"] }
deno_core = { workspace = true, features = ["include_js_files_for_snapshotting"] } deno_core = { workspace = true, features = ["include_js_files_for_snapshotting"] }
deno_doc = { version = "0.148.0", features = ["html", "syntect"] } deno_doc = { version = "0.148.0", features = ["html", "syntect"] }
deno_graph = { version = "=0.82.1" } 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_lockfile.workspace = true
deno_npm = "=0.25.1" deno_npm = "=0.25.1"
deno_package_json.workspace = true deno_package_json.workspace = true

View file

@ -3,7 +3,8 @@
"steps": [ "steps": [
{ {
"args": "run main.ts", "args": "run main.ts",
"output": "" "output": "main.out",
"exitCode": 1
}, },
{ {
"args": "lint main.ts", "args": "lint main.ts",

View file

@ -1,9 +1,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:3:14 --> [WILDCARD]main.ts:3:14
| |
3 | const _foo = process.env.FOO; 3 | const _foo = setImmediate;
| ^^^^^^^ | ^^^^^^^^^^^^
= hint: Add `import process from "node:process";` = hint: Add `import { setImmediate } from "node:timers";`
docs: https://lint.deno.land/rules/no-node-globals 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 error[no-node-globals]: NodeJS globals are not available in Deno
--> [WILDCARD]main.ts:7:14 --> [WILDCARD]main.ts:7:14
| |
7 | const _bar = process.env.BAR; 7 | const _bar = setImmediate;
| ^^^^^^^ | ^^^^^^^^^^^^
= hint: Add `import process from "node:process";` = hint: Add `import { setImmediate } from "node:timers";`
docs: https://lint.deno.land/rules/no-node-globals docs: https://lint.deno.land/rules/no-node-globals

View file

@ -0,0 +1,4 @@
error: Uncaught (in promise) ReferenceError: setImmediate is not defined
const _foo = setImmediate;
^
at [WILDCARD]main.ts:3:14

View file

@ -1,7 +1,7 @@
import {} from "node:console"; import {} from "node:console";
const _foo = process.env.FOO; const _foo = setImmediate;
import {} from "node:assert"; import {} from "node:assert";
const _bar = process.env.BAR; const _bar = setImmediate;