diff --git a/docs/rules/no_deprecated_deno_api.md b/docs/rules/no_deprecated_deno_api.md index 5f80198af..bd4a8b313 100644 --- a/docs/rules/no_deprecated_deno_api.md +++ b/docs/rules/no_deprecated_deno_api.md @@ -1,6 +1,7 @@ Warns the usage of the deprecated Deno APIs -The following APIs in `Deno` namespace are now marked as deprecated and will get removed from the namespace in Deno 2.0 +The following APIs in `Deno` namespace are now marked as deprecated and will get +removed from the namespace in Deno 2.0 **IO APIs** @@ -8,13 +9,15 @@ The following APIs in `Deno` namespace are now marked as deprecated and will get - `Deno.copy` - `Deno.iter` - `Deno.iterSync` +- `Deno.read` +- `Deno.readSync` - `Deno.readAll` - `Deno.readAllSync` - `Deno.writeAll` - `Deno.writeAllSync` -The IO APIs are already available in `std/io` or `std/streams`, so replace these -deprecated ones with alternatives from `std`. For more detail, see +The IO APIs are already available in `std/io`, so replace these deprecated ones +with alternatives from `std`. For more detail, see [the tracking issue](https://github.com/denoland/deno/issues/9795). **Sub Process API** diff --git a/www/static/docs.json b/www/static/docs.json index 60200c15f..198c76194 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 `Deno` namespace are now marked as deprecated and will get\nremoved from the namespace in the future.\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\nThe IO APIs are already available in `std/io` or `std/streams`, so replace these\ndeprecated ones with alternatives from `std`. 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**HTTP server API**\n\n- `Deno.serveHttp`\n\n`Deno.serveHttp` was deprecated in favor of `Deno.serve`.\n\n### Invalid:\n\n```typescript\n// buffer\nconst a = Deno.Buffer();\n\n// read\nconst b = await Deno.readAll(reader);\nconst c = Deno.readAllSync(reader);\n\n// write\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\nfunction foo(file: Deno.File) {\n // ...\n}\n```\n\n### Valid:\n\n```typescript\n// readAll\nimport { toArrayBuffer } from \"https://deno.land/std/streams/to_array_buffer.ts\";\nconst b = await toArrayBuffer(reader); // `b` is ArrayBuffer\nconst c = new Uint8Array(b); // You can convert ArrayBuffer to Uint8Array\n\n// writeAll\n// reader is `ReadableStream` and writer is `WritableStream`\nconst reader = ReadableStream.from([1, 2, 3]);\nawait reader.pipeTo(writer);\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\nfunction foo(file: Deno.FsFile) {\n // ...\n}\n```\n", + "docs": "Warns the usage of the deprecated Deno APIs\n\nThe following APIs in `Deno` namespace are now marked as deprecated and will get\nremoved 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.read`\n- `Deno.readSync`\n- `Deno.readAll`\n- `Deno.readAllSync`\n- `Deno.writeAll`\n- `Deno.writeAllSync`\n\nThe IO APIs are already available in `std/io`, so replace these deprecated ones\nwith alternatives from `std`. 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**HTTP server API**\n\n- `Deno.serveHttp`\n\n`Deno.serveHttp` was deprecated in favor of `Deno.serve`.\n\n### Invalid:\n\n```typescript\n// buffer\nconst a = Deno.Buffer();\n\n// read\nconst b = await Deno.readAll(reader);\nconst c = Deno.readAllSync(reader);\n\n// write\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\nfunction foo(file: Deno.File) {\n // ...\n}\n```\n\n### Valid:\n\n```typescript\n// readAll\nimport { toArrayBuffer } from \"https://deno.land/std/streams/to_array_buffer.ts\";\nconst b = await toArrayBuffer(reader); // `b` is ArrayBuffer\nconst c = new Uint8Array(b); // You can convert ArrayBuffer to Uint8Array\n\n// writeAll\n// reader is `ReadableStream` and writer is `WritableStream`\nconst reader = ReadableStream.from([1, 2, 3]);\nawait reader.pipeTo(writer);\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\nfunction foo(file: Deno.FsFile) {\n // ...\n}\n```\n", "tags": [ "recommended" ]