mirror of
https://github.com/denoland/deno.git
synced 2024-12-27 17:49:08 -05:00
5ec3c5c3a4
From upgrading `deno_lint`. Previously if you had a node project that used a bunch of node globals (`process.env`, etc), you would have to fix the errors by hand. This PR includes a new lint that detects usages of node globals (`process`, `setImmediate`, `Buffer`, etc.) and provides an autofix to import the correct value. For instance: ```ts // main.ts const _foo = process.env.FOO; ``` `deno lint` gives you ```ts error[no-node-globals]: NodeJS globals are not available in Deno --> /home/foo.ts:1:14 | 1 | const _foo = process.env.FOO; | ^^^^^^^ = hint: Add `import process from "node:process";` docs: https://lint.deno.land/rules/no-node-globals Found 1 problem (1 fixable via --fix) Checked 1 file ``` And `deno lint --fix` adds the import for you: ```ts // main.ts import process from "node:process"; const _foo = process.env.FOO; ``` |
||
---|---|---|
.. | ||
bom | ||
jsr_tag | ||
lint_fix | ||
no_slow_types | ||
no_slow_types_entrypoint | ||
no_slow_types_workspace | ||
node_globals_no_duplicate_imports | ||
sloppy_imports_dts | ||
sloppy_imports_no_incremental_cache | ||
syntax_error_reporting | ||
workspace | ||
workspace_no_slow_types |