Skip to content

Commit

Permalink
Merge pull request #8030 from Agoric/prettier-3.0
Browse files Browse the repository at this point in the history
Prettier 3.0
  • Loading branch information
turadg authored Jul 10, 2023
2 parents 1303537 + a6cc2fd commit 3c22e86
Show file tree
Hide file tree
Showing 18 changed files with 315 additions and 115 deletions.
5 changes: 2 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,18 +26,17 @@
"eslint-plugin-github": "^4.8.0",
"eslint-plugin-import": "^2.25.3",
"eslint-plugin-jsdoc": "^40.1.0",
"eslint-plugin-prettier": "^4.2.1",
"eslint-plugin-prettier": "^5.0.0-alpha.2",
"lerna": "^3.22.1",
"npm-run-all": "^4.1.5",
"prettier": "^2.8.3",
"prettier": "^3.0.0",
"typescript": "~5.1.6"
},
"engines": {
"node": "^16.13 || ^18.12"
},
"prettier": {
"arrowParens": "avoid",
"trailingComma": "all",
"singleQuote": true
},
"scripts": {
Expand Down
2 changes: 1 addition & 1 deletion packages/agoric-cli/src/commands/inter.js
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ const makeFormatters = assets => {
* @param {(_: T) => string} f
* @returns { (x: T | null | undefined ) => string | undefined }
*/
const maybe = f => x => x ? f(x) : undefined;
const maybe = f => x => (x ? f(x) : undefined);

return {
amount,
Expand Down
20 changes: 11 additions & 9 deletions packages/agoric-cli/src/commands/psm.js
Original file line number Diff line number Diff line change
Expand Up @@ -151,15 +151,17 @@ export const makePsmCommand = logger => {
.option('--giveMinted <DOLLARS>', 'amount of minted tokens to give', Number)
.option('--feePct [%]', 'Gas fee percentage', Number)
.option('--offerId <string>', 'Offer id', String, `swap-${Date.now()}`)
.action(async function (
/** @type {Parameters<typeof Offers.psm.swap>[2]} */ opts,
) {
console.warn('running with options', opts);
const { agoricNames, lookupPsmInstance } = await rpcTools();
const instance = await lookupPsmInstance(opts.pair);
const offer = Offers.psm.swap(agoricNames, instance, opts);
outputExecuteOfferAction(offer);
});
.action(
async function (
/** @type {Parameters<typeof Offers.psm.swap>[2]} */ opts,
) {
console.warn('running with options', opts);
const { agoricNames, lookupPsmInstance } = await rpcTools();
const instance = await lookupPsmInstance(opts.pair);
const offer = Offers.psm.swap(agoricNames, instance, opts);
outputExecuteOfferAction(offer);
},
);

psm
.command('proposePauseOffers')
Expand Down
8 changes: 4 additions & 4 deletions packages/cosmic-proto/dist/agoric/swingset/msgs.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -506,15 +506,15 @@ interface Rpc {
data: Uint8Array,
): Promise<Uint8Array>;
}
declare type Builtin =
type Builtin =
| Date
| Function
| Uint8Array
| string
| number
| boolean
| undefined;
export declare type DeepPartial<T> = T extends Builtin
export type DeepPartial<T> = T extends Builtin
? T
: T extends Long
? string | number | Long
Expand All @@ -527,8 +527,8 @@ export declare type DeepPartial<T> = T extends Builtin
[K in keyof T]?: DeepPartial<T[K]>;
}
: Partial<T>;
declare type KeysOfUnion<T> = T extends T ? keyof T : never;
export declare type Exact<P, I extends P> = P extends Builtin
type KeysOfUnion<T> = T extends T ? keyof T : never;
export type Exact<P, I extends P> = P extends Builtin
? P
: P & {
[K in keyof P]: Exact<P[K], I[K]>;
Expand Down
30 changes: 15 additions & 15 deletions packages/cosmic-proto/dist/agoric/swingset/msgs.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,10 +64,10 @@ export const MsgDeliverInbound = {
fromJSON(object) {
return {
messages: Array.isArray(object?.messages)
? object.messages.map((e) => String(e))
? object.messages.map(e => String(e))
: [],
nums: Array.isArray(object?.nums)
? object.nums.map((e) => Long.fromValue(e))
? object.nums.map(e => Long.fromValue(e))
: [],
ack: isSet(object.ack) ? Long.fromValue(object.ack) : Long.UZERO,
submitter: isSet(object.submitter)
Expand All @@ -78,12 +78,12 @@ export const MsgDeliverInbound = {
toJSON(message) {
const obj = {};
if (message.messages) {
obj.messages = message.messages.map((e) => e);
obj.messages = message.messages.map(e => e);
} else {
obj.messages = [];
}
if (message.nums) {
obj.nums = message.nums.map((e) => (e || Long.UZERO).toString());
obj.nums = message.nums.map(e => (e || Long.UZERO).toString());
} else {
obj.nums = [];
}
Expand All @@ -97,8 +97,8 @@ export const MsgDeliverInbound = {
},
fromPartial(object) {
const message = createBaseMsgDeliverInbound();
message.messages = object.messages?.map((e) => e) || [];
message.nums = object.nums?.map((e) => Long.fromValue(e)) || [];
message.messages = object.messages?.map(e => e) || [];
message.nums = object.nums?.map(e => Long.fromValue(e)) || [];
message.ack =
object.ack !== undefined && object.ack !== null
? Long.fromValue(object.ack)
Expand Down Expand Up @@ -378,7 +378,7 @@ export const MsgProvision = {
? bytesFromBase64(object.address)
: new Uint8Array(),
powerFlags: Array.isArray(object?.powerFlags)
? object.powerFlags.map((e) => String(e))
? object.powerFlags.map(e => String(e))
: [],
submitter: isSet(object.submitter)
? bytesFromBase64(object.submitter)
Expand All @@ -393,7 +393,7 @@ export const MsgProvision = {
message.address !== undefined ? message.address : new Uint8Array(),
));
if (message.powerFlags) {
obj.powerFlags = message.powerFlags.map((e) => e);
obj.powerFlags = message.powerFlags.map(e => e);
} else {
obj.powerFlags = [];
}
Expand All @@ -407,7 +407,7 @@ export const MsgProvision = {
const message = createBaseMsgProvision();
message.nickname = object.nickname ?? '';
message.address = object.address ?? new Uint8Array();
message.powerFlags = object.powerFlags?.map((e) => e) || [];
message.powerFlags = object.powerFlags?.map(e => e) || [];
message.submitter = object.submitter ?? new Uint8Array();
return message;
},
Expand Down Expand Up @@ -588,35 +588,35 @@ export class MsgClientImpl {
InstallBundle(request) {
const data = MsgInstallBundle.encode(request).finish();
const promise = this.rpc.request(this.service, 'InstallBundle', data);
return promise.then((data) =>
return promise.then(data =>
MsgInstallBundleResponse.decode(new _m0.Reader(data)),
);
}
DeliverInbound(request) {
const data = MsgDeliverInbound.encode(request).finish();
const promise = this.rpc.request(this.service, 'DeliverInbound', data);
return promise.then((data) =>
return promise.then(data =>
MsgDeliverInboundResponse.decode(new _m0.Reader(data)),
);
}
WalletAction(request) {
const data = MsgWalletAction.encode(request).finish();
const promise = this.rpc.request(this.service, 'WalletAction', data);
return promise.then((data) =>
return promise.then(data =>
MsgWalletActionResponse.decode(new _m0.Reader(data)),
);
}
WalletSpendAction(request) {
const data = MsgWalletSpendAction.encode(request).finish();
const promise = this.rpc.request(this.service, 'WalletSpendAction', data);
return promise.then((data) =>
return promise.then(data =>
MsgWalletSpendActionResponse.decode(new _m0.Reader(data)),
);
}
Provision(request) {
const data = MsgProvision.encode(request).finish();
const promise = this.rpc.request(this.service, 'Provision', data);
return promise.then((data) =>
return promise.then(data =>
MsgProvisionResponse.decode(new _m0.Reader(data)),
);
}
Expand Down Expand Up @@ -653,7 +653,7 @@ function base64FromBytes(arr) {
return globalThis.Buffer.from(arr).toString('base64');
} else {
const bin = [];
arr.forEach((byte) => {
arr.forEach(byte => {
bin.push(String.fromCharCode(byte));
});
return globalThis.btoa(bin.join(''));
Expand Down
8 changes: 4 additions & 4 deletions packages/cosmic-proto/dist/agoric/swingset/query.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -374,15 +374,15 @@ interface Rpc {
data: Uint8Array,
): Promise<Uint8Array>;
}
declare type Builtin =
type Builtin =
| Date
| Function
| Uint8Array
| string
| number
| boolean
| undefined;
export declare type DeepPartial<T> = T extends Builtin
export type DeepPartial<T> = T extends Builtin
? T
: T extends Long
? string | number | Long
Expand All @@ -395,8 +395,8 @@ export declare type DeepPartial<T> = T extends Builtin
[K in keyof T]?: DeepPartial<T[K]>;
}
: Partial<T>;
declare type KeysOfUnion<T> = T extends T ? keyof T : never;
export declare type Exact<P, I extends P> = P extends Builtin
type KeysOfUnion<T> = T extends T ? keyof T : never;
export type Exact<P, I extends P> = P extends Builtin
? P
: P & {
[K in keyof P]: Exact<P[K], I[K]>;
Expand Down
8 changes: 4 additions & 4 deletions packages/cosmic-proto/dist/agoric/swingset/query.js
Original file line number Diff line number Diff line change
Expand Up @@ -280,21 +280,21 @@ export class QueryClientImpl {
Params(request) {
const data = QueryParamsRequest.encode(request).finish();
const promise = this.rpc.request(this.service, 'Params', data);
return promise.then((data) =>
return promise.then(data =>
QueryParamsResponse.decode(new _m0.Reader(data)),
);
}
Egress(request) {
const data = QueryEgressRequest.encode(request).finish();
const promise = this.rpc.request(this.service, 'Egress', data);
return promise.then((data) =>
return promise.then(data =>
QueryEgressResponse.decode(new _m0.Reader(data)),
);
}
Mailbox(request) {
const data = QueryMailboxRequest.encode(request).finish();
const promise = this.rpc.request(this.service, 'Mailbox', data);
return promise.then((data) =>
return promise.then(data =>
QueryMailboxResponse.decode(new _m0.Reader(data)),
);
}
Expand Down Expand Up @@ -331,7 +331,7 @@ function base64FromBytes(arr) {
return globalThis.Buffer.from(arr).toString('base64');
} else {
const bin = [];
arr.forEach((byte) => {
arr.forEach(byte => {
bin.push(String.fromCharCode(byte));
});
return globalThis.btoa(bin.join(''));
Expand Down
8 changes: 4 additions & 4 deletions packages/cosmic-proto/dist/agoric/swingset/swingset.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -539,15 +539,15 @@ export declare const ExtensionSnapshotterArtifactPayload: {
object: I,
): ExtensionSnapshotterArtifactPayload;
};
declare type Builtin =
type Builtin =
| Date
| Function
| Uint8Array
| string
| number
| boolean
| undefined;
export declare type DeepPartial<T> = T extends Builtin
export type DeepPartial<T> = T extends Builtin
? T
: T extends Long
? string | number | Long
Expand All @@ -560,8 +560,8 @@ export declare type DeepPartial<T> = T extends Builtin
[K in keyof T]?: DeepPartial<T[K]>;
}
: Partial<T>;
declare type KeysOfUnion<T> = T extends T ? keyof T : never;
export declare type Exact<P, I extends P> = P extends Builtin
type KeysOfUnion<T> = T extends T ? keyof T : never;
export type Exact<P, I extends P> = P extends Builtin
? P
: P & {
[K in keyof P]: Exact<P[K], I[K]>;
Expand Down
Loading

0 comments on commit 3c22e86

Please sign in to comment.