From 08e8f781d62e0ad19c3362e1c688ff850d4e2783 Mon Sep 17 00:00:00 2001 From: Rene Saarsoo Date: Thu, 17 Sep 2020 22:50:12 +0300 Subject: [PATCH] Add prettier --- package.json | 4 +++- src/index.ts | 5 +++-- yarn.lock | 5 +++++ 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/package.json b/package.json index 956d2ea..0d50781 100644 --- a/package.json +++ b/package.json @@ -4,10 +4,12 @@ "license": "GPL-3.0-or-later", "scripts": { "lint:ts": "tsc --no-emit", - "test": "ts-node src/index.ts examples/threshold-pushing.txt" + "test": "ts-node src/index.ts examples/threshold-pushing.txt", + "format:js": "prettier --write src/" }, "devDependencies": { "@types/node": "^14.10.3", + "prettier": "^2.1.2", "ts-node": "^9.0.0", "typescript": "^4.0.2" } diff --git a/src/index.ts b/src/index.ts index abf38b1..b90cabf 100644 --- a/src/index.ts +++ b/src/index.ts @@ -13,7 +13,7 @@ const parseDefinition = (line: string): Def | undefined => { return { type: matches[1], text: matches[2], - } + }; }; const isDefined = (x: T | undefined): x is T => Boolean(x); @@ -24,7 +24,8 @@ console.log(`Parsing: ${filename}`); const file = fs.readFileSync(filename, "utf8"); -file.split(/\n/) +file + .split(/\n/) .map(parseDefinition) .filter(isDefined) .forEach((def) => console.log(def.type)); diff --git a/yarn.lock b/yarn.lock index 22b6cc3..fe564fa 100644 --- a/yarn.lock +++ b/yarn.lock @@ -27,6 +27,11 @@ make-error@^1.1.1: resolved "https://registry.yarnpkg.com/make-error/-/make-error-1.3.6.tgz#2eb2e37ea9b67c4891f684a1394799af484cf7a2" integrity sha512-s8UhlNe7vPKomQhC1qFelMokr/Sc3AgNbso3n74mVPA5LTZwkB9NlXf4XPamLxJE8h0gh73rM94xvwRT2CVInw== +prettier@^2.1.2: + version "2.1.2" + resolved "https://registry.yarnpkg.com/prettier/-/prettier-2.1.2.tgz#3050700dae2e4c8b67c4c3f666cdb8af405e1ce5" + integrity sha512-16c7K+x4qVlJg9rEbXl7HEGmQyZlG4R9AgP+oHKRMsMsuk8s+ATStlf1NpDqyBI1HpVyfjLOeMhH2LvuNvV5Vg== + source-map-support@^0.5.17: version "0.5.19" resolved "https://registry.yarnpkg.com/source-map-support/-/source-map-support-0.5.19.tgz#a98b62f86dcaf4f67399648c085291ab9e8fed61"