Linter: apply all recommended biome settings

Enforces previously-skipped useArrowFunction check
This commit is contained in:
Lovell Fuller
2025-11-03 21:14:45 +00:00
parent 09d5aa8cfa
commit 4f9f8179a6
66 changed files with 1823 additions and 1910 deletions

View File

@@ -7,55 +7,43 @@
* Is this value defined and not null?
* @private
*/
const defined = function (val) {
return typeof val !== 'undefined' && val !== null;
};
const defined = (val) => typeof val !== 'undefined' && val !== null;
/**
* Is this value an object?
* @private
*/
const object = function (val) {
return typeof val === 'object';
};
const object = (val) => typeof val === 'object';
/**
* Is this value a plain object?
* @private
*/
const plainObject = function (val) {
return Object.prototype.toString.call(val) === '[object Object]';
};
const plainObject = (val) => Object.prototype.toString.call(val) === '[object Object]';
/**
* Is this value a function?
* @private
*/
const fn = function (val) {
return typeof val === 'function';
};
const fn = (val) => typeof val === 'function';
/**
* Is this value a boolean?
* @private
*/
const bool = function (val) {
return typeof val === 'boolean';
};
const bool = (val) => typeof val === 'boolean';
/**
* Is this value a Buffer object?
* @private
*/
const buffer = function (val) {
return val instanceof Buffer;
};
const buffer = (val) => val instanceof Buffer;
/**
* Is this value a typed array object?. E.g. Uint8Array or Uint8ClampedArray?
* @private
*/
const typedArray = function (val) {
const typedArray = (val) => {
if (defined(val)) {
switch (val.constructor) {
case Uint8Array:
@@ -78,49 +66,37 @@ const typedArray = function (val) {
* Is this value an ArrayBuffer object?
* @private
*/
const arrayBuffer = function (val) {
return val instanceof ArrayBuffer;
};
const arrayBuffer = (val) => val instanceof ArrayBuffer;
/**
* Is this value a non-empty string?
* @private
*/
const string = function (val) {
return typeof val === 'string' && val.length > 0;
};
const string = (val) => typeof val === 'string' && val.length > 0;
/**
* Is this value a real number?
* @private
*/
const number = function (val) {
return typeof val === 'number' && !Number.isNaN(val);
};
const number = (val) => typeof val === 'number' && !Number.isNaN(val);
/**
* Is this value an integer?
* @private
*/
const integer = function (val) {
return Number.isInteger(val);
};
const integer = (val) => Number.isInteger(val);
/**
* Is this value within an inclusive given range?
* @private
*/
const inRange = function (val, min, max) {
return val >= min && val <= max;
};
const inRange = (val, min, max) => val >= min && val <= max;
/**
* Is this value within the elements of an array?
* @private
*/
const inArray = function (val, list) {
return list.includes(val);
};
const inArray = (val, list) => list.includes(val);
/**
* Create an Error with a message relating to an invalid parameter.
@@ -131,11 +107,9 @@ const inArray = function (val, list) {
* @returns {Error} Containing the formatted message.
* @private
*/
const invalidParameterError = function (name, expected, actual) {
return new Error(
const invalidParameterError = (name, expected, actual) => new Error(
`Expected ${expected} for ${name} but received ${actual} of type ${typeof actual}`
);
};
/**
* Ensures an Error from C++ contains a JS stack.
@@ -145,7 +119,7 @@ const invalidParameterError = function (name, expected, actual) {
* @returns {Error} Error with message and stack.
* @private
*/
const nativeError = function (native, context) {
const nativeError = (native, context) => {
context.message = native.message;
return context;
};