Skip to content

Commit

Permalink
Bump prettier from 2.8.8 to 3.0.0 (#543)
Browse files Browse the repository at this point in the history
  • Loading branch information
dependabot[bot] authored Aug 1, 2023
1 parent 732192d commit 9eb3478
Show file tree
Hide file tree
Showing 77 changed files with 383 additions and 379 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ lint: node_modules $(BUILD)/protobuf $(BUILD)/protobuf-test $(BUILD)/protobuf-co

.PHONY: format
format: node_modules $(BIN)/git-ls-files-unstaged $(BIN)/license-header ## Format all files, adding license headers
npx prettier --write '**/*.{json,js,jsx,ts,tsx,css,mjs}' --loglevel error
npx prettier --write '**/*.{json,js,jsx,ts,tsx,css,mjs}' --log-level error
$(BIN)/git-ls-files-unstaged | \
grep -v $(patsubst %,-e %,$(sort $(LICENSE_HEADER_IGNORES))) | \
xargs $(BIN)/license-header \
Expand Down
12 changes: 6 additions & 6 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
"eslint-import-resolver-typescript": "^3.5.5",
"eslint-plugin-import": "^2.28.0",
"eslint-plugin-node": "^11.1.0",
"prettier": "^2.8.8",
"prettier": "^3.0.0",
"typescript": "^5.1.6"
},
"dependencies": {
Expand Down
8 changes: 4 additions & 4 deletions packages/protobuf-conformance/src/conformance.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ const registry = createRegistry(
Int32Value,
TestAllTypesProto3,
TestAllTypesProto2,
Any
Any,
);

function main() {
Expand All @@ -54,7 +54,7 @@ function main() {
}
} catch (e) {
process.stderr.write(
`conformance.ts: exiting after ${testCount} tests: ${String(e)}`
`conformance.ts: exiting after ${testCount} tests: ${String(e)}`,
);
process.exit(1);
}
Expand Down Expand Up @@ -149,7 +149,7 @@ function test(request: ConformanceRequest): ConformanceResponse["result"] {
// Returns true if the test ran successfully, false on legitimate EOF.
// If EOF is encountered in an unexpected place, raises IOError.
function testIo(
test: (request: ConformanceRequest) => ConformanceResponse["result"]
test: (request: ConformanceRequest) => ConformanceResponse["result"],
): boolean {
setBlockingStdout();
const requestLengthBuf = readBuffer(4);
Expand Down Expand Up @@ -198,7 +198,7 @@ function writeBuffer(buffer: Buffer): void {
1,
buffer,
totalWritten,
buffer.length - totalWritten
buffer.length - totalWritten,
);
}
}
Expand Down
6 changes: 3 additions & 3 deletions packages/protobuf-test/src/clone.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ describe("clone", function () {
b.messageField.name = "123";
}
expect(b.messageField?.name).not.toBe(a.messageField?.name);
}
},
);

testMT(
Expand Down Expand Up @@ -82,7 +82,7 @@ describe("clone", function () {
const c = a.clone();
c.bytesField.set([0, 1], 0);
expect(c.bytesField).not.toStrictEqual(a.bytesField);
}
},
);

testMT(
Expand Down Expand Up @@ -118,7 +118,7 @@ describe("clone", function () {
expect(b).toStrictEqual(a);
a.doubleField.push(1.2);
expect(b.doubleField).not.toBe(a.doubleField);
}
},
);

testMT({ ts: TS_WrappersMessage, js: JS_WrappersMessage }, (messageType) => {
Expand Down
20 changes: 10 additions & 10 deletions packages/protobuf-test/src/constructor.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ describe("constructor takes message partial for message field", function () {
},
});
expect(m.recursiveMessage?.optionalInt32).toBe(123);
}
},
);
});

Expand All @@ -44,7 +44,7 @@ describe("constructor takes message instance for message field", function () {
}),
});
expect(m.recursiveMessage?.optionalInt32).toBe(123);
}
},
);
});

Expand All @@ -68,7 +68,7 @@ describe("constructor takes partial message for oneof field", function () {
expect(m.oneofField.value.corecursive).not.toBeUndefined();
expect(m.oneofField.value.corecursive?.optionalInt32).toBe(123);
}
}
},
);
});

