diff --git a/Makefile b/Makefile index 6164ec8a4d..f43c453b6a 100644 --- a/Makefile +++ b/Makefile @@ -31,4 +31,8 @@ lint: node_modules yarn lint go vet +fmt: node_modules + yarn fmt + go fmt + .PHONY: lint clean distclean diff --git a/main.ts b/main.ts index 91be0c4553..f833a3b6cc 100644 --- a/main.ts +++ b/main.ts @@ -28,11 +28,11 @@ function load(argv: string[]): void { V8Worker2.recv((ab: ArrayBuffer) => { const msg = pb.Msg.decode(new Uint8Array(ab)); switch (msg.kind) { - case pb.Msg.MsgKind.LOAD: - load(msg.argv); - break; - default: - console.log("Unknown message", msg); - break; + case pb.Msg.MsgKind.LOAD: + load(msg.argv); + break; + default: + console.log("Unknown message", msg); + break; } }); diff --git a/package.json b/package.json index 7ec00b9b91..48593c59fb 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,8 @@ { "name": "deno", "scripts": { - "lint": "tslint -p tsconfig.json" + "lint": "tslint -p tsconfig.json", + "fmt": "prettier --write *.ts* *.js *.json" }, "devDependencies": { "@types/text-encoding": "^0.0.32", diff --git a/tslint.json b/tslint.json index 59d7bdaa8b..d0e6447bbc 100644 --- a/tslint.json +++ b/tslint.json @@ -2,7 +2,8 @@ "rules": { "array-type": [true, "array-simple"], "arrow-return-shorthand": true, - "ban": [true, + "ban": [ + true, ["fit"], ["fdescribe"], ["xit"], @@ -12,7 +13,8 @@ ["fitFakeAsync"], ["xitFakeAsync"] ], - "ban-types": [true, + "ban-types": [ + true, ["Object", "Use {} instead."], ["String", "Use 'string' instead."], ["Number", "Use 'number' instead."], @@ -41,7 +43,11 @@ "no-unused-variable": true, "no-var-keyword": true, "object-literal-shorthand": true, - "only-arrow-functions": [true, "allow-declarations", "allow-named-functions"], + "only-arrow-functions": [ + true, + "allow-declarations", + "allow-named-functions" + ], "prefer-const": true, "quotemark": [true, "double"], "radix": true, diff --git a/util.ts b/util.ts index 7d0acfce79..e92714d99f 100644 --- a/util.ts +++ b/util.ts @@ -15,7 +15,7 @@ _global["console"] = { log(...args: any[]): void { const out: string[] = []; for (const a of args) { - if (typeof(a) === "string") { + if (typeof a === "string") { out.push(a); } else { out.push(JSON.stringify(a)); diff --git a/yarn.lock b/yarn.lock index 5874b85035..782e7ceaa6 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2816,6 +2816,10 @@ prepend-http@^1.0.0: version "1.0.4" resolved "https://registry.yarnpkg.com/prepend-http/-/prepend-http-1.0.4.tgz#d4f4562b0ce3696e41ac52d0e002e57a635dc6dc" +prettier@^1.12.1: + version "1.12.1" + resolved "https://registry.yarnpkg.com/prettier/-/prettier-1.12.1.tgz#c1ad20e803e7749faf905a409d2367e06bbe7325" + private@^0.1.6, private@^0.1.8: version "0.1.8" resolved "https://registry.yarnpkg.com/private/-/private-0.1.8.tgz#2381edb3689f7a53d653190060fcf822d2f368ff"