Skip to content

Commit

Permalink
style: reformat due to prettier upgrade
Browse files Browse the repository at this point in the history
  • Loading branch information
spiltcoffee committed Jul 9, 2023
1 parent ccb1a5a commit ccee38f
Show file tree
Hide file tree
Showing 21 changed files with 94 additions and 94 deletions.
2 changes: 1 addition & 1 deletion packages/@postdfm/ast/src/object.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ export class DObject extends ASTNode<ObjectRaws> {
type: string,
order?: number,
properties?: Property[],
children?: DObject[]
children?: DObject[],
) {
super(ASTType.Object);
this.kind = kind;
Expand Down
2 changes: 1 addition & 1 deletion packages/@postdfm/ast/test/item.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ describe("creating Items", () => {
test("Item", () => {
const propertyNode = new AST.Property(
"Font.Name",
new AST.StringValue([new AST.LiteralString("sans-serif")])
new AST.StringValue([new AST.LiteralString("sans-serif")]),
);
const node = new AST.Item([propertyNode]);

Expand Down
4 changes: 2 additions & 2 deletions packages/@postdfm/ast/test/list.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ describe("creating Lists", () => {
]);

expect(node.values).toContainEqual(
new AST.StringValue([new AST.LiteralString("world")])
new AST.StringValue([new AST.LiteralString("world")]),
);

expect(node.values).toContainEqual(new AST.IntegerValue(255));
Expand Down Expand Up @@ -65,7 +65,7 @@ describe("creating Lists", () => {
const itemNode2 = new AST.Item([
new AST.Property(
"Font.Name",
new AST.StringValue([new AST.LiteralString("sans-serif")])
new AST.StringValue([new AST.LiteralString("sans-serif")]),
),
]);
const node = new AST.ItemList([itemNode1, itemNode2]);
Expand Down
10 changes: 5 additions & 5 deletions packages/@postdfm/ast/test/object.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,15 @@ describe("creating FormObjects", () => {
test("FormObject with properties", () => {
const propertyNode = new AST.Property(
"Font.Name",
new AST.StringValue([new AST.LiteralString("sans-serif")])
new AST.StringValue([new AST.LiteralString("sans-serif")]),
);

const node = new AST.DObject(
AST.ObjectKind.Object,
"MyForm",
"TMyForm",
undefined,
[propertyNode]
[propertyNode],
);

expect(node.kind).toBe(AST.ObjectKind.Object);
Expand All @@ -54,7 +54,7 @@ describe("creating FormObjects", () => {
"TMyForm",
undefined,
undefined,
[childNode]
[childNode],
);

expect(node.kind).toBe(AST.ObjectKind.Object);
Expand All @@ -68,7 +68,7 @@ describe("creating FormObjects", () => {
test("FormObject with a bit of everything", () => {
const propertyNode = new AST.Property(
"Font.Name",
new AST.StringValue([new AST.LiteralString("sans-serif")])
new AST.StringValue([new AST.LiteralString("sans-serif")]),
);

const childNode = new AST.DObject(AST.ObjectKind.Object, "MyEdit", "TEdit");
Expand All @@ -79,7 +79,7 @@ describe("creating FormObjects", () => {
"TMyForm",
0,
[propertyNode],
[childNode]
[childNode],
);

expect(node.kind).toBe(AST.ObjectKind.Object);
Expand Down
2 changes: 1 addition & 1 deletion packages/@postdfm/ast/test/root.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ describe("creating FormObjects", () => {
const objectNode = new AST.DObject(
AST.ObjectKind.Inherited,
"MyForm",
"TMyForm"
"TMyForm",
);

const node = new AST.Root(objectNode);
Expand Down
36 changes: 18 additions & 18 deletions packages/@postdfm/ast2dfm/src/stringifier.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ export default class Stringifier {
return this.print(
raws.before,
ast.value.map((str) => this.stringify(str)).join(""),
raws.after
raws.after,
);
}

Expand All @@ -55,7 +55,7 @@ export default class Stringifier {
raws.before,
"#",
`${ast.value.charCodeAt(0)}`,
raws.after
raws.after,
);
}

Expand All @@ -66,7 +66,7 @@ export default class Stringifier {
"'",
ast.value.replace(/'/g, "''"),
"'",
raws.after
raws.after,
);
}

Expand All @@ -92,7 +92,7 @@ export default class Stringifier {
ast.value.integer,
ast.value.fraction ? `.${ast.value.fraction}` : "",
ast.value.exponent ? `e${ast.value.exponent}` : "",
raws.after
raws.after,
);
}

Expand All @@ -104,7 +104,7 @@ export default class Stringifier {
ast.value.fraction ? `.${ast.value.fraction}` : "",
ast.value.exponent ? `e${ast.value.exponent}` : "",
"s",
raws.after
raws.after,
);
}

Expand All @@ -116,7 +116,7 @@ export default class Stringifier {
ast.value.fraction ? `.${ast.value.fraction}` : "",
ast.value.exponent ? `e${ast.value.exponent}` : "",
"c",
raws.after
raws.after,
);
}

Expand All @@ -128,7 +128,7 @@ export default class Stringifier {
ast.value.fraction ? `.${ast.value.fraction}` : "",
ast.value.exponent ? `e${ast.value.exponent}` : "",
"d",
raws.after
raws.after,
);
}

Expand All @@ -151,7 +151,7 @@ export default class Stringifier {
ast.properties.map((property) => this.printProperty(property)).join(""),
raws.beforeEnd,
"end",
raws.after
raws.after,
);
}

Expand All @@ -164,7 +164,7 @@ export default class Stringifier {
ast.values.map((variant) => this.stringify(variant)).join(""),
raws.beforeClose,
")",
raws.after
raws.after,
);
}

Expand All @@ -179,7 +179,7 @@ export default class Stringifier {
.join(""),
raws.beforeClose,
"}",
raws.after
raws.after,
);
}

Expand All @@ -194,7 +194,7 @@ export default class Stringifier {
.join(","),
raws.beforeClose,
"]",
raws.after
raws.after,
);
}

Expand All @@ -207,7 +207,7 @@ export default class Stringifier {
ast.values.map((item) => this.printItem(item)).join(""),
raws.beforeClose,
">",
raws.after
raws.after,
);
}

Expand All @@ -220,7 +220,7 @@ export default class Stringifier {
"=",
raws.beforeValue,
this.stringify(ast.value),
raws.after
raws.after,
);
}

Expand All @@ -242,26 +242,26 @@ export default class Stringifier {
raws.beforeOrder,
`${ast.order}`,
raws.afterOrder,
"]"
"]",
)
: "",
ast.properties && ast.properties.length
? this.print(
raws.beforeProperties,
ast.properties
.map((property) => this.printProperty(property))
.join("")
.join(""),
)
: "",
ast.children && ast.children.length
? this.print(
raws.beforeChildren,
ast.children.map((child) => this.printObject(child)).join("")
ast.children.map((child) => this.printObject(child)).join(""),
)
: "",
raws.beforeEnd,
"end",
raws.after
raws.after,
);
}

Expand All @@ -270,7 +270,7 @@ export default class Stringifier {
return this.print(
raws.before,
ast.child ? this.printObject(ast.child) : "",
raws.after
raws.after,
);
}

Expand Down
2 changes: 1 addition & 1 deletion packages/@postdfm/ast2dfm/test/broken/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { stringify } from "@postdfm/ast2dfm";
describe("dfm2ast", () => {
test("broken AST throws error", () => {
const ast = JSON.parse(
readFileSync(new URL("./ast.json", import.meta.url), "utf8")
readFileSync(new URL("./ast.json", import.meta.url), "utf8"),
) as Root;

expect(() => stringify(ast)).toThrow("Cannot stringify astType unknown");
Expand Down
8 changes: 4 additions & 4 deletions packages/@postdfm/ast2dfm/test/fixtures/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { stringify } from "@postdfm/ast2dfm";

const parseFixturesPath = new URL(
"../../../../../test/fixtures/parse/",
import.meta.url
import.meta.url,
);

describe("dfm2ast", () => {
Expand All @@ -18,9 +18,9 @@ describe("dfm2ast", () => {
expect(
stringify(
JSON.parse(
readFileSync(new URL("./ast.json", fixturePath), "utf8")
) as Root
)
readFileSync(new URL("./ast.json", fixturePath), "utf8"),
) as Root,
),
).toEqual(readFileSync(new URL("./form.dfm", fixturePath), "ascii"));
});
});
Expand Down
4 changes: 2 additions & 2 deletions packages/@postdfm/dfm2ast/src/grammar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -579,7 +579,7 @@ const grammar: Grammar = {
type,
order,
undefined,
children
children,
);
node.raws = {
...(defRaws || {}),
Expand Down Expand Up @@ -626,7 +626,7 @@ const grammar: Grammar = {
type,
order,
properties,
children
children,
);
node.raws = {
...(defRaws || {}),
Expand Down
2 changes: 1 addition & 1 deletion packages/@postdfm/dfm2ast/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ function parse(dfm: string): Root {
throw new Error(
`Ambiguous Grammar: ${parser.results.length} Results Found\n\n` +
" This probably isn't your fault. Please consider raising an " +
"issue with a reproducable case at github.com/spiltcoffee/postdfm"
"issue with a reproducable case at github.com/spiltcoffee/postdfm",
);
}

Expand Down
6 changes: 3 additions & 3 deletions packages/@postdfm/dfm2ast/test/fixtures/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { parse } from "@postdfm/dfm2ast";

const parseFixturesPath = new URL(
"../../../../../test/fixtures/parse/",
import.meta.url
import.meta.url,
);

describe("dfm2ast", () => {
Expand All @@ -15,10 +15,10 @@ describe("dfm2ast", () => {
const fixturePath = new URL(`./${fixture}/`, parseFixturesPath);
const formFile = readFileSync(
new URL("./form.dfm", fixturePath),
"ascii"
"ascii",
);
const astJson = JSON.parse(
readFileSync(new URL("./ast.json", fixturePath), "utf-8")
readFileSync(new URL("./ast.json", fixturePath), "utf-8"),
) as ASTNode;

test(`${fixture}`, () => {
Expand Down
Loading

0 comments on commit ccee38f

Please sign in to comment.