Expand All @@ -91,10 +91,10 @@ describe("constructor takes partial message for map value", function () {
expect(m.mapStringNestedMessage["key"].a).toBe(0);
expect(m.mapStringNestedMessage["key"].corecursive).not.toBeUndefined();
expect(m.mapStringNestedMessage["key"].corecursive?.optionalInt32).toBe(
123
123,
);
}
}
},
);
testMT(
{ ts: TS_TestAllTypesProto3, js: JS_TestAllTypesProto3 },
Expand Down Expand Up @@ -136,21 +136,21 @@ describe("constructor takes partial message for map value", function () {
});
expect(t.optionalNestedMessage?.a).toBe(123);
expect(
t.optionalNestedMessage?.corecursive?.optionalNestedMessage?.a
t.optionalNestedMessage?.corecursive?.optionalNestedMessage?.a,
).toBe(456);
expect(
t.optionalNestedMessage?.corecursive?.optionalNestedMessage?.corecursive
?.optionalNestedMessage?.a
?.optionalNestedMessage?.a,
).toBe(0);
expect(t.repeatedNestedMessage.length).toBe(1);
expect(t.repeatedNestedMessage[0]?.a).toBe(123);
expect(
t.repeatedNestedMessage[0]?.corecursive?.repeatedNestedMessage[0]?.a
t.repeatedNestedMessage[0]?.corecursive?.repeatedNestedMessage[0]?.a,
).toBe(456);
expect(
t.repeatedNestedMessage[0]?.corecursive?.repeatedNestedMessage[0]
?.corecursive?.repeatedNestedMessage[0]?.a
?.corecursive?.repeatedNestedMessage[0]?.a,
).toBe(0);
}
},
);
});
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ describe("createRegistryFromDescriptors()", () => {
});

