diff --git a/.eslintrc.js b/.eslintrc.js index 0fe1bff7..4a7fc62d 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -26,7 +26,7 @@ module.exports = { "func-names": "off", "global-require": "off", "guard-for-in": "off", - "indent": "off", + "indent": ["error", 2], "import/no-extraneous-dependencies": "off", "import/no-unresolved": "off", "import/newline-after-import": "off", diff --git a/lib/utils/index.js b/lib/utils/index.js index 8cdab4a3..0f703a33 100644 --- a/lib/utils/index.js +++ b/lib/utils/index.js @@ -338,14 +338,14 @@ function build_eager(transformations) { */ function build_custom_headers(headers) { switch (true) { - case headers == null: - return void 0; - case isArray(headers): - return headers.join("\n"); - case isObject(headers): - return entries(headers).map(([k, v]) => `${k}:${v}`).join("\n"); - default: - return headers; + case headers == null: + return void 0; + case isArray(headers): + return headers.join("\n"); + case isObject(headers): + return entries(headers).map(([k, v]) => `${k}:${v}`).join("\n"); + default: + return headers; } } @@ -1100,15 +1100,15 @@ const OFFSET_ANY_PATTERN_RE = RegExp(`(${OFFSET_ANY_PATTERN})\\.\\.(${OFFSET_ANY // Split a range into the start and end values function split_range(range) { // :nodoc: switch (range.constructor) { - case String: - if (!OFFSET_ANY_PATTERN_RE.test(range)) { - return range; - } - return range.split(".."); - case Array: - return [first(range), last(range)]; - default: - return [null, null]; + case String: + if (!OFFSET_ANY_PATTERN_RE.test(range)) { + return range; + } + return range.split(".."); + case Array: + return [first(range), last(range)]; + default: + return [null, null]; } } @@ -1131,23 +1131,23 @@ function norm_range_value(value) { // :nodoc: */ function process_video_params(param) { switch (param.constructor) { - case Object: { - let video = ""; - if ('codec' in param) { - video = param.codec; - if ('profile' in param) { - video += ":" + param.profile; - if ('level' in param) { - video += ":" + param.level; - } + case Object: { + let video = ""; + if ('codec' in param) { + video = param.codec; + if ('profile' in param) { + video += ":" + param.profile; + if ('level' in param) { + video += ":" + param.level; } } - return video; } - case String: - return param; - default: - return null; + return video; + } + case String: + return param; + default: + return null; } } /** diff --git a/lib/utils/parsing/toArray.js b/lib/utils/parsing/toArray.js index fdf0257a..684d3a1f 100644 --- a/lib/utils/parsing/toArray.js +++ b/lib/utils/parsing/toArray.js @@ -7,12 +7,12 @@ const isArray = require('lodash/isArray'); */ function toArray(arg) { switch (true) { - case arg == null: - return []; - case isArray(arg): - return arg; - default: - return [arg]; + case arg == null: + return []; + case isArray(arg): + return arg; + default: + return [arg]; } } diff --git a/test/api_spec.js b/test/api_spec.js index ef779179..4fcfe02f 100644 --- a/test/api_spec.js +++ b/test/api_spec.js @@ -231,10 +231,10 @@ describe("api", function () { ({ public_id }) => cloudinary.v2.api.resources({ type: "upload" }) .then(result => [public_id, result]) .then(([public_id, result]) => { - let resource = findByAttr(result.resources, "public_id", public_id); - expect(resource).to.be.an(Object); - expect(resource.type).to.eql("upload"); - })); + let resource = findByAttr(result.resources, "public_id", public_id); + expect(resource).to.be.an(Object); + expect(resource.type).to.eql("upload"); + })); }); it("should allow listing resources by prefix", function () { this.timeout(TIMEOUT.MEDIUM); diff --git a/test/spechelper.js b/test/spechelper.js index e13d61dd..fa4351d4 100644 --- a/test/spechelper.js +++ b/test/spechelper.js @@ -63,15 +63,15 @@ const allExamples = {}; function sharedExamples(name, examples) { switch (true) { - case isFunction(examples): - allExamples[name] = examples; - return examples; - case allExamples.hasOwnProperty(name): - return allExamples[name]; - default: - return function () { - console.log(`Shared example ${name} was not found!`); - }; + case isFunction(examples): + allExamples[name] = examples; + return examples; + case allExamples.hasOwnProperty(name): + return allExamples[name]; + default: + return function () { + console.log(`Shared example ${name} was not found!`); + }; } }