From af5204ed35e7af337ad5658900dd4362f9cd96a5 Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=B4me=20Benoit?= Date: Sun, 23 Oct 2022 10:57:13 +0200 Subject: [PATCH] Refine code formatting configuration MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Jérôme Benoit --- .lintstagedrc.js | 3 +-- CONTRIBUTING.md | 2 +- package.json | 10 ++++++++-- src/worker/abstract-worker.ts | 4 +++- 4 files changed, 13 insertions(+), 6 deletions(-) diff --git a/.lintstagedrc.js b/.lintstagedrc.js index 33c1152d..91447fa0 100644 --- a/.lintstagedrc.js +++ b/.lintstagedrc.js @@ -1,9 +1,8 @@ module.exports = { - '**/*.{ts,tsx}': [ + '**/*.{ts,tsx,js,jsx,mjs,cjs}': [ 'prettier --write', 'ts-standard --fix', 'eslint --cache --fix' ], - '**/*.{js,jsx,mjs,cjs}': ['prettier --write', 'eslint --cache --fix'], '**/*.{json,md,yml,yaml}': ['prettier --write'] } diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 4142a351..9d3e4fba 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -5,7 +5,7 @@ This repo use standard js style, please use it if you want to contribute Take tasks from todo list, develop a new feature or fix a bug and do a pull request. Another thing that you can do to contribute is to build something on top of ring-election and link ring-election to your project -Please ask your PR to be merged on **master** branch. +Please do your PR on **master** branch. **How to run unit tests and coverage** diff --git a/package.json b/package.json index 441c9475..0561bb50 100644 --- a/package.json +++ b/package.json @@ -15,6 +15,7 @@ "test:debug": "npm run build && mocha --no-parallel --inspect 'tests/**/*.test.js'", "coverage": "c8 report --reporter=lcov", "coverage:html": "c8 report --reporter=html", + "format": "prettier . --write; ts-standard . --fix", "lint": "eslint . --cache", "lint:fix": "eslint . --cache --fix", "lint:report": "eslint . --cache --format json --output-file reports/eslint.json", @@ -24,8 +25,13 @@ "prepublishOnly": "npm run build:prod" }, "ts-standard": { - "ignore": [ - "tests/**/*.js" + "globals": [ + "describe", + "it", + "before", + "after", + "beforeEach", + "afterEach" ] }, "engines": { diff --git a/src/worker/abstract-worker.ts b/src/worker/abstract-worker.ts index ab56a5e9..84699459 100644 --- a/src/worker/abstract-worker.ts +++ b/src/worker/abstract-worker.ts @@ -114,7 +114,9 @@ export abstract class AbstractWorker< */ private checkFunctionInput (fn: (data: Data) => Response): void { if (fn == null) throw new Error('fn parameter is mandatory') - if (typeof fn !== 'function') { throw new TypeError('fn parameter is not a function') } + if (typeof fn !== 'function') { + throw new TypeError('fn parameter is not a function') + } } /** -- 2.34.1