From 765f1ede668f70e3af7717bf4d5f05dbf009c7f8 Mon Sep 17 00:00:00 2001 From: toasted-nutbread Date: Sat, 10 Feb 2024 23:12:01 -0500 Subject: Eslint rule updates (#665) * Padding newline rules * Update rules * Update rules * Update rules * Updates * Update object quotes * Merge similar ts and js rules * Change export spacing rules * Move typescript-eslint rules * Spacing * Actually save and commit changes --- ext/js/data/json-schema.js | 2 +- ext/js/data/options-util.js | 9 ++++++--- 2 files changed, 7 insertions(+), 4 deletions(-) (limited to 'ext/js/data') diff --git a/ext/js/data/json-schema.js b/ext/js/data/json-schema.js index 9b7ea011..3342e387 100644 --- a/ext/js/data/json-schema.js +++ b/ext/js/data/json-schema.js @@ -805,7 +805,7 @@ export class JsonSchema { const {type: schemaType, const: schemaConst, enum: schemaEnum} = schema; const type = this._getValueType(value); if (!this._isValueTypeAny(value, type, schemaType)) { - throw this._createError(`Value type ${type} does not match schema type ${schemaType}`); + throw this._createError(`Value type ${type} does not match schema type ${Array.isArray(schemaType) ? schemaType.join(',') : schemaType}`); } if (typeof schemaConst !== 'undefined' && !this._valuesAreEqual(value, schemaConst)) { diff --git a/ext/js/data/options-util.js b/ext/js/data/options-util.js index d93927a7..2ecd5527 100644 --- a/ext/js/data/options-util.js +++ b/ext/js/data/options-util.js @@ -46,7 +46,8 @@ export class OptionsUtil { // Invalid options let options = /** @type {{[key: string]: unknown}} */ ( typeof optionsInput === 'object' && optionsInput !== null && !Array.isArray(optionsInput) ? - optionsInput : {} + optionsInput : + {} ); // Check for legacy options @@ -495,6 +496,7 @@ export class OptionsUtil { * @returns {import('options-util').UpdateFunction[]} */ _getVersionUpdates(targetVersion) { + /* eslint-disable @typescript-eslint/unbound-method */ const result = [ this._updateVersion1, this._updateVersion2, @@ -521,6 +523,7 @@ export class OptionsUtil { this._updateVersion23, this._updateVersion24 ]; + /* eslint-enable @typescript-eslint/unbound-method */ if (typeof targetVersion === 'number' && targetVersion < result.length) { result.splice(targetVersion); } @@ -1090,9 +1093,9 @@ export class OptionsUtil { } if (customTemplates && isObject(chrome.storage)) { - chrome.storage.session.set({'needsCustomTemplatesWarning': true}); + chrome.storage.session.set({needsCustomTemplatesWarning: true}); await this._createTab(chrome.runtime.getURL('/welcome.html')); - chrome.storage.session.set({'openedWelcomePage': true}); + chrome.storage.session.set({openedWelcomePage: true}); } } -- cgit v1.2.3