1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-12-21 23:04:45 -05:00
denoland-deno/cli/tools
Nathan Whitaker 5ec3c5c3a4
feat(lint): Add lint for usage of node globals (with autofix) (#25048)
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;
```
2024-08-15 20:43:04 +00:00
..
bench fix(upgrade): do not error if config in cwd invalid (#24689) 2024-07-23 19:00:48 -04:00
coverage feat(coverage): add breadcrumbs to deno coverage --html report (#24860) 2024-08-14 16:37:19 +09:00
init feat: deno init --serve (#24897) 2024-08-08 16:54:39 +00:00
jupyter fix: adapt to new jupyter runtime API and include session IDs (#24762) 2024-07-27 10:39:08 +02:00
lint feat(lint): Add lint for usage of node globals (with autofix) (#25048) 2024-08-15 20:43:04 +00:00
registry feat(publish): error on missing license file (#25011) 2024-08-12 19:51:58 -04:00
repl docs: fix typos (#24820) 2024-08-02 13:26:54 +02:00
run feat(serve): Opt-in parallelism for deno serve (#24920) 2024-08-14 22:26:21 +00:00
test chore: upgrade to rust 1.80 (#24778) 2024-07-29 12:58:04 -04:00
vendor fix(compile): support workspace members importing other members (#24909) 2024-08-07 07:43:05 +00:00
bundle.rs fix(upgrade): do not error if config in cwd invalid (#24689) 2024-07-23 19:00:48 -04:00
check.rs feat: npm workspace and better Deno workspace support (#24334) 2024-07-04 00:54:33 +00:00
clean.rs feat(clean): add progress bar (#25026) 2024-08-14 13:04:07 +02:00
compile.rs feat: deno compile --icon <ico> (#25039) 2024-08-15 10:12:23 +05:30
doc.rs fix: update deno_doc (#24972) 2024-08-12 12:57:50 -07:00
fmt.rs feat(fmt): support HTML, Svelte, Vue, Astro and Angular (#25019) 2024-08-14 22:58:48 +02:00
info.rs fix(upgrade): do not error if config in cwd invalid (#24689) 2024-07-23 19:00:48 -04:00
installer.rs fix(add): Better error message when missing npm specifier (#24970) 2024-08-09 14:29:11 +00:00
mod.rs feat(serve): Opt-in parallelism for deno serve (#24920) 2024-08-14 22:26:21 +00:00
serve.rs feat(serve): Opt-in parallelism for deno serve (#24920) 2024-08-14 22:26:21 +00:00
task.rs feat: deno run <task> (#24891) 2024-08-06 20:35:30 +05:30
upgrade.rs refactor: remove version::is_canary(), use ReleaseChannel instead (#25053) 2024-08-15 21:59:16 +02:00