Skip to content

Commit

Permalink
Add require-await eslint rule as error
Browse files Browse the repository at this point in the history
  • Loading branch information
nvergez committed Aug 25, 2024
1 parent b7bfbad commit 7890671
Show file tree
Hide file tree
Showing 9 changed files with 17 additions and 16 deletions.
3 changes: 2 additions & 1 deletion .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,8 @@
"no-useless-rename": "error",
"object-shorthand": "error",
"prettier/prettier": "error",
"curly": ["error", "multi-line"]
"curly": ["error", "multi-line"],
"require-await": "error"
},
"ignorePatterns": ["xsuite/dist/"]
}
2 changes: 1 addition & 1 deletion contracts/blank/tests/contract.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ beforeEach(async () => {
}));
});

afterEach(async () => {
afterEach(() => {
world.terminate();
});

Expand Down
2 changes: 1 addition & 1 deletion contracts/vested-transfers/tests/contract.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ beforeEach(async () => {
executor = await world.createWallet();
});

afterEach(async () => {
afterEach(() => {
world.terminate();
});

Expand Down
4 changes: 2 additions & 2 deletions xsuite/src/context.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@ test("cwd outside context", () => {
expect(cwd()).toEqual(process.cwd());
});

test("log inside context", async () => {
test("log inside context", () => {
const ctx = new Context();
ctx.run(() => log("hello!"));
expect(ctx.flushStdout()).toEqual("hello!\n");
});

test("log outside context", async () => {
test("log outside context", () => {
const int = new StdoutInterceptor();
log("hello!");
expect(int.stdout).toEqual("hello!\n");
Expand Down
6 changes: 3 additions & 3 deletions xsuite/src/data/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ beforeAll(async () => {
complexSysAccState = await world.sysAcc.getSerializableAccount();
});

afterAll(async () => {
afterAll(() => {
world.terminate();
});

Expand Down Expand Up @@ -867,7 +867,7 @@ test("eKvsUnfiltered - empty mappers", () => {
}
});

test("e.account", async () => {
test("e.account", () => {
expect(walletState).toEqual(
e.account({
address: wallet,
Expand Down Expand Up @@ -1261,7 +1261,7 @@ test("d.vs - number of values and decoders not matching", () => {
);
});

test("d.kvs", async () => {
test("d.kvs", () => {
expect(
d
.kvs({
Expand Down
4 changes: 2 additions & 2 deletions xsuite/src/world/fsworld.ts
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ export class FSWorld extends World {
return setAccountsParams.map((a) => this.newWallet(a.address));
}

async createWallet(params: FSWorldCreateAccountParams = {}) {
createWallet(params: FSWorldCreateAccountParams = {}) {
return this.createWallets([params]).then((wallets) => wallets[0]);
}

Expand All @@ -119,7 +119,7 @@ export class FSWorld extends World {
return setAccountsParams.map((a) => this.newContract(a.address));
}

async createContract(params: FSWorldCreateAccountParams = {}) {
createContract(params: FSWorldCreateAccountParams = {}) {
return this.createContracts([params]).then((contracts) => contracts[0]);
}

Expand Down
4 changes: 2 additions & 2 deletions xsuite/src/world/lsworld.ts
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ export class LSWorld extends World {
return setAccountsParams.map((a) => this.newWallet(a.address));
}

async createWallet(params: LSWorldCreateAccountParams = {}) {
createWallet(params: LSWorldCreateAccountParams = {}) {
return this.createWallets([params]).then((wallets) => wallets[0]);
}

Expand All @@ -145,7 +145,7 @@ export class LSWorld extends World {
return setAccountsParams.map((a) => this.newContract(a.address));
}

async createContract(params: LSWorldCreateAccountParams = {}) {
createContract(params: LSWorldCreateAccountParams = {}) {
return this.createContracts([params]).then((contracts) => contracts[0]);
}

Expand Down
4 changes: 2 additions & 2 deletions xsuite/src/world/signer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ export abstract class Signer extends Account {
}

export class DummySigner extends Signer {
async sign() {
return Buffer.from("00");
sign(): Promise<Uint8Array> {
return Promise.resolve(Buffer.from("00"));
}
}

Expand Down
4 changes: 2 additions & 2 deletions xsuite/src/world/world.ts
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ export class World {
return this.preTx(tx).then((tx) => this.proxy.sendUpgradeContract(tx));
}

private async preTxs<T extends IncompleteTx>(txs: T[]) {
private preTxs<T extends IncompleteTx>(txs: T[]) {
const noncePromises: Record<string, Promise<number>> = {};
return Promise.all(
txs.map(async (tx) => {
Expand All @@ -204,7 +204,7 @@ export class World {
);
}

private async preTx<T extends IncompleteTx>(tx: T) {
private preTx<T extends IncompleteTx>(tx: T) {
return this.preTxs([tx]).then((r) => r[0]);
}

Expand Down

0 comments on commit 7890671

Please sign in to comment.