diff options
author | David Sherret <dsherret@users.noreply.github.com> | 2020-07-14 15:24:17 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-07-14 15:24:17 -0400 |
commit | cde4dbb35132848ffece59ef9cfaccff32347124 (patch) | |
tree | cc7830968c6decde704c8cfb83c9185193dc698f /std/encoding | |
parent | 9eca71caa1674c31f9cc5d4e86c03f10b59e0a00 (diff) |
Use dprint for internal formatting (#6682)
Diffstat (limited to 'std/encoding')
-rw-r--r-- | std/encoding/README.md | 2 | ||||
-rw-r--r-- | std/encoding/_yaml/dumper/dumper.ts | 74 | ||||
-rw-r--r-- | std/encoding/_yaml/dumper/dumper_state.ts | 2 | ||||
-rw-r--r-- | std/encoding/_yaml/error.ts | 2 | ||||
-rw-r--r-- | std/encoding/_yaml/example/dump.ts | 2 | ||||
-rw-r--r-- | std/encoding/_yaml/loader/loader.ts | 121 | ||||
-rw-r--r-- | std/encoding/_yaml/loader/loader_state.ts | 2 | ||||
-rw-r--r-- | std/encoding/_yaml/mark.ts | 12 | ||||
-rw-r--r-- | std/encoding/_yaml/parse.ts | 2 | ||||
-rw-r--r-- | std/encoding/_yaml/schema.ts | 6 | ||||
-rw-r--r-- | std/encoding/_yaml/type/float.ts | 2 | ||||
-rw-r--r-- | std/encoding/_yaml/type/timestamp.ts | 24 | ||||
-rw-r--r-- | std/encoding/ascii85.ts | 20 | ||||
-rw-r--r-- | std/encoding/ascii85_test.ts | 8 | ||||
-rw-r--r-- | std/encoding/base32.ts | 37 | ||||
-rw-r--r-- | std/encoding/base32_test.ts | 2 | ||||
-rw-r--r-- | std/encoding/base64url.ts | 3 | ||||
-rw-r--r-- | std/encoding/binary.ts | 14 | ||||
-rw-r--r-- | std/encoding/binary_test.ts | 12 | ||||
-rw-r--r-- | std/encoding/csv.ts | 13 | ||||
-rw-r--r-- | std/encoding/csv_test.ts | 8 | ||||
-rw-r--r-- | std/encoding/hex.ts | 2 | ||||
-rw-r--r-- | std/encoding/hex_test.ts | 4 | ||||
-rw-r--r-- | std/encoding/toml.ts | 6 | ||||
-rw-r--r-- | std/encoding/toml_test.ts | 3 |
25 files changed, 188 insertions, 195 deletions
diff --git a/std/encoding/README.md b/std/encoding/README.md index 588661269..0ec5f4e72 100644 --- a/std/encoding/README.md +++ b/std/encoding/README.md @@ -84,7 +84,7 @@ const string = "a,b,c\nd,e,f"; console.log( await parse(string, { header: false, - }) + }), ); // output: // [["a", "b", "c"], ["d", "e", "f"]] diff --git a/std/encoding/_yaml/dumper/dumper.ts b/std/encoding/_yaml/dumper/dumper.ts index 2b23d4758..e1f1a142a 100644 --- a/std/encoding/_yaml/dumper/dumper.ts +++ b/std/encoding/_yaml/dumper/dumper.ts @@ -92,7 +92,7 @@ function encodeHex(character: number): string { length = 8; } else { throw new YAMLError( - "code point within a string may not be greater than 0xFFFFFFFF" + "code point within a string may not be greater than 0xFFFFFFFF", ); } @@ -242,14 +242,13 @@ function chooseScalarStyle( singleLineOnly: boolean, indentPerLevel: number, lineWidth: number, - testAmbiguousType: (...args: Any[]) => Any + testAmbiguousType: (...args: Any[]) => Any, ): number { const shouldTrackWidth = lineWidth !== -1; let hasLineBreak = false, hasFoldableLine = false, // only checked if shouldTrackWidth previousLineBreak = -1, // count the first line correctly - plain = - isPlainSafeFirst(string.charCodeAt(0)) && + plain = isPlainSafeFirst(string.charCodeAt(0)) && !isWhitespace(string.charCodeAt(string.length - 1)); let char: number, i: number; @@ -271,8 +270,7 @@ function chooseScalarStyle( hasLineBreak = true; // Check if any line can be folded. if (shouldTrackWidth) { - hasFoldableLine = - hasFoldableLine || + hasFoldableLine = hasFoldableLine || // Foldable line = too long, and not more-indented. (i - previousLineBreak - 1 > lineWidth && string[previousLineBreak + 1] !== " "); @@ -284,8 +282,7 @@ function chooseScalarStyle( plain = plain && isPlainSafe(char); } // in case the end is missing a \n - hasFoldableLine = - hasFoldableLine || + hasFoldableLine = hasFoldableLine || (shouldTrackWidth && i - previousLineBreak - 1 > lineWidth && string[previousLineBreak + 1] !== " "); @@ -387,8 +384,7 @@ function foldString(string: string, width: number): string { const prefix = match[1], line = match[2]; moreIndented = line[0] === " "; - result += - prefix + + result += prefix + (!prevMoreIndented && !moreIndented && line !== "" ? "\n" : "") + // eslint-disable-next-line @typescript-eslint/no-use-before-define foldLine(line, width); @@ -412,7 +408,7 @@ function escapeString(string: string): string { if (nextChar >= 0xdc00 && nextChar <= 0xdfff /* low surrogate */) { // Combine the surrogate pair and store it escaped. result += encodeHex( - (char - 0xd800) * 0x400 + nextChar - 0xdc00 + 0x10000 + (char - 0xd800) * 0x400 + nextChar - 0xdc00 + 0x10000, ); // Advance index one extra since we already used that char here. i++; @@ -420,10 +416,9 @@ function escapeString(string: string): string { } } escapeSeq = ESCAPE_SEQUENCES[char]; - result += - !escapeSeq && isPrintable(char) - ? string[i] - : escapeSeq || encodeHex(char); + result += !escapeSeq && isPrintable(char) + ? string[i] + : escapeSeq || encodeHex(char); } return result; @@ -453,7 +448,7 @@ function writeScalar( state: DumperState, string: string, level: number, - iskey: boolean + iskey: boolean, ): void { state.dump = ((): string => { if (string.length === 0) { @@ -476,15 +471,13 @@ function writeScalar( // This behaves better than a constant minimum width which disallows // narrower options, or an indent threshold which causes the width // to suddenly increase. - const lineWidth = - state.lineWidth === -1 - ? -1 - : Math.max(Math.min(state.lineWidth, 40), state.lineWidth - indent); + const lineWidth = state.lineWidth === -1 + ? -1 + : Math.max(Math.min(state.lineWidth, 40), state.lineWidth - indent); // Without knowing if keys are implicit/explicit, // assume implicit for safety. - const singleLineOnly = - iskey || + const singleLineOnly = iskey || // No block styles in flow mode. (state.flowLevel > -1 && level >= state.flowLevel); function testAmbiguity(str: string): boolean { @@ -497,7 +490,7 @@ function writeScalar( singleLineOnly, state.indent, lineWidth, - testAmbiguity + testAmbiguity, ) ) { case STYLE_PLAIN: @@ -505,13 +498,15 @@ function writeScalar( case STYLE_SINGLE: return `'${string.replace(/'/g, "''")}'`; case STYLE_LITERAL: - return `|${blockHeader(string, state.indent)}${dropEndingNewline( - indentString(string, indent) - )}`; + return `|${blockHeader(string, state.indent)}${ + dropEndingNewline(indentString(string, indent)) + }`; case STYLE_FOLDED: - return `>${blockHeader(string, state.indent)}${dropEndingNewline( - indentString(foldString(string, lineWidth), indent) - )}`; + return `>${blockHeader(string, state.indent)}${ + dropEndingNewline( + indentString(foldString(string, lineWidth), indent), + ) + }`; case STYLE_DOUBLE: return `"${escapeString(string)}"`; default: @@ -523,7 +518,7 @@ function writeScalar( function writeFlowSequence( state: DumperState, level: number, - object: Any + object: Any, ): void { let _result = ""; const _tag = state.tag; @@ -545,7 +540,7 @@ function writeBlockSequence( state: DumperState, level: number, object: Any, - compact = false + compact = false, ): void { let _result = ""; const _tag = state.tag; @@ -575,7 +570,7 @@ function writeBlockSequence( function writeFlowMapping( state: DumperState, level: number, - object: Any + object: Any, ): void { let _result = ""; const _tag = state.tag, @@ -624,7 +619,7 @@ function writeBlockMapping( state: DumperState, level: number, object: Any, - compact = false + compact = false, ): void { const _tag = state.tag, objectKeyList = Object.keys(object); @@ -665,8 +660,7 @@ function writeBlockMapping( continue; // Skip this pair because of invalid key. } - explicitPair = - (state.tag !== null && state.tag !== "?") || + explicitPair = (state.tag !== null && state.tag !== "?") || (state.dump && state.dump.length > 1024); if (explicitPair) { @@ -707,7 +701,7 @@ function writeBlockMapping( function detectType( state: DumperState, object: Any, - explicit = false + explicit = false, ): boolean { const typeList = explicit ? state.explicitTypes : state.implicitTypes; @@ -733,11 +727,11 @@ function detectType( } else if (_hasOwnProperty.call(type.represent, style)) { _result = (type.represent as ArrayObject<RepresentFn>)[style]( object, - style + style, ); } else { throw new YAMLError( - `!<${type.tag}> tag resolver accepts not "${style}" style` + `!<${type.tag}> tag resolver accepts not "${style}" style`, ); } @@ -760,7 +754,7 @@ function writeNode( object: Any, block: boolean, compact: boolean, - iskey = false + iskey = false, ): boolean { state.tag = null; state.dump = object; @@ -843,7 +837,7 @@ function writeNode( function inspectNode( object: Any, objects: Any[], - duplicatesIndexes: number[] + duplicatesIndexes: number[], ): void { if (object !== null && typeof object === "object") { const index = objects.indexOf(object); diff --git a/std/encoding/_yaml/dumper/dumper_state.ts b/std/encoding/_yaml/dumper/dumper_state.ts index 2124ecb98..63b04983e 100644 --- a/std/encoding/_yaml/dumper/dumper_state.ts +++ b/std/encoding/_yaml/dumper/dumper_state.ts @@ -12,7 +12,7 @@ const _hasOwnProperty = Object.prototype.hasOwnProperty; function compileStyleMap( schema: Schema, - map?: ArrayObject<StyleVariant> | null + map?: ArrayObject<StyleVariant> | null, ): ArrayObject<StyleVariant> { if (typeof map === "undefined" || map === null) return {}; diff --git a/std/encoding/_yaml/error.ts b/std/encoding/_yaml/error.ts index a96ab11d6..77473fbd8 100644 --- a/std/encoding/_yaml/error.ts +++ b/std/encoding/_yaml/error.ts @@ -8,7 +8,7 @@ import type { Mark } from "./mark.ts"; export class YAMLError extends Error { constructor( message = "(unknown reason)", - protected mark: Mark | string = "" + protected mark: Mark | string = "", ) { super(`${message} ${mark}`); this.name = this.constructor.name; diff --git a/std/encoding/_yaml/example/dump.ts b/std/encoding/_yaml/example/dump.ts index db3647274..bc4684dfe 100644 --- a/std/encoding/_yaml/example/dump.ts +++ b/std/encoding/_yaml/example/dump.ts @@ -18,5 +18,5 @@ console.log( ], }, test: "foobar", - }) + }), ); diff --git a/std/encoding/_yaml/loader/loader.ts b/std/encoding/_yaml/loader/loader.ts index 4ab3e9adc..216e315f2 100644 --- a/std/encoding/_yaml/loader/loader.ts +++ b/std/encoding/_yaml/loader/loader.ts @@ -25,12 +25,14 @@ const CHOMPING_CLIP = 1; const CHOMPING_STRIP = 2; const CHOMPING_KEEP = 3; -const PATTERN_NON_PRINTABLE = /[\x00-\x08\x0B\x0C\x0E-\x1F\x7F-\x84\x86-\x9F\uFFFE\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/; +const PATTERN_NON_PRINTABLE = + /[\x00-\x08\x0B\x0C\x0E-\x1F\x7F-\x84\x86-\x9F\uFFFE\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/; const PATTERN_NON_ASCII_LINE_BREAKS = /[\x85\u2028\u2029]/; const PATTERN_FLOW_INDICATORS = /[,\[\]\{\}]/; const PATTERN_TAG_HANDLE = /^(?:!|!!|![a-z\-]+!)$/i; /* eslint-disable-next-line max-len */ -const PATTERN_TAG_URI = /^(?:!|[^,\[\]\{\}])(?:%[0-9a-f]{2}|[0-9a-z\-#;\/\?:@&=\+\$,_\.!~\*'\(\)\[\]])*$/i; +const PATTERN_TAG_URI = + /^(?:!|[^,\[\]\{\}])(?:%[0-9a-f]{2}|[0-9a-z\-#;\/\?:@&=\+\$,_\.!~\*'\(\)\[\]])*$/i; function _class(obj: unknown): string { return Object.prototype.toString.call(obj); @@ -148,7 +150,7 @@ function charFromCodepoint(c: number): string { // https://en.wikipedia.org/wiki/UTF-16#Code_points_U.2B010000_to_U.2B10FFFF return String.fromCharCode( ((c - 0x010000) >> 10) + 0xd800, - ((c - 0x010000) & 0x03ff) + 0xdc00 + ((c - 0x010000) & 0x03ff) + 0xdc00, ); } @@ -167,8 +169,8 @@ function generateError(state: LoaderState, message: string): YAMLError { state.input, state.position, state.line, - state.position - state.lineStart - ) + state.position - state.lineStart, + ), ); } @@ -229,21 +231,21 @@ const directiveHandlers: DirectiveHandlers = { if (!PATTERN_TAG_HANDLE.test(handle)) { return throwError( state, - "ill-formed tag handle (first argument) of the TAG directive" + "ill-formed tag handle (first argument) of the TAG directive", ); } if (_hasOwnProperty.call(state.tagMap, handle)) { return throwError( state, - `there is a previously declared suffix for "${handle}" tag handle` + `there is a previously declared suffix for "${handle}" tag handle`, ); } if (!PATTERN_TAG_URI.test(prefix)) { return throwError( state, - "ill-formed tag prefix (second argument) of the TAG directive" + "ill-formed tag prefix (second argument) of the TAG directive", ); } @@ -258,7 +260,7 @@ function captureSegment( state: LoaderState, start: number, end: number, - checkJson: boolean + checkJson: boolean, ): void { let result: string; if (start < end) { @@ -289,12 +291,12 @@ function mergeMappings( state: LoaderState, destination: ArrayObject, source: ArrayObject, - overridableKeys: ArrayObject<boolean> + overridableKeys: ArrayObject<boolean>, ): void { if (!common.isObject(source)) { return throwError( state, - "cannot merge mappings; the provided source object is unacceptable" + "cannot merge mappings; the provided source object is unacceptable", ); } @@ -316,7 +318,7 @@ function storeMappingPair( keyNode: Any, valueNode: unknown, startLine?: number, - startPos?: number + startPos?: number, ): ArrayObject { // The output is a plain object here, so keys can only be strings. // We need to convert keyNode to a string, but doing so can hang the process @@ -401,7 +403,7 @@ function readLineBreak(state: LoaderState): void { function skipSeparationSpace( state: LoaderState, allowComments: boolean, - checkIndent: number + checkIndent: number, ): number { let lineBreaks = 0, ch = state.input.charCodeAt(state.position); @@ -478,7 +480,7 @@ function writeFoldedLines(state: LoaderState, count: number): void { function readPlainScalar( state: LoaderState, nodeIndent: number, - withinFlowCollection: boolean + withinFlowCollection: boolean, ): boolean { const kind = state.kind; const result = state.result; @@ -587,7 +589,7 @@ function readPlainScalar( function readSingleQuotedScalar( state: LoaderState, - nodeIndent: number + nodeIndent: number, ): boolean { let ch, captureStart, captureEnd; @@ -624,7 +626,7 @@ function readSingleQuotedScalar( ) { return throwError( state, - "unexpected end of the document within a single quoted scalar" + "unexpected end of the document within a single quoted scalar", ); } else { state.position++; @@ -634,13 +636,13 @@ function readSingleQuotedScalar( return throwError( state, - "unexpected end of the stream within a single quoted scalar" + "unexpected end of the stream within a single quoted scalar", ); } function readDoubleQuotedScalar( state: LoaderState, - nodeIndent: number + nodeIndent: number, ): boolean { let ch = state.input.charCodeAt(state.position); @@ -703,7 +705,7 @@ function readDoubleQuotedScalar( ) { return throwError( state, - "unexpected end of the document within a double quoted scalar" + "unexpected end of the document within a double quoted scalar", ); } else { state.position++; @@ -713,7 +715,7 @@ function readDoubleQuotedScalar( return throwError( state, - "unexpected end of the stream within a double quoted scalar" + "unexpected end of the stream within a double quoted scalar", ); } @@ -808,7 +810,7 @@ function readFlowCollection(state: LoaderState, nodeIndent: number): boolean { overridableKeys, keyTag, keyNode, - valueNode + valueNode, ); } else if (isPair) { (result as Array<{}>).push( @@ -818,8 +820,8 @@ function readFlowCollection(state: LoaderState, nodeIndent: number): boolean { overridableKeys, keyTag, keyNode, - valueNode - ) + valueNode, + ), ); } else { (result as ResultType[]).push(keyNode as ResultType); @@ -839,7 +841,7 @@ function readFlowCollection(state: LoaderState, nodeIndent: number): boolean { return throwError( state, - "unexpected end of the stream within a flow collection" + "unexpected end of the stream within a flow collection", ); } @@ -879,7 +881,7 @@ function readBlockScalar(state: LoaderState, nodeIndent: number): boolean { if (tmp === 0) { return throwError( state, - "bad explicit indentation width of a block scalar; it cannot be less than one" + "bad explicit indentation width of a block scalar; it cannot be less than one", ); } else if (!detectedIndent) { textIndent = nodeIndent + tmp - 1; @@ -933,7 +935,7 @@ function readBlockScalar(state: LoaderState, nodeIndent: number): boolean { if (chomping === CHOMPING_KEEP) { state.result += common.repeat( "\n", - didReadContent ? 1 + emptyLines : emptyLines + didReadContent ? 1 + emptyLines : emptyLines, ); } else if (chomping === CHOMPING_CLIP) { if (didReadContent) { @@ -954,7 +956,7 @@ function readBlockScalar(state: LoaderState, nodeIndent: number): boolean { // except for the first content line (cf. Example 8.1) state.result += common.repeat( "\n", - didReadContent ? 1 + emptyLines : emptyLines + didReadContent ? 1 + emptyLines : emptyLines, ); // End of more-indented block. @@ -979,7 +981,7 @@ function readBlockScalar(state: LoaderState, nodeIndent: number): boolean { // Keep all line breaks except the header line break. state.result += common.repeat( "\n", - didReadContent ? 1 + emptyLines : emptyLines + didReadContent ? 1 + emptyLines : emptyLines, ); } @@ -1067,7 +1069,7 @@ function readBlockSequence(state: LoaderState, nodeIndent: number): boolean { function readBlockMapping( state: LoaderState, nodeIndent: number, - flowIndent: number + flowIndent: number, ): boolean { const tag = state.tag, anchor = state.anchor, @@ -1112,7 +1114,7 @@ function readBlockMapping( overridableKeys, keyTag as string, keyNode, - null + null, ); keyTag = keyNode = valueNode = null; } @@ -1127,7 +1129,7 @@ function readBlockMapping( } else { return throwError( state, - "incomplete explicit mapping pair; a key node is missed; or followed by a non-tabulated empty line" + "incomplete explicit mapping pair; a key node is missed; or followed by a non-tabulated empty line", ); } @@ -1152,7 +1154,7 @@ function readBlockMapping( if (!isWsOrEol(ch)) { return throwError( state, - "a whitespace character is expected after the key-value separator within a block mapping" + "a whitespace character is expected after the key-value separator within a block mapping", ); } @@ -1163,7 +1165,7 @@ function readBlockMapping( overridableKeys, keyTag as string, keyNode, - null + null, ); keyTag = keyNode = valueNode = null; } @@ -1176,7 +1178,7 @@ function readBlockMapping( } else if (detected) { return throwError( state, - "can not read an implicit mapping pair; a colon is missed" + "can not read an implicit mapping pair; a colon is missed", ); } else { state.tag = tag; @@ -1186,7 +1188,7 @@ function readBlockMapping( } else if (detected) { return throwError( state, - "can not read a block mapping entry; a multiline key may not be an implicit key" + "can not read a block mapping entry; a multiline key may not be an implicit key", ); } else { state.tag = tag; @@ -1221,7 +1223,7 @@ function readBlockMapping( keyNode, valueNode, line, - pos + pos, ); keyTag = keyNode = valueNode = null; } @@ -1249,7 +1251,7 @@ function readBlockMapping( overridableKeys, keyTag as string, keyNode, - null + null, ); } @@ -1306,7 +1308,7 @@ function readTagProperty(state: LoaderState): boolean { } else { return throwError( state, - "unexpected end of the stream within a verbatim tag" + "unexpected end of the stream within a verbatim tag", ); } } else { @@ -1318,7 +1320,7 @@ function readTagProperty(state: LoaderState): boolean { if (!PATTERN_TAG_HANDLE.test(tagHandle)) { return throwError( state, - "named tag handle cannot contain such characters" + "named tag handle cannot contain such characters", ); } @@ -1327,7 +1329,7 @@ function readTagProperty(state: LoaderState): boolean { } else { return throwError( state, - "tag suffix cannot contain exclamation marks" + "tag suffix cannot contain exclamation marks", ); } } @@ -1340,7 +1342,7 @@ function readTagProperty(state: LoaderState): boolean { if (PATTERN_FLOW_INDICATORS.test(tagName)) { return throwError( state, - "tag suffix cannot contain flow indicator characters" + "tag suffix cannot contain flow indicator characters", ); } } @@ -1348,7 +1350,7 @@ function readTagProperty(state: LoaderState): boolean { if (tagName && !PATTERN_TAG_URI.test(tagName)) { return throwError( state, - `tag name cannot contain such characters: ${tagName}` + `tag name cannot contain such characters: ${tagName}`, ); } @@ -1387,7 +1389,7 @@ function readAnchorProperty(state: LoaderState): boolean { if (state.position === position) { return throwError( state, - "name of an anchor node must contain at least one character" + "name of an anchor node must contain at least one character", ); } @@ -1410,7 +1412,7 @@ function readAlias(state: LoaderState): boolean { if (state.position === _position) { return throwError( state, - "name of an alias node must contain at least one character" + "name of an alias node must contain at least one character", ); } @@ -1434,7 +1436,7 @@ function composeNode( parentIndent: number, nodeContext: number, allowToSeek: boolean, - allowCompact: boolean + allowCompact: boolean, ): boolean { let allowBlockScalars: boolean, allowBlockCollections: boolean, @@ -1454,8 +1456,9 @@ function composeNode( state.kind = null; state.result = null; - const allowBlockStyles = (allowBlockScalars = allowBlockCollections = - CONTEXT_BLOCK_OUT === nodeContext || CONTEXT_BLOCK_IN === nodeContext); + const allowBlockStyles = + (allowBlockScalars = allowBlockCollections = + CONTEXT_BLOCK_OUT === nodeContext || CONTEXT_BLOCK_IN === nodeContext); if (allowToSeek) { if (skipSeparationSpace(state, true, -1)) { @@ -1495,8 +1498,8 @@ function composeNode( } if (indentStatus === 1 || CONTEXT_BLOCK_OUT === nodeContext) { - const cond = - CONTEXT_FLOW_IN === nodeContext || CONTEXT_FLOW_OUT === nodeContext; + const cond = CONTEXT_FLOW_IN === nodeContext || + CONTEXT_FLOW_OUT === nodeContext; flowIndent = cond ? parentIndent : parentIndent + 1; blockIndent = state.position - state.lineStart; @@ -1522,7 +1525,7 @@ function composeNode( if (state.tag !== null || state.anchor !== null) { return throwError( state, - "alias node should not have Any properties" + "alias node should not have Any properties", ); } } else if ( @@ -1542,8 +1545,8 @@ function composeNode( } else if (indentStatus === 0) { // Special case: block sequences are allowed to have same indentation level as the parent. // http://www.yaml.org/spec/1.2/spec.html#id2799784 - hasContent = - allowBlockCollections && readBlockSequence(state, blockIndent); + hasContent = allowBlockCollections && + readBlockSequence(state, blockIndent); } } @@ -1578,7 +1581,7 @@ function composeNode( if (state.result !== null && type.kind !== state.kind) { return throwError( state, - `unacceptable node kind for !<${state.tag}> tag; it should be "${type.kind}", not "${state.kind}"` + `unacceptable node kind for !<${state.tag}> tag; it should be "${type.kind}", not "${state.kind}"`, ); } @@ -1586,7 +1589,7 @@ function composeNode( // `state.result` updated in resolver if matched return throwError( state, - `cannot resolve a node with !<${state.tag}> explicit tag` + `cannot resolve a node with !<${state.tag}> explicit tag`, ); } else { state.result = type.construct(state.result); @@ -1641,7 +1644,7 @@ function readDocument(state: LoaderState): void { if (directiveName.length < 1) { return throwError( state, - "directive name must not be less than one character in length" + "directive name must not be less than one character in length", ); } @@ -1697,7 +1700,7 @@ function readDocument(state: LoaderState): void { if ( state.checkLineBreaks && PATTERN_NON_ASCII_LINE_BREAKS.test( - state.input.slice(documentStart, state.position) + state.input.slice(documentStart, state.position), ) ) { throwWarning(state, "non-ASCII line breaks are interpreted as content"); @@ -1716,7 +1719,7 @@ function readDocument(state: LoaderState): void { if (state.position < state.length - 1) { return throwError( state, - "end of the stream or a document separator is expected" + "end of the stream or a document separator is expected", ); } else { return; @@ -1767,7 +1770,7 @@ function isCbFunction(fn: unknown): fn is CbFunction { export function loadAll<T extends CbFunction | LoaderStateOptions>( input: string, iteratorOrOption?: T, - options?: LoaderStateOptions + options?: LoaderStateOptions, ): T extends CbFunction ? void : unknown[] { if (!isCbFunction(iteratorOrOption)) { return loadDocuments(input, iteratorOrOption as LoaderStateOptions) as Any; @@ -1792,6 +1795,6 @@ export function load(input: string, options?: LoaderStateOptions): unknown { return documents[0]; } throw new YAMLError( - "expected a single document in the stream, but found more" + "expected a single document in the stream, but found more", ); } diff --git a/std/encoding/_yaml/loader/loader_state.ts b/std/encoding/_yaml/loader/loader_state.ts index 781a4a086..60a7ccabc 100644 --- a/std/encoding/_yaml/loader/loader_state.ts +++ b/std/encoding/_yaml/loader/loader_state.ts @@ -57,7 +57,7 @@ export class LoaderState extends State { legacy = false, json = false, listener = null, - }: LoaderStateOptions + }: LoaderStateOptions, ) { super(schema); this.filename = filename; diff --git a/std/encoding/_yaml/mark.ts b/std/encoding/_yaml/mark.ts index 44cf175a0..35e986cce 100644 --- a/std/encoding/_yaml/mark.ts +++ b/std/encoding/_yaml/mark.ts @@ -11,7 +11,7 @@ export class Mark { public buffer: string, public position: number, public line: number, - public column: number + public column: number, ) {} public getSnippet(indent = 4, maxLength = 75): string | null { @@ -48,10 +48,12 @@ export class Mark { } const snippet = this.buffer.slice(start, end); - return `${repeat(" ", indent)}${head}${snippet}${tail}\n${repeat( - " ", - indent + this.position - start + head.length - )}^`; + return `${repeat(" ", indent)}${head}${snippet}${tail}\n${ + repeat( + " ", + indent + this.position - start + head.length, + ) + }^`; } public toString(compact?: boolean): string { diff --git a/std/encoding/_yaml/parse.ts b/std/encoding/_yaml/parse.ts index 9a6f325f2..05a9b48ac 100644 --- a/std/encoding/_yaml/parse.ts +++ b/std/encoding/_yaml/parse.ts @@ -26,7 +26,7 @@ export function parse(content: string, options?: ParseOptions): unknown { export function parseAll( content: string, iterator?: CbFunction, - options?: ParseOptions + options?: ParseOptions, ): unknown { return loadAll(content, iterator, options); } diff --git a/std/encoding/_yaml/schema.ts b/std/encoding/_yaml/schema.ts index 98b49203c..b955e5df8 100644 --- a/std/encoding/_yaml/schema.ts +++ b/std/encoding/_yaml/schema.ts @@ -10,7 +10,7 @@ import type { ArrayObject, Any } from "./utils.ts"; function compileList( schema: Schema, name: "implicit" | "explicit", - result: Type[] + result: Type[], ): Type[] { const exclude: number[] = []; @@ -78,7 +78,7 @@ export class Schema implements SchemaDefinition { if (type.loadKind && type.loadKind !== "scalar") { throw new YAMLError( // eslint-disable-next-line max-len - "There is a non-scalar type in the implicit list of a schema. Implicit resolving of such types is not supported." + "There is a non-scalar type in the implicit list of a schema. Implicit resolving of such types is not supported.", ); } } @@ -87,7 +87,7 @@ export class Schema implements SchemaDefinition { this.compiledExplicit = compileList(this, "explicit", []); this.compiledTypeMap = compileMap( this.compiledImplicit, - this.compiledExplicit + this.compiledExplicit, ); } diff --git a/std/encoding/_yaml/type/float.ts b/std/encoding/_yaml/type/float.ts index 5ae0689b2..6d59ed9ed 100644 --- a/std/encoding/_yaml/type/float.ts +++ b/std/encoding/_yaml/type/float.ts @@ -17,7 +17,7 @@ const YAML_FLOAT_PATTERN = new RegExp( // .inf "|[-+]?\\.(?:inf|Inf|INF)" + // .nan - "|\\.(?:nan|NaN|NAN))$" + "|\\.(?:nan|NaN|NAN))$", ); function resolveYamlFloat(data: string): boolean { diff --git a/std/encoding/_yaml/type/timestamp.ts b/std/encoding/_yaml/type/timestamp.ts index eb03b3825..231908231 100644 --- a/std/encoding/_yaml/type/timestamp.ts +++ b/std/encoding/_yaml/type/timestamp.ts @@ -7,21 +7,21 @@ import { Type } from "../type.ts"; const YAML_DATE_REGEXP = new RegExp( "^([0-9][0-9][0-9][0-9])" + // [1] year - "-([0-9][0-9])" + // [2] month - "-([0-9][0-9])$" // [3] day + "-([0-9][0-9])" + // [2] month + "-([0-9][0-9])$", // [3] day ); const YAML_TIMESTAMP_REGEXP = new RegExp( "^([0-9][0-9][0-9][0-9])" + // [1] year - "-([0-9][0-9]?)" + // [2] month - "-([0-9][0-9]?)" + // [3] day - "(?:[Tt]|[ \\t]+)" + // ... - "([0-9][0-9]?)" + // [4] hour - ":([0-9][0-9])" + // [5] minute - ":([0-9][0-9])" + // [6] second - "(?:\\.([0-9]*))?" + // [7] fraction - "(?:[ \\t]*(Z|([-+])([0-9][0-9]?)" + // [8] tz [9] tz_sign [10] tz_hour - "(?::([0-9][0-9]))?))?$" // [11] tz_minute + "-([0-9][0-9]?)" + // [2] month + "-([0-9][0-9]?)" + // [3] day + "(?:[Tt]|[ \\t]+)" + // ... + "([0-9][0-9]?)" + // [4] hour + ":([0-9][0-9])" + // [5] minute + ":([0-9][0-9])" + // [6] second + "(?:\\.([0-9]*))?" + // [7] fraction + "(?:[ \\t]*(Z|([-+])([0-9][0-9]?)" + // [8] tz [9] tz_sign [10] tz_hour + "(?::([0-9][0-9]))?))?$", // [11] tz_minute ); function resolveYamlTimestamp(data: string): boolean { @@ -75,7 +75,7 @@ function constructYamlTimestamp(data: string): Date { } const date = new Date( - Date.UTC(year, month, day, hour, minute, second, fraction) + Date.UTC(year, month, day, hour, minute, second, fraction), ); if (delta) date.setTime(date.getTime() - delta); diff --git a/std/encoding/ascii85.ts b/std/encoding/ascii85.ts index b7a2e2065..6a303ebda 100644 --- a/std/encoding/ascii85.ts +++ b/std/encoding/ascii85.ts @@ -65,9 +65,11 @@ export function encode(uint8: Uint8Array, options?: Ascii85Options): string { break; case "btoa": if (options?.delimiter) { - return `xbtoa Begin\n${output - .slice(0, output.length - difference) - .join("")}\nxbtoa End`; + return `xbtoa Begin\n${ + output + .slice(0, output.length - difference) + .join("") + }\nxbtoa End`; } break; case "RFC 1924": @@ -99,13 +101,15 @@ export function decode(ascii85: string, options?: Ascii85Options): Uint8Array { .replaceAll("y", "+<VdL"); break; case "RFC 1924": - ascii85 = ascii85.replaceAll(/./g, (match) => - String.fromCharCode(rfc1924.indexOf(match) + 33) + ascii85 = ascii85.replaceAll( + /./g, + (match) => String.fromCharCode(rfc1924.indexOf(match) + 33), ); break; case "Z85": - ascii85 = ascii85.replaceAll(/./g, (match) => - String.fromCharCode(Z85.indexOf(match) + 33) + ascii85 = ascii85.replaceAll( + /./g, + (match) => String.fromCharCode(Z85.indexOf(match) + 33), ); break; } @@ -117,7 +121,7 @@ export function decode(ascii85: string, options?: Ascii85Options): Uint8Array { let v = 0, n = 0, max = 0; - for (let i = 0; i < len; ) { + for (let i = 0; i < len;) { for (max += 5; i < max; i++) { v = v * 85 + (i < len ? ascii85.charCodeAt(i) : 117) - 33; } diff --git a/std/encoding/ascii85_test.ts b/std/encoding/ascii85_test.ts index d068c0bf6..02af70964 100644 --- a/std/encoding/ascii85_test.ts +++ b/std/encoding/ascii85_test.ts @@ -126,7 +126,7 @@ for (const [standard, tests] of Object.entries(testCasesNoDelimeter)) { encode(utf8encoder.encode(bin), { standard: standard as Ascii85Standard, }), - b85 + b85, ); } }, @@ -138,7 +138,7 @@ for (const [standard, tests] of Object.entries(testCasesNoDelimeter)) { for (const [bin, b85] of tests) { assertEquals( decode(b85, { standard: standard as Ascii85Standard }), - utf8encoder.encode(bin) + utf8encoder.encode(bin), ); } }, @@ -155,7 +155,7 @@ for (const [standard, tests] of Object.entries(testCasesDelimeter)) { standard: standard as Ascii85Standard, delimiter: true, }), - b85 + b85, ); } }, @@ -170,7 +170,7 @@ for (const [standard, tests] of Object.entries(testCasesDelimeter)) { standard: standard as Ascii85Standard, delimiter: true, }), - utf8encoder.encode(bin) + utf8encoder.encode(bin), ); } }, diff --git a/std/encoding/base32.ts b/std/encoding/base32.ts index e7d3332fd..7d0ec81f3 100644 --- a/std/encoding/base32.ts +++ b/std/encoding/base32.ts @@ -65,8 +65,7 @@ export function decode(b32: string): Uint8Array { let i: number; for (i = 0; i < len; i += 8) { - tmp = - (revLookup[b32.charCodeAt(i)] << 20) | + tmp = (revLookup[b32.charCodeAt(i)] << 20) | (revLookup[b32.charCodeAt(i + 1)] << 15) | (revLookup[b32.charCodeAt(i + 2)] << 10) | (revLookup[b32.charCodeAt(i + 3)] << 5) | @@ -75,8 +74,7 @@ export function decode(b32: string): Uint8Array { arr[curByte++] = (tmp >> 9) & 0xff; arr[curByte++] = (tmp >> 1) & 0xff; - tmp = - ((tmp & 1) << 15) | + tmp = ((tmp & 1) << 15) | (revLookup[b32.charCodeAt(i + 5)] << 10) | (revLookup[b32.charCodeAt(i + 6)] << 5) | revLookup[b32.charCodeAt(i + 7)]; @@ -85,8 +83,7 @@ export function decode(b32: string): Uint8Array { } if (placeHoldersLen === 1) { - tmp = - (revLookup[b32.charCodeAt(i)] << 20) | + tmp = (revLookup[b32.charCodeAt(i)] << 20) | (revLookup[b32.charCodeAt(i + 1)] << 15) | (revLookup[b32.charCodeAt(i + 2)] << 10) | (revLookup[b32.charCodeAt(i + 3)] << 5) | @@ -94,14 +91,12 @@ export function decode(b32: string): Uint8Array { arr[curByte++] = (tmp >> 17) & 0xff; arr[curByte++] = (tmp >> 9) & 0xff; arr[curByte++] = (tmp >> 1) & 0xff; - tmp = - ((tmp & 1) << 7) | + tmp = ((tmp & 1) << 7) | (revLookup[b32.charCodeAt(i + 5)] << 2) | (revLookup[b32.charCodeAt(i + 6)] >> 3); arr[curByte++] = tmp & 0xff; } else if (placeHoldersLen === 3) { - tmp = - (revLookup[b32.charCodeAt(i)] << 19) | + tmp = (revLookup[b32.charCodeAt(i)] << 19) | (revLookup[b32.charCodeAt(i + 1)] << 14) | (revLookup[b32.charCodeAt(i + 2)] << 9) | (revLookup[b32.charCodeAt(i + 3)] << 4) | @@ -110,16 +105,14 @@ export function decode(b32: string): Uint8Array { arr[curByte++] = (tmp >> 8) & 0xff; arr[curByte++] = tmp & 0xff; } else if (placeHoldersLen === 4) { - tmp = - (revLookup[b32.charCodeAt(i)] << 11) | + tmp = (revLookup[b32.charCodeAt(i)] << 11) | (revLookup[b32.charCodeAt(i + 1)] << 6) | (revLookup[b32.charCodeAt(i + 2)] << 1) | (revLookup[b32.charCodeAt(i + 3)] >> 4); arr[curByte++] = (tmp >> 8) & 0xff; arr[curByte++] = tmp & 0xff; } else if (placeHoldersLen === 6) { - tmp = - (revLookup[b32.charCodeAt(i)] << 3) | + tmp = (revLookup[b32.charCodeAt(i)] << 3) | (revLookup[b32.charCodeAt(i + 1)] >> 2); arr[curByte++] = tmp & 0xff; } @@ -131,16 +124,14 @@ function encodeChunk(uint8: Uint8Array, start: number, end: number): string { let tmp: number; const output = []; for (let i = start; i < end; i += 5) { - tmp = - ((uint8[i] << 16) & 0xff0000) | + tmp = ((uint8[i] << 16) & 0xff0000) | ((uint8[i + 1] << 8) & 0xff00) | (uint8[i + 2] & 0xff); output.push(lookup[(tmp >> 19) & 0x1f]); output.push(lookup[(tmp >> 14) & 0x1f]); output.push(lookup[(tmp >> 9) & 0x1f]); output.push(lookup[(tmp >> 4) & 0x1f]); - tmp = - ((tmp & 0xf) << 16) | + tmp = ((tmp & 0xf) << 16) | ((uint8[i + 3] << 8) & 0xff00) | (uint8[i + 4] & 0xff); output.push(lookup[(tmp >> 15) & 0x1f]); @@ -169,15 +160,14 @@ export function encode(uint8: Uint8Array): string { encodeChunk( uint8, i, - i + maxChunkLength > len2 ? len2 : i + maxChunkLength - ) + i + maxChunkLength > len2 ? len2 : i + maxChunkLength, + ), ); } // pad the end with zeros, but make sure to not forget the extra bytes if (extraBytes === 4) { - tmp = - ((uint8[len2] & 0xff) << 16) | + tmp = ((uint8[len2] & 0xff) << 16) | ((uint8[len2 + 1] & 0xff) << 8) | (uint8[len2 + 2] & 0xff); parts.push(lookup[(tmp >> 19) & 0x1f]); @@ -190,8 +180,7 @@ export function encode(uint8: Uint8Array): string { parts.push(lookup[tmp & 0x1f]); parts.push("="); } else if (extraBytes === 3) { - tmp = - ((uint8[len2] & 0xff) << 17) | + tmp = ((uint8[len2] & 0xff) << 17) | ((uint8[len2 + 1] & 0xff) << 9) | ((uint8[len2 + 2] & 0xff) << 1); parts.push(lookup[(tmp >> 20) & 0x1f]); diff --git a/std/encoding/base32_test.ts b/std/encoding/base32_test.ts index 2bd7acea1..cfefe54d7 100644 --- a/std/encoding/base32_test.ts +++ b/std/encoding/base32_test.ts @@ -112,7 +112,7 @@ Deno.test({ decode("OOOO=="); } catch (e) { assert( - e.message.includes("Invalid string. Length must be a multiple of 8") + e.message.includes("Invalid string. Length must be a multiple of 8"), ); errorCaught = true; } diff --git a/std/encoding/base64url.ts b/std/encoding/base64url.ts index 726ea2eb8..b20878554 100644 --- a/std/encoding/base64url.ts +++ b/std/encoding/base64url.ts @@ -12,8 +12,9 @@ import { export function addPaddingToBase64url(base64url: string): string { if (base64url.length % 4 === 2) return base64url + "=="; if (base64url.length % 4 === 3) return base64url + "="; - if (base64url.length % 4 === 1) + if (base64url.length % 4 === 1) { throw new TypeError("Illegal base64url string!"); + } return base64url; } diff --git a/std/encoding/binary.ts b/std/encoding/binary.ts index aed9343b9..f4918e750 100644 --- a/std/encoding/binary.ts +++ b/std/encoding/binary.ts @@ -47,7 +47,7 @@ export function sizeof(dataType: DataType): number { * Resolves it in a `Uint8Array`, or throws `Deno.errors.UnexpectedEof` if `n` bytes cannot be read. */ export async function getNBytes( r: Deno.Reader, - n: number + n: number, ): Promise<Uint8Array> { const scratch = new Uint8Array(n); const nRead = await r.read(scratch); @@ -117,7 +117,7 @@ export function varbig(b: Uint8Array, o: VarbigOptions = {}): bigint | null { export function putVarnum( b: Uint8Array, x: number, - o: VarnumOptions = {} + o: VarnumOptions = {}, ): number { o.dataType = o.dataType ?? "int32"; const littleEndian = (o.endian ?? "big") === "little" ? true : false; @@ -158,7 +158,7 @@ export function putVarnum( export function putVarbig( b: Uint8Array, x: bigint, - o: VarbigOptions = {} + o: VarbigOptions = {}, ): number { o.dataType = o.dataType ?? "int64"; const littleEndian = (o.endian ?? "big") === "little" ? true : false; @@ -198,7 +198,7 @@ export function putVarbig( * `o.dataType` defaults to `"int32"`. */ export async function readVarnum( r: Deno.Reader, - o: VarnumOptions = {} + o: VarnumOptions = {}, ): Promise<number> { o.dataType = o.dataType ?? "int32"; const scratch = await getNBytes(r, sizeof(o.dataType)); @@ -210,7 +210,7 @@ export async function readVarnum( * `o.dataType` defaults to `"int64"`. */ export async function readVarbig( r: Deno.Reader, - o: VarbigOptions = {} + o: VarbigOptions = {}, ): Promise<bigint> { o.dataType = o.dataType ?? "int64"; const scratch = await getNBytes(r, sizeof(o.dataType)); @@ -223,7 +223,7 @@ export async function readVarbig( export function writeVarnum( w: Deno.Writer, x: number, - o: VarnumOptions = {} + o: VarnumOptions = {}, ): Promise<number> { o.dataType = o.dataType ?? "int32"; const scratch = new Uint8Array(sizeof(o.dataType)); @@ -237,7 +237,7 @@ export function writeVarnum( export function writeVarbig( w: Deno.Writer, x: bigint, - o: VarbigOptions = {} + o: VarbigOptions = {}, ): Promise<number> { o.dataType = o.dataType ?? "int64"; const scratch = new Uint8Array(sizeof(o.dataType)); diff --git a/std/encoding/binary_test.ts b/std/encoding/binary_test.ts index 6213bc2e3..89a5b8c8e 100644 --- a/std/encoding/binary_test.ts +++ b/std/encoding/binary_test.ts @@ -36,7 +36,7 @@ Deno.test("testPutVarbig", function (): void { putVarbig(buff, 0xffeeddccbbaa9988n); assertEquals( buff, - new Uint8Array([0xff, 0xee, 0xdd, 0xcc, 0xbb, 0xaa, 0x99, 0x88]) + new Uint8Array([0xff, 0xee, 0xdd, 0xcc, 0xbb, 0xaa, 0x99, 0x88]), ); }); @@ -45,7 +45,7 @@ Deno.test("testPutVarbigLittleEndian", function (): void { putVarbig(buff, 0x8899aabbccddeeffn, { endian: "little" }); assertEquals( buff, - new Uint8Array([0xff, 0xee, 0xdd, 0xcc, 0xbb, 0xaa, 0x99, 0x88]) + new Uint8Array([0xff, 0xee, 0xdd, 0xcc, 0xbb, 0xaa, 0x99, 0x88]), ); }); @@ -132,7 +132,7 @@ Deno.test("testWriteVarbig", async function (): Promise<void> { await buff.read(data); assertEquals( data, - new Uint8Array([0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08]) + new Uint8Array([0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08]), ); }); @@ -143,7 +143,7 @@ Deno.test("testWriteVarbigLittleEndian", async function (): Promise<void> { await buff.read(data); assertEquals( data, - new Uint8Array([0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08]) + new Uint8Array([0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08]), ); }); @@ -167,7 +167,7 @@ Deno.test("testVarbigBytes", function (): void { const rslt = varbigBytes(0x0102030405060708n); assertEquals( rslt, - new Uint8Array([0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08]) + new Uint8Array([0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08]), ); }); @@ -175,7 +175,7 @@ Deno.test("testVarbigBytesLittleEndian", function (): void { const rslt = varbigBytes(0x0807060504030201n, { endian: "little" }); assertEquals( rslt, - new Uint8Array([0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08]) + new Uint8Array([0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08]), ); }); diff --git a/std/encoding/csv.ts b/std/encoding/csv.ts index 5af054530..27b40c566 100644 --- a/std/encoding/csv.ts +++ b/std/encoding/csv.ts @@ -63,7 +63,7 @@ function chkOptions(opt: ReadOptions): void { async function readRecord( Startline: number, reader: BufReader, - opt: ReadOptions = { comma: ",", trimLeadingSpace: false } + opt: ReadOptions = { comma: ",", trimLeadingSpace: false }, ): Promise<string[] | null> { const tp = new TextProtoReader(reader); const lineIndex = Startline; @@ -86,7 +86,8 @@ async function readRecord( const commaLen = opt.comma.length; let recordBuffer = ""; const fieldIndexes = [] as number[]; - parseField: for (;;) { + parseField: + for (;;) { if (opt.trimLeadingSpace) { line = line.trimLeft(); } @@ -221,7 +222,7 @@ export async function readMatrix( comma: ",", trimLeadingSpace: false, lazyQuotes: false, - } + }, ): Promise<string[][]> { const result: string[][] = []; let _nbFields: number | undefined; @@ -315,7 +316,7 @@ export async function parse( input: string | BufReader, opt: ParseOptions = { header: false, - } + }, ): Promise<unknown[]> { let r: string[][]; if (input instanceof BufReader) { @@ -336,7 +337,7 @@ export async function parse( return { name: e, }; - } + }, ); } } else { @@ -347,7 +348,7 @@ export async function parse( return { name: e, }; - } + }, ); i++; } diff --git a/std/encoding/csv_test.ts b/std/encoding/csv_test.ts index 60d43e35e..07a8e0965 100644 --- a/std/encoding/csv_test.ts +++ b/std/encoding/csv_test.ts @@ -381,8 +381,8 @@ x,,, */ { Name: "HugeLines", - Input: - "#ignore\n".repeat(10000) + "@".repeat(5000) + "," + "*".repeat(5000), + Input: "#ignore\n".repeat(10000) + "@".repeat(5000) + "," + + "*".repeat(5000), Output: [["@".repeat(5000), "*".repeat(5000)]], Comment: "#", }, @@ -488,7 +488,7 @@ for (const t of testCases) { trimLeadingSpace: trim, fieldsPerRecord: fieldsPerRec, lazyQuotes: lazyquote, - } + }, ); } catch (e) { err = e; @@ -504,7 +504,7 @@ for (const t of testCases) { trimLeadingSpace: trim, fieldsPerRecord: fieldsPerRec, lazyQuotes: lazyquote, - } + }, ); const expected = t.Output; assertEquals(actual, expected); diff --git a/std/encoding/hex.ts b/std/encoding/hex.ts index 729df6c49..5b09422a9 100644 --- a/std/encoding/hex.ts +++ b/std/encoding/hex.ts @@ -10,7 +10,7 @@ const hextable = new TextEncoder().encode("0123456789abcdef"); export function errInvalidByte(byte: number): Error { return new Error( "encoding/hex: invalid byte: " + - new TextDecoder().decode(new Uint8Array([byte])) + new TextDecoder().decode(new Uint8Array([byte])), ); } diff --git a/std/encoding/hex_test.ts b/std/encoding/hex_test.ts index a42238e53..0cf39ad2e 100644 --- a/std/encoding/hex_test.ts +++ b/std/encoding/hex_test.ts @@ -132,7 +132,7 @@ Deno.test({ assertThrows( () => decode(new TextEncoder().encode(input as string)), Error, - (expectedErr as Error).message + (expectedErr as Error).message, ); } }, @@ -147,7 +147,7 @@ Deno.test({ decodeString(input as string); }, Error, - (expectedErr as Error).message + (expectedErr as Error).message, ); } }, diff --git a/std/encoding/toml.ts b/std/encoding/toml.ts index 8a0715ab6..7d340c8e8 100644 --- a/std/encoding/toml.ts +++ b/std/encoding/toml.ts @@ -110,7 +110,7 @@ class Parser { .join("\n") .replace(/"""/g, '"') .replace(/'''/g, `'`) - .replace(/\n/g, "\\n") + .replace(/\n/g, "\\n"), ); isLiteral = false; } else { @@ -321,7 +321,7 @@ class Parser { this.context.currentGroup.type === "array" ) { this.context.currentGroup.arrValues.push( - this.context.currentGroup.objValues + this.context.currentGroup.objValues, ); this.context.currentGroup.objValues = {}; } @@ -350,7 +350,7 @@ class Parser { if (this.context.currentGroup) { if (this.context.currentGroup.type === "array") { this.context.currentGroup.arrValues.push( - this.context.currentGroup.objValues + this.context.currentGroup.objValues, ); } this._groupToOutput(); diff --git a/std/encoding/toml_test.ts b/std/encoding/toml_test.ts index d272a29ff..5c4c63b5a 100644 --- a/std/encoding/toml_test.ts +++ b/std/encoding/toml_test.ts @@ -27,8 +27,7 @@ Deno.test({ str4: 'this is a "quote"', str5: "The quick brown\nfox jumps over\nthe lazy dog.", str6: "The quick brown\nfox jumps over\nthe lazy dog.", - lines: - "The first newline is\ntrimmed in raw strings.\n All other " + + lines: "The first newline is\ntrimmed in raw strings.\n All other " + "whitespace\n is preserved.", }, }; |