From a41c62be2b618030394ed707f9adcf51f5132ba8 Mon Sep 17 00:00:00 2001 From: Lovell Fuller Date: Tue, 26 Sep 2023 21:25:15 +0100 Subject: [PATCH] Upgrade semistandard, appease new linter rules --- lib/is.js | 28 ++++++++++++++-------------- lib/output.js | 2 +- package.json | 2 +- test/bench/perf.js | 6 +++--- test/unit/composite.js | 4 ++-- test/unit/extend.js | 8 ++++---- test/unit/io.js | 8 ++++---- test/unit/jpeg.js | 2 +- test/unit/resize.js | 2 +- test/unit/text.js | 6 +++--- test/unit/tile.js | 20 ++++++++++---------- 11 files changed, 44 insertions(+), 44 deletions(-) diff --git a/lib/is.js b/lib/is.js index 364778f2..f1f390bc 100644 --- a/lib/is.js +++ b/lib/is.js @@ -138,18 +138,18 @@ const invalidParameterError = function (name, expected, actual) { }; module.exports = { - defined: defined, - object: object, - plainObject: plainObject, - fn: fn, - bool: bool, - buffer: buffer, - typedArray: typedArray, - arrayBuffer: arrayBuffer, - string: string, - number: number, - integer: integer, - inRange: inRange, - inArray: inArray, - invalidParameterError: invalidParameterError + defined, + object, + plainObject, + fn, + bool, + buffer, + typedArray, + arrayBuffer, + string, + number, + integer, + inRange, + inArray, + invalidParameterError }; diff --git a/lib/output.js b/lib/output.js index dcf78e01..e3fe71f9 100644 --- a/lib/output.js +++ b/lib/output.js @@ -1370,7 +1370,7 @@ function _pipeline (callback) { reject(err); } else { if (this.options.resolveWithObject) { - resolve({ data: data, info: info }); + resolve({ data, info }); } else { resolve(data); } diff --git a/package.json b/package.json index 637a1cc8..7f3b0be2 100644 --- a/package.json +++ b/package.json @@ -172,7 +172,7 @@ "mocha": "^10.2.0", "nyc": "^15.1.0", "prebuild": "^12.1.0", - "semistandard": "^16.0.1", + "semistandard": "^17.0.0", "tar-fs": "^3.0.4", "tsd": "^0.29.0" }, diff --git a/test/bench/perf.js b/test/bench/perf.js index a017df80..4941f855 100644 --- a/test/bench/perf.js +++ b/test/bench/perf.js @@ -190,8 +190,8 @@ async.series({ srcPath: fixtures.inputJpg, dstPath: outputJpg, quality: 0.8, - width: width, - height: height, + width, + height, format: 'jpg', filter: 'Lanczos' }, function (err) { @@ -795,7 +795,7 @@ async.series({ imagemagick.resize({ srcPath: fixtures.inputPngAlphaPremultiplicationLarge, dstPath: outputPng, - width: width, + width, height: heightPng, filter: 'Lanczos', customArgs: [ diff --git a/test/unit/composite.js b/test/unit/composite.js index 27ac22ad..46528ad2 100644 --- a/test/unit/composite.js +++ b/test/unit/composite.js @@ -269,7 +269,7 @@ describe('composite', () => { .resize(80) .composite([{ input: fixtures.inputPngWithTransparency16bit, - gravity: gravity + gravity }]) .toBuffer((err, data, info) => { if (err) throw err; @@ -314,7 +314,7 @@ describe('composite', () => { .composite([{ input: fixtures.inputPngWithTransparency16bit, tile: true, - gravity: gravity + gravity }]) .toBuffer((err, data, info) => { if (err) throw err; diff --git a/test/unit/extend.js b/test/unit/extend.js index 18c64863..c06b709a 100644 --- a/test/unit/extend.js +++ b/test/unit/extend.js @@ -40,7 +40,7 @@ describe('Extend', function () { sharp(fixtures.inputWebPAnimated, { pages: -1 }) .resize(120) .extend({ - extendWith: extendWith, + extendWith, top: 40, bottom: 40, left: 40, @@ -58,7 +58,7 @@ describe('Extend', function () { sharp(fixtures.inputJpg) .resize(120) .extend({ - extendWith: extendWith, + extendWith, top: 10, bottom: 10, left: 10, @@ -77,7 +77,7 @@ describe('Extend', function () { sharp(fixtures.inputPngWithTransparency16bit) .resize(120) .extend({ - extendWith: extendWith, + extendWith, top: 50, left: 10, right: 35, @@ -94,7 +94,7 @@ describe('Extend', function () { it(`PNG with 2 channels (${extendWith})`, function (done) { sharp(fixtures.inputPngWithGreyAlpha) .extend({ - extendWith: extendWith, + extendWith, top: 50, bottom: 50, left: 80, diff --git a/test/unit/io.js b/test/unit/io.js index 137bdc43..485d07fc 100644 --- a/test/unit/io.js +++ b/test/unit/io.js @@ -914,7 +914,7 @@ describe('Input/output', function () { channels: 3, background: { r: 0, g: 255, b: 0 } }; - sharp({ create: create }) + sharp({ create }) .jpeg() .toBuffer(function (err, data, info) { if (err) throw err; @@ -932,7 +932,7 @@ describe('Input/output', function () { channels: 4, background: { r: 255, g: 0, b: 0, alpha: 128 } }; - sharp({ create: create }) + sharp({ create }) .png() .toBuffer(function (err, data, info) { if (err) throw err; @@ -951,7 +951,7 @@ describe('Input/output', function () { background: { r: 0, g: 0, b: 0 } }; assert.throws(function () { - sharp({ create: create }); + sharp({ create }); }); }); it('Missing background', function () { @@ -961,7 +961,7 @@ describe('Input/output', function () { channels: 3 }; assert.throws(function () { - sharp({ create: create }); + sharp({ create }); }); }); }); diff --git a/test/unit/jpeg.js b/test/unit/jpeg.js index 8c461664..6f7ca978 100644 --- a/test/unit/jpeg.js +++ b/test/unit/jpeg.js @@ -36,7 +36,7 @@ describe('JPEG', function () { [-1, 88.2, 'test'].forEach(function (quality) { it(quality.toString(), function () { assert.throws(function () { - sharp().jpeg({ quality: quality }); + sharp().jpeg({ quality }); }); }); }); diff --git a/test/unit/resize.js b/test/unit/resize.js index a184d028..255fb15f 100644 --- a/test/unit/resize.js +++ b/test/unit/resize.js @@ -646,7 +646,7 @@ describe('Resize dimensions', function () { ].forEach(function (kernel) { it(`kernel ${kernel}`, function (done) { sharp(fixtures.inputJpg) - .resize(320, null, { kernel: kernel }) + .resize(320, null, { kernel }) .toBuffer(function (err, data, info) { if (err) throw err; assert.strictEqual('jpeg', info.format); diff --git a/test/unit/text.js b/test/unit/text.js index 1b5a80c6..742d039a 100644 --- a/test/unit/text.js +++ b/test/unit/text.js @@ -66,7 +66,7 @@ describe('Text to image', function () { const text = sharp({ text: { text: 'Hello, world!', - dpi: dpi + dpi } }); text.toFile(output, function (err, info) { @@ -87,7 +87,7 @@ describe('Text to image', function () { text: { text: 'redblue', rgba: true, - dpi: dpi + dpi } }); text.toFile(output, function (err, info) { @@ -146,7 +146,7 @@ describe('Text to image', function () { text: { text: 'cool', font: 'sans 30', - dpi: dpi, + dpi, rgba: true } }, diff --git a/test/unit/tile.js b/test/unit/tile.js index 6b03d620..a70d16a6 100644 --- a/test/unit/tile.js +++ b/test/unit/tile.js @@ -125,7 +125,7 @@ describe('Tile', function () { [1, 8192].forEach(function (size) { assert.doesNotThrow(function () { sharp().tile({ - size: size + size }); }); }); @@ -135,7 +135,7 @@ describe('Tile', function () { ['zoinks', 1.1, -1, 0, 8193].forEach(function (size) { assert.throws(function () { sharp().tile({ - size: size + size }); }); }); @@ -146,7 +146,7 @@ describe('Tile', function () { assert.doesNotThrow(function () { sharp().tile({ size: 8192, - overlap: overlap + overlap }); }); }); @@ -156,7 +156,7 @@ describe('Tile', function () { ['zoinks', 1.1, -1, 8193].forEach(function (overlap) { assert.throws(function () { sharp().tile({ - overlap: overlap + overlap }); }); }); @@ -166,7 +166,7 @@ describe('Tile', function () { ['fs', 'zip'].forEach(function (container) { assert.doesNotThrow(function () { sharp().tile({ - container: container + container }); }); }); @@ -176,7 +176,7 @@ describe('Tile', function () { ['zoinks', 1].forEach(function (container) { assert.throws(function () { sharp().tile({ - container: container + container }); }); }); @@ -186,7 +186,7 @@ describe('Tile', function () { ['dz', 'google', 'zoomify'].forEach(function (layout) { assert.doesNotThrow(function () { sharp().tile({ - layout: layout + layout }); }); }); @@ -196,7 +196,7 @@ describe('Tile', function () { ['zoinks', 1].forEach(function (layout) { assert.throws(function () { sharp().tile({ - layout: layout + layout }); }); }); @@ -254,7 +254,7 @@ describe('Tile', function () { [90, 270, -90].forEach(function (angle) { assert.doesNotThrow(function () { sharp().tile({ - angle: angle + angle }); }); }); @@ -264,7 +264,7 @@ describe('Tile', function () { ['zoinks', 1.1, -1, 27].forEach(function (angle) { assert.throws(function () { sharp().tile({ - angle: angle + angle }); }); });