From 110a5fe8f19b564e76162de567a6bffe2a6285d1 Mon Sep 17 00:00:00 2001 From: Justin Wind Date: Sun, 8 Aug 2021 11:42:11 -0700 Subject: [PATCH] fix and enforce indent rules --- .eslintrc.json | 9 ++++++++- CHANGELOG.md | 4 ++-- lib/dingus.js | 6 +++--- package.json | 1 + test/index.js | 1 - test/lib/dingus.js | 2 +- 6 files changed, 15 insertions(+), 8 deletions(-) diff --git a/.eslintrc.json b/.eslintrc.json index 7602b33..1dc01d2 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -56,6 +56,13 @@ "error", "last" ], + "indent": [ + "warn", + 2, + { + "SwitchCase": 1 + } + ], "sonarjs/cognitive-complexity": "warn", "keyword-spacing": "error", "linebreak-style": [ @@ -79,4 +86,4 @@ "strict": "error", "vars-on-top": "error" } -} \ No newline at end of file +} diff --git a/CHANGELOG.md b/CHANGELOG.md index 4b796d1..8e0e331 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,7 +4,7 @@ Releases and notable changes to this project are documented here. ## [Unreleased] -## [v1.1.0] - +## [v1.1.0] - 2021-08-08 ### Added @@ -20,4 +20,4 @@ Releases and notable changes to this project are documented here. [Unreleased]: https://git.squeep.com/?p=squeep-api-dingus;a=commitdiff;h=HEAD;hp=v1.1.0 [v1.1.0]: https://git.squeep.com/?p=squeep-api-dingus;a=commitdiff;h=v1.1.0;hp=v1.0.0 -[v1.0.0]: https://git.squeep.com/?p=squeep-api-dingus;a=commitdiff;h=v1.0.0;hp=v0.0.0 \ No newline at end of file +[v1.0.0]: https://git.squeep.com/?p=squeep-api-dingus;a=commitdiff;h=v1.0.0;hp=v0.0.0 diff --git a/lib/dingus.js b/lib/dingus.js index 1cbfd72..0143585 100644 --- a/lib/dingus.js +++ b/lib/dingus.js @@ -274,7 +274,7 @@ class Dingus { default: this.logger.error(_scope, 'unknown dingus error', { error: e }); handler = this.handlerInternalServerError.bind(this); - } + } } else if (e instanceof URIError) { handler = this.handlerBadRequest.bind(this); } else { @@ -651,7 +651,7 @@ class Dingus { * @param {http.ServerResponse} res * @param {object} ctx */ - async handlerBadRequest(req, res, ctx) { + async handlerBadRequest(req, res, ctx) { this.setResponseType(this.responseTypes, req, res, ctx); throw new ResponseError(Enum.ErrorResponse.BadRequest); } @@ -662,7 +662,7 @@ class Dingus { * @param {http.ServerResponse} res * @param {object} ctx */ - async handlerInternalServerError(req, res, ctx) { + async handlerInternalServerError(req, res, ctx) { this.setResponseType(this.responseTypes, req, res, ctx); throw new ResponseError(Enum.ErrorResponse.InternalServerError); } diff --git a/package.json b/package.json index 3b1199c..450ee79 100644 --- a/package.json +++ b/package.json @@ -9,6 +9,7 @@ "test": "mocha --recursive" }, "pre-commit": [ + "eslint", "coverage" ], "engines": { diff --git a/test/index.js b/test/index.js index 6075304..922335d 100644 --- a/test/index.js +++ b/test/index.js @@ -3,7 +3,6 @@ 'use strict'; const assert = require('assert'); -const sinon = require('sinon'); // eslint-disable-line node/no-unpublished-require const apiDingus = require('..'); diff --git a/test/lib/dingus.js b/test/lib/dingus.js index eeeaf3a..60b0dad 100644 --- a/test/lib/dingus.js +++ b/test/lib/dingus.js @@ -552,7 +552,7 @@ describe('Dingus', function () { dingus.strictAccept = false; dingus.setResponseType(['my/type'], req, res, ctx); assert.strictEqual(ctx.responseType, 'my/type'); - }); + }); }); // setResponseType -- 2.43.2