function assertExpectedRegistry(
registry: ReturnType<typeof createRegistry>
registry: ReturnType<typeof createRegistry>,
): void {
expect(registry.findEnum("foo.Foo")).toBeUndefined();
const mt = registry.findMessage(TestAllTypes.typeName);
Expand Down
4 changes: 2 additions & 2 deletions packages/protobuf-test/src/create-registry.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,13 @@ describe("createRegistry()", () => {
test("finds message", () => {
const reg = createRegistry(MessageFieldMessage);
expect(reg.findMessage(MessageFieldMessage.typeName)).toBe(
MessageFieldMessage
MessageFieldMessage,
);
});
test("finds message through field", () => {
const reg = createRegistry(MessageFieldMessage);
expect(reg.findMessage(MessageFieldMessage_TestMessage.typeName)).toBe(
MessageFieldMessage_TestMessage
MessageFieldMessage_TestMessage,
);
});
});
26 changes: 13 additions & 13 deletions packages/protobuf-test/src/descriptor-set.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ describe("DescriptorSet", () => {
const set = createDescriptorSet(fdsBytes);
test("knows extension", () => {
const ext = set.extensions.get(
"protobuf_unittest.optional_int32_extension"
"protobuf_unittest.optional_int32_extension",
);
expect(ext).toBeDefined();
expect(ext?.name).toBe("optional_int32_extension");
Expand All @@ -42,28 +42,28 @@ describe("DescriptorSet", () => {
expect(ext?.fieldKind).toBe("scalar");
expect(ext?.scalar).toBe(ScalarType.INT32);
expect(ext?.toString()).toBe(
"extension protobuf_unittest.optional_int32_extension"
"extension protobuf_unittest.optional_int32_extension",
);
expect(ext?.declarationString()).toBe(
"optional int32 optional_int32_extension = 1"
"optional int32 optional_int32_extension = 1",
);
});
test("knows nested extension", () => {
const ext = set.extensions.get(
"protobuf_unittest.TestNestedExtension.nested_string_extension"
"protobuf_unittest.TestNestedExtension.nested_string_extension",
);
expect(ext).toBeDefined();
expect(ext?.name).toBe("nested_string_extension");
expect(ext?.typeName).toBe(
"protobuf_unittest.TestNestedExtension.nested_string_extension"
"protobuf_unittest.TestNestedExtension.nested_string_extension",
);
expect(ext?.extendee.typeName).toBe(TestAllExtensions.typeName);
expect(ext?.scalar).toBe(ScalarType.STRING);
expect(ext?.toString()).toBe(
"extension protobuf_unittest.TestNestedExtension.nested_string_extension"
"extension protobuf_unittest.TestNestedExtension.nested_string_extension",
);
expect(ext?.declarationString()).toBe(
"optional string nested_string_extension = 1003"
"optional string nested_string_extension = 1003",
);
const ext2 = set.messages
.get(TestNestedExtension.typeName)
Expand All @@ -77,7 +77,7 @@ describe("DescriptorSet", () => {
if (message !== undefined) {
const field = message.fields.find((f) => f.number === 1);
expect(field?.declarationString()).toBe(
'string scalar_field = 1 [json_name = "scalarFieldJsonName"]'
'string scalar_field = 1 [json_name = "scalarFieldJsonName"]',
);
}
});
Expand All @@ -87,7 +87,7 @@ describe("DescriptorSet", () => {
if (message !== undefined) {
const field = message.fields.find((f) => f.number === 1);
expect(field?.declarationString()).toBe(
"repeated double double_field = 1"
"repeated double double_field = 1",
);
}
});
Expand All @@ -110,15 +110,15 @@ describe("DescriptorSet", () => {
describe("for file", () => {
const file = set.files.find((file) =>
file.messages.some(
(message) => message.typeName === MessageWithComments.typeName
)
(message) => message.typeName === MessageWithComments.typeName,
),
);
test("syntax", () => {
const comments = file?.getSyntaxComments();
expect(comments).toBeDefined();
if (comments) {
expect(comments.leadingDetached[0]).toMatch(
/ Copyright .* Buf Technologies/
/ Copyright .* Buf Technologies/,
);
expect(comments.leading).toBe(" Comment before syntax.\n");
expect(comments.trailing).toBe(" Comment next to syntax.\n");
Expand Down Expand Up @@ -159,7 +159,7 @@ describe("DescriptorSet", () => {
"\n Comment after start of message,\n with funny indentation,\n and empty lines on start and end.\n\n",
]);
expect(comments.leading).toBe(
" Comment before field with 5 lines:\n line 2, next is empty\n\n line 4, next is empty\n\n"
" Comment before field with 5 lines:\n line 2, next is empty\n\n line 4, next is empty\n\n",
);
expect(comments.trailing).toBe(" Comment next to field.\n");
}
Expand Down
20 changes: 10 additions & 10 deletions packages/protobuf-test/src/equals.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ describe("equals", function () {
a.repeatedMessageField[0].name = "changed";
expect(a.equals(b)).toBeFalsy();
});
}
},
);

describeMT(
Expand Down Expand Up @@ -161,7 +161,7 @@ describe("equals", function () {
expect(a).not.toStrictEqual(b);
expect(a.equals(b)).toBeFalsy();
});
}
},
);

describeMT({ ts: TS_MapsMessage, js: JS_MapsMessage }, (messageType) => {
Expand All @@ -176,8 +176,8 @@ describe("equals", function () {
strMsgField: {
a: { strStrField: { e: "f", c: "d" } },
},
})
)
}),
),
).toBeTruthy();
});
test("added key not equal", () => {
Expand All @@ -192,8 +192,8 @@ describe("equals", function () {
a: {},
b: {},
},
})
)
}),
),
).toBeFalsy();
});
test("removed key not equal", () => {
Expand All @@ -207,8 +207,8 @@ describe("equals", function () {
strMsgField: {
a: { strStrField: { c: "d" } },
},
})
)
}),
),
).toBeFalsy();
});
test("changed value not equal", () => {
Expand All @@ -222,8 +222,8 @@ describe("equals", function () {
strMsgField: {
a: { strStrField: { c: "e" } },
},
})
)
}),
),
).toBeFalsy();
});
});
Expand Down
4 changes: 2 additions & 2 deletions packages/protobuf-test/src/google/protobuf/any.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ describe("google.protobuf.Any", () => {
},
}),
},
})
}),
).toJson({ typeRegistry });
expect(got).toStrictEqual(want);
});
Expand All @@ -156,7 +156,7 @@ describe("google.protobuf.Any", () => {
"@type": "type.googleapis.com/google.protobuf.Value",
value: 1,
},
{ typeRegistry }
{ typeRegistry },
);
const got = new Value();
expect(any.unpackTo(got)).toBe(true);
Expand Down
4 changes: 2 additions & 2 deletions packages/protobuf-test/src/google/protobuf/field_mask.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,15 +41,15 @@ describe("google.protobuf.FieldMask", () => {
expect(() => {
fieldMask.toJson();
}).toThrow(
'cannot encode google.protobuf.FieldMask to JSON: lowerCamelCase of path name "user.displayName" is irreversible'
'cannot encode google.protobuf.FieldMask to JSON: lowerCamelCase of path name "user.displayName" is irreversible',
);
});
test("fromJson fails on invalid json", () => {
const json = "user.display_name,photo";
expect(() => {
FieldMask.fromJson(json);
}).toThrow(
"cannot decode google.protobuf.FieldMask from JSON: path names must be lowerCamelCase"
"cannot decode google.protobuf.FieldMask from JSON: path names must be lowerCamelCase",
);
});
});
Expand Down
Loading

0 comments on commit 9eb3478

Please sign in to comment.