mirror of
https://github.com/cosmos/cosmjs.git
synced 2025-03-11 14:09:15 +00:00
Add and lint-fix in cli package
This commit is contained in:
parent
22d329f480
commit
a65c95d023
@ -18,6 +18,7 @@
|
||||
"format": "prettier --write --loglevel warn \"./src/**/*.ts\"",
|
||||
"format-text": "prettier --write --prose-wrap always --print-width 80 \"./*.md\"",
|
||||
"lint": "eslint --max-warnings 0 \"**/*.{js,ts}\"",
|
||||
"lint-fix": "eslint --max-warnings 0 \"**/*.{js,ts}\" --fix",
|
||||
"build": "tsc",
|
||||
"build-or-skip": "[ -n \"$SKIP_BUILD\" ] || yarn build",
|
||||
"start": "yarn build-or-skip && ./bin/cosmwasm-cli",
|
||||
|
@ -163,7 +163,7 @@ export function main(originalArgs: readonly string[]): void {
|
||||
}
|
||||
|
||||
if (args.init) {
|
||||
for (const path of args.init.map(arg => arg.toString())) {
|
||||
for (const path of args.init.map((arg) => arg.toString())) {
|
||||
if (args.debug) console.info(`Adding file: '${path}' ...`);
|
||||
init += fs.readFileSync(path, "utf8") + "\n";
|
||||
}
|
||||
@ -171,7 +171,7 @@ export function main(originalArgs: readonly string[]): void {
|
||||
|
||||
const tsconfigPath = join(__dirname, "..", "tsconfig_repl.json");
|
||||
const installationDir = join(__dirname, "..");
|
||||
new TsRepl(tsconfigPath, init, !!args.debug, installationDir).start().catch(error => {
|
||||
new TsRepl(tsconfigPath, init, !!args.debug, installationDir).start().catch((error) => {
|
||||
console.error(error);
|
||||
process.exit(1);
|
||||
});
|
||||
|
@ -85,13 +85,13 @@ describe("Helpers", () => {
|
||||
const context = createContext({});
|
||||
await executeJavaScriptAsync("var a", "myfile.js", context)
|
||||
.then(() => fail("must not resolve"))
|
||||
.catch(e => expect(e).toMatch(/SyntaxError:/));
|
||||
.catch((e) => expect(e).toMatch(/SyntaxError:/));
|
||||
await executeJavaScriptAsync("let b", "myfile.js", context)
|
||||
.then(() => fail("must not resolve"))
|
||||
.catch(e => expect(e).toMatch(/SyntaxError:/));
|
||||
.catch((e) => expect(e).toMatch(/SyntaxError:/));
|
||||
await executeJavaScriptAsync("const c", "myfile.js", context)
|
||||
.then(() => fail("must not resolve"))
|
||||
.catch(e => expect(e).toMatch(/SyntaxError:/));
|
||||
.catch((e) => expect(e).toMatch(/SyntaxError:/));
|
||||
});
|
||||
|
||||
it("can execute multiple commands in one context", async () => {
|
||||
|
@ -29,5 +29,5 @@ export function isRecoverable(error: TSError): boolean {
|
||||
2355, // "A function whose declared type is neither 'void' nor 'any' must return a value."
|
||||
]);
|
||||
|
||||
return error.diagnosticCodes.every(code => recoveryCodes.has(code));
|
||||
return error.diagnosticCodes.every((code) => recoveryCodes.has(code));
|
||||
}
|
||||
|
@ -35,12 +35,12 @@ describe("TsRepl", () => {
|
||||
await new TsRepl(tsConfigPath, "const a: string = 123;")
|
||||
.start()
|
||||
.then(() => fail("must not resolve"))
|
||||
.catch(e => expect(e).toMatch(/is not assignable to type 'string'/));
|
||||
.catch((e) => expect(e).toMatch(/is not assignable to type 'string'/));
|
||||
|
||||
await new TsRepl(tsConfigPath, "const const const;")
|
||||
.start()
|
||||
.then(() => fail("must not resolve"))
|
||||
.catch(e => expect(e).toMatch(/Variable declaration expected./));
|
||||
.catch((e) => expect(e).toMatch(/Variable declaration expected./));
|
||||
});
|
||||
|
||||
it("can be started with top level await", async () => {
|
||||
|
@ -156,7 +156,7 @@ export class TsRepl {
|
||||
// statement in TypeScript is compiled to no JavaScript until the imported symbol is used
|
||||
// somewhere. This btw. leads to a different execution order of imports than in the TS source.
|
||||
let lastResult: any;
|
||||
for (const added of changes.filter(change => change.added)) {
|
||||
for (const added of changes.filter((change) => change.added)) {
|
||||
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
||||
lastResult = await executeJavaScriptAsync(added.value, this.evalFilename, this.context!);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user