feat(fmt): add basic JS doc formatting (#11902)

This commit is contained in:
David Sherret 2021-09-02 18:28:12 -04:00 committed by GitHub
parent 1bf7b90ca8
commit 987716798f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
19 changed files with 260 additions and 271 deletions

View file

@ -36,9 +36,9 @@
"tools/wpt/manifest.json" "tools/wpt/manifest.json"
], ],
"plugins": [ "plugins": [
"https://plugins.dprint.dev/typescript-0.53.0.wasm", "https://plugins.dprint.dev/typescript-0.54.0.wasm",
"https://plugins.dprint.dev/json-0.12.3.wasm", "https://plugins.dprint.dev/json-0.13.0.wasm",
"https://plugins.dprint.dev/markdown-0.9.6.wasm", "https://plugins.dprint.dev/markdown-0.10.0.wasm",
"https://plugins.dprint.dev/toml-0.5.1.wasm" "https://plugins.dprint.dev/toml-0.5.1.wasm"
] ]
} }

16
Cargo.lock generated
View file

@ -1034,9 +1034,9 @@ dependencies = [
[[package]] [[package]]
name = "dprint-core" name = "dprint-core"
version = "0.44.0" version = "0.46.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "58e8b33392ddbb25277c26d9af64f84d1dd661d3a98aeead9abb114854550ad2" checksum = "c5f145afa493cba0217d2c52e256e7626730b8ed97c9db4e20e0db8c242458ca"
dependencies = [ dependencies = [
"bumpalo", "bumpalo",
"fnv", "fnv",
@ -1045,9 +1045,9 @@ dependencies = [
[[package]] [[package]]
name = "dprint-plugin-json" name = "dprint-plugin-json"
version = "0.12.3" version = "0.13.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e2af0c28f3fa7dcc4bfa0f6d88bd55e2cf13e3137e2038952a356a3a78698991" checksum = "4a32a4eef2c639055370f16a359f0278025058e63193f0ad2340f30bf7ca8361"
dependencies = [ dependencies = [
"dprint-core", "dprint-core",
"jsonc-parser", "jsonc-parser",
@ -1056,9 +1056,9 @@ dependencies = [
[[package]] [[package]]
name = "dprint-plugin-markdown" name = "dprint-plugin-markdown"
version = "0.9.6" version = "0.10.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fdd7aeda8d9feccc49f178bf246fff6746afee584870c49ee4c4bd890cfb5da8" checksum = "48b364aed2db4ccf8747dc1d9c7eb52a5e981a705c7aadfddd297fc4c3310772"
dependencies = [ dependencies = [
"dprint-core", "dprint-core",
"pulldown-cmark", "pulldown-cmark",
@ -1068,9 +1068,9 @@ dependencies = [
[[package]] [[package]]
name = "dprint-plugin-typescript" name = "dprint-plugin-typescript"
version = "0.53.0" version = "0.54.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "63674b5e577e3244436463aa8ab59947aba0a3d5b4de6d181c6bd7a3e190b336" checksum = "2249bbc5f46daecd4de4157cec4c4a118724024a213bea8a53ac693047959291"
dependencies = [ dependencies = [
"dprint-core", "dprint-core",
"dprint-swc-ecma-ast-view", "dprint-swc-ecma-ast-view",

View file

@ -56,9 +56,9 @@ byteorder = "1.4.3"
clap = "2.33.3" clap = "2.33.3"
data-url = "0.1.0" data-url = "0.1.0"
dissimilar = "1.0.2" dissimilar = "1.0.2"
dprint-plugin-json = "0.12.3" dprint-plugin-json = "0.13.0"
dprint-plugin-markdown = "0.9.6" dprint-plugin-markdown = "0.10.0"
dprint-plugin-typescript = "0.53.0" dprint-plugin-typescript = "0.54.0"
encoding_rs = "0.8.28" encoding_rs = "0.8.28"
env_logger = "0.8.4" env_logger = "0.8.4"
fancy-regex = "0.7.1" fancy-regex = "0.7.1"

View file

@ -54,7 +54,7 @@ declare interface PerformanceMeasureOptions {
detail?: any; detail?: any;
/** Timestamp to be used as the start time or string to be used as start /** Timestamp to be used as the start time or string to be used as start
* mark.*/ * mark. */
start?: string | number; start?: string | number;
/** Duration between the start and end times. */ /** Duration between the start and end times. */
@ -121,7 +121,7 @@ declare namespace Deno {
* `only` set to true and fail the test suite. */ * `only` set to true and fail the test suite. */
only?: boolean; only?: boolean;
/** Check that the number of async completed ops after the test is the same /** Check that the number of async completed ops after the test is the same
* as number of dispatched ops. Defaults to true.*/ * as number of dispatched ops. Defaults to true. */
sanitizeOps?: boolean; sanitizeOps?: boolean;
/** Ensure the test case does not "leak" resources - ie. the resource table /** Ensure the test case does not "leak" resources - ie. the resource table
* after the test has exactly the same contents as before the test. Defaults * after the test has exactly the same contents as before the test. Defaults
@ -183,7 +183,7 @@ declare namespace Deno {
* assertEquals(decoder.decode(data), "Hello world"); * assertEquals(decoder.decode(data), "Hello world");
* }); * });
* ``` * ```
* */ */
export function test(name: string, fn: () => void | Promise<void>): void; export function test(name: string, fn: () => void | Promise<void>): void;
/** Exit the Deno process with optional exit code. If no exit code is supplied /** Exit the Deno process with optional exit code. If no exit code is supplied
@ -295,7 +295,6 @@ declare namespace Deno {
export function linkSync(oldpath: string, newpath: string): void; export function linkSync(oldpath: string, newpath: string): void;
/** /**
*
* Creates `newpath` as a hard link to `oldpath`. * Creates `newpath` as a hard link to `oldpath`.
* *
* ```ts * ```ts
@ -866,7 +865,7 @@ declare namespace Deno {
* any write calls on it will overwrite its contents, by default without * any write calls on it will overwrite its contents, by default without
* truncating it. */ * truncating it. */
write?: boolean; write?: boolean;
/**Sets the option for the append mode. This option, when `true`, means that /** Sets the option for the append mode. This option, when `true`, means that
* writes will append to a file instead of overwriting previous contents. * writes will append to a file instead of overwriting previous contents.
* Note that setting `{ write: true, append: true }` has the same effect as * Note that setting `{ write: true, append: true }` has the same effect as
* setting only `{ append: true }`. */ * setting only `{ append: true }`. */
@ -901,7 +900,6 @@ declare namespace Deno {
} }
/** /**
*
* Check if a given resource id (`rid`) is a TTY. * Check if a given resource id (`rid`) is a TTY.
* *
* ```ts * ```ts
@ -1536,7 +1534,7 @@ declare namespace Deno {
* *
* Requires `allow-read` permission for the target path. * Requires `allow-read` permission for the target path.
* Also requires `allow-read` permission for the CWD if the target path is * Also requires `allow-read` permission for the CWD if the target path is
* relative.*/ * relative. */
export function realPathSync(path: string | URL): string; export function realPathSync(path: string | URL): string;
/** Resolves to the absolute normalized path, with symbolic links resolved. /** Resolves to the absolute normalized path, with symbolic links resolved.
@ -1552,7 +1550,7 @@ declare namespace Deno {
* *
* Requires `allow-read` permission for the target path. * Requires `allow-read` permission for the target path.
* Also requires `allow-read` permission for the CWD if the target path is * Also requires `allow-read` permission for the CWD if the target path is
* relative.*/ * relative. */
export function realPath(path: string | URL): Promise<string>; export function realPath(path: string | URL): Promise<string>;
export interface DirEntry { export interface DirEntry {
@ -1914,7 +1912,7 @@ declare namespace Deno {
* console.log(">>>> event", event); * console.log(">>>> event", event);
* // { kind: "create", paths: [ "/foo.txt" ] } * // { kind: "create", paths: [ "/foo.txt" ] }
* } * }
*``` * ```
* *
* Requires `allow-read` permission. * Requires `allow-read` permission.
* *
@ -1968,7 +1966,7 @@ declare namespace Deno {
* ]); * ]);
* p.close(); * p.close();
* ``` * ```
**/ */
status(): Promise<ProcessStatus>; status(): Promise<ProcessStatus>;
/** Buffer the stdout until EOF and return it as `Uint8Array`. /** Buffer the stdout until EOF and return it as `Uint8Array`.
* *

View file

@ -111,7 +111,7 @@ declare namespace WebAssembly {
/** /**
* Given a `Module` and string, returns a copy of the contents of all custom sections in the * Given a `Module` and string, returns a copy of the contents of all custom sections in the
* module with the given string name. * module with the given string name.
* */ */
static customSections( static customSections(
moduleObject: Module, moduleObject: Module,
sectionName: string, sectionName: string,
@ -494,7 +494,7 @@ declare interface PerformanceMeasureOptions {
detail?: any; detail?: any;
/** Timestamp to be used as the start time or string to be used as start /** Timestamp to be used as the start time or string to be used as start
* mark.*/ * mark. */
start?: string | number; start?: string | number;
/** Duration between the start and end times. */ /** Duration between the start and end times. */

View file

@ -64,7 +64,6 @@ declare namespace Deno {
* ``` * ```
* *
* Requires `allow-env` permission. * Requires `allow-env` permission.
*
*/ */
export function osRelease(): string; export function osRelease(): string;
@ -80,7 +79,6 @@ declare namespace Deno {
* ``` * ```
* *
* Requires `allow-env` permission. * Requires `allow-env` permission.
*
*/ */
export function systemMemoryInfo(): SystemMemoryInfo; export function systemMemoryInfo(): SystemMemoryInfo;

View file

@ -88,7 +88,6 @@ declare class URLSearchParams {
* console.log(value, key, parent); * console.log(value, key, parent);
* }); * });
* ``` * ```
*
*/ */
forEach( forEach(
callbackfn: (value: string, key: string, parent: this) => void, callbackfn: (value: string, key: string, parent: this) => void,

View file

@ -38,7 +38,7 @@
} }
/** Clone a value in a similar way to structured cloning. It is similar to a /** Clone a value in a similar way to structured cloning. It is similar to a
* StructureDeserialize(StructuredSerialize(...)). */ * StructureDeserialize(StructuredSerialize(...)). */
function structuredClone(value) { function structuredClone(value) {
// Performance optimization for buffers, otherwise // Performance optimization for buffers, otherwise
// `serialize/deserialize` will allocate new buffer. // `serialize/deserialize` will allocate new buffer.

View file

@ -2850,7 +2850,7 @@
/** /**
* @template W * @template W
* @param {WritableStream<W>} stream * @param {WritableStream<W>} stream
* */ */
function writableStreamMarkFirstWriteRequestInFlight(stream) { function writableStreamMarkFirstWriteRequestInFlight(stream) {
assert(stream[_inFlightWriteRequest] === undefined); assert(stream[_inFlightWriteRequest] === undefined);
assert(stream[_writeRequests].length); assert(stream[_writeRequests].length);
@ -3765,7 +3765,6 @@
[_writable]; [_writable];
/** /**
*
* @param {Transformer<I, O>} transformer * @param {Transformer<I, O>} transformer
* @param {QueuingStrategy<I>} writableStrategy * @param {QueuingStrategy<I>} writableStrategy
* @param {QueuingStrategy<O>} readableStrategy * @param {QueuingStrategy<O>} readableStrategy

View file

@ -38,7 +38,6 @@
#rid = null; #rid = null;
/** /**
*
* @param {string} label * @param {string} label
* @param {TextDecoderOptions} options * @param {TextDecoderOptions} options
*/ */
@ -198,7 +197,6 @@
#transform; #transform;
/** /**
*
* @param {string} label * @param {string} label
* @param {TextDecoderOptions} options * @param {TextDecoderOptions} options
*/ */

View file

@ -544,7 +544,6 @@
const _message = Symbol("[[message]]"); const _message = Symbol("[[message]]");
/** /**
*
* @param {string | undefined} reason * @param {string | undefined} reason
* @param {string} message * @param {string} message
* @returns {GPUDeviceLostInfo} * @returns {GPUDeviceLostInfo}
@ -3377,7 +3376,6 @@
} }
/** /**
*
* @param {number} x * @param {number} x
* @param {number} y * @param {number} y
* @param {number} width * @param {number} width

View file

@ -75,7 +75,7 @@
/** /**
* @param {string} permission * @param {string} permission
* @return {(boolean | string[])} * @return {(boolean | string[])}
* */ */
function parseArrayPermission( function parseArrayPermission(
value, value,
permission, permission,

View file

@ -111,7 +111,6 @@
const statusCache = new Map(); const statusCache = new Map();
/** /**
*
* @param {Deno.PermissionDescriptor} desc * @param {Deno.PermissionDescriptor} desc
* @param {Deno.PermissionState} state * @param {Deno.PermissionState} state
* @returns {PermissionStatus} * @returns {PermissionStatus}