Upgrade semistandard, appease new linter rules

This commit is contained in:
Lovell Fuller 2023-09-26 21:25:15 +01:00
parent 854ed65016
commit a41c62be2b
11 changed files with 44 additions and 44 deletions

View File

@ -138,18 +138,18 @@ const invalidParameterError = function (name, expected, actual) {
}; };
module.exports = { module.exports = {
defined: defined, defined,
object: object, object,
plainObject: plainObject, plainObject,
fn: fn, fn,
bool: bool, bool,
buffer: buffer, buffer,
typedArray: typedArray, typedArray,
arrayBuffer: arrayBuffer, arrayBuffer,
string: string, string,
number: number, number,
integer: integer, integer,
inRange: inRange, inRange,
inArray: inArray, inArray,
invalidParameterError: invalidParameterError invalidParameterError
}; };

View File

@ -1370,7 +1370,7 @@ function _pipeline (callback) {
reject(err); reject(err);
} else { } else {
if (this.options.resolveWithObject) { if (this.options.resolveWithObject) {
resolve({ data: data, info: info }); resolve({ data, info });
} else { } else {
resolve(data); resolve(data);
} }

View File

@ -172,7 +172,7 @@
"mocha": "^10.2.0", "mocha": "^10.2.0",
"nyc": "^15.1.0", "nyc": "^15.1.0",
"prebuild": "^12.1.0", "prebuild": "^12.1.0",
"semistandard": "^16.0.1", "semistandard": "^17.0.0",
"tar-fs": "^3.0.4", "tar-fs": "^3.0.4",
"tsd": "^0.29.0" "tsd": "^0.29.0"
}, },

View File

@ -190,8 +190,8 @@ async.series({
srcPath: fixtures.inputJpg, srcPath: fixtures.inputJpg,
dstPath: outputJpg, dstPath: outputJpg,
quality: 0.8, quality: 0.8,
width: width, width,
height: height, height,
format: 'jpg', format: 'jpg',
filter: 'Lanczos' filter: 'Lanczos'
}, function (err) { }, function (err) {
@ -795,7 +795,7 @@ async.series({
imagemagick.resize({ imagemagick.resize({
srcPath: fixtures.inputPngAlphaPremultiplicationLarge, srcPath: fixtures.inputPngAlphaPremultiplicationLarge,
dstPath: outputPng, dstPath: outputPng,
width: width, width,
height: heightPng, height: heightPng,
filter: 'Lanczos', filter: 'Lanczos',
customArgs: [ customArgs: [

View File

@ -269,7 +269,7 @@ describe('composite', () => {
.resize(80) .resize(80)
.composite([{ .composite([{
input: fixtures.inputPngWithTransparency16bit, input: fixtures.inputPngWithTransparency16bit,
gravity: gravity gravity
}]) }])
.toBuffer((err, data, info) => { .toBuffer((err, data, info) => {
if (err) throw err; if (err) throw err;
@ -314,7 +314,7 @@ describe('composite', () => {
.composite([{ .composite([{
input: fixtures.inputPngWithTransparency16bit, input: fixtures.inputPngWithTransparency16bit,
tile: true, tile: true,
gravity: gravity gravity
}]) }])
.toBuffer((err, data, info) => { .toBuffer((err, data, info) => {
if (err) throw err; if (err) throw err;

View File

@ -40,7 +40,7 @@ describe('Extend', function () {
sharp(fixtures.inputWebPAnimated, { pages: -1 }) sharp(fixtures.inputWebPAnimated, { pages: -1 })
.resize(120) .resize(120)
.extend({ .extend({
extendWith: extendWith, extendWith,
top: 40, top: 40,
bottom: 40, bottom: 40,
left: 40, left: 40,
@ -58,7 +58,7 @@ describe('Extend', function () {
sharp(fixtures.inputJpg) sharp(fixtures.inputJpg)
.resize(120) .resize(120)
.extend({ .extend({
extendWith: extendWith, extendWith,
top: 10, top: 10,
bottom: 10, bottom: 10,
left: 10, left: 10,
@ -77,7 +77,7 @@ describe('Extend', function () {
sharp(fixtures.inputPngWithTransparency16bit) sharp(fixtures.inputPngWithTransparency16bit)
.resize(120) .resize(120)
.extend({ .extend({
extendWith: extendWith, extendWith,
top: 50, top: 50,
left: 10, left: 10,
right: 35, right: 35,
@ -94,7 +94,7 @@ describe('Extend', function () {
it(`PNG with 2 channels (${extendWith})`, function (done) { it(`PNG with 2 channels (${extendWith})`, function (done) {
sharp(fixtures.inputPngWithGreyAlpha) sharp(fixtures.inputPngWithGreyAlpha)
.extend({ .extend({
extendWith: extendWith, extendWith,
top: 50, top: 50,
bottom: 50, bottom: 50,
left: 80, left: 80,

View File

@ -914,7 +914,7 @@ describe('Input/output', function () {
channels: 3, channels: 3,
background: { r: 0, g: 255, b: 0 } background: { r: 0, g: 255, b: 0 }
}; };
sharp({ create: create }) sharp({ create })
.jpeg() .jpeg()
.toBuffer(function (err, data, info) { .toBuffer(function (err, data, info) {
if (err) throw err; if (err) throw err;
@ -932,7 +932,7 @@ describe('Input/output', function () {
channels: 4, channels: 4,
background: { r: 255, g: 0, b: 0, alpha: 128 } background: { r: 255, g: 0, b: 0, alpha: 128 }
}; };
sharp({ create: create }) sharp({ create })
.png() .png()
.toBuffer(function (err, data, info) { .toBuffer(function (err, data, info) {
if (err) throw err; if (err) throw err;
@ -951,7 +951,7 @@ describe('Input/output', function () {
background: { r: 0, g: 0, b: 0 } background: { r: 0, g: 0, b: 0 }
}; };
assert.throws(function () { assert.throws(function () {
sharp({ create: create }); sharp({ create });
}); });
}); });
it('Missing background', function () { it('Missing background', function () {
@ -961,7 +961,7 @@ describe('Input/output', function () {
channels: 3 channels: 3
}; };
assert.throws(function () { assert.throws(function () {
sharp({ create: create }); sharp({ create });
}); });
}); });
}); });

View File

@ -36,7 +36,7 @@ describe('JPEG', function () {
[-1, 88.2, 'test'].forEach(function (quality) { [-1, 88.2, 'test'].forEach(function (quality) {
it(quality.toString(), function () { it(quality.toString(), function () {
assert.throws(function () { assert.throws(function () {
sharp().jpeg({ quality: quality }); sharp().jpeg({ quality });
}); });
}); });
}); });

View File

@ -646,7 +646,7 @@ describe('Resize dimensions', function () {
].forEach(function (kernel) { ].forEach(function (kernel) {
it(`kernel ${kernel}`, function (done) { it(`kernel ${kernel}`, function (done) {
sharp(fixtures.inputJpg) sharp(fixtures.inputJpg)
.resize(320, null, { kernel: kernel }) .resize(320, null, { kernel })
.toBuffer(function (err, data, info) { .toBuffer(function (err, data, info) {
if (err) throw err; if (err) throw err;
assert.strictEqual('jpeg', info.format); assert.strictEqual('jpeg', info.format);

View File

@ -66,7 +66,7 @@ describe('Text to image', function () {
const text = sharp({ const text = sharp({
text: { text: {
text: 'Hello, world!', text: 'Hello, world!',
dpi: dpi dpi
} }
}); });
text.toFile(output, function (err, info) { text.toFile(output, function (err, info) {
@ -87,7 +87,7 @@ describe('Text to image', function () {
text: { text: {
text: '<span foreground="red" font="100">red</span><span font="50" background="cyan">blue</span>', text: '<span foreground="red" font="100">red</span><span font="50" background="cyan">blue</span>',
rgba: true, rgba: true,
dpi: dpi dpi
} }
}); });
text.toFile(output, function (err, info) { text.toFile(output, function (err, info) {
@ -146,7 +146,7 @@ describe('Text to image', function () {
text: { text: {
text: '<span background="cyan">cool</span>', text: '<span background="cyan">cool</span>',
font: 'sans 30', font: 'sans 30',
dpi: dpi, dpi,
rgba: true rgba: true
} }
}, },

View File

@ -125,7 +125,7 @@ describe('Tile', function () {
[1, 8192].forEach(function (size) { [1, 8192].forEach(function (size) {
assert.doesNotThrow(function () { assert.doesNotThrow(function () {
sharp().tile({ sharp().tile({
size: size size
}); });
}); });
}); });
@ -135,7 +135,7 @@ describe('Tile', function () {
['zoinks', 1.1, -1, 0, 8193].forEach(function (size) { ['zoinks', 1.1, -1, 0, 8193].forEach(function (size) {
assert.throws(function () { assert.throws(function () {
sharp().tile({ sharp().tile({
size: size size
}); });
}); });
}); });
@ -146,7 +146,7 @@ describe('Tile', function () {
assert.doesNotThrow(function () { assert.doesNotThrow(function () {
sharp().tile({ sharp().tile({
size: 8192, size: 8192,
overlap: overlap overlap
}); });
}); });
}); });
@ -156,7 +156,7 @@ describe('Tile', function () {
['zoinks', 1.1, -1, 8193].forEach(function (overlap) { ['zoinks', 1.1, -1, 8193].forEach(function (overlap) {
assert.throws(function () { assert.throws(function () {
sharp().tile({ sharp().tile({
overlap: overlap overlap
}); });
}); });
}); });
@ -166,7 +166,7 @@ describe('Tile', function () {
['fs', 'zip'].forEach(function (container) { ['fs', 'zip'].forEach(function (container) {
assert.doesNotThrow(function () { assert.doesNotThrow(function () {
sharp().tile({ sharp().tile({
container: container container
}); });
}); });
}); });
@ -176,7 +176,7 @@ describe('Tile', function () {
['zoinks', 1].forEach(function (container) { ['zoinks', 1].forEach(function (container) {
assert.throws(function () { assert.throws(function () {
sharp().tile({ sharp().tile({
container: container container
}); });
}); });
}); });
@ -186,7 +186,7 @@ describe('Tile', function () {
['dz', 'google', 'zoomify'].forEach(function (layout) { ['dz', 'google', 'zoomify'].forEach(function (layout) {
assert.doesNotThrow(function () { assert.doesNotThrow(function () {
sharp().tile({ sharp().tile({
layout: layout layout
}); });
}); });
}); });
@ -196,7 +196,7 @@ describe('Tile', function () {
['zoinks', 1].forEach(function (layout) { ['zoinks', 1].forEach(function (layout) {
assert.throws(function () { assert.throws(function () {
sharp().tile({ sharp().tile({
layout: layout layout
}); });
}); });
}); });
@ -254,7 +254,7 @@ describe('Tile', function () {
[90, 270, -90].forEach(function (angle) { [90, 270, -90].forEach(function (angle) {
assert.doesNotThrow(function () { assert.doesNotThrow(function () {
sharp().tile({ sharp().tile({
angle: angle angle
}); });
}); });
}); });
@ -264,7 +264,7 @@ describe('Tile', function () {
['zoinks', 1.1, -1, 27].forEach(function (angle) { ['zoinks', 1.1, -1, 27].forEach(function (angle) {
assert.throws(function () { assert.throws(function () {
sharp().tile({ sharp().tile({
angle: angle angle
}); });
}); });
}); });