diff options
| author | Kitson Kelly <me@kitsonkelly.com> | 2020-03-29 04:03:49 +1100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-03-28 13:03:49 -0400 |
| commit | bced52505f32d6cca4f944bb610a8a26767908a8 (patch) | |
| tree | da49a5df4b7bd6f8306248069228cd6bd0db1303 /std/encoding/yaml | |
| parent | 1397b8e0e7c85762e19d88fde103342bfa563360 (diff) | |
Update to Prettier 2 and use ES Private Fields (#4498)
Diffstat (limited to 'std/encoding/yaml')
26 files changed, 64 insertions, 67 deletions
diff --git a/std/encoding/yaml/dumper/dumper.ts b/std/encoding/yaml/dumper/dumper.ts index 3a34e14cc..1280ee757 100644 --- a/std/encoding/yaml/dumper/dumper.ts +++ b/std/encoding/yaml/dumper/dumper.ts @@ -73,7 +73,7 @@ const DEPRECATED_BOOLEANS_SYNTAX = [ "NO", "off", "Off", - "OFF" + "OFF", ]; function encodeHex(character: number): string { diff --git a/std/encoding/yaml/dumper/dumper_state.ts b/std/encoding/yaml/dumper/dumper_state.ts index 88164a0d2..94cd84878 100644 --- a/std/encoding/yaml/dumper/dumper_state.ts +++ b/std/encoding/yaml/dumper/dumper_state.ts @@ -121,7 +121,7 @@ export class DumperState extends State { lineWidth = 80, noRefs = false, noCompatMode = false, - condenseFlow = false + condenseFlow = false, }: DumperStateOptions) { super(schema); this.indent = Math.max(1, indent); diff --git a/std/encoding/yaml/example/dump.ts b/std/encoding/yaml/example/dump.ts index 746c3be01..db3647274 100644 --- a/std/encoding/yaml/example/dump.ts +++ b/std/encoding/yaml/example/dump.ts @@ -10,13 +10,13 @@ console.log( "a", "b", { - a: false + a: false, }, { - a: false - } - ] + a: false, + }, + ], }, - test: "foobar" + test: "foobar", }) ); diff --git a/std/encoding/yaml/example/inout.ts b/std/encoding/yaml/example/inout.ts index 80cad8258..b0b47e3fe 100644 --- a/std/encoding/yaml/example/inout.ts +++ b/std/encoding/yaml/example/inout.ts @@ -9,14 +9,14 @@ const test = { "a", "b", { - a: false + a: false, }, { - a: false - } - ] + a: false, + }, + ], }, - test: "foobar" + test: "foobar", }; const string = stringify(test); diff --git a/std/encoding/yaml/loader/loader.ts b/std/encoding/yaml/loader/loader.ts index 1ab4fc7f5..f0d535624 100644 --- a/std/encoding/yaml/loader/loader.ts +++ b/std/encoding/yaml/loader/loader.ts @@ -37,11 +37,11 @@ function _class(obj: unknown): string { } function isEOL(c: number): boolean { - return c === 0x0a /* LF */ || c === 0x0d /* CR */; + return c === 0x0a || /* LF */ c === 0x0d /* CR */; } function isWhiteSpace(c: number): boolean { - return c === 0x09 /* Tab */ || c === 0x20 /* Space */; + return c === 0x09 || /* Tab */ c === 0x20 /* Space */; } function isWsOrEol(c: number): boolean { @@ -64,13 +64,13 @@ function isFlowIndicator(c: number): boolean { } function fromHexCode(c: number): number { - if (0x30 /* 0 */ <= c && c <= 0x39 /* 9 */) { + if (0x30 <= /* 0 */ c && c <= 0x39 /* 9 */) { return c - 0x30; } const lc = c | 0x20; - if (0x61 /* a */ <= lc && lc <= 0x66 /* f */) { + if (0x61 <= /* a */ lc && lc <= 0x66 /* f */) { return lc - 0x61 + 10; } @@ -91,7 +91,7 @@ function escapedHexLen(c: number): number { } function fromDecimalCode(c: number): number { - if (0x30 /* 0 */ <= c && c <= 0x39 /* 9 */) { + if (0x30 <= /* 0 */ c && c <= 0x39 /* 9 */) { return c - 0x30; } @@ -251,7 +251,7 @@ const directiveHandlers: DirectiveHandlers = { state.tagMap = {}; } state.tagMap[handle] = prefix; - } + }, }; function captureSegment( @@ -414,7 +414,7 @@ function skipSeparationSpace( if (allowComments && ch === 0x23 /* # */) { do { ch = state.input.charCodeAt(++state.position); - } while (ch !== 0x0a /* LF */ && ch !== 0x0d /* CR */ && ch !== 0); + } while (ch !== 0x0a && /* LF */ ch !== 0x0d && /* CR */ ch !== 0); } if (isEOL(ch)) { @@ -451,7 +451,7 @@ function testDocumentSeparator(state: LoaderState): boolean { // Condition state.position === state.lineStart is tested // in parent on each call, for efficiency. No needs to test here again. if ( - (ch === 0x2d /* - */ || ch === 0x2e) /* . */ && + (ch === 0x2d || /* - */ ch === 0x2e) /* . */ && ch === state.input.charCodeAt(_position + 1) && ch === state.input.charCodeAt(_position + 2) ) { @@ -503,7 +503,7 @@ function readPlainScalar( } let following: number; - if (ch === 0x3f /* ? */ || ch === 0x2d /* - */) { + if (ch === 0x3f || /* ? */ ch === 0x2d /* - */) { following = state.input.charCodeAt(state.position + 1); if ( @@ -869,7 +869,7 @@ function readBlockScalar(state: LoaderState, nodeIndent: number): boolean { while (ch !== 0) { ch = state.input.charCodeAt(++state.position); - if (ch === 0x2b /* + */ || ch === 0x2d /* - */) { + if (ch === 0x2b || /* + */ ch === 0x2d /* - */) { if (CHOMPING_CLIP === chomping) { chomping = ch === 0x2b /* + */ ? CHOMPING_KEEP : CHOMPING_STRIP; } else { @@ -1103,7 +1103,7 @@ function readBlockMapping( // Explicit notation case. There are two separate blocks: // first for the key (denoted by "?") and second for the value (denoted by ":") // - if ((ch === 0x3f /* ? */ || ch === 0x3a) /* : */ && isWsOrEol(following)) { + if ((ch === 0x3f || /* ? */ ch === 0x3a) && /* : */ isWsOrEol(following)) { if (ch === 0x3f /* ? */) { if (atExplicitKey) { storeMappingPair( diff --git a/std/encoding/yaml/loader/loader_state.ts b/std/encoding/yaml/loader/loader_state.ts index 1e136025c..ca50fcaf1 100644 --- a/std/encoding/yaml/loader/loader_state.ts +++ b/std/encoding/yaml/loader/loader_state.ts @@ -56,7 +56,7 @@ export class LoaderState extends State { onWarning, legacy = false, json = false, - listener = null + listener = null, }: LoaderStateOptions ) { super(schema); diff --git a/std/encoding/yaml/parse_test.ts b/std/encoding/yaml/parse_test.ts index bdcd8db62..21f1b893b 100644 --- a/std/encoding/yaml/parse_test.ts +++ b/std/encoding/yaml/parse_test.ts @@ -20,7 +20,7 @@ Deno.test({ const expected = { test: "toto", foo: { bar: true, baz: 1, qux: null } }; assertEquals(parse(yaml), expected); - } + }, }); Deno.test({ @@ -40,17 +40,17 @@ name: Eve const expected = [ { id: 1, - name: "Alice" + name: "Alice", }, { id: 2, - name: "Bob" + name: "Bob", }, { id: 3, - name: "Eve" - } + name: "Eve", + }, ]; assertEquals(parseAll(yaml), expected); - } + }, }); diff --git a/std/encoding/yaml/schema.ts b/std/encoding/yaml/schema.ts index 1968e34c1..579644dbb 100644 --- a/std/encoding/yaml/schema.ts +++ b/std/encoding/yaml/schema.ts @@ -45,7 +45,7 @@ function compileMap(...typesList: Type[][]): TypeMap { fallback: {}, mapping: {}, scalar: {}, - sequence: {} + sequence: {}, }; for (const types of typesList) { diff --git a/std/encoding/yaml/schema/core.ts b/std/encoding/yaml/schema/core.ts index 82a512a1e..4fadc9bfe 100644 --- a/std/encoding/yaml/schema/core.ts +++ b/std/encoding/yaml/schema/core.ts @@ -9,5 +9,5 @@ import { json } from "./json.ts"; // Standard YAML's Core schema. // http://www.yaml.org/spec/1.2/spec.html#id2804923 export const core = new Schema({ - include: [json] + include: [json], }); diff --git a/std/encoding/yaml/schema/default.ts b/std/encoding/yaml/schema/default.ts index 0fe1dbf12..4c5ceeba7 100644 --- a/std/encoding/yaml/schema/default.ts +++ b/std/encoding/yaml/schema/default.ts @@ -12,5 +12,5 @@ import { core } from "./core.ts"; export const def = new Schema({ explicit: [binary, omap, pairs, set], implicit: [timestamp, merge], - include: [core] + include: [core], }); diff --git a/std/encoding/yaml/schema/failsafe.ts b/std/encoding/yaml/schema/failsafe.ts index 0fbb74ca9..74e1897be 100644 --- a/std/encoding/yaml/schema/failsafe.ts +++ b/std/encoding/yaml/schema/failsafe.ts @@ -9,5 +9,5 @@ import { map, seq, str } from "../type/mod.ts"; // Standard YAML's Failsafe schema. // http://www.yaml.org/spec/1.2/spec.html#id2802346 export const failsafe = new Schema({ - explicit: [str, seq, map] + explicit: [str, seq, map], }); diff --git a/std/encoding/yaml/schema/json.ts b/std/encoding/yaml/schema/json.ts index dae469f35..c30166fdf 100644 --- a/std/encoding/yaml/schema/json.ts +++ b/std/encoding/yaml/schema/json.ts @@ -11,5 +11,5 @@ import { failsafe } from "./failsafe.ts"; // http://www.yaml.org/spec/1.2/spec.html#id2803231 export const json = new Schema({ implicit: [nil, bool, int, float], - include: [failsafe] + include: [failsafe], }); diff --git a/std/encoding/yaml/stringify_test.ts b/std/encoding/yaml/stringify_test.ts index 941beb789..03a3090d9 100644 --- a/std/encoding/yaml/stringify_test.ts +++ b/std/encoding/yaml/stringify_test.ts @@ -16,14 +16,14 @@ Deno.test({ "a", "b", { - a: false + a: false, }, { - a: false - } - ] + a: false, + }, + ], }, - test: "foobar" + test: "foobar", }; const ASSERTS = `foo: @@ -37,5 +37,5 @@ test: foobar `; assertEquals(stringify(FIXTURE), ASSERTS); - } + }, }); diff --git a/std/encoding/yaml/type/binary.ts b/std/encoding/yaml/type/binary.ts index 8cfe54f79..f4823b3f7 100644 --- a/std/encoding/yaml/type/binary.ts +++ b/std/encoding/yaml/type/binary.ts @@ -135,5 +135,5 @@ export const binary = new Type("tag:yaml.org,2002:binary", { kind: "scalar", predicate: isBinary, represent: representYamlBinary, - resolve: resolveYamlBinary + resolve: resolveYamlBinary, }); diff --git a/std/encoding/yaml/type/bool.ts b/std/encoding/yaml/type/bool.ts index e39823872..a5a85cf9e 100644 --- a/std/encoding/yaml/type/bool.ts +++ b/std/encoding/yaml/type/bool.ts @@ -33,7 +33,7 @@ export const bool = new Type("tag:yaml.org,2002:bool", { }, camelcase(object: boolean): string { return object ? "True" : "False"; - } + }, }, - resolve: resolveYamlBoolean + resolve: resolveYamlBoolean, }); diff --git a/std/encoding/yaml/type/float.ts b/std/encoding/yaml/type/float.ts index acb12f5b0..5ae0689b2 100644 --- a/std/encoding/yaml/type/float.ts +++ b/std/encoding/yaml/type/float.ts @@ -121,5 +121,5 @@ export const float = new Type("tag:yaml.org,2002:float", { kind: "scalar", predicate: isFloat, represent: representYamlFloat, - resolve: resolveYamlFloat + resolve: resolveYamlFloat, }); diff --git a/std/encoding/yaml/type/int.ts b/std/encoding/yaml/type/int.ts index 93ec8260e..6a86aafe9 100644 --- a/std/encoding/yaml/type/int.ts +++ b/std/encoding/yaml/type/int.ts @@ -8,18 +8,18 @@ import { isNegativeZero, Any } from "../utils.ts"; function isHexCode(c: number): boolean { return ( - (0x30 /* 0 */ <= c && c <= 0x39) /* 9 */ || - (0x41 /* A */ <= c && c <= 0x46) /* F */ || - (0x61 /* a */ <= c && c <= 0x66) /* f */ + (0x30 <= /* 0 */ c && c <= 0x39) /* 9 */ || + (0x41 <= /* A */ c && c <= 0x46) /* F */ || + (0x61 <= /* a */ c && c <= 0x66) /* f */ ); } function isOctCode(c: number): boolean { - return 0x30 /* 0 */ <= c && c <= 0x37 /* 7 */; + return 0x30 <= /* 0 */ c && c <= 0x37 /* 7 */; } function isDecCode(c: number): boolean { - return 0x30 /* 0 */ <= c && c <= 0x39 /* 9 */; + return 0x30 <= /* 0 */ c && c <= 0x39 /* 9 */; } function resolveYamlInteger(data: string): boolean { @@ -175,17 +175,14 @@ export const int = new Type("tag:yaml.org,2002:int", { hexadecimal(obj: number): string { return obj >= 0 ? `0x${obj.toString(16).toUpperCase()}` - : `-0x${obj - .toString(16) - .toUpperCase() - .slice(1)}`; - } + : `-0x${obj.toString(16).toUpperCase().slice(1)}`; + }, }, resolve: resolveYamlInteger, styleAliases: { binary: [2, "bin"], decimal: [10, "dec"], hexadecimal: [16, "hex"], - octal: [8, "oct"] - } + octal: [8, "oct"], + }, }); diff --git a/std/encoding/yaml/type/map.ts b/std/encoding/yaml/type/map.ts index 60e678657..dcd99abca 100644 --- a/std/encoding/yaml/type/map.ts +++ b/std/encoding/yaml/type/map.ts @@ -10,5 +10,5 @@ export const map = new Type("tag:yaml.org,2002:map", { construct(data): Any { return data !== null ? data : {}; }, - kind: "mapping" + kind: "mapping", }); diff --git a/std/encoding/yaml/type/merge.ts b/std/encoding/yaml/type/merge.ts index 77b34025b..68314bf2e 100644 --- a/std/encoding/yaml/type/merge.ts +++ b/std/encoding/yaml/type/merge.ts @@ -11,5 +11,5 @@ function resolveYamlMerge(data: string): boolean { export const merge = new Type("tag:yaml.org,2002:merge", { kind: "scalar", - resolve: resolveYamlMerge + resolve: resolveYamlMerge, }); diff --git a/std/encoding/yaml/type/nil.ts b/std/encoding/yaml/type/nil.ts index 00627514c..8a48d02fb 100644 --- a/std/encoding/yaml/type/nil.ts +++ b/std/encoding/yaml/type/nil.ts @@ -39,7 +39,7 @@ export const nil = new Type("tag:yaml.org,2002:null", { }, camelcase(): string { return "Null"; - } + }, }, - resolve: resolveYamlNull + resolve: resolveYamlNull, }); diff --git a/std/encoding/yaml/type/omap.ts b/std/encoding/yaml/type/omap.ts index 541e31df6..d6d751505 100644 --- a/std/encoding/yaml/type/omap.ts +++ b/std/encoding/yaml/type/omap.ts @@ -42,5 +42,5 @@ function constructYamlOmap(data: Any): Any { export const omap = new Type("tag:yaml.org,2002:omap", { construct: constructYamlOmap, kind: "sequence", - resolve: resolveYamlOmap + resolve: resolveYamlOmap, }); diff --git a/std/encoding/yaml/type/pairs.ts b/std/encoding/yaml/type/pairs.ts index c964524b5..e999748ae 100644 --- a/std/encoding/yaml/type/pairs.ts +++ b/std/encoding/yaml/type/pairs.ts @@ -45,5 +45,5 @@ function constructYamlPairs(data: string): Any[] { export const pairs = new Type("tag:yaml.org,2002:pairs", { construct: constructYamlPairs, kind: "sequence", - resolve: resolveYamlPairs + resolve: resolveYamlPairs, }); diff --git a/std/encoding/yaml/type/seq.ts b/std/encoding/yaml/type/seq.ts index bd7ceb945..b19565dbc 100644 --- a/std/encoding/yaml/type/seq.ts +++ b/std/encoding/yaml/type/seq.ts @@ -10,5 +10,5 @@ export const seq = new Type("tag:yaml.org,2002:seq", { construct(data): Any { return data !== null ? data : []; }, - kind: "sequence" + kind: "sequence", }); diff --git a/std/encoding/yaml/type/set.ts b/std/encoding/yaml/type/set.ts index 3b7fca0e9..0bfe1c8db 100644 --- a/std/encoding/yaml/type/set.ts +++ b/std/encoding/yaml/type/set.ts @@ -27,5 +27,5 @@ function constructYamlSet(data: string): Any { export const set = new Type("tag:yaml.org,2002:set", { construct: constructYamlSet, kind: "mapping", - resolve: resolveYamlSet + resolve: resolveYamlSet, }); diff --git a/std/encoding/yaml/type/str.ts b/std/encoding/yaml/type/str.ts index c7227743e..cd6e9430f 100644 --- a/std/encoding/yaml/type/str.ts +++ b/std/encoding/yaml/type/str.ts @@ -8,5 +8,5 @@ export const str = new Type("tag:yaml.org,2002:str", { construct(data): string { return data !== null ? data : ""; }, - kind: "scalar" + kind: "scalar", }); diff --git a/std/encoding/yaml/type/timestamp.ts b/std/encoding/yaml/type/timestamp.ts index 14d24077a..eb03b3825 100644 --- a/std/encoding/yaml/type/timestamp.ts +++ b/std/encoding/yaml/type/timestamp.ts @@ -92,5 +92,5 @@ export const timestamp = new Type("tag:yaml.org,2002:timestamp", { instanceOf: Date, kind: "scalar", represent: representYamlTimestamp, - resolve: resolveYamlTimestamp + resolve: resolveYamlTimestamp, }); |
