From f356d5de0b7980ff21f0ddf3bd90bf54cccf7926 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bartek=20Iwa=C5=84czuk?= Date: Wed, 24 Jan 2024 23:41:59 +0100 Subject: [PATCH] update docs --- docs/rules/no_deprecated_deno_api.md | 2 +- www/static/docs.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/rules/no_deprecated_deno_api.md b/docs/rules/no_deprecated_deno_api.md index ec40588ef..aed63787f 100644 --- a/docs/rules/no_deprecated_deno_api.md +++ b/docs/rules/no_deprecated_deno_api.md @@ -150,7 +150,7 @@ Deno.close(file.rid); ### Valid: -```typescript +```typescript const file = await Deno.open("foo.txt"); file.close(); ``` diff --git a/www/static/docs.json b/www/static/docs.json index 067bdd55e..d3a196a80 100644 --- a/www/static/docs.json +++ b/www/static/docs.json @@ -205,7 +205,7 @@ }, { "code": "no-deprecated-deno-api", - "docs": "Warns the usage of the deprecated Deno APIs\n\nThe following APIs in the `Deno` namespace are now marked as deprecated and will\nbe removed from the namespace in Deno 2.0.\n\n**IO APIs**\n\n- `Deno.Buffer`\n- `Deno.copy`\n- `Deno.iter`\n- `Deno.iterSync`\n- `Deno.readAll`\n- `Deno.readAllSync`\n- `Deno.writeAll`\n- `Deno.writeAllSync`\n\nMost of these APIs have been moved to [`std/io`](https://deno.land/std/io) of\nthe Deno Standard Library. For more detail, see\n[the tracking issue](https://github.com/denoland/deno/issues/9795).\n\n**Sub Process API**\n\n- `Deno.run`\n\n`Deno.run` was deprecated in favor of `Deno.Command`. See\n[deno#9435](https://github.com/denoland/deno/discussions/9435) for more details.\n\n**Custom Inspector API**\n\n- `Deno.customInspect`\n\n`Deno.customInspect` was deprecated in favor of\n`Symbol.for(\"Deno.customInspect\")`. Replace the usages with this symbol\nexpression. See [deno#9294](https://github.com/denoland/deno/issues/9294) for\nmore details.\n\n**File system API**\n\n- `Deno.File`\n\n`Deno.File` was deprecated in favor of `Deno.FsFile`. Replace the usages with\nnew class name.\n\n### Invalid:\n\n```typescript\n// buffer\nconst a = new Deno.Buffer();\n\n// read all\nconst b = await Deno.readAll(reader);\nconst c = Deno.readAllSync(reader);\n\n// write all\nawait Deno.writeAll(writer, data);\nDeno.writeAllSync(writer, data);\n\n// iter\nfor await (const x of Deno.iter(xs)) {}\nfor (const y of Deno.iterSync(ys)) {}\n\n// copy\nawait Deno.copy(reader, writer);\n\n// custom inspector\nclass A {\n [Deno.customInspect]() {\n return \"This is A\";\n }\n}\n\n// file\nfunction foo(file: Deno.File) {\n // ...\n}\n```\n\n### Valid:\n\n```typescript\n// buffer\nimport { Buffer } from \"https://deno.land/std/io/buffer.ts\";\nconst a = new Buffer();\n\n// read all\nimport { readAll, readAllSync } from \"https://deno.land/std/io/read_all.ts\";\nconst b = await readAll(reader);\nconst c = readAllSync(reader);\n\n// write all\nimport { writeAll, writeAllSync } from \"https://deno.land/std/io/write_all.ts\";\nawait writeAll(writer, data);\nwriteAllSync(writer, data);\n\n// iter\n// reader is `ReadableStream`\nfor await (const chunk of reader) {\n // do something\n}\n\n// copy\n// reader is `ReadableStream` and writer is `WritableStream`\nawait reader.pipeTo(writer);\n\n// custom inspector\nclass A {\n [Symbol.for(\"Deno.customInspect\")]() {\n return \"This is A\";\n }\n}\n\n// file\nfunction foo(file: Deno.FsFile) {\n // ...\n}\n```\n\n- `Deno.isatty`\n\n`Deno.isatty` was deprecated in favor of `Deno.stdin.isTerminal()`,\n`Deno.stdout.isTerminal()` and `Deno.stderr.isTerminal()`.\n\n### Invalid:\n\n```typescript\nDeno.isatty(Deno.stdin.rid);\nDeno.isatty(Deno.stdout.rid);\nDeno.isatty(Deno.stderr.rid);\n```\n\n### Valid:\n\n```typescript\nDeno.stdin.isTerminal();\nDeno.stdout.isTerminal();\nDeno.stderr.isTerminal();\n```\n\n- `Deno.close`\n\n`Deno.close` was deprecated in favor of `.close()` method available on relevant\nobjects.\n\n### Invalid:\n\n```typescript\nconst file = await Deno.open(\"foo.txt\");\nDeno.close(file.rid);\n```\n\n### Valid:\n\n```typescript \nconst file = await Deno.open(\"foo.txt\");\nfile.close();\n```\n\n- `Deno.resources()`\n\nDeno.resources() was deprecated. There are no replacements for this API.\n\n- `Deno.metrics()`\n\nDeno.metrics() was deprecated. There are no replacements for this API.\n\n**HTTP server API**\n\n- `Deno.serveHttp`\n\n`Deno.serveHttp` was deprecated in favor of `Deno.serve`.\n", + "docs": "Warns the usage of the deprecated Deno APIs\n\nThe following APIs in the `Deno` namespace are now marked as deprecated and will\nbe removed from the namespace in Deno 2.0.\n\n**IO APIs**\n\n- `Deno.Buffer`\n- `Deno.copy`\n- `Deno.iter`\n- `Deno.iterSync`\n- `Deno.readAll`\n- `Deno.readAllSync`\n- `Deno.writeAll`\n- `Deno.writeAllSync`\n\nMost of these APIs have been moved to [`std/io`](https://deno.land/std/io) of\nthe Deno Standard Library. For more detail, see\n[the tracking issue](https://github.com/denoland/deno/issues/9795).\n\n**Sub Process API**\n\n- `Deno.run`\n\n`Deno.run` was deprecated in favor of `Deno.Command`. See\n[deno#9435](https://github.com/denoland/deno/discussions/9435) for more details.\n\n**Custom Inspector API**\n\n- `Deno.customInspect`\n\n`Deno.customInspect` was deprecated in favor of\n`Symbol.for(\"Deno.customInspect\")`. Replace the usages with this symbol\nexpression. See [deno#9294](https://github.com/denoland/deno/issues/9294) for\nmore details.\n\n**File system API**\n\n- `Deno.File`\n\n`Deno.File` was deprecated in favor of `Deno.FsFile`. Replace the usages with\nnew class name.\n\n### Invalid:\n\n```typescript\n// buffer\nconst a = new Deno.Buffer();\n\n// read all\nconst b = await Deno.readAll(reader);\nconst c = Deno.readAllSync(reader);\n\n// write all\nawait Deno.writeAll(writer, data);\nDeno.writeAllSync(writer, data);\n\n// iter\nfor await (const x of Deno.iter(xs)) {}\nfor (const y of Deno.iterSync(ys)) {}\n\n// copy\nawait Deno.copy(reader, writer);\n\n// custom inspector\nclass A {\n [Deno.customInspect]() {\n return \"This is A\";\n }\n}\n\n// file\nfunction foo(file: Deno.File) {\n // ...\n}\n```\n\n### Valid:\n\n```typescript\n// buffer\nimport { Buffer } from \"https://deno.land/std/io/buffer.ts\";\nconst a = new Buffer();\n\n// read all\nimport { readAll, readAllSync } from \"https://deno.land/std/io/read_all.ts\";\nconst b = await readAll(reader);\nconst c = readAllSync(reader);\n\n// write all\nimport { writeAll, writeAllSync } from \"https://deno.land/std/io/write_all.ts\";\nawait writeAll(writer, data);\nwriteAllSync(writer, data);\n\n// iter\n// reader is `ReadableStream`\nfor await (const chunk of reader) {\n // do something\n}\n\n// copy\n// reader is `ReadableStream` and writer is `WritableStream`\nawait reader.pipeTo(writer);\n\n// custom inspector\nclass A {\n [Symbol.for(\"Deno.customInspect\")]() {\n return \"This is A\";\n }\n}\n\n// file\nfunction foo(file: Deno.FsFile) {\n // ...\n}\n```\n\n- `Deno.isatty`\n\n`Deno.isatty` was deprecated in favor of `Deno.stdin.isTerminal()`,\n`Deno.stdout.isTerminal()` and `Deno.stderr.isTerminal()`.\n\n### Invalid:\n\n```typescript\nDeno.isatty(Deno.stdin.rid);\nDeno.isatty(Deno.stdout.rid);\nDeno.isatty(Deno.stderr.rid);\n```\n\n### Valid:\n\n```typescript\nDeno.stdin.isTerminal();\nDeno.stdout.isTerminal();\nDeno.stderr.isTerminal();\n```\n\n- `Deno.close`\n\n`Deno.close` was deprecated in favor of `.close()` method available on relevant\nobjects.\n\n### Invalid:\n\n```typescript\nconst file = await Deno.open(\"foo.txt\");\nDeno.close(file.rid);\n```\n\n### Valid:\n\n```typescript\nconst file = await Deno.open(\"foo.txt\");\nfile.close();\n```\n\n- `Deno.resources()`\n\nDeno.resources() was deprecated. There are no replacements for this API.\n\n- `Deno.metrics()`\n\nDeno.metrics() was deprecated. There are no replacements for this API.\n\n**HTTP server API**\n\n- `Deno.serveHttp`\n\n`Deno.serveHttp` was deprecated in favor of `Deno.serve`.\n", "tags": [ "recommended" ]