diff --git a/.eslintrc b/.eslintrc deleted file mode 100644 index eeff4d9da..000000000 --- a/.eslintrc +++ /dev/null @@ -1,35 +0,0 @@ -{ - "parser": "@babel/eslint-parser", - "parserOptions": { - "sourceType": "module", - "ecmaVersion": 2020 - }, - "extends": [ - "eslint-config-prettier", - "plugin:import/recommended" - ], - "plugins": [], - "rules": { - "import/no-cycle": 2, - "import/no-unresolved": "off", - "no-unused-vars": 1, - "no-console": "off", - "max-classes-per-file": "off", - "prefer-const": "off", - "no-param-reassign": "off", - "guard-for-in": "off", - "no-restricted-syntax": "off", - "class-methods-use-this": "off", - "dot-notation": "off", - "no-plusplus": "off", - "no-return-await": "off", - "no-await-in-loop": "off", - "one-var": "off", - "default-case": "warn", - "no-shadow": "warn", - "no-prototype-builtins": "off", - "prefer-template": "off", - "lit/no-invalid-html": "off", - "no-dupe-keys": "error", - } -} diff --git a/.lintstagedrc.json b/.lintstagedrc.json index d292b1a4a..b8277fcbd 100644 --- a/.lintstagedrc.json +++ b/.lintstagedrc.json @@ -1,5 +1,5 @@ { - "*.{js,cjs}": ["eslint --fix", "prettier --write", "git add"], + "*.{js,cjs}": ["biome check --write", "git add"], "*.css": ["stylelint --fix", "prettier --write --parser css", "git add"], "*.json": ["prettier --write --parser json", "git add"], "*.md": ["prettier --write --parser markdown", "git add"] diff --git a/abstract/ActivityBlock.js b/abstract/ActivityBlock.js index 6878ed45e..89bb5fb1b 100644 --- a/abstract/ActivityBlock.js +++ b/abstract/ActivityBlock.js @@ -1,6 +1,6 @@ // @ts-check -import { debounce } from '../blocks/utils/debounce.js'; import { EventType } from '../blocks/UploadCtxProvider/EventEmitter.js'; +import { debounce } from '../blocks/utils/debounce.js'; import { Block } from './Block.js'; import { activityBlockCtx } from './CTX.js'; @@ -15,7 +15,7 @@ export class ActivityBlock extends Block { /** @private */ _deactivate() { - let actDesc = ActivityBlock._activityCallbacks.get(this); + const actDesc = ActivityBlock._activityCallbacks.get(this); this[ACTIVE_PROP] = false; this.removeAttribute(ACTIVE_ATTR); actDesc?.deactivateCallback?.(); @@ -23,7 +23,7 @@ export class ActivityBlock extends Block { /** @private */ _activate() { - let actDesc = ActivityBlock._activityCallbacks.get(this); + const actDesc = ActivityBlock._activityCallbacks.get(this); this.$['*historyBack'] = this.historyBack.bind(this); /** @private */ this[ACTIVE_PROP] = true; @@ -167,7 +167,7 @@ export class ActivityBlock extends Block { historyBack() { /** @type {String[]} */ - let history = this.$['*history']; + const history = this.$['*history']; if (history) { let nextActivity = history.pop(); while (nextActivity === this.activityType) { diff --git a/abstract/Block.js b/abstract/Block.js index f4e68c554..3c45777ca 100644 --- a/abstract/Block.js +++ b/abstract/Block.js @@ -3,16 +3,16 @@ import { BaseComponent, Data } from '@symbiotejs/symbiote'; import { initialConfig } from '../blocks/Config/initialConfig.js'; import { EventEmitter } from '../blocks/UploadCtxProvider/EventEmitter.js'; import { WindowHeightTracker } from '../utils/WindowHeightTracker.js'; -import { extractFilename, extractCdnUrlModifiers, extractUuid } from '../utils/cdn-utils.js'; +import { extractCdnUrlModifiers, extractFilename, extractUuid } from '../utils/cdn-utils.js'; import { getLocaleDirection } from '../utils/getLocaleDirection.js'; import { getPluralForm } from '../utils/getPluralForm.js'; import { applyTemplateData, getPluralObjects } from '../utils/template-utils.js'; import { waitForAttribute } from '../utils/waitForAttribute.js'; import { blockCtx } from './CTX.js'; import { LocaleManager, localeStateKey } from './LocaleManager.js'; +import { A11y } from './a11y.js'; import { l10nProcessor } from './l10nProcessor.js'; import { sharedConfigKey } from './sharedConfigKey.js'; -import { A11y } from './a11y.js'; const TAG_PREFIX = 'lr-'; @@ -39,15 +39,15 @@ export class Block extends BaseComponent { if (!str) { return ''; } - let template = this.$[localeStateKey(str)] || str; - let pluralObjects = getPluralObjects(template); - for (let pluralObject of pluralObjects) { + const template = this.$[localeStateKey(str)] || str; + const pluralObjects = getPluralObjects(template); + for (const pluralObject of pluralObjects) { variables[pluralObject.variable] = this.pluralize( pluralObject.pluralKey, Number(variables[pluralObject.countVariable]), ); } - let result = applyTemplateData(template, variables); + const result = applyTemplateData(template, variables); return result; } @@ -97,7 +97,7 @@ export class Block extends BaseComponent { * @returns {Boolean} */ hasBlockInCtx(callback) { - for (let block of this.blocksRegistry) { + for (const block of this.blocksRegistry) { if (callback(block)) { return true; } @@ -129,13 +129,13 @@ export class Block extends BaseComponent { connectedCallback() { const styleAttrs = /** @type {typeof Block} */ (this.constructor).styleAttrs; - styleAttrs.forEach((attr) => { + for (const attr of styleAttrs) { this.setAttribute(attr, ''); - }); + } if (this.hasAttribute('retpl')) { // @ts-ignore TODO: fix this - this.constructor['template'] = null; + this.constructor.template = null; this.processInnerHtml = true; } if (this.requireCtxName) { @@ -168,7 +168,7 @@ export class Block extends BaseComponent { this.add('*blocksRegistry', new Set()); } - let blocksRegistry = this.$['*blocksRegistry']; + const blocksRegistry = this.$['*blocksRegistry']; blocksRegistry.add(this); if (!this.has('*eventEmitter')) { @@ -204,7 +204,7 @@ export class Block extends BaseComponent { } destroyCallback() { - let blocksRegistry = this.blocksRegistry; + const blocksRegistry = this.blocksRegistry; blocksRegistry.delete(this); this.localeManager?.destroyL10nBindings(this); @@ -239,7 +239,7 @@ export class Block extends BaseComponent { * @param {Number} [decimals] */ fileSizeFmt(bytes, decimals = 2) { - let units = ['B', 'KB', 'MB', 'GB', 'TB']; + const units = ['B', 'KB', 'MB', 'GB', 'TB']; /** * @param {String} str * @returns {String} @@ -247,10 +247,10 @@ export class Block extends BaseComponent { if (bytes === 0) { return `0 ${units[0]}`; } - let k = 1024; - let dm = decimals < 0 ? 0 : decimals; - let i = Math.floor(Math.log(bytes) / Math.log(k)); - return parseFloat((bytes / k ** i).toFixed(dm)) + ' ' + units[i]; + const k = 1024; + const dm = decimals < 0 ? 0 : decimals; + const i = Math.floor(Math.log(bytes) / Math.log(k)); + return `${Number.parseFloat((bytes / k ** i).toFixed(dm))} ${units[i]}`; } /** @@ -283,7 +283,7 @@ export class Block extends BaseComponent { /** @returns {import('../types').ConfigType} } */ get cfg() { if (!this.__cfgProxy) { - let o = Object.create(null); + const o = Object.create(null); /** @private */ this.__cfgProxy = new Proxy(o, { set: (obj, key, value) => { @@ -342,10 +342,10 @@ export class Block extends BaseComponent { /** @param {String} [name] */ static reg(name) { if (!name) { - super.reg(); + BaseComponent.reg(); return; } - super.reg(name.startsWith(TAG_PREFIX) ? name : TAG_PREFIX + name); + BaseComponent.reg(name.startsWith(TAG_PREFIX) ? name : TAG_PREFIX + name); } } diff --git a/abstract/LocaleManager.js b/abstract/LocaleManager.js index 93054dec0..4815bcdc7 100644 --- a/abstract/LocaleManager.js +++ b/abstract/LocaleManager.js @@ -1,7 +1,7 @@ // @ts-check import { debounce } from '../blocks/utils/debounce.js'; -import { resolveLocaleDefinition } from './localeRegistry.js'; import { default as en } from '../locales/file-uploader/en.js'; +import { resolveLocaleDefinition } from './localeRegistry.js'; /** @param {string} key */ export const localeStateKey = (key) => `*l10n/${key}`; @@ -33,7 +33,7 @@ export class LocaleManager { constructor(blockInstance) { this._blockInstance = blockInstance; - for (let [key, value] of Object.entries(en)) { + for (const [key, value] of Object.entries(en)) { this._blockInstance.add(localeStateKey(key), value, false); } diff --git a/abstract/SolutionBlock.js b/abstract/SolutionBlock.js index 4f5e7eed7..20cc3a7da 100644 --- a/abstract/SolutionBlock.js +++ b/abstract/SolutionBlock.js @@ -14,10 +14,10 @@ export class SolutionBlock extends Block { } static set template(value) { - this._template = svgIconsSprite + value + /** HTML */ ``; + SolutionBlock._template = /* HTML */ `${svgIconsSprite + value}`; } static get template() { - return this._template; + return SolutionBlock._template; } } diff --git a/abstract/TypedCollection.js b/abstract/TypedCollection.js index a5a871529..9020870c6 100644 --- a/abstract/TypedCollection.js +++ b/abstract/TypedCollection.js @@ -81,9 +81,9 @@ export class TypedCollection { if (Object.keys(changeMap).length === 0) { return; } - this.__propertyObservers.forEach((handler) => { + for (const handler of this.__propertyObservers) { handler({ ...changeMap }); - }); + } changeMap = Object.create(null); }); }; @@ -95,8 +95,8 @@ export class TypedCollection { } /** @private */ this.__notifyTimeout = window.setTimeout(() => { - let added = new Set(this.__added); - let removed = new Set(this.__removed); + const added = new Set(this.__added); + const removed = new Set(this.__removed); this.__added.clear(); this.__removed.clear(); for (const handler of this.__collectionObservers) { @@ -128,8 +128,8 @@ export class TypedCollection { * @returns {string} */ add(init) { - let item = new TypedData(this.__typedSchema); - for (let prop in init) { + const item = new TypedData(this.__typedSchema); + for (const prop in init) { item.setValue(prop, init[prop]); } this.__items.add(item.uid); @@ -137,7 +137,7 @@ export class TypedCollection { this.__data.add(item.uid, item); this.__added.add(item); - this.__watchList.forEach((propName) => { + for (const propName of this.__watchList) { if (!this.__subsMap[item.uid]) { this.__subsMap[item.uid] = []; } @@ -146,7 +146,7 @@ export class TypedCollection { this.__notifyObservers(propName, item.uid); }), ); - }); + } return item.uid; } @@ -164,7 +164,7 @@ export class TypedCollection { * @returns {any} */ readProp(id, propName) { - let item = this.read(id); + const item = this.read(id); return item.getValue(propName); } @@ -175,7 +175,7 @@ export class TypedCollection { * @param {T} value */ publishProp(id, propName, value) { - let item = this.read(id); + const item = this.read(id); item.setValue(propName, value); } @@ -189,9 +189,9 @@ export class TypedCollection { } clearAll() { - this.__items.forEach((id) => { + for (const id of this.__items) { this.remove(id); - }); + } } /** @param {Function} handler */ @@ -213,13 +213,13 @@ export class TypedCollection { * @returns {String[]} */ findItems(checkFn) { - let result = []; - this.__items.forEach((id) => { - let item = this.read(id); + const result = []; + for (const id of this.__items) { + const item = this.read(id); if (checkFn(item)) { result.push(id); } - }); + } return result; } @@ -235,10 +235,10 @@ export class TypedCollection { Data.deleteCtx(this.__ctxId); this.__propertyObservers = null; this.__collectionObservers = null; - for (let id in this.__subsMap) { - this.__subsMap[id].forEach((sub) => { + for (const id in this.__subsMap) { + for (const sub of this.__subsMap[id]) { sub.remove(); - }); + } delete this.__subsMap[id]; } } diff --git a/abstract/TypedData.js b/abstract/TypedData.js index af7f1039f..a10e2ff24 100644 --- a/abstract/TypedData.js +++ b/abstract/TypedData.js @@ -35,11 +35,11 @@ export class TypedData { * @param {any} value */ setValue(prop, value) { - if (!this.__typedSchema.hasOwnProperty(prop)) { + if (!Object.hasOwn(this.__typedSchema, prop)) { console.warn(MSG_NAME + prop); return; } - let pDesc = this.__typedSchema[prop]; + const pDesc = this.__typedSchema[prop]; if (value?.constructor === pDesc.type || value instanceof pDesc.type || (pDesc.nullable && value === null)) { this.__data.pub(prop, value); return; @@ -49,14 +49,14 @@ export class TypedData { /** @param {Object} updObj */ setMultipleValues(updObj) { - for (let prop in updObj) { + for (const prop in updObj) { this.setValue(prop, updObj[prop]); } } /** @param {String} prop */ getValue(prop) { - if (!this.__typedSchema.hasOwnProperty(prop)) { + if (!Object.hasOwn(this.__typedSchema, prop)) { console.warn(MSG_NAME + prop); return undefined; } diff --git a/abstract/UploaderBlock.js b/abstract/UploaderBlock.js index 1498fb64b..0aff20aa7 100644 --- a/abstract/UploaderBlock.js +++ b/abstract/UploaderBlock.js @@ -12,14 +12,14 @@ import { debounce } from '../blocks/utils/debounce.js'; import { customUserAgent } from '../blocks/utils/userAgent.js'; import { createCdnUrl, createCdnUrlModifiers } from '../utils/cdn-utils.js'; import { IMAGE_ACCEPT_LIST, fileIsImage, mergeFileTypes } from '../utils/fileTypes.js'; +import { parseCdnUrl } from '../utils/parseCdnUrl.js'; import { stringToArray } from '../utils/stringToArray.js'; import { uploaderBlockCtx } from './CTX.js'; +import { SecureUploadsManager } from './SecureUploadsManager.js'; import { TypedCollection } from './TypedCollection.js'; +import { ValidationManager } from './ValidationManager.js'; import { buildOutputCollectionState } from './buildOutputCollectionState.js'; import { uploadEntrySchema } from './uploadEntrySchema.js'; -import { parseCdnUrl } from '../utils/parseCdnUrl.js'; -import { SecureUploadsManager } from './SecureUploadsManager.js'; -import { ValidationManager } from './ValidationManager.js'; export class UploaderBlock extends ActivityBlock { couldBeCtxOwner = false; @@ -40,7 +40,7 @@ export class UploaderBlock extends ActivityBlock { super.initCallback(); if (!this.$['*uploadCollection']) { - let uploadCollection = new TypedCollection({ + const uploadCollection = new TypedCollection({ typedSchema: uploadEntrySchema, watchList: ['uploadProgress', 'uploadError', 'fileInfo', 'errors', 'cdnUrl', 'isUploading'], }); @@ -193,7 +193,9 @@ export class UploaderBlock extends ActivityBlock { /** @param {{ captureCamera?: boolean }} options */ openSystemDialog(options = {}) { - let accept = serializeCsv(mergeFileTypes([this.cfg.accept ?? '', ...(this.cfg.imgOnly ? IMAGE_ACCEPT_LIST : [])])); + const accept = serializeCsv( + mergeFileTypes([this.cfg.accept ?? '', ...(this.cfg.imgOnly ? IMAGE_ACCEPT_LIST : [])]), + ); if (this.cfg.accept && !!this.cfg.imgOnly) { console.warn( @@ -214,14 +216,15 @@ export class UploaderBlock extends ActivityBlock { this.fileInput.dispatchEvent(new MouseEvent('click')); this.fileInput.onchange = () => { // @ts-ignore TODO: fix this - [...this.fileInput['files']].forEach((file) => - this.addFileFromObject(file, { source: options.captureCamera ? UploadSource.CAMERA : UploadSource.LOCAL }), - ); + for (const file of [...this.fileInput.files]) { + this.addFileFromObject(file, { source: options.captureCamera ? UploadSource.CAMERA : UploadSource.LOCAL }); + } + // To call uploadTrigger UploadList should draw file items first: this.$['*currentActivity'] = ActivityBlock.activities.UPLOAD_LIST; this.setOrAddState('*modalActive', true); // @ts-ignore TODO: fix this - this.fileInput['value'] = ''; + this.fileInput.value = ''; this.fileInput = null; }; } @@ -251,7 +254,7 @@ export class UploaderBlock extends ActivityBlock { // TODO: We should refactor those handlers if (srcKey === 'local') { this.$['*currentActivity'] = ActivityBlock.activities.UPLOAD_LIST; - this?.['openSystemDialog'](); + this?.openSystemDialog(); return; } @@ -385,8 +388,7 @@ export class UploaderBlock extends ActivityBlock { ...new Set( Object.entries(changeMap) .filter(([key]) => ['uploadError', 'fileInfo'].includes(key)) - .map(([, ids]) => [...ids]) - .flat(), + .flatMap(([, ids]) => [...ids]), ), ]; @@ -424,10 +426,10 @@ export class UploaderBlock extends ActivityBlock { if (this.cfg.cropPreset) { this.setInitialCrop(); } - let loadedItems = uploadCollection.findItems((entry) => { + const loadedItems = uploadCollection.findItems((entry) => { return !!entry.getValue('fileInfo'); }); - let errorItems = uploadCollection.findItems((entry) => { + const errorItems = uploadCollection.findItems((entry) => { return entry.getValue('errors').length > 0; }); if (errorItems.length === 0 && uploadCollection.size === loadedItems.length) { @@ -454,9 +456,9 @@ export class UploaderBlock extends ActivityBlock { const uids = [...changeMap.cdnUrl].filter((uid) => { return !!this.uploadCollection.read(uid)?.getValue('cdnUrl'); }); - uids.forEach((uid) => { + for (const uid of uids) { this.emit(EventType.FILE_URL_CHANGED, this.getOutputItem(uid)); - }); + } this.$['*groupInfo'] = null; } @@ -468,10 +470,10 @@ export class UploaderBlock extends ActivityBlock { /** @type {Set} */ const uploadTrigger = this.$['*uploadTrigger']; const items = [...uploadTrigger].filter((id) => !!this.uploadCollection.read(id)); - items.forEach((id) => { + for (const id of items) { const uploadProgress = this.uploadCollection.readProp(id, 'uploadProgress'); commonProgress += uploadProgress; - }); + } const progress = items.length ? Math.round(commonProgress / items.length) : 0; if (this.$['*commonProgress'] === progress) { @@ -545,7 +547,7 @@ export class UploaderBlock extends ActivityBlock { const secureUploadsManager = this.$['*secureUploadsManager']; const secureToken = await secureUploadsManager.getSecureToken().catch(() => null); - let options = { + const options = { store: this.cfg.store, publicKey: this.cfg.pubkey, baseCDN: this.cfg.cdnCname, @@ -578,11 +580,11 @@ export class UploaderBlock extends ActivityBlock { const fileInfo = uploadEntryData.fileInfo; /** @type {import('../types').OutputFileEntry['status']} */ - let status = uploadEntryData.isRemoved + const status = uploadEntryData.isRemoved ? 'removed' : uploadEntryData.errors.length > 0 ? 'failed' - : !!uploadEntryData.fileInfo + : uploadEntryData.fileInfo ? 'success' : uploadEntryData.isUploading ? 'uploading' diff --git a/abstract/ValidationManager.js b/abstract/ValidationManager.js index 045573bfa..584bfadb1 100644 --- a/abstract/ValidationManager.js +++ b/abstract/ValidationManager.js @@ -1,12 +1,12 @@ // @ts-check import { EventType } from '../blocks/UploadCtxProvider/EventEmitter.js'; +import { validateCollectionUploadError, validateMultiple } from '../utils/validators/collection/index.js'; import { - validateIsImage, validateFileType, + validateIsImage, validateMaxSizeLimit, validateUploadError, } from '../utils/validators/file/index.js'; -import { validateMultiple, validateCollectionUploadError } from '../utils/validators/collection/index.js'; /** * @typedef {( diff --git a/abstract/a11y.js b/abstract/a11y.js index f29f1dce6..dd4eae043 100644 --- a/abstract/a11y.js +++ b/abstract/a11y.js @@ -1,5 +1,5 @@ // @ts-check -import { startKeyUX, hiddenKeyUX, jumpKeyUX, focusGroupKeyUX, pressKeyUX } from 'keyux'; +import { focusGroupKeyUX, hiddenKeyUX, jumpKeyUX, pressKeyUX, startKeyUX } from 'keyux'; /** * MinimalWindow interface is not exported by keyux, so we import it here using tricky way. diff --git a/abstract/connectBlocksFrom.js b/abstract/connectBlocksFrom.js index 43101596b..9efed34cb 100644 --- a/abstract/connectBlocksFrom.js +++ b/abstract/connectBlocksFrom.js @@ -17,7 +17,7 @@ export async function connectBlocksFrom(url, register = false) { resolve(window[LR_WINDOW_KEY]); return; } - let script = document.createElement('script'); + const script = document.createElement('script'); script.async = true; script.src = url; script.onerror = () => { @@ -25,7 +25,7 @@ export async function connectBlocksFrom(url, register = false) { }; script.onload = () => { /** @type {import('../index.js')} */ - let blocks = window[LR_WINDOW_KEY]; + const blocks = window[LR_WINDOW_KEY]; register && registerBlocks(blocks); resolve(blocks); }; diff --git a/abstract/l10nProcessor.js b/abstract/l10nProcessor.js index 43076a19f..380eded2c 100644 --- a/abstract/l10nProcessor.js +++ b/abstract/l10nProcessor.js @@ -8,7 +8,7 @@ import { localeStateKey } from './LocaleManager.js'; * @param {T} fnCtx */ export function l10nProcessor(fr, fnCtx) { - [...fr.querySelectorAll('[l10n]')].forEach((el) => { + for (const el of fr.querySelectorAll('[l10n]')) { let key = el.getAttribute('l10n'); if (!key) { return; @@ -36,15 +36,12 @@ export function l10nProcessor(fr, fnCtx) { if (!fnCtx.l10nProcessorSubs.has(localCtxKey)) { fnCtx.l10nProcessorSubs.set(localCtxKey, new Set()); } - const keySubs = fnCtx.l10nProcessorSubs.get(localCtxKey); - keySubs?.forEach( - /** @param {{ remove: () => void }} sub */ - (sub) => { - sub.remove(); - keySubs.delete(sub); - fnCtx.allSubs.delete(sub); - }, - ); + const keySubs = fnCtx.l10nProcessorSubs.get(localCtxKey) ?? new Set(); + for (const sub of keySubs) { + sub.remove(); + keySubs.delete(sub); + fnCtx.allSubs.delete(sub); + } // We don't need the leading * in the key because we use the key as a local context key relative to the global state const nodeStateKey = localeStateKey(mappedKey).replace('*', ''); // If the key is not present in the node context, add it @@ -76,5 +73,5 @@ export function l10nProcessor(fr, fnCtx) { } }); el.removeAttribute('l10n'); - }); + } } diff --git a/abstract/registerBlocks.js b/abstract/registerBlocks.js index 44d0cb2ac..f8201a85f 100644 --- a/abstract/registerBlocks.js +++ b/abstract/registerBlocks.js @@ -1,17 +1,17 @@ /** @param {Object} blockExports */ export function registerBlocks(blockExports) { - for (let blockName in blockExports) { + for (const blockName in blockExports) { let tagName = [...blockName].reduce((name, char) => { if (char.toUpperCase() === char) { - char = '-' + char.toLowerCase(); + return `${name}-${char.toLowerCase()}`; } - return (name += char); + return `${name}${char}`; }, ''); if (tagName.startsWith('-')) { tagName = tagName.replace('-', ''); } if (!tagName.startsWith('lr-')) { - tagName = 'lr-' + tagName; + tagName = `lr-${tagName}`; } if (blockExports[blockName].reg) { blockExports[blockName].reg(tagName); diff --git a/biome.json b/biome.json new file mode 100644 index 000000000..55e73320b --- /dev/null +++ b/biome.json @@ -0,0 +1,57 @@ +{ + "$schema": "https://biomejs.dev/schemas/1.8.2/schema.json", + "files": { + "ignore": [ + "**/svg-sprite.js", + "./web/**", + "./index.ssr.js", + "./index.ssr.d.ts", + "./env.d.ts", + "./env.template.d.ts", + "./build-svg-sprite.d.ts", + "./build-ssr-stubs.d.ts", + "./build-jsx-types.d.ts", + "./build-items.d.ts", + "./build.d.ts", + "./index.d.ts", + "./test-locales.d.ts", + "./abstract/**/*.d.ts", + "./blocks/**/*.d.ts", + "./locales/**/*.d.ts", + "./solutions/**/*.d.ts", + "./utils/**/*.d.ts", + "./demo/**/*.d.ts" + ] + }, + "formatter": { + "enabled": true, + "formatWithErrors": false, + "indentStyle": "space", + "indentWidth": 2, + "lineEnding": "lf", + "lineWidth": 120, + "attributePosition": "auto" + }, + "organizeImports": { + "enabled": true + }, + "linter": { + "enabled": true, + "rules": { + "recommended": true + } + }, + "javascript": { + "formatter": { + "jsxQuoteStyle": "double", + "quoteProperties": "asNeeded", + "trailingCommas": "all", + "semicolons": "always", + "arrowParentheses": "always", + "bracketSpacing": true, + "bracketSameLine": false, + "quoteStyle": "single", + "attributePosition": "auto" + } + } +} diff --git a/blocks/CameraSource/CameraSource.js b/blocks/CameraSource/CameraSource.js index af01923aa..616baec9a 100644 --- a/blocks/CameraSource/CameraSource.js +++ b/blocks/CameraSource/CameraSource.js @@ -1,8 +1,8 @@ -import { UploaderBlock } from '../../abstract/UploaderBlock.js'; import { ActivityBlock } from '../../abstract/ActivityBlock.js'; +import { UploaderBlock } from '../../abstract/UploaderBlock.js'; +import { UploadSource } from '../utils/UploadSource.js'; import { canUsePermissionsApi } from '../utils/abilities.js'; import { debounce } from '../utils/debounce.js'; -import { UploadSource } from '../utils/UploadSource.js'; export class CameraSource extends UploaderBlock { couldBeCtxOwner = true; @@ -98,7 +98,7 @@ export class CameraSource extends UploaderBlock { async _subscribePermissions() { try { // @ts-ignore - let permissionsResponse = await navigator.permissions.query({ name: 'camera' }); + const permissionsResponse = await navigator.permissions.query({ name: 'camera' }); permissionsResponse.addEventListener('change', this._handlePermissionsChange); } catch (err) { console.log('Failed to use permissions API. Fallback to manual request mode.', err); @@ -108,7 +108,7 @@ export class CameraSource extends UploaderBlock { /** @private */ async _capture() { - let constr = { + const constr = { video: { width: { ideal: 1920, @@ -134,7 +134,7 @@ export class CameraSource extends UploaderBlock { try { this._setPermissionsState('prompt'); - let stream = await navigator.mediaDevices.getUserMedia(constr); + const stream = await navigator.mediaDevices.getUserMedia(constr); stream.addEventListener('inactive', () => { this._setPermissionsState('denied'); }); @@ -159,15 +159,15 @@ export class CameraSource extends UploaderBlock { /** @private */ _shot() { - this._canvas.height = this.ref.video['videoHeight']; - this._canvas.width = this.ref.video['videoWidth']; + this._canvas.height = this.ref.video.videoHeight; + this._canvas.width = this.ref.video.videoWidth; // @ts-ignore this._ctx.drawImage(this.ref.video, 0, 0); const date = Date.now(); const name = `camera-${date}.jpeg`; const format = 'image/jpeg'; this._canvas.toBlob((blob) => { - let file = new File([blob], name, { + const file = new File([blob], name, { lastModified: date, type: format, }); @@ -190,8 +190,8 @@ export class CameraSource extends UploaderBlock { }); try { - let deviceList = await navigator.mediaDevices.enumerateDevices(); - let cameraSelectOptions = deviceList + const deviceList = await navigator.mediaDevices.enumerateDevices(); + const cameraSelectOptions = deviceList .filter((info) => { return info.kind === 'videoinput'; }) diff --git a/blocks/CloudImageEditor/src/CloudImageEditorBlock.js b/blocks/CloudImageEditor/src/CloudImageEditorBlock.js index d00c60c2f..f9d93127a 100644 --- a/blocks/CloudImageEditor/src/CloudImageEditorBlock.js +++ b/blocks/CloudImageEditor/src/CloudImageEditorBlock.js @@ -154,7 +154,7 @@ export class CloudImageEditorBlock extends Block { }); this.sub('src', (src) => { - let el = this.ref['img-el']; + const el = this.ref['img-el']; if (el.src !== src) { this._imgLoading = true; el.src = src || TRANSPARENT_PIXEL_SRC; @@ -192,12 +192,12 @@ export class CloudImageEditorBlock extends Block { if (Object.keys(transformations).length === 0) { return; } - let originalUrl = this.$['*originalUrl']; - let cdnUrlModifiers = createCdnUrlModifiers(transformationsToOperations(transformations), 'preview'); - let cdnUrl = createCdnUrl(originalUrl, cdnUrlModifiers); + const originalUrl = this.$['*originalUrl']; + const cdnUrlModifiers = createCdnUrlModifiers(transformationsToOperations(transformations), 'preview'); + const cdnUrl = createCdnUrl(originalUrl, cdnUrlModifiers); /** @type {import('./types.js').ApplyResult} */ - let eventData = { + const eventData = { originalUrl, cdnUrlModifiers, cdnUrl, diff --git a/blocks/CloudImageEditor/src/CropFrame.js b/blocks/CloudImageEditor/src/CropFrame.js index 8b1f79842..6055be672 100644 --- a/blocks/CloudImageEditor/src/CropFrame.js +++ b/blocks/CloudImageEditor/src/CropFrame.js @@ -49,7 +49,7 @@ export class CropFrame extends Block { * @param {import('./types.js').Direction} direction */ _shouldThumbBeDisabled(direction) { - let imageBox = this.$['*imageBox']; + const imageBox = this.$['*imageBox']; if (!imageBox) { return; } @@ -58,30 +58,30 @@ export class CropFrame extends Block { return true; } - let tooHigh = imageBox.height <= MIN_CROP_SIZE && (direction.includes('n') || direction.includes('s')); - let tooWide = imageBox.width <= MIN_CROP_SIZE && (direction.includes('e') || direction.includes('w')); + const tooHigh = imageBox.height <= MIN_CROP_SIZE && (direction.includes('n') || direction.includes('s')); + const tooWide = imageBox.width <= MIN_CROP_SIZE && (direction.includes('e') || direction.includes('w')); return tooHigh || tooWide; } /** @private */ _createBackdrop() { /** @type {import('./types.js').Rectangle} */ - let cropBox = this.$['*cropBox']; + const cropBox = this.$['*cropBox']; if (!cropBox) { return; } - let { x, y, width, height } = cropBox; - let svg = this.ref['svg-el']; + const { x, y, width, height } = cropBox; + const svg = this.ref['svg-el']; - let mask = createSvgNode('mask', { id: 'backdrop-mask' }); - let maskRectOuter = createSvgNode('rect', { + const mask = createSvgNode('mask', { id: 'backdrop-mask' }); + const maskRectOuter = createSvgNode('rect', { x: 0, y: 0, width: '100%', height: '100%', fill: 'white', }); - let maskRectInner = createSvgNode('rect', { + const maskRectInner = createSvgNode('rect', { x, y, width, @@ -91,7 +91,7 @@ export class CropFrame extends Block { mask.appendChild(maskRectOuter); mask.appendChild(maskRectInner); - let backdropRect = createSvgNode('rect', { + const backdropRect = createSvgNode('rect', { x: 0, y: 0, width: '100%', @@ -126,11 +126,11 @@ export class CropFrame extends Block { /** @private */ _updateBackdrop() { /** @type {import('./types.js').Rectangle} */ - let cropBox = this.$['*cropBox']; + const cropBox = this.$['*cropBox']; if (!cropBox) { return; } - let { x, y, width, height } = cropBox; + const { x, y, width, height } = cropBox; this._backdropMaskInner && setSvgNodeAttrs(this._backdropMaskInner, { x, y, width, height }); } @@ -138,16 +138,16 @@ export class CropFrame extends Block { /** @private */ _updateFrame() { /** @type {import('./types.js').Rectangle} */ - let cropBox = this.$['*cropBox']; + const cropBox = this.$['*cropBox']; if (!cropBox || !this._frameGuides || !this._frameThumbs) { return; } - for (let thumb of Object.values(this._frameThumbs)) { - let { direction, pathNode, interactionNode, groupNode } = thumb; - let isCenter = direction === ''; - let isCorner = direction.length === 2; - let { x, y, width, height } = cropBox; + for (const thumb of Object.values(this._frameThumbs)) { + const { direction, pathNode, interactionNode, groupNode } = thumb; + const isCenter = direction === ''; + const isCorner = direction.length === 2; + const { x, y, width, height } = cropBox; if (isCenter) { const moveThumbRect = { @@ -164,7 +164,7 @@ export class CropFrame extends Block { 1, ); - let { d, center } = isCorner + const { d, center } = isCorner ? cornerPath(cropBox, direction, thumbSizeMultiplier) : sidePath( cropBox, @@ -184,7 +184,7 @@ export class CropFrame extends Block { setSvgNodeAttrs(pathNode, { d }); } - let disableThumb = this._shouldThumbBeDisabled(direction); + const disableThumb = this._shouldThumbBeDisabled(direction); groupNode.setAttribute( 'class', classNames('thumb', { @@ -218,14 +218,14 @@ export class CropFrame extends Block { for (let i = 0; i < 3; i++) { for (let j = 0; j < 3; j++) { - let direction = /** @type {import('./types.js').Direction} */ (`${['n', '', 's'][i]}${['w', '', 'e'][j]}`); - let groupNode = createSvgNode('g'); + const direction = /** @type {import('./types.js').Direction} */ (`${['n', '', 's'][i]}${['w', '', 'e'][j]}`); + const groupNode = createSvgNode('g'); groupNode.classList.add('thumb'); groupNode.setAttribute('with-effects', ''); - let interactionNode = createSvgNode('rect', { + const interactionNode = createSvgNode('rect', { fill: 'transparent', }); - let pathNode = createSvgNode('path', { + const pathNode = createSvgNode('path', { stroke: 'currentColor', fill: 'none', 'stroke-width': THUMB_STROKE_WIDTH, @@ -248,9 +248,9 @@ export class CropFrame extends Block { /** @private */ _createGuides() { - let svg = createSvgNode('svg'); + const svg = createSvgNode('svg'); - let rect = createSvgNode('rect', { + const rect = createSvgNode('rect', { x: 0, y: 0, width: '100%', @@ -263,11 +263,11 @@ export class CropFrame extends Block { svg.appendChild(rect); for (let i = 1; i <= 2; i++) { - let line = createSvgNode('line', { + const line = createSvgNode('line', { x1: `${GUIDE_THIRD * i}%`, - y1: `0%`, + y1: '0%', x2: `${GUIDE_THIRD * i}%`, - y2: `100%`, + y2: '100%', stroke: 'currentColor', 'stroke-width': GUIDE_STROKE_WIDTH, 'stroke-opacity': 0.3, @@ -276,10 +276,10 @@ export class CropFrame extends Block { } for (let i = 1; i <= 2; i++) { - let line = createSvgNode('line', { - x1: `0%`, + const line = createSvgNode('line', { + x1: '0%', y1: `${GUIDE_THIRD * i}%`, - x2: `100%`, + x2: '100%', y2: `${GUIDE_THIRD * i}%`, stroke: 'currentColor', 'stroke-width': GUIDE_STROKE_WIDTH, @@ -295,14 +295,14 @@ export class CropFrame extends Block { /** @private */ _createFrame() { - let svg = this.ref['svg-el']; - let fr = document.createDocumentFragment(); + const svg = this.ref['svg-el']; + const fr = document.createDocumentFragment(); - let frameGuides = this._createGuides(); + const frameGuides = this._createGuides(); fr.appendChild(frameGuides); - let frameThumbs = this._createThumbs(); - for (let { groupNode } of Object.values(frameThumbs)) { + const frameThumbs = this._createThumbs(); + for (const { groupNode } of Object.values(frameThumbs)) { fr.appendChild(groupNode); } @@ -318,15 +318,15 @@ export class CropFrame extends Block { */ _handlePointerDown(direction, e) { if (!this._frameThumbs) return; - let thumb = this._frameThumbs[direction]; + const thumb = this._frameThumbs[direction]; if (this._shouldThumbBeDisabled(direction)) { return; } - let cropBox = this.$['*cropBox']; - let { x: svgX, y: svgY } = this.ref['svg-el'].getBoundingClientRect(); - let x = e.x - svgX; - let y = e.y - svgY; + const cropBox = this.$['*cropBox']; + const { x: svgX, y: svgY } = this.ref['svg-el'].getBoundingClientRect(); + const x = e.x - svgX; + const y = e.y - svgY; this.$.dragging = true; this._draggingThumb = thumb; @@ -362,13 +362,13 @@ export class CropFrame extends Block { e.stopPropagation(); e.preventDefault(); - let svg = this.ref['svg-el']; - let { x: svgX, y: svgY } = svg.getBoundingClientRect(); - let x = e.x - svgX; - let y = e.y - svgY; - let dx = x - this._dragStartPoint[0]; - let dy = y - this._dragStartPoint[1]; - let { direction } = this._draggingThumb; + const svg = this.ref['svg-el']; + const { x: svgX, y: svgY } = svg.getBoundingClientRect(); + const x = e.x - svgX; + const y = e.y - svgY; + const dx = x - this._dragStartPoint[0]; + const dy = y - this._dragStartPoint[1]; + const { direction } = this._draggingThumb; const movedCropBox = this._calcCropBox(direction, [dx, dy]); if (movedCropBox) { @@ -384,7 +384,7 @@ export class CropFrame extends Block { _calcCropBox(direction, delta) { const [dx, dy] = delta; /** @type {import('./types.js').Rectangle} */ - let imageBox = this.$['*imageBox']; + const imageBox = this.$['*imageBox']; let rect = /** @type {import('./types.js').Rectangle} */ (this._dragStartCrop) ?? this.$['*cropBox']; /** @type {import('./types.js').CropPresetList[0]} */ const cropPreset = this.$['*cropPresetList']?.[0]; @@ -412,19 +412,19 @@ export class CropFrame extends Block { _handleSvgPointerMove_(e) { if (!this._frameThumbs) return; - let hoverThumb = Object.values(this._frameThumbs).find((thumb) => { + const hoverThumb = Object.values(this._frameThumbs).find((thumb) => { if (this._shouldThumbBeDisabled(thumb.direction)) { return false; } - let node = thumb.interactionNode; - let bounds = node.getBoundingClientRect(); - let rect = { + const node = thumb.interactionNode; + const bounds = node.getBoundingClientRect(); + const rect = { x: bounds.x, y: bounds.y, width: bounds.width, height: bounds.height, }; - let hover = rectContainsPoint(rect, [e.x, e.y]); + const hover = rectContainsPoint(rect, [e.x, e.y]); return hover; }); @@ -434,7 +434,7 @@ export class CropFrame extends Block { /** @private */ _updateCursor() { - let hoverThumb = this._hoverThumb; + const hoverThumb = this._hoverThumb; this.ref['svg-el'].style.cursor = hoverThumb ? thumbCursor(hoverThumb.direction) : 'initial'; } @@ -447,17 +447,17 @@ export class CropFrame extends Block { /** @param {boolean} visible */ toggleThumbs(visible) { if (!this._frameThumbs) return; - Object.values(this._frameThumbs) - .map(({ groupNode }) => groupNode) - .forEach((groupNode) => { - groupNode.setAttribute( - 'class', - classNames('thumb', { - 'thumb--hidden': !visible, - 'thumb--visible': visible, - }), - ); - }); + + for (const thumb of Object.values(this._frameThumbs)) { + const { groupNode } = thumb; + groupNode.setAttribute( + 'class', + classNames('thumb', { + 'thumb--hidden': !visible, + 'thumb--visible': visible, + }), + ); + } } initCallback() { diff --git a/blocks/CloudImageEditor/src/EditorButtonControl.js b/blocks/CloudImageEditor/src/EditorButtonControl.js index 3dd6b66cc..9571dc29d 100644 --- a/blocks/CloudImageEditor/src/EditorButtonControl.js +++ b/blocks/CloudImageEditor/src/EditorButtonControl.js @@ -1,5 +1,5 @@ -import { classNames } from './lib/classNames.js'; import { Block } from '../../../abstract/Block.js'; +import { classNames } from './lib/classNames.js'; export class EditorButtonControl extends Block { init$ = { @@ -17,7 +17,7 @@ export class EditorButtonControl extends Block { this._iconEl = this.ref['icon-el']; this.sub('title', (title) => { - let titleEl = this._titleEl; + const titleEl = this._titleEl; if (titleEl) { this._titleEl.style.display = title ? 'block' : 'none'; } diff --git a/blocks/CloudImageEditor/src/EditorCropButtonControl.js b/blocks/CloudImageEditor/src/EditorCropButtonControl.js index 22767ae95..63ffac021 100644 --- a/blocks/CloudImageEditor/src/EditorCropButtonControl.js +++ b/blocks/CloudImageEditor/src/EditorCropButtonControl.js @@ -27,12 +27,12 @@ export class EditorCropButtonControl extends EditorButtonControl { /** @private */ this._operation = operation; - this.$['icon'] = operation; + this.$.icon = operation; }); this.$['on.click'] = (e) => { - let prev = this.$['*cropperEl'].getValue(this._operation); - let next = nextValue(this._operation, prev); + const prev = this.$['*cropperEl'].getValue(this._operation); + const next = nextValue(this._operation, prev); this.$['*cropperEl'].setValue(this._operation, next); }; } diff --git a/blocks/CloudImageEditor/src/EditorFilterControl.js b/blocks/CloudImageEditor/src/EditorFilterControl.js index 2a8e92e97..4ec49e3f0 100644 --- a/blocks/CloudImageEditor/src/EditorFilterControl.js +++ b/blocks/CloudImageEditor/src/EditorFilterControl.js @@ -1,8 +1,8 @@ import { createCdnUrl, createCdnUrlModifiers } from '../../../utils/cdn-utils.js'; import { EditorButtonControl } from './EditorButtonControl.js'; import { FAKE_ORIGINAL_FILTER } from './EditorSlider.js'; -import { COMMON_OPERATIONS, transformationsToOperations } from './lib/transformationUtils.js'; import { preloadImage } from './lib/preloadImage.js'; +import { COMMON_OPERATIONS, transformationsToOperations } from './lib/transformationUtils.js'; export class EditorFilterControl extends EditorButtonControl { init$ = { @@ -16,14 +16,14 @@ export class EditorFilterControl extends EditorButtonControl { }; _previewSrc() { - let previewSize = parseInt(window.getComputedStyle(this).getPropertyValue('--l-base-min-width'), 10); - let dpr = window.devicePixelRatio; - let size = Math.ceil(dpr * previewSize); - let quality = dpr >= 2 ? 'lightest' : 'normal'; - let filterValue = 100; + const previewSize = Number.parseInt(window.getComputedStyle(this).getPropertyValue('--l-base-min-width'), 10); + const dpr = window.devicePixelRatio; + const size = Math.ceil(dpr * previewSize); + const quality = dpr >= 2 ? 'lightest' : 'normal'; + const filterValue = 100; /** @type {import('./types.js').Transformations} */ - let transformations = { ...this.$['*editorTransformations'] }; + const transformations = { ...this.$['*editorTransformations'] }; transformations[this._operation] = this._filter !== FAKE_ORIGINAL_FILTER ? { @@ -48,11 +48,11 @@ export class EditorFilterControl extends EditorButtonControl { * @param {IntersectionObserver} observer */ _observerCallback(entries, observer) { - let intersectionEntry = entries[0]; + const intersectionEntry = entries[0]; if (intersectionEntry.isIntersecting) { - let src = this.proxyUrl(this._previewSrc()); - let previewEl = this.ref['preview-el']; - let { promise, cancel } = preloadImage(src); + const src = this.proxyUrl(this._previewSrc()); + const previewEl = this.ref['preview-el']; + const { promise, cancel } = preloadImage(src); this._cancelPreload = cancel; promise .catch((err) => { @@ -66,7 +66,7 @@ export class EditorFilterControl extends EditorButtonControl { observer.unobserve(this); }); } else { - this._cancelPreload && this._cancelPreload(); + this._cancelPreload?.(); } } @@ -96,7 +96,7 @@ export class EditorFilterControl extends EditorButtonControl { threshold: [0, 1], }); - let originalUrl = this.$['*originalUrl']; + const originalUrl = this.$['*originalUrl']; this._originalUrl = originalUrl; if (this.$.isOriginal) { @@ -117,10 +117,10 @@ export class EditorFilterControl extends EditorButtonControl { if (this.$.isOriginal) { return; } - let iconEl = this.ref['icon-el']; + const iconEl = this.ref['icon-el']; iconEl.style.opacity = active ? '1' : '0'; - let previewEl = this.ref['preview-el']; + const previewEl = this.ref['preview-el']; if (active) { previewEl.style.opacity = '0'; } else if (previewEl.style.backgroundImage) { @@ -130,8 +130,8 @@ export class EditorFilterControl extends EditorButtonControl { this.sub('*networkProblems', (networkProblems) => { if (!networkProblems) { - let src = this.proxyUrl(this._previewSrc()); - let previewEl = this.ref['preview-el']; + const src = this.proxyUrl(this._previewSrc()); + const previewEl = this.ref['preview-el']; if (previewEl.style.backgroundImage) { previewEl.style.backgroundImage = 'none'; previewEl.style.backgroundImage = `url(${src})`; @@ -143,7 +143,7 @@ export class EditorFilterControl extends EditorButtonControl { destroyCallback() { super.destroyCallback(); this._observer?.disconnect(); - this._cancelPreload && this._cancelPreload(); + this._cancelPreload?.(); } } diff --git a/blocks/CloudImageEditor/src/EditorImageCropper.js b/blocks/CloudImageEditor/src/EditorImageCropper.js index 37f4bad0a..daedb9684 100644 --- a/blocks/CloudImageEditor/src/EditorImageCropper.js +++ b/blocks/CloudImageEditor/src/EditorImageCropper.js @@ -33,7 +33,7 @@ function validateCrop(crop) { return true; } /** @type {((arg: NonNullable) => boolean)[]} */ - let shouldMatch = [ + const shouldMatch = [ ({ dimensions, coords }) => [...dimensions, ...coords].every((number) => Number.isInteger(number) && Number.isFinite(number)), ({ dimensions, coords }) => dimensions.every((d) => d > 0) && coords.every((c) => c >= 0), @@ -95,21 +95,21 @@ export class EditorImageCropper extends Block { /** @private */ _syncTransformations() { - let transformations = this.$['*editorTransformations']; - let pickedTransformations = pick(transformations, Object.keys(this.$['*operations'])); - let operations = { ...this.$['*operations'], ...pickedTransformations }; + const transformations = this.$['*editorTransformations']; + const pickedTransformations = pick(transformations, Object.keys(this.$['*operations'])); + const operations = { ...this.$['*operations'], ...pickedTransformations }; this.$['*operations'] = operations; } /** @private */ _initCanvas() { /** @type {HTMLCanvasElement} */ - let canvas = this.ref['canvas-el']; - let ctx = canvas.getContext('2d'); + const canvas = this.ref['canvas-el']; + const ctx = canvas.getContext('2d'); - let width = this.offsetWidth; - let height = this.offsetHeight; - let dpr = window.devicePixelRatio; + const width = this.offsetWidth; + const height = this.offsetHeight; + const dpr = window.devicePixelRatio; canvas.style.width = `${width}px`; canvas.style.height = `${height}px`; canvas.width = width * dpr; @@ -126,36 +126,36 @@ export class EditorImageCropper extends Block { return; } - let image = this.$.image; - let padding = this.$['*padding']; - let operations = this.$['*operations']; - let { rotate } = operations; + const image = this.$.image; + const padding = this.$['*padding']; + const operations = this.$['*operations']; + const { rotate } = operations; - let bounds = { width: this.offsetWidth, height: this.offsetHeight }; - let naturalSize = rotateSize({ width: image.naturalWidth, height: image.naturalHeight }, rotate); + const bounds = { width: this.offsetWidth, height: this.offsetHeight }; + const naturalSize = rotateSize({ width: image.naturalWidth, height: image.naturalHeight }, rotate); let imageBox; if (naturalSize.width > bounds.width - padding * 2 || naturalSize.height > bounds.height - padding * 2) { - let imageAspectRatio = naturalSize.width / naturalSize.height; - let viewportAspectRatio = bounds.width / bounds.height; + const imageAspectRatio = naturalSize.width / naturalSize.height; + const viewportAspectRatio = bounds.width / bounds.height; if (imageAspectRatio > viewportAspectRatio) { - let width = bounds.width - padding * 2; - let height = width / imageAspectRatio; - let x = 0 + padding; - let y = padding + (bounds.height - padding * 2) / 2 - height / 2; + const width = bounds.width - padding * 2; + const height = width / imageAspectRatio; + const x = 0 + padding; + const y = padding + (bounds.height - padding * 2) / 2 - height / 2; imageBox = { x, y, width, height }; } else { - let height = bounds.height - padding * 2; - let width = height * imageAspectRatio; - let x = padding + (bounds.width - padding * 2) / 2 - width / 2; - let y = 0 + padding; + const height = bounds.height - padding * 2; + const width = height * imageAspectRatio; + const x = padding + (bounds.width - padding * 2) / 2 - width / 2; + const y = 0 + padding; imageBox = { x, y, width, height }; } } else { - let { width, height } = naturalSize; - let x = padding + (bounds.width - padding * 2) / 2 - width / 2; - let y = padding + (bounds.height - padding * 2) / 2 - height / 2; + const { width, height } = naturalSize; + const x = padding + (bounds.width - padding * 2) / 2 - width / 2; + const y = padding + (bounds.height - padding * 2) / 2 - height / 2; imageBox = { x, y, width, height }; } @@ -165,19 +165,19 @@ export class EditorImageCropper extends Block { /** @private */ _alignCrop() { let cropBox = this.$['*cropBox']; - let imageBox = this.$['*imageBox']; - let operations = this.$['*operations']; - let { rotate } = operations; - let cropTransformation = this.$['*editorTransformations']['crop']; - let { width: previewWidth, x: previewX, y: previewY } = this.$['*imageBox']; + const imageBox = this.$['*imageBox']; + const operations = this.$['*operations']; + const { rotate } = operations; + const cropTransformation = this.$['*editorTransformations'].crop; + const { width: previewWidth, x: previewX, y: previewY } = this.$['*imageBox']; if (cropTransformation) { - let { + const { dimensions: [width, height], coords: [x, y], } = cropTransformation; - let { width: sourceWidth } = rotateSize(this._imageSize, rotate); - let ratio = previewWidth / sourceWidth; + const { width: sourceWidth } = rotateSize(this._imageSize, rotate); + const ratio = previewWidth / sourceWidth; cropBox = constraintRect( roundRect({ x: previewX + x * ratio, @@ -220,13 +220,13 @@ export class EditorImageCropper extends Block { /** @private */ _drawImage() { - let ctx = this._ctx; + const ctx = this._ctx; if (!ctx) return; - let image = this.$.image; - let imageBox = this.$['*imageBox']; - let operations = this.$['*operations']; - let { mirror, flip, rotate } = operations; - let rotated = rotateSize({ width: imageBox.width, height: imageBox.height }, rotate); + const image = this.$.image; + const imageBox = this.$['*imageBox']; + const operations = this.$['*operations']; + const { mirror, flip, rotate } = operations; + const rotated = rotateSize({ width: imageBox.width, height: imageBox.height }, rotate); ctx.save(); ctx.translate(imageBox.x + imageBox.width / 2, imageBox.y + imageBox.height / 2); ctx.rotate((rotate * Math.PI * -1) / 180); @@ -240,8 +240,8 @@ export class EditorImageCropper extends Block { if (!this._isActive || !this.$.image || !this._canvas || !this._ctx) { return; } - let canvas = this._canvas; - let ctx = this._ctx; + const canvas = this._canvas; + const ctx = this._ctx; ctx.clearRect(0, 0, canvas.width, canvas.height); @@ -271,18 +271,18 @@ export class EditorImageCropper extends Block { * @returns {NonNullable['dimensions']} */ _getCropDimensions() { - let cropBox = this.$['*cropBox']; - let imageBox = this.$['*imageBox']; - let operations = this.$['*operations']; - let { rotate } = operations; - let { width: previewWidth, height: previewHeight } = imageBox; - let { width: sourceWidth, height: sourceHeight } = rotateSize(this._imageSize, rotate); - let { width: cropWidth, height: cropHeight } = cropBox; - let ratioW = previewWidth / sourceWidth; - let ratioH = previewHeight / sourceHeight; + const cropBox = this.$['*cropBox']; + const imageBox = this.$['*imageBox']; + const operations = this.$['*operations']; + const { rotate } = operations; + const { width: previewWidth, height: previewHeight } = imageBox; + const { width: sourceWidth, height: sourceHeight } = rotateSize(this._imageSize, rotate); + const { width: cropWidth, height: cropHeight } = cropBox; + const ratioW = previewWidth / sourceWidth; + const ratioH = previewHeight / sourceHeight; /** @type {[Number, Number]} */ - let dimensions = [ + const dimensions = [ clamp(Math.round(cropWidth / ratioW), 1, sourceWidth), clamp(Math.round(cropHeight / ratioH), 1, sourceHeight), ]; @@ -295,18 +295,18 @@ export class EditorImageCropper extends Block { * @returns {import('./types.js').Transformations['crop']} */ _getCropTransformation() { - let cropBox = this.$['*cropBox']; - let imageBox = this.$['*imageBox']; - let operations = this.$['*operations']; - let { rotate } = operations; - let { width: previewWidth, height: previewHeight, x: previewX, y: previewY } = imageBox; - let { width: sourceWidth, height: sourceHeight } = rotateSize(this._imageSize, rotate); - let { x: cropX, y: cropY } = cropBox; - let ratioW = previewWidth / sourceWidth; - let ratioH = previewHeight / sourceHeight; - - let dimensions = this._getCropDimensions(); - let crop = { + const cropBox = this.$['*cropBox']; + const imageBox = this.$['*imageBox']; + const operations = this.$['*operations']; + const { rotate } = operations; + const { width: previewWidth, height: previewHeight, x: previewX, y: previewY } = imageBox; + const { width: sourceWidth, height: sourceHeight } = rotateSize(this._imageSize, rotate); + const { x: cropX, y: cropY } = cropBox; + const ratioW = previewWidth / sourceWidth; + const ratioH = previewHeight / sourceHeight; + + const dimensions = this._getCropDimensions(); + const crop = { dimensions, coords: /** @type {[Number, Number]} */ ([ clamp(Math.round((cropX - previewX) / ratioW), 0, sourceWidth - dimensions[0]), @@ -331,12 +331,12 @@ export class EditorImageCropper extends Block { if (!this.isConnected || !this._imageSize) { return; } - let operations = this.$['*operations']; - let { rotate, mirror, flip } = operations; - let crop = this._getCropTransformation(); + const operations = this.$['*operations']; + const { rotate, mirror, flip } = operations; + const crop = this._getCropTransformation(); /** @type {import('./types.js').Transformations} */ - let editorTransformations = this.$['*editorTransformations']; - let transformations = { + const editorTransformations = this.$['*editorTransformations']; + const transformations = { ...editorTransformations, crop, rotate, @@ -425,12 +425,12 @@ export class EditorImageCropper extends Block { /** @private */ _transitionToCrop() { - let dimensions = this._getCropDimensions(); - let scaleX = Math.min(this.offsetWidth, dimensions[0]) / this.$['*cropBox'].width; - let scaleY = Math.min(this.offsetHeight, dimensions[1]) / this.$['*cropBox'].height; - let scale = Math.min(scaleX, scaleY); - let cropCenterX = this.$['*cropBox'].x + this.$['*cropBox'].width / 2; - let cropCenterY = this.$['*cropBox'].y + this.$['*cropBox'].height / 2; + const dimensions = this._getCropDimensions(); + const scaleX = Math.min(this.offsetWidth, dimensions[0]) / this.$['*cropBox'].width; + const scaleY = Math.min(this.offsetHeight, dimensions[1]) / this.$['*cropBox'].height; + const scale = Math.min(scaleX, scaleY); + const cropCenterX = this.$['*cropBox'].x + this.$['*cropBox'].width / 2; + const cropCenterY = this.$['*cropBox'].y + this.$['*cropBox'].height / 2; this.style.transform = `scale(${scale}) translate(${(this.offsetWidth / 2 - cropCenterX) / scale}px, ${ (this.offsetHeight / 2 - cropCenterY) / scale @@ -440,10 +440,10 @@ export class EditorImageCropper extends Block { /** @private */ _transitionToImage() { - let cropCenterX = this.$['*cropBox'].x + this.$['*cropBox'].width / 2; - let cropCenterY = this.$['*cropBox'].y + this.$['*cropBox'].height / 2; + const cropCenterX = this.$['*cropBox'].x + this.$['*cropBox'].width / 2; + const cropCenterY = this.$['*cropBox'].y + this.$['*cropBox'].height / 2; - this.style.transform = `scale(1)`; + this.style.transform = 'scale(1)'; this.style.transformOrigin = `${cropCenterX}px ${cropCenterY}px`; } @@ -462,21 +462,21 @@ export class EditorImageCropper extends Block { * @returns {Promise} */ _waitForImage(originalUrl, transformations) { - let width = this.offsetWidth; - transformations = { + const width = this.offsetWidth; + const appendedTransformations = { ...transformations, crop: undefined, rotate: undefined, flip: undefined, mirror: undefined, }; - let src = this.proxyUrl(viewerImageSrc(originalUrl, width, transformations)); - let { promise, cancel, image } = preloadImage(src); + const src = this.proxyUrl(viewerImageSrc(originalUrl, width, appendedTransformations)); + const { promise, cancel, image } = preloadImage(src); - let stop = this._handleImageLoading(src); + const stop = this._handleImageLoading(src); image.addEventListener('load', stop, { once: true }); image.addEventListener('error', stop, { once: true }); - this._cancelPreload && this._cancelPreload(); + this._cancelPreload?.(); this._cancelPreload = cancel; return promise @@ -494,8 +494,8 @@ export class EditorImageCropper extends Block { * @returns {() => void} Destructor */ _handleImageLoading(src) { - let operation = 'crop'; - let loadingOperations = this.$['*loadingOperations']; + const operation = 'crop'; + const loadingOperations = this.$['*loadingOperations']; if (!loadingOperations.get(operation)) { loadingOperations.set(operation, new Map()); } diff --git a/blocks/CloudImageEditor/src/EditorImageFader.js b/blocks/CloudImageEditor/src/EditorImageFader.js index 4148169e7..5d543e21c 100644 --- a/blocks/CloudImageEditor/src/EditorImageFader.js +++ b/blocks/CloudImageEditor/src/EditorImageFader.js @@ -1,5 +1,5 @@ -import { debounce } from '../../utils/debounce.js'; import { Block } from '../../../abstract/Block.js'; +import { debounce } from '../../utils/debounce.js'; import { classNames } from './lib/classNames.js'; import { linspace } from './lib/linspace.js'; import { batchPreloadImages } from './lib/preloadImage.js'; @@ -11,10 +11,13 @@ import { viewerImageSrc } from './util.js'; * @returns {[Number, Number][]} */ function splitBySections(numbers) { - return numbers.reduce( - (acc, point, idx) => (idx < numbers.length - 1 ? [...acc, [point, numbers[idx + 1]]] : acc), - [], - ); + return numbers.reduce((acc, point, idx) => { + if (idx < numbers.length - 1) { + acc.push([point, numbers[idx + 1]]); + return acc; + } + return acc; + }, []); } /** @@ -23,10 +26,10 @@ function splitBySections(numbers) { * @param {Number} zero */ function calculateOpacities(keypoints, value, zero) { - let section = splitBySections(keypoints).find(([left, right]) => left <= value && value <= right); + const section = splitBySections(keypoints).find(([left, right]) => left <= value && value <= right); return keypoints.map((point) => { - let distance = Math.abs(section[0] - section[1]); - let relation = Math.abs(value - section[0]) / distance; + const distance = Math.abs(section[0] - section[1]); + const relation = Math.abs(value - section[0]) / distance; if (section[0] === point) { return value > zero ? 1 : 1 - relation; @@ -52,8 +55,8 @@ function calculateZIndices(keypoints, zero) { * @returns {Number[]} */ function keypointsRange(operation, value) { - let n = COLOR_OPERATIONS_CONFIG[operation].keypointsNumber; - let { range, zero } = COLOR_OPERATIONS_CONFIG[operation]; + const n = COLOR_OPERATIONS_CONFIG[operation].keypointsNumber; + const { range, zero } = COLOR_OPERATIONS_CONFIG[operation]; return [...new Set([...linspace(range[0], zero, n + 1), ...linspace(zero, range[1], n + 1), zero, value])].sort( (a, b) => a - b, @@ -97,9 +100,9 @@ export class EditorImageFader extends Block { * @returns {() => void} Destructor */ _handleImageLoading(src) { - let operation = this._operation; + const operation = this._operation; - let loadingOperations = this.$['*loadingOperations']; + const loadingOperations = this.$['*loadingOperations']; if (!loadingOperations.get(operation)) { loadingOperations.set(operation, new Map()); } @@ -121,8 +124,8 @@ export class EditorImageFader extends Block { _flush() { window.cancelAnimationFrame(this._raf); this._raf = window.requestAnimationFrame(() => { - for (let kp of this._keypoints) { - let { image } = kp; + for (const kp of this._keypoints) { + const { image } = kp; if (image) { image.style.opacity = kp.opacity.toString(); image.style.zIndex = kp.zIndex.toString(); @@ -141,14 +144,14 @@ export class EditorImageFader extends Block { * @returns {String} */ _imageSrc({ url = this._url, filter = this._filter, operation, value } = {}) { - let transformations = { ...this._transformations }; + const transformations = { ...this._transformations }; if (operation) { transformations[operation] = filter ? { name: filter, amount: value } : value; } // do not use getBoundingClientRect because scale transform affects it - let width = this.offsetWidth; + const width = this.offsetWidth; return this.proxyUrl(viewerImageSrc(url, width, transformations)); } @@ -159,7 +162,7 @@ export class EditorImageFader extends Block { * @returns {Keypoint} */ _constructKeypoint(operation, value) { - let src = this._imageSrc({ operation, value }); + const src = this._imageSrc({ operation, value }); return { src, image: null, @@ -188,16 +191,16 @@ export class EditorImageFader extends Block { * @param {Number} value */ _addKeypoint(operation, filter, value) { - let shouldSkip = () => + const shouldSkip = () => !this._isSame(operation, filter) || this._value !== value || !!this._keypoints.find((kp) => kp.value === value); if (shouldSkip()) { return; } - let keypoint = this._constructKeypoint(operation, value); - let image = new Image(); + const keypoint = this._constructKeypoint(operation, value); + const image = new Image(); image.src = keypoint.src; - let stop = this._handleImageLoading(keypoint.src); + const stop = this._handleImageLoading(keypoint.src); image.addEventListener('load', stop, { once: true }); image.addEventListener('error', stop, { once: true }); keypoint.image = image; @@ -209,9 +212,9 @@ export class EditorImageFader extends Block { if (shouldSkip()) { return; } - let keypoints = this._keypoints; - let idx = keypoints.findIndex((kp) => kp.value > value); - let insertBeforeNode = idx < keypoints.length ? keypoints[idx].image : null; + const keypoints = this._keypoints; + const idx = keypoints.findIndex((kp) => kp.value > value); + const insertBeforeNode = idx < keypoints.length ? keypoints[idx].image : null; if (!this._container || (insertBeforeNode && !this._container.contains(insertBeforeNode))) { return; } @@ -233,9 +236,9 @@ export class EditorImageFader extends Block { /** @param {String | Number} value */ set(value) { - value = typeof value === 'string' ? parseInt(value, 10) : value; - this._update(this._operation, value); - this._addKeypointDebounced(this._operation, this._filter, value); + const normalizedValue = typeof value === 'string' ? Number.parseInt(value, 10) : value; + this._update(this._operation, normalizedValue); + this._addKeypointDebounced(this._operation, this._filter, normalizedValue); } /** @@ -247,13 +250,13 @@ export class EditorImageFader extends Block { this._operation = operation; this._value = value; - let { zero } = COLOR_OPERATIONS_CONFIG[operation]; + const { zero } = COLOR_OPERATIONS_CONFIG[operation]; - let keypointValues = this._keypoints.map((kp) => kp.value); - let opacities = calculateOpacities(keypointValues, value, zero); - let zIndices = calculateZIndices(keypointValues, zero); + const keypointValues = this._keypoints.map((kp) => kp.value); + const opacities = calculateOpacities(keypointValues, value, zero); + const zIndices = calculateZIndices(keypointValues, zero); - for (let [idx, kp] of Object.entries(this._keypoints)) { + for (const [idx, kp] of Object.entries(this._keypoints)) { kp.opacity = opacities[idx]; kp.zIndex = zIndices[idx]; } @@ -263,7 +266,7 @@ export class EditorImageFader extends Block { /** @private */ _createPreviewImage() { - let image = new Image(); + const image = new Image(); image.classList.add('fader-image', 'fader-image--preview'); image.style.opacity = '0'; return image; @@ -271,33 +274,33 @@ export class EditorImageFader extends Block { /** @private */ async _initNodes() { - let fr = document.createDocumentFragment(); + const fr = document.createDocumentFragment(); this._previewImage = this._previewImage || this._createPreviewImage(); !this.contains(this._previewImage) && fr.appendChild(this._previewImage); - let container = document.createElement('div'); + const container = document.createElement('div'); fr.appendChild(container); - let srcList = this._keypoints.map((kp) => kp.src); + const srcList = this._keypoints.map((kp) => kp.src); - let { images, promise, cancel } = batchPreloadImages(srcList); - images.forEach((node) => { - let stop = this._handleImageLoading(node.src); + const { images, promise, cancel } = batchPreloadImages(srcList); + for (const node of images) { + const stop = this._handleImageLoading(node.src); node.addEventListener('load', stop); node.addEventListener('error', stop); - }); + } this._cancelLastImages = () => { cancel(); this._cancelLastImages = undefined; }; - let operation = this._operation; - let filter = this._filter; + const operation = this._operation; + const filter = this._filter; await promise; if (this._isActive && this._isSame(operation, filter)) { - this._container && this._container.remove(); + this._container?.remove(); this._container = container; this._keypoints.forEach((kp, idx) => { - let kpImage = images[idx]; + const kpImage = images[idx]; kpImage.classList.add('fader-image'); kp.image = kpImage; this._container.appendChild(kpImage); @@ -311,8 +314,8 @@ export class EditorImageFader extends Block { setTransformations(transformations) { this._transformations = transformations; if (this._previewImage) { - let src = this._imageSrc(); - let stop = this._handleImageLoading(src); + const src = this._imageSrc(); + const stop = this._handleImageLoading(src); this._previewImage.src = src; this._previewImage.addEventListener('load', stop, { once: true }); this._previewImage.addEventListener('error', stop, { once: true }); @@ -336,18 +339,18 @@ export class EditorImageFader extends Block { * @param {String} [options.filter] */ preload({ url, filter, operation, value }) { - this._cancelBatchPreload && this._cancelBatchPreload(); + this._cancelBatchPreload?.(); - let keypoints = keypointsRange(operation, value); - let srcList = keypoints.map((kp) => this._imageSrc({ url, filter, operation, value: kp })); - let { cancel } = batchPreloadImages(srcList); + const keypoints = keypointsRange(operation, value); + const srcList = keypoints.map((kp) => this._imageSrc({ url, filter, operation, value: kp })); + const { cancel } = batchPreloadImages(srcList); this._cancelBatchPreload = cancel; } /** @private */ _setOriginalSrc(src) { - let image = this._previewImage || this._createPreviewImage(); + const image = this._previewImage || this._createPreviewImage(); !this.contains(image) && this.appendChild(image); this._previewImage = image; @@ -362,7 +365,7 @@ export class EditorImageFader extends Block { return; } image.style.opacity = '0'; - let stop = this._handleImageLoading(src); + const stop = this._handleImageLoading(src); image.addEventListener('error', stop, { once: true }); image.src = src; image.addEventListener( @@ -407,11 +410,11 @@ export class EditorImageFader extends Block { this._filter = filter; this._fromViewer = fromViewer; - let isOriginal = typeof value !== 'number' && !filter; + const isOriginal = typeof value !== 'number' && !filter; if (isOriginal) { - let src = this._imageSrc({ operation, value }); + const src = this._imageSrc({ operation, value }); this._setOriginalSrc(src); - this._container && this._container.remove(); + this._container?.remove(); return; } this._keypoints = keypointsRange(operation, value).map((keyValue) => this._constructKeypoint(operation, keyValue)); @@ -424,8 +427,8 @@ export class EditorImageFader extends Block { deactivate({ hide = true } = {}) { this._isActive = false; - this._cancelLastImages && this._cancelLastImages(); - this._cancelBatchPreload && this._cancelBatchPreload(); + this._cancelLastImages?.(); + this._cancelBatchPreload?.(); if (hide && !this._hidden) { this._hidden = true; @@ -440,12 +443,12 @@ export class EditorImageFader extends Block { this.addEventListener( 'transitionend', () => { - this._container && this._container.remove(); + this._container?.remove(); }, { once: true }, ); } else { - this._container && this._container.remove(); + this._container?.remove(); } } } diff --git a/blocks/CloudImageEditor/src/EditorOperationControl.js b/blocks/CloudImageEditor/src/EditorOperationControl.js index 91df9b282..1b72a4118 100644 --- a/blocks/CloudImageEditor/src/EditorOperationControl.js +++ b/blocks/CloudImageEditor/src/EditorOperationControl.js @@ -20,7 +20,7 @@ export class EditorOperationControl extends EditorButtonControl { this.defineAccessor('operation', (operation) => { if (operation) { this._operation = operation; - this.$['icon'] = operation; + this.$.icon = operation; this.bindL10n('title', () => this.l10n(operation)); } }); @@ -30,9 +30,9 @@ export class EditorOperationControl extends EditorButtonControl { return; } - let { zero } = COLOR_OPERATIONS_CONFIG[this._operation]; - let value = editorTransformations[this._operation]; - let isActive = typeof value !== 'undefined' ? value !== zero : false; + const { zero } = COLOR_OPERATIONS_CONFIG[this._operation]; + const value = editorTransformations[this._operation]; + const isActive = typeof value !== 'undefined' ? value !== zero : false; this.$.active = isActive; }); } diff --git a/blocks/CloudImageEditor/src/EditorScroller.js b/blocks/CloudImageEditor/src/EditorScroller.js index ccdb9f6c2..d2f3acda4 100644 --- a/blocks/CloudImageEditor/src/EditorScroller.js +++ b/blocks/CloudImageEditor/src/EditorScroller.js @@ -11,7 +11,7 @@ export class EditorScroller extends Block { (e) => { e.preventDefault(); - let { deltaY, deltaX } = e; + const { deltaY, deltaX } = e; if (Math.abs(deltaX) > X_THRESHOLD) { this.scrollLeft += deltaX; } else { @@ -30,4 +30,5 @@ export class EditorScroller extends Block { } } -EditorScroller.template = /* HTML */ ` `; +// biome-ignore lint/style/noUnusedTemplateLiteral: This is HTML template +EditorScroller.template = /* HTML */ ``; diff --git a/blocks/CloudImageEditor/src/EditorSlider.js b/blocks/CloudImageEditor/src/EditorSlider.js index 52c0dc2cc..a9f04f85f 100644 --- a/blocks/CloudImageEditor/src/EditorSlider.js +++ b/blocks/CloudImageEditor/src/EditorSlider.js @@ -47,25 +47,25 @@ export class EditorSlider extends Block { /** @private */ _initializeValues() { - let { range, zero } = COLOR_OPERATIONS_CONFIG[this._operation]; - let [min, max] = range; + const { range, zero } = COLOR_OPERATIONS_CONFIG[this._operation]; + const [min, max] = range; this.$.min = min; this.$.max = max; this.$.zero = zero; - let transformation = this.$['*editorTransformations'][this._operation]; + const transformation = this.$['*editorTransformations'][this._operation]; if (this._controlType === ControlType.FILTER) { let value = max; if (transformation) { - let { name, amount } = transformation; + const { name, amount } = transformation; value = name === this._filter ? amount : max; } this.$.value = value; this.$.defaultValue = value; } if (this._controlType === ControlType.COLOR_OPERATION) { - let value = typeof transformation !== 'undefined' ? transformation : zero; + const value = typeof transformation !== 'undefined' ? transformation : zero; this.$.value = value; this.$.defaultValue = value; } @@ -84,7 +84,7 @@ export class EditorSlider extends Block { } /** @type {import('./types.js').Transformations} */ - let transformations = { + const transformations = { ...this.$['*editorTransformations'], [this._operation]: operationValue, }; @@ -104,7 +104,7 @@ export class EditorSlider extends Block { }); this.sub('value', (value) => { - let tooltip = `${this._filter || this._operation} ${value}`; + const tooltip = `${this._filter || this._operation} ${value}`; this.$['*operationTooltip'] = tooltip; }); } diff --git a/blocks/CloudImageEditor/src/EditorToolbar.js b/blocks/CloudImageEditor/src/EditorToolbar.js index 6c946cb9c..2cb6662a5 100644 --- a/blocks/CloudImageEditor/src/EditorToolbar.js +++ b/blocks/CloudImageEditor/src/EditorToolbar.js @@ -1,6 +1,6 @@ // @ts-check -import { debounce } from '../../utils/debounce.js'; import { Block } from '../../../abstract/Block.js'; +import { debounce } from '../../utils/debounce.js'; import { EditorCropButtonControl } from './EditorCropButtonControl.js'; import { EditorFilterControl } from './EditorFilterControl.js'; import { EditorOperationControl } from './EditorOperationControl.js'; @@ -97,7 +97,7 @@ export class EditorToolbar extends Block { visible: 'tab-toggles--visible', }, 'on.cancel': () => { - this._cancelPreload && this._cancelPreload(); + this._cancelPreload?.(); this.$['*on.cancel'](); }, 'on.apply': () => { @@ -142,7 +142,7 @@ export class EditorToolbar extends Block { * @param {String} operation */ _createOperationControl(operation) { - let el = new EditorOperationControl(); + const el = new EditorOperationControl(); // @ts-expect-error TODO: fix el.operation = operation; return el; @@ -153,7 +153,7 @@ export class EditorToolbar extends Block { * @param {String} filter */ _createFilterControl(filter) { - let el = new EditorFilterControl(); + const el = new EditorFilterControl(); // @ts-expect-error TODO: fix el.filter = filter; return el; @@ -164,7 +164,7 @@ export class EditorToolbar extends Block { * @param {String} operation */ _createToggleControl(operation) { - let el = new EditorCropButtonControl(); + const el = new EditorCropButtonControl(); // @ts-expect-error TODO: fix el.operation = operation; return el; @@ -175,31 +175,26 @@ export class EditorToolbar extends Block { * @param {String} tabId */ _renderControlsList(tabId) { - let listEl = this.ref[`controls-list-${tabId}`]; - let fr = document.createDocumentFragment(); + const listEl = this.ref[`controls-list-${tabId}`]; + const fr = document.createDocumentFragment(); if (tabId === TabId.CROP) { - this.$.cropOperations.forEach( - /** @param {string} operation */ (operation) => { - let el = this._createToggleControl(operation); - // @ts-ignore - fr.appendChild(el); - }, - ); + this.$.cropOperations.forEach(); + for (const operation of /** @type {string[]} */ (this.$.cropOperations)) { + const el = this._createToggleControl(operation); + fr.appendChild(el); + } } else if (tabId === TabId.FILTERS) { - [FAKE_ORIGINAL_FILTER, ...this.$.filters].forEach((filterId) => { - let el = this._createFilterControl(filterId); - // @ts-ignore + for (const filterId of [FAKE_ORIGINAL_FILTER, ...this.$.filters]) { + const el = this._createFilterControl(filterId); fr.appendChild(el); - }); + } } else if (tabId === TabId.TUNING) { - this.$.colorOperations.forEach( - /** @param {string} operation */ (operation) => { - let el = this._createOperationControl(operation); - // @ts-ignore - fr.appendChild(el); - }, - ); + for (const operation of /** @type {string[]} */ (this.$.colorOperations)) { + const el = this._createOperationControl(operation); + // @ts-ignore + fr.appendChild(el); + } } [...fr.children].forEach((el, idx) => { @@ -228,10 +223,10 @@ export class EditorToolbar extends Block { this.$['*cropperEl'].deactivate(); } - for (let tabId of ALL_TABS) { - let isCurrentTab = tabId === id; + for (const tabId of ALL_TABS) { + const isCurrentTab = tabId === id; - let tabToggleEl = this.ref[`tab-toggle-${tabId}`]; + const tabToggleEl = this.ref[`tab-toggle-${tabId}`]; tabToggleEl.active = isCurrentTab; if (isCurrentTab) { @@ -249,7 +244,7 @@ export class EditorToolbar extends Block { * @param {String} tabId */ _unmountTabControls(tabId) { - let listEl = this.ref[`controls-list-${tabId}`]; + const listEl = this.ref[`controls-list-${tabId}`]; if (listEl) { listEl.innerHTML = ''; } @@ -257,18 +252,18 @@ export class EditorToolbar extends Block { /** @private */ _syncTabIndicator() { - let tabToggleEl = this.ref[`tab-toggle-${this.$['*tabId']}`]; - let indicatorEl = this.ref['tabs-indicator']; + const tabToggleEl = this.ref[`tab-toggle-${this.$['*tabId']}`]; + const indicatorEl = this.ref['tabs-indicator']; indicatorEl.style.transform = `translateX(${tabToggleEl.offsetLeft}px)`; } /** @private */ _preloadEditedImage() { if (this.$['*imgContainerEl'] && this.$['*originalUrl']) { - let width = this.$['*imgContainerEl'].offsetWidth; - let src = this.proxyUrl(viewerImageSrc(this.$['*originalUrl'], width, this.$['*editorTransformations'])); - this._cancelPreload && this._cancelPreload(); - let { cancel } = batchPreloadImages([src]); + const width = this.$['*imgContainerEl'].offsetWidth; + const src = this.proxyUrl(viewerImageSrc(this.$['*originalUrl'], width, this.$['*editorTransformations'])); + this._cancelPreload?.(); + const { cancel } = batchPreloadImages([src]); this._cancelPreload = () => { cancel(); this._cancelPreload = undefined; @@ -294,15 +289,15 @@ export class EditorToolbar extends Block { if (this.$['*tabId'] === TabId.FILTERS) { visible = true; if (this.$['*currentFilter'] && transformations?.filter?.name === this.$['*currentFilter']) { - let value = transformations?.filter?.amount || 100; - text = this.$['*currentFilter'] + ' ' + value; + const value = transformations?.filter?.amount || 100; + text = `${this.$['*currentFilter']} ${value}`; } else { text = this.l10n(FAKE_ORIGINAL_FILTER); } } else if (this.$['*tabId'] === TabId.TUNING && currentOperation) { visible = true; - let value = transformations?.[currentOperation] || COLOR_OPERATIONS_CONFIG[currentOperation].zero; - text = this.l10n(currentOperation) + ' ' + value; + const value = transformations?.[currentOperation] || COLOR_OPERATIONS_CONFIG[currentOperation].zero; + text = `${this.l10n(currentOperation)} ${value}`; } if (visible) { this.$['*operationTooltip'] = text; @@ -324,7 +319,7 @@ export class EditorToolbar extends Block { }); this.sub('*editorTransformations', (editorTransformations) => { - let appliedFilter = editorTransformations?.filter?.name; + const appliedFilter = editorTransformations?.filter?.name; if (this.$['*currentFilter'] !== appliedFilter) { this.$['*currentFilter'] = appliedFilter; } @@ -343,7 +338,7 @@ export class EditorToolbar extends Block { }); this.sub('*originalUrl', () => { - this.$['*faderEl'] && this.$['*faderEl'].deactivate(); + this.$['*faderEl']?.deactivate(); }); this.sub('*editorTransformations', (transformations) => { @@ -355,11 +350,11 @@ export class EditorToolbar extends Block { this.sub('*loadingOperations', (/** @type {import('./types.js').LoadingOperations} */ loadingOperations) => { let anyLoading = false; - for (let [, mapping] of loadingOperations.entries()) { + for (const [, mapping] of loadingOperations.entries()) { if (anyLoading) { break; } - for (let [, loading] of mapping.entries()) { + for (const [, loading] of mapping.entries()) { if (loading) { anyLoading = true; break; diff --git a/blocks/CloudImageEditor/src/crop-utils.js b/blocks/CloudImageEditor/src/crop-utils.js index 81b5239bc..b3c84a574 100644 --- a/blocks/CloudImageEditor/src/crop-utils.js +++ b/blocks/CloudImageEditor/src/crop-utils.js @@ -6,7 +6,7 @@ import { MIN_CROP_SIZE, THUMB_CORNER_SIZE, THUMB_OFFSET, THUMB_SIDE_SIZE } from * @param {{ [key: String]: String | Number }} attrs */ export function setSvgNodeAttrs(node, attrs) { - for (let p in attrs) node.setAttributeNS(null, p, attrs[p].toString()); + for (const p in attrs) node.setAttributeNS(null, p, attrs[p].toString()); } /** @@ -15,7 +15,7 @@ export function setSvgNodeAttrs(node, attrs) { * @returns {SVGElement} */ export function createSvgNode(name, attrs = {}) { - let node = document.createElementNS('http://www.w3.org/2000/svg', name); + const node = document.createElementNS('http://www.w3.org/2000/svg', name); setSvgNodeAttrs(node, attrs); return node; } @@ -26,25 +26,25 @@ export function createSvgNode(name, attrs = {}) { * @param {number} sizeMultiplier */ export function cornerPath(rect, direction, sizeMultiplier) { - let { x, y, width, height } = rect; + const { x, y, width, height } = rect; - let wMul = direction.includes('w') ? 0 : 1; - let hMul = direction.includes('n') ? 0 : 1; - let xSide = [-1, 1][wMul]; - let ySide = [-1, 1][hMul]; + const wMul = direction.includes('w') ? 0 : 1; + const hMul = direction.includes('n') ? 0 : 1; + const xSide = [-1, 1][wMul]; + const ySide = [-1, 1][hMul]; - let p1 = [ + const p1 = [ x + wMul * width + THUMB_OFFSET * xSide, y + hMul * height + THUMB_OFFSET * ySide - THUMB_CORNER_SIZE * sizeMultiplier * ySide, ]; - let p2 = [x + wMul * width + THUMB_OFFSET * xSide, y + hMul * height + THUMB_OFFSET * ySide]; - let p3 = [ + const p2 = [x + wMul * width + THUMB_OFFSET * xSide, y + hMul * height + THUMB_OFFSET * ySide]; + const p3 = [ x + wMul * width - THUMB_CORNER_SIZE * sizeMultiplier * xSide + THUMB_OFFSET * xSide, y + hMul * height + THUMB_OFFSET * ySide, ]; - let path = `M ${p1[0]} ${p1[1]} L ${p2[0]} ${p2[1]} L ${p3[0]} ${p3[1]}`; - let center = p2; + const path = `M ${p1[0]} ${p1[1]} L ${p2[0]} ${p2[1]} L ${p3[0]} ${p3[1]}`; + const center = p2; return { d: path, @@ -58,18 +58,19 @@ export function cornerPath(rect, direction, sizeMultiplier) { * @param {number} sizeMultiplier */ export function sidePath(rect, direction, sizeMultiplier) { - let { x, y, width, height } = rect; + const { x, y, width, height } = rect; - let wMul = ['n', 's'].includes(direction) + const wMul = ['n', 's'].includes(direction) ? 0.5 : { w: 0, e: 1 }[/** @type {Extract} */ (direction)]; - let hMul = ['w', 'e'].includes(direction) + const hMul = ['w', 'e'].includes(direction) ? 0.5 : { n: 0, s: 1 }[/** @type {Extract} */ (direction)]; - let xSide = [-1, 1][wMul]; - let ySide = [-1, 1][hMul]; + const xSide = [-1, 1][wMul]; + const ySide = [-1, 1][hMul]; - let p1, p2; + let p1; + let p2; if (['n', 's'].includes(direction)) { p1 = [x + wMul * width - (THUMB_SIDE_SIZE * sizeMultiplier) / 2, y + hMul * height + THUMB_OFFSET * ySide]; p2 = [x + wMul * width + (THUMB_SIDE_SIZE * sizeMultiplier) / 2, y + hMul * height + THUMB_OFFSET * ySide]; @@ -77,8 +78,8 @@ export function sidePath(rect, direction, sizeMultiplier) { p1 = [x + wMul * width + THUMB_OFFSET * xSide, y + hMul * height - (THUMB_SIDE_SIZE * sizeMultiplier) / 2]; p2 = [x + wMul * width + THUMB_OFFSET * xSide, y + hMul * height + (THUMB_SIDE_SIZE * sizeMultiplier) / 2]; } - let path = `M ${p1[0]} ${p1[1]} L ${p2[0]} ${p2[1]}`; - let center = [p2[0] - (p2[0] - p1[0]) / 2, p2[1] - (p2[1] - p1[1]) / 2]; + const path = `M ${p1[0]} ${p1[1]} L ${p2[0]} ${p2[1]}`; + const center = [p2[0] - (p2[0] - p1[0]) / 2, p2[1] - (p2[1] - p1[1]) / 2]; return { d: path, center }; } @@ -671,7 +672,7 @@ export function isRectMatchesAspectRatio(rect, aspectRatio) { * @returns {import('./types.js').ImageSize} */ export function rotateSize({ width, height }, angle) { - let swap = (angle / 90) % 2 !== 0; + const swap = (angle / 90) % 2 !== 0; return { width: swap ? height : width, height: swap ? width : height }; } @@ -682,7 +683,8 @@ export function rotateSize({ width, height }, angle) { */ export function calculateMaxCenteredCropFrame(width, height, aspectRatio) { const imageAspectRatio = width / height; - let cropWidth, cropHeight; + let cropWidth; + let cropHeight; if (imageAspectRatio > aspectRatio) { cropWidth = Math.round(height * aspectRatio); diff --git a/blocks/CloudImageEditor/src/elements/line-loader/LineLoaderUi.js b/blocks/CloudImageEditor/src/elements/line-loader/LineLoaderUi.js index e66cadfb3..9d95ed151 100644 --- a/blocks/CloudImageEditor/src/elements/line-loader/LineLoaderUi.js +++ b/blocks/CloudImageEditor/src/elements/line-loader/LineLoaderUi.js @@ -7,10 +7,10 @@ export class LineLoaderUi extends Block { this._active = false; this._handleTransitionEndRight = () => { - let lineEl = this.ref['line-el']; - lineEl.style.transition = `initial`; + const lineEl = this.ref['line-el']; + lineEl.style.transition = 'initial'; lineEl.style.opacity = '0'; - lineEl.style.transform = `translateX(-101%)`; + lineEl.style.transform = 'translateX(-101%)'; this._active && this._start(); }; } @@ -30,9 +30,9 @@ export class LineLoaderUi extends Block { _start() { this._active = true; - let { width } = this.getBoundingClientRect(); - let lineEl = this.ref['line-el']; - lineEl.style.transition = `transform 1s`; + const { width } = this.getBoundingClientRect(); + const lineEl = this.ref['line-el']; + lineEl.style.transition = 'transform 1s'; lineEl.style.opacity = '1'; lineEl.style.transform = `translateX(${width}px)`; lineEl.addEventListener('transitionend', this._handleTransitionEndRight, { diff --git a/blocks/CloudImageEditor/src/elements/presence-toggle/PresenceToggle.js b/blocks/CloudImageEditor/src/elements/presence-toggle/PresenceToggle.js index 575aabe53..30598d036 100644 --- a/blocks/CloudImageEditor/src/elements/presence-toggle/PresenceToggle.js +++ b/blocks/CloudImageEditor/src/elements/presence-toggle/PresenceToggle.js @@ -1,5 +1,5 @@ -import { applyClassNames } from '../../lib/classNames.js'; import { Block } from '../../../../../abstract/Block.js'; +import { applyClassNames } from '../../lib/classNames.js'; /** * @typedef {Object} Style @@ -68,4 +68,5 @@ export class PresenceToggle extends Block { }, 0); } } -PresenceToggle.template = /* HTML */ ` `; +// biome-ignore lint/style/noUnusedTemplateLiteral: This is HTML template +PresenceToggle.template = /* HTML */ ``; diff --git a/blocks/CloudImageEditor/src/elements/slider/SliderUi.js b/blocks/CloudImageEditor/src/elements/slider/SliderUi.js index daff4c273..86944a639 100644 --- a/blocks/CloudImageEditor/src/elements/slider/SliderUi.js +++ b/blocks/CloudImageEditor/src/elements/slider/SliderUi.js @@ -10,13 +10,13 @@ export class SliderUi extends Block { onChange: null, defaultValue: null, 'on.sliderInput': () => { - let value = parseInt(this.ref['input-el'].value, 10); + const value = Number.parseInt(this.ref['input-el'].value, 10); this._updateValue(value); - this.$.onInput && this.$.onInput(value); + this.$.onInput?.(value); }, 'on.sliderChange': () => { - let value = parseInt(this.ref['input-el'].value, 10); - this.$.onChange && this.$.onChange(value); + const value = Number.parseInt(this.ref['input-el'].value, 10); + this.$.onChange?.(value); }, }; @@ -64,20 +64,20 @@ export class SliderUi extends Block { this._observer = new ResizeObserver(() => { this._updateSteps(); - let value = parseInt(this.ref['input-el'].value, 10); + const value = Number.parseInt(this.ref['input-el'].value, 10); this._updateValue(value); }); this._observer.observe(this); - this._thumbSize = parseInt(window.getComputedStyle(this).getPropertyValue('--l-thumb-size'), 10); + this._thumbSize = Number.parseInt(window.getComputedStyle(this).getPropertyValue('--l-thumb-size'), 10); setTimeout(() => { - let value = parseInt(this.ref['input-el'].value, 10); + const value = Number.parseInt(this.ref['input-el'].value, 10); this._updateValue(value); }, 0); this.sub('disabled', (disabled) => { - let el = this.ref['input-el']; + const el = this.ref['input-el']; if (disabled) { el.setAttribute('disabled', 'disabled'); } else { @@ -85,7 +85,7 @@ export class SliderUi extends Block { } }); - let inputEl = this.ref['input-el']; + const inputEl = this.ref['input-el']; inputEl.addEventListener('focus', () => { this.style.setProperty('--color-effect', 'var(--hover-color-rgb)'); }); @@ -97,10 +97,10 @@ export class SliderUi extends Block { _updateValue(value) { this._updateZeroDot(value); - let { width } = this.getBoundingClientRect(); - let slope = 100 / (this.$.max - this.$.min); - let mappedValue = slope * (value - this.$.min); - let offset = (mappedValue * (width - this._thumbSize)) / 100; + const { width } = this.getBoundingClientRect(); + const slope = 100 / (this.$.max - this.$.min); + const mappedValue = slope * (value - this.$.min); + const offset = (mappedValue * (width - this._thumbSize)) / 100; window.requestAnimationFrame(() => { this.ref['thumb-el'].style.transform = `translateX(${offset}px)`; @@ -116,10 +116,10 @@ export class SliderUi extends Block { } else { this._zeroDotEl.style.opacity = '0.2'; } - let { width } = this.getBoundingClientRect(); - let slope = 100 / (this.$.max - this.$.min); - let mappedValue = slope * (this._zero - this.$.min); - let offset = (mappedValue * (width - this._thumbSize)) / 100; + const { width } = this.getBoundingClientRect(); + const slope = 100 / (this.$.max - this.$.min); + const mappedValue = slope * (this._zero - this.$.min); + const offset = (mappedValue * (width - this._thumbSize)) / 100; window.requestAnimationFrame(() => { this._zeroDotEl.style.transform = `translateX(${offset}px)`; }); @@ -128,18 +128,18 @@ export class SliderUi extends Block { _updateSteps() { const STEP_GAP = 15; - let stepsEl = this.ref['steps-el']; - let { width } = stepsEl.getBoundingClientRect(); - let half = Math.ceil(width / 2); - let count = Math.ceil(half / STEP_GAP) - 2; + const stepsEl = this.ref['steps-el']; + const { width } = stepsEl.getBoundingClientRect(); + const half = Math.ceil(width / 2); + const count = Math.ceil(half / STEP_GAP) - 2; if (this._stepsCount === count) { return; } - let fr = document.createDocumentFragment(); - let minorStepEl = document.createElement('div'); - let borderStepEl = document.createElement('div'); + const fr = document.createDocumentFragment(); + const minorStepEl = document.createElement('div'); + const borderStepEl = document.createElement('div'); minorStepEl.className = 'minor-step'; borderStepEl.className = 'border-step'; fr.appendChild(borderStepEl); @@ -152,7 +152,7 @@ export class SliderUi extends Block { } fr.appendChild(borderStepEl.cloneNode()); - let zeroDotEl = document.createElement('div'); + const zeroDotEl = document.createElement('div'); zeroDotEl.className = 'zero-dot'; fr.appendChild(zeroDotEl); this._zeroDotEl = zeroDotEl; diff --git a/blocks/CloudImageEditor/src/lib/FocusVisible.js b/blocks/CloudImageEditor/src/lib/FocusVisible.js index 4badd96a9..6188d666b 100644 --- a/blocks/CloudImageEditor/src/lib/FocusVisible.js +++ b/blocks/CloudImageEditor/src/lib/FocusVisible.js @@ -1,5 +1,6 @@ import { applyFocusVisiblePolyfill } from './applyFocusVisiblePolyfill.js'; +// biome-ignore lint/complexity/noStaticOnlyClass: It will be removed soon export class FocusVisible { /** * @param {boolean} focusVisible @@ -7,7 +8,7 @@ export class FocusVisible { */ static handleFocusVisible(focusVisible, element) { if (focusVisible) { - let customOutline = element.style.getPropertyValue('--focus-visible-outline'); + const customOutline = element.style.getPropertyValue('--focus-visible-outline'); element.style.outline = customOutline || '2px solid var(--color-focus-ring)'; } else { element.style.outline = 'none'; @@ -24,7 +25,7 @@ export class FocusVisible { if (!FocusVisible._destructors.has(scope)) { return; } - let removeFocusVisiblePolyfill = FocusVisible._destructors.get(scope); + const removeFocusVisiblePolyfill = FocusVisible._destructors.get(scope); removeFocusVisiblePolyfill(); FocusVisible._destructors.delete(scope); } diff --git a/blocks/CloudImageEditor/src/lib/applyFocusVisiblePolyfill.js b/blocks/CloudImageEditor/src/lib/applyFocusVisiblePolyfill.js index e6754ebac..4fc7d46d4 100644 --- a/blocks/CloudImageEditor/src/lib/applyFocusVisiblePolyfill.js +++ b/blocks/CloudImageEditor/src/lib/applyFocusVisiblePolyfill.js @@ -26,7 +26,7 @@ function isValidFocusTarget(el) { * @returns {boolean} */ function focusTriggersKeyboardModality(el) { - let { tagName } = /** @type {Element} */ (el); + const { tagName } = /** @type {Element} */ (el); if (tagName === 'INPUT' && !(/** @type {HTMLInputElement} */ (el).readOnly)) { return true; @@ -157,7 +157,6 @@ export function applyFocusVisiblePolyfill(scope, callback) { * first loads and anytime the window is blurred so that they are active when the window regains focus. */ function addInitialPointerMoveListeners() { - /* eslint-disable no-use-before-define */ document.addEventListener('mousemove', onInitialPointerMove); document.addEventListener('mousedown', onInitialPointerMove); document.addEventListener('mouseup', onInitialPointerMove); @@ -167,11 +166,9 @@ export function applyFocusVisiblePolyfill(scope, callback) { document.addEventListener('touchmove', onInitialPointerMove); document.addEventListener('touchstart', onInitialPointerMove); document.addEventListener('touchend', onInitialPointerMove); - /* eslint-enable no-use-before-define */ } function removeInitialPointerMoveListeners() { - /* eslint-disable no-use-before-define */ document.removeEventListener('mousemove', onInitialPointerMove); document.removeEventListener('mousedown', onInitialPointerMove); document.removeEventListener('mouseup', onInitialPointerMove); @@ -181,7 +178,6 @@ export function applyFocusVisiblePolyfill(scope, callback) { document.removeEventListener('touchmove', onInitialPointerMove); document.removeEventListener('touchstart', onInitialPointerMove); document.removeEventListener('touchend', onInitialPointerMove); - /* eslint-enable no-use-before-define */ } /** diff --git a/blocks/CloudImageEditor/src/lib/classNames.js b/blocks/CloudImageEditor/src/lib/classNames.js index e9cf816ec..4aee19ff5 100644 --- a/blocks/CloudImageEditor/src/lib/classNames.js +++ b/blocks/CloudImageEditor/src/lib/classNames.js @@ -5,7 +5,7 @@ function normalize(...args) { return result; } - for (let token of Object.keys(arg)) { + for (const token of Object.keys(arg)) { result[token] = arg[token]; } @@ -14,7 +14,7 @@ function normalize(...args) { } export function classNames(...args) { - let mapping = normalize(...args); + const mapping = normalize(...args); return Object.keys(mapping) .reduce((result, token) => { if (mapping[token]) { @@ -27,8 +27,8 @@ export function classNames(...args) { } export function applyClassNames(element, ...args) { - let mapping = normalize(...args); - for (let token of Object.keys(mapping)) { + const mapping = normalize(...args); + for (const token of Object.keys(mapping)) { element.classList.toggle(token, mapping[token]); } } diff --git a/blocks/CloudImageEditor/src/lib/linspace.js b/blocks/CloudImageEditor/src/lib/linspace.js index efa94aca0..69ec04b70 100644 --- a/blocks/CloudImageEditor/src/lib/linspace.js +++ b/blocks/CloudImageEditor/src/lib/linspace.js @@ -5,10 +5,10 @@ * @returns {Number[]} */ export function linspace(a, b, n) { - let ret = Array(n); - n--; - for (let i = n; i >= 0; i--) { - ret[i] = Math.ceil((i * b + (n - i) * a) / n); + const ret = Array(n); + const startN = n - 1; + for (let i = startN; i >= 0; i--) { + ret[i] = Math.ceil((i * b + (startN - i) * a) / startN); } return ret; } diff --git a/blocks/CloudImageEditor/src/lib/pick.js b/blocks/CloudImageEditor/src/lib/pick.js index fe3b617ff..f207d17f8 100644 --- a/blocks/CloudImageEditor/src/lib/pick.js +++ b/blocks/CloudImageEditor/src/lib/pick.js @@ -4,10 +4,10 @@ * @returns {{}} */ export function pick(obj, keys) { - let result = {}; - for (let key of keys) { - let value = obj[key]; - if (obj.hasOwnProperty(key) || value !== undefined) { + const result = {}; + for (const key of keys) { + const value = obj[key]; + if (Object.hasOwn(obj, key) || value !== undefined) { result[key] = value; } } diff --git a/blocks/CloudImageEditor/src/lib/preloadImage.js b/blocks/CloudImageEditor/src/lib/preloadImage.js index 022775feb..bed30a25a 100644 --- a/blocks/CloudImageEditor/src/lib/preloadImage.js +++ b/blocks/CloudImageEditor/src/lib/preloadImage.js @@ -1,15 +1,15 @@ import { TRANSPARENT_PIXEL_SRC } from '../../../../utils/transparentPixelSrc.js'; export function preloadImage(src) { - let image = new Image(); + const image = new Image(); - let promise = new Promise((resolve, reject) => { + const promise = new Promise((resolve, reject) => { image.src = src; image.onload = resolve; image.onerror = reject; }); - let cancel = () => { + const cancel = () => { if (image.naturalWidth === 0) { image.src = TRANSPARENT_PIXEL_SRC; } @@ -19,19 +19,19 @@ export function preloadImage(src) { } export function batchPreloadImages(list) { - let preloaders = []; + const preloaders = []; - for (let src of list) { - let preload = preloadImage(src); + for (const src of list) { + const preload = preloadImage(src); preloaders.push(preload); } - let images = preloaders.map((preload) => preload.image); - let promise = Promise.allSettled(preloaders.map((preload) => preload.promise)); - let cancel = () => { - preloaders.forEach((preload) => { + const images = preloaders.map((preload) => preload.image); + const promise = Promise.allSettled(preloaders.map((preload) => preload.promise)); + const cancel = () => { + for (const preload of preloaders) { preload.cancel(); - }); + } }; return { promise, images, cancel }; diff --git a/blocks/CloudImageEditor/src/lib/transformationUtils.js b/blocks/CloudImageEditor/src/lib/transformationUtils.js index 654363828..3a5114a23 100644 --- a/blocks/CloudImageEditor/src/lib/transformationUtils.js +++ b/blocks/CloudImageEditor/src/lib/transformationUtils.js @@ -61,7 +61,7 @@ function transformationToStr(operation, options) { } if (operation === 'crop' && options) { - let { dimensions, coords } = /** @type {NonNullable} */ (options); + const { dimensions, coords } = /** @type {NonNullable} */ (options); return `${operation}/${dimensions.join('x')}/${coords.join(',')}`; } @@ -78,7 +78,7 @@ export function transformationsToOperations(transformations) { (operation) => typeof transformations[operation] !== 'undefined' && transformations[operation] !== null, ) .map((operation) => { - let options = transformations[operation]; + const options = transformations[operation]; return transformationToStr(operation, options); }) .filter((str) => !!str), diff --git a/blocks/CloudImageEditor/src/state.js b/blocks/CloudImageEditor/src/state.js index f86743a86..6360dd10c 100644 --- a/blocks/CloudImageEditor/src/state.js +++ b/blocks/CloudImageEditor/src/state.js @@ -45,9 +45,9 @@ export function initState(fnCtx) { 'presence.viewerToolbar': true, // TODO: beware of wrong ctx in case of element re-creation: '*on.retryNetwork': () => { - let images = fnCtx.querySelectorAll('img'); - for (let img of images) { - let originalSrc = img.src; + const images = fnCtx.querySelectorAll('img'); + for (const img of images) { + const originalSrc = img.src; img.src = TRANSPARENT_PIXEL_SRC; img.src = originalSrc; } @@ -58,12 +58,12 @@ export function initState(fnCtx) { if (!transformations) { return; } - let originalUrl = fnCtx.$['*originalUrl']; - let cdnUrlModifiers = createCdnUrlModifiers(transformationsToOperations(transformations), 'preview'); - let cdnUrl = createCdnUrl(originalUrl, cdnUrlModifiers); + const originalUrl = fnCtx.$['*originalUrl']; + const cdnUrlModifiers = createCdnUrlModifiers(transformationsToOperations(transformations), 'preview'); + const cdnUrl = createCdnUrl(originalUrl, cdnUrlModifiers); /** @type {import('./types.js').ApplyResult} */ - let eventData = { + const eventData = { originalUrl, cdnUrlModifiers, cdnUrl, diff --git a/blocks/CloudImageEditor/src/util.js b/blocks/CloudImageEditor/src/util.js index b8d298d41..4b1f0120b 100644 --- a/blocks/CloudImageEditor/src/util.js +++ b/blocks/CloudImageEditor/src/util.js @@ -3,9 +3,9 @@ import { COMMON_OPERATIONS, transformationsToOperations } from './lib/transforma export function viewerImageSrc(originalUrl, width, transformations) { const MAX_CDN_DIMENSION = 3000; - let dpr = window.devicePixelRatio; - let size = Math.min(Math.ceil(width * dpr), MAX_CDN_DIMENSION); - let quality = dpr >= 2 ? 'lightest' : 'normal'; + const dpr = window.devicePixelRatio; + const size = Math.min(Math.ceil(width * dpr), MAX_CDN_DIMENSION); + const quality = dpr >= 2 ? 'lightest' : 'normal'; return createCdnUrl( originalUrl, diff --git a/blocks/CloudImageEditorActivity/CloudImageEditorActivity.js b/blocks/CloudImageEditorActivity/CloudImageEditorActivity.js index 000e17552..908b711e0 100644 --- a/blocks/CloudImageEditorActivity/CloudImageEditorActivity.js +++ b/blocks/CloudImageEditorActivity/CloudImageEditorActivity.js @@ -55,7 +55,7 @@ export class CloudImageEditorActivity extends UploaderBlock { if (!this.entry) { return; } - let result = e.detail; + const result = e.detail; this.entry.setMultipleValues({ cdnUrl: result.cdnUrl, cdnUrlModifiers: result.cdnUrlModifiers, diff --git a/blocks/CloudImageEditorActivity/test.js b/blocks/CloudImageEditorActivity/test.js index 6c575f00f..929fb19d9 100644 --- a/blocks/CloudImageEditorActivity/test.js +++ b/blocks/CloudImageEditorActivity/test.js @@ -1,5 +1,5 @@ -import { ifRef } from '../../utils/ifRef.js'; import * as blocks from '../../index.js'; +import { ifRef } from '../../utils/ifRef.js'; ifRef(() => { blocks.registerBlocks(blocks); diff --git a/blocks/Config/Config.js b/blocks/Config/Config.js index e3585dd81..5a8ac288c 100644 --- a/blocks/Config/Config.js +++ b/blocks/Config/Config.js @@ -1,8 +1,8 @@ // @ts-check import { Block } from '../../abstract/Block.js'; -import { initialConfig } from './initialConfig.js'; import { sharedConfigKey } from '../../abstract/sharedConfigKey.js'; import { toKebabCase } from '../../utils/toKebabCase.js'; +import { initialConfig } from './initialConfig.js'; import { normalizeConfigValue } from './normalizeConfigValue.js'; const allConfigKeys = /** @type {(keyof import('../../types').ConfigType)[]} */ ([ @@ -30,7 +30,7 @@ export const complexConfigKeys = [ 'secureDeliveryProxyUrlResolver', 'iconHrefResolver', 'fileValidators', - 'collectionValidators' + 'collectionValidators', ]; /** @type {(key: keyof import('../../types').ConfigType) => key is keyof import('../../types').ConfigComplexType} */ @@ -58,7 +58,7 @@ const attrStateMapping = /** @type {Record '__' + key; +const getLocalPropName = (key) => `__${key}`; class ConfigClass extends Block { requireCtxName = true; @@ -118,6 +118,7 @@ class ConfigClass extends Block { * @param {unknown} value */ _setValue(key, value) { + // biome-ignore lint/complexity/noUselessThisAlias: const anyThis = /** @type {typeof this & any} */ (this); const normalizedValue = normalizeConfigValue(key, value); @@ -141,6 +142,7 @@ class ConfigClass extends Block { * @param {keyof import('../../types').ConfigType} key */ _getValue(key) { + // biome-ignore lint/complexity/noUselessThisAlias: const anyThis = /** @type {typeof this & any} */ (this); const localPropName = getLocalPropName(key); return anyThis[localPropName]; @@ -163,7 +165,7 @@ class ConfigClass extends Block { `[lr-config] Option "${key}" value is the same as the previous one but the reference is different`, ); console.warn( - `[lr-config] You should avoid changing the reference of the object to prevent unnecessary calculations`, + '[lr-config] You should avoid changing the reference of the object to prevent unnecessary calculations', ); console.warn(`[lr-config] "${key}" previous value:`, previousValue); console.warn(`[lr-config] "${key}" new value:`, nextValue); @@ -173,6 +175,7 @@ class ConfigClass extends Block { initCallback() { super.initCallback(); + // biome-ignore lint/complexity/noUselessThisAlias: const anyThis = /** @type {typeof this & any} */ (this); // Subscribe to the state changes and update the local properties and attributes. @@ -219,6 +222,7 @@ class ConfigClass extends Block { attributeChangedCallback(name, oldVal, newVal) { if (oldVal === newVal) return; + // biome-ignore lint/complexity/noUselessThisAlias: const anyThis = /** @type {typeof this & any} */ (this); const key = attrKeyMapping[name]; // attributeChangedCallback could be called before the initCallback diff --git a/blocks/DropArea/DropArea.js b/blocks/DropArea/DropArea.js index 4106d125c..371632aac 100644 --- a/blocks/DropArea/DropArea.js +++ b/blocks/DropArea/DropArea.js @@ -107,13 +107,13 @@ export class DropArea extends UploaderBlock { return; } - items.forEach((/** @type {import('./getDropItems.js').DropItem} */ item) => { + for (const item of items) { if (item.type === 'url') { this.addFileFromUrl(item.url, { source: UploadSource.DROP_AREA }); } else if (item.type === 'file') { this.addFileFromObject(item.file, { source: UploadSource.DROP_AREA, fullPath: item.fullPath }); } - }); + } if (this.uploadCollection.size) { this.set$({ '*currentActivity': ActivityBlock.activities.UPLOAD_LIST, @@ -123,7 +123,7 @@ export class DropArea extends UploaderBlock { }, }); - let contentWrapperEl = this.ref['content-wrapper']; + const contentWrapperEl = this.ref['content-wrapper']; if (contentWrapperEl) { this._destroyContentWrapperDropzone = addDropzone({ element: contentWrapperEl, @@ -210,9 +210,9 @@ export class DropArea extends UploaderBlock { /** @private */ _couldHandleFiles() { - let isMultiple = this.cfg.multiple; - let multipleMax = this.cfg.multipleMax; - let currentFilesCount = this.uploadCollection.size; + const isMultiple = this.cfg.multiple; + const multipleMax = this.cfg.multipleMax; + const currentFilesCount = this.uploadCollection.size; if (isMultiple && multipleMax && currentFilesCount >= multipleMax) { return false; diff --git a/blocks/DropArea/addDropzone.js b/blocks/DropArea/addDropzone.js index 42a2042c0..eaf13975e 100644 --- a/blocks/DropArea/addDropzone.js +++ b/blocks/DropArea/addDropzone.js @@ -8,9 +8,9 @@ export const DropzoneState = { OVER: 3, }; -let RESET_EVENTS = ['focus']; -let NEAR_OFFSET = 100; -let nearnessRegistry = new Map(); +const RESET_EVENTS = ['focus']; +const NEAR_OFFSET = 100; +const nearnessRegistry = new Map(); /** * @param {[x: number, y: number]} p @@ -18,8 +18,8 @@ let nearnessRegistry = new Map(); * @returns {number} */ function distance(p, r) { - let cx = Math.max(Math.min(p[0], r.x + r.width), r.x); - let cy = Math.max(Math.min(p[1], r.y + r.height), r.y); + const cx = Math.max(Math.min(p[0], r.x + r.width), r.x); + const cy = Math.max(Math.min(p[1], r.y + r.height), r.y); return Math.sqrt((p[0] - cx) * (p[0] - cx) + (p[1] - cy) * (p[1] - cy)); } @@ -34,48 +34,50 @@ function distance(p, r) { export function addDropzone(desc) { let eventCounter = 0; - let body = document.body; - let switchHandlers = new Set(); - let handleSwitch = (fn) => switchHandlers.add(fn); + const body = document.body; + const switchHandlers = new Set(); + const handleSwitch = (fn) => switchHandlers.add(fn); let state = DropzoneState.INACTIVE; - let setState = (newState) => { + const setState = (newState) => { if (desc.shouldIgnore() && newState !== DropzoneState.INACTIVE) { return; } if (state !== newState) { - switchHandlers.forEach((fn) => fn(newState)); + for (const fn of switchHandlers) { + fn(newState); + } } state = newState; }; - let isDragging = () => eventCounter > 0; + const isDragging = () => eventCounter > 0; handleSwitch((newState) => desc.onChange(newState)); - let onResetEvent = () => { + const onResetEvent = () => { eventCounter = 0; setState(DropzoneState.INACTIVE); }; - let onDragEnter = () => { + const onDragEnter = () => { eventCounter += 1; if (state === DropzoneState.INACTIVE) { setState(DropzoneState.ACTIVE); } }; - let onDragLeave = () => { + const onDragLeave = () => { eventCounter -= 1; if (!isDragging()) { setState(DropzoneState.INACTIVE); } }; - let onDrop = (e) => { + const onDrop = (e) => { e.preventDefault(); eventCounter = 0; setState(DropzoneState.INACTIVE); }; - let onDragOver = (e) => { + const onDragOver = (e) => { if (desc.shouldIgnore()) { return; } @@ -85,14 +87,14 @@ export function addDropzone(desc) { } /** @type {[Number, Number]} */ - let dragPoint = [e.x, e.y]; - let targetRect = desc.element.getBoundingClientRect(); - let nearness = Math.floor(distance(dragPoint, targetRect)); - let isNear = nearness < NEAR_OFFSET; - let isOver = e.composedPath().includes(desc.element); + const dragPoint = [e.x, e.y]; + const targetRect = desc.element.getBoundingClientRect(); + const nearness = Math.floor(distance(dragPoint, targetRect)); + const isNear = nearness < NEAR_OFFSET; + const isOver = e.composedPath().includes(desc.element); nearnessRegistry.set(desc.element, nearness); - let isNearest = Math.min(...nearnessRegistry.values()) === nearness; + const isNearest = Math.min(...nearnessRegistry.values()) === nearness; if (isOver && isNearest) { e.preventDefault(); @@ -104,12 +106,12 @@ export function addDropzone(desc) { } }; - let onElementDrop = async (e) => { + const onElementDrop = async (e) => { if (desc.shouldIgnore()) { return; } e.preventDefault(); - let items = await getDropItems(e.dataTransfer); + const items = await getDropItems(e.dataTransfer); desc.onItems(items); setState(DropzoneState.INACTIVE); }; @@ -119,9 +121,9 @@ export function addDropzone(desc) { body.addEventListener('dragenter', onDragEnter); body.addEventListener('dragover', onDragOver); desc.element.addEventListener('drop', onElementDrop); - RESET_EVENTS.forEach((eventName) => { + for (const eventName of RESET_EVENTS) { window.addEventListener(eventName, onResetEvent); - }); + } return () => { nearnessRegistry.delete(desc.element); @@ -130,8 +132,8 @@ export function addDropzone(desc) { body.removeEventListener('dragenter', onDragEnter); body.removeEventListener('dragover', onDragOver); desc.element.removeEventListener('drop', onElementDrop); - RESET_EVENTS.forEach((eventName) => { + for (const eventName of RESET_EVENTS) { window.removeEventListener(eventName, onResetEvent); - }); + } }; } diff --git a/blocks/DropArea/getDropItems.js b/blocks/DropArea/getDropItems.js index a917e0ee6..f0697766a 100644 --- a/blocks/DropArea/getDropItems.js +++ b/blocks/DropArea/getDropItems.js @@ -23,12 +23,12 @@ function checkIsDirectory(file) { } try { - let reader = new FileReader(); + const reader = new FileReader(); reader.onerror = () => { resolve(true); }; /** @param {Event} e */ - let onLoad = (e) => { + const onLoad = (e) => { if (e.type !== 'loadend') { reader.abort(); } @@ -83,12 +83,12 @@ function readEntryContentAsync(webkitEntry, dataTransferItemType) { }; /** @param {FileSystemDirectoryReader} reader */ - let readReaderContent = (reader) => { + const readReaderContent = (reader) => { reading++; reader.readEntries((entries) => { reading--; - for (let entry of entries) { + for (const entry of entries) { readEntry(entry); } @@ -113,14 +113,14 @@ export function getDropItems(dataTransfer) { const dropItems = []; const promises = []; for (let i = 0; i < dataTransfer.items.length; i++) { - let item = dataTransfer.items[i]; + const item = dataTransfer.items[i]; if (!item) { continue; } if (item.kind === 'file') { const itemType = item.type; if (typeof item.webkitGetAsEntry === 'function' || typeof (/** @type {any} */ (item).getAsEntry) === 'function') { - let entry = + const entry = typeof item.webkitGetAsEntry === 'function' ? item.webkitGetAsEntry() : /** @type {any} */ (item).getAsEntry(); diff --git a/blocks/ExternalSource/ExternalSource.js b/blocks/ExternalSource/ExternalSource.js index 871e63675..f6f4259da 100644 --- a/blocks/ExternalSource/ExternalSource.js +++ b/blocks/ExternalSource/ExternalSource.js @@ -70,7 +70,7 @@ export class ExternalSource extends UploaderBlock { super.initCallback(); this.registerActivity(this.activityType, { onActivate: () => { - let { externalSourceType } = /** @type {ActivityParams} */ (this.activityParams); + const { externalSourceType } = /** @type {ActivityParams} */ (this.activityParams); this.set$({ activityCaption: `${externalSourceType?.[0].toUpperCase()}${externalSourceType?.slice(1)}`, @@ -147,13 +147,13 @@ export class ExternalSource extends UploaderBlock { * @param {string} propName */ getCssValue(propName) { - let style = window.getComputedStyle(this); + const style = window.getComputedStyle(this); return style.getPropertyValue(propName).trim(); } /** @private */ applyStyles() { - let colors = { + const colors = { radius: this.getCssValue('--uc-radius'), backgroundColor: this.getCssValue('--uc-background'), textColor: this.getCssValue('--uc-foreground'), @@ -193,7 +193,7 @@ export class ExternalSource extends UploaderBlock { mountIframe() { /** @type {HTMLIFrameElement} */ // @ts-ignore - let iframe = create({ + const iframe = create({ tag: 'iframe', attributes: { src: this.remoteUrl(), diff --git a/blocks/ExternalSource/buildStyles.js b/blocks/ExternalSource/buildStyles.js index 388d349f4..40ed3b712 100644 --- a/blocks/ExternalSource/buildStyles.js +++ b/blocks/ExternalSource/buildStyles.js @@ -9,9 +9,9 @@ const styleToCss = (style) => { const propertiesObj = style[selector]; const propertiesStr = Object.keys(propertiesObj).reduce((acc, prop) => { const value = propertiesObj[prop]; - return acc + `${prop}: ${value};`; + return `${acc}${prop}: ${value};`; }, ''); - return acc + `${selector}{${propertiesStr}}`; + return `${acc}${selector}{${propertiesStr}}`; }, ''); return css; }; diff --git a/blocks/ExternalSource/messages.js b/blocks/ExternalSource/messages.js index 290a7440e..afbe300b3 100644 --- a/blocks/ExternalSource/messages.js +++ b/blocks/ExternalSource/messages.js @@ -1,4 +1,4 @@ -let cbMapping = {}; +const cbMapping = {}; window.addEventListener('message', (e) => { let message; @@ -9,8 +9,8 @@ window.addEventListener('message', (e) => { } if (message?.type in cbMapping) { - let cbList = cbMapping[message.type]; - for (let [sender, callback] of cbList) { + const cbList = cbMapping[message.type]; + for (const [sender, callback] of cbList) { if (e.source === sender) { callback(message); } @@ -18,7 +18,7 @@ window.addEventListener('message', (e) => { } }); -const registerMessage = function (type, sender, callback) { +const registerMessage = (type, sender, callback) => { if (!(type in cbMapping)) { cbMapping[type] = []; } @@ -26,7 +26,7 @@ const registerMessage = function (type, sender, callback) { cbMapping[type].push([sender, callback]); }; -const unregisterMessage = function (type, sender) { +const unregisterMessage = (type, sender) => { if (type in cbMapping) { cbMapping[type] = cbMapping[type].filter((item) => item[0] !== sender); } diff --git a/blocks/ExternalSource/query-string.js b/blocks/ExternalSource/query-string.js index 988003938..f8ec08cca 100644 --- a/blocks/ExternalSource/query-string.js +++ b/blocks/ExternalSource/query-string.js @@ -3,8 +3,8 @@ * @returns {string} */ export function queryString(params) { - let list = []; - for (let [key, value] of Object.entries(params)) { + const list = []; + for (const [key, value] of Object.entries(params)) { if (value === undefined || value === null || (typeof value === 'string' && value.length === 0)) { continue; } diff --git a/blocks/FileItem/FileItem.js b/blocks/FileItem/FileItem.js index 9ff9f7a81..29b9a3efe 100644 --- a/blocks/FileItem/FileItem.js +++ b/blocks/FileItem/FileItem.js @@ -1,13 +1,13 @@ // @ts-check -import { CancelError, uploadFile } from '@uploadcare/upload-client'; import { shrinkFile } from '@uploadcare/image-shrink'; +import { CancelError, uploadFile } from '@uploadcare/upload-client'; import { ActivityBlock } from '../../abstract/ActivityBlock.js'; import { UploaderBlock } from '../../abstract/UploaderBlock.js'; import { createCdnUrl, createCdnUrlModifiers, createOriginalUrl } from '../../utils/cdn-utils.js'; +import { parseShrink } from '../../utils/parseShrink.js'; import { fileCssBg } from '../svg-backgrounds/svg-backgrounds.js'; import { debounce } from '../utils/debounce.js'; import { generateThumb } from '../utils/resizeImage.js'; -import { parseShrink } from '../../utils/parseShrink.js'; const FileItemState = Object.freeze({ FINISHED: Symbol(0), @@ -75,7 +75,7 @@ export class FileItem extends UploaderBlock { } _reset() { - for (let sub of this._entrySubs) { + for (const sub of this._entrySubs) { sub.remove(); } @@ -90,7 +90,7 @@ export class FileItem extends UploaderBlock { * @param {IntersectionObserverEntry[]} entries */ _observerCallback(entries) { - let [entry] = entries; + const [entry] = entries; this._isIntersecting = entry.isIntersecting; if (entry.isIntersecting && !this._renderedOnce) { @@ -109,7 +109,7 @@ export class FileItem extends UploaderBlock { if (!this._entry) { return; } - let entry = this._entry; + const entry = this._entry; let state = FileItemState.IDLE; if (entry.getValue('errors').length > 0) { @@ -128,17 +128,17 @@ export class FileItem extends UploaderBlock { if (!this._entry) { return; } - let entry = this._entry; + const entry = this._entry; if (entry.getValue('fileInfo') && entry.getValue('isImage')) { - let size = this.cfg.thumbSize; - let thumbUrl = this.proxyUrl( + const size = this.cfg.thumbSize; + const thumbUrl = this.proxyUrl( createCdnUrl( createOriginalUrl(this.cfg.cdnCname, this._entry.getValue('uuid')), createCdnUrlModifiers(entry.getValue('cdnUrlModifiers'), `scale_crop/${size}x${size}/center`), ), ); - let currentThumbUrl = entry.getValue('thumbUrl'); + const currentThumbUrl = entry.getValue('thumbUrl'); if (currentThumbUrl !== thumbUrl) { entry.setValue('thumbUrl', thumbUrl); currentThumbUrl?.startsWith('blob:') && URL.revokeObjectURL(currentThumbUrl); @@ -152,14 +152,14 @@ export class FileItem extends UploaderBlock { if (entry.getValue('file')?.type.includes('image')) { try { - let thumbUrl = await generateThumb(entry.getValue('file'), this.cfg.thumbSize); + const thumbUrl = await generateThumb(entry.getValue('file'), this.cfg.thumbSize); entry.setValue('thumbUrl', thumbUrl); } catch (err) { - let color = window.getComputedStyle(this).getPropertyValue('--uc-muted-foreground'); + const color = window.getComputedStyle(this).getPropertyValue('--uc-muted-foreground'); entry.setValue('thumbUrl', fileCssBg(color)); } } else { - let color = window.getComputedStyle(this).getPropertyValue('--uc-muted-foreground'); + const color = window.getComputedStyle(this).getPropertyValue('--uc-muted-foreground'); entry.setValue('thumbUrl', fileCssBg(color)); } } @@ -170,7 +170,7 @@ export class FileItem extends UploaderBlock { * @param {(value: any) => void} handler */ _subEntry(prop, handler) { - let sub = this._entry.subscribe( + const sub = this._entry.subscribe( prop, /** @param {any} value */ (value) => { if (this.isConnected) { @@ -189,7 +189,7 @@ export class FileItem extends UploaderBlock { this._reset(); /** @type {import('../../abstract/TypedData.js').TypedData} */ - let entry = this.uploadCollection?.read(id); + const entry = this.uploadCollection?.read(id); this._entry = entry; if (!entry) { @@ -251,13 +251,13 @@ export class FileItem extends UploaderBlock { this.subConfigValue('useCloudImageEditor', () => this._debouncedCalculateState()); this.onclick = () => { - FileItem.activeInstances.forEach((inst) => { - if (inst === this) { - inst.setAttribute('focused', ''); + for (const instance of FileItem.activeInstances) { + if (instance === this) { + instance.setAttribute('focused', ''); } else { - inst.removeAttribute('focused'); + instance.removeAttribute('focused'); } - }); + } }; this.sub( @@ -335,7 +335,7 @@ export class FileItem extends UploaderBlock { } async upload() { - let entry = this._entry; + const entry = this._entry; if (!this.uploadCollection.read(entry.uid)) { return; @@ -354,7 +354,7 @@ export class FileItem extends UploaderBlock { entry.setValue('errors', []); try { - let abortController = new AbortController(); + const abortController = new AbortController(); entry.setValue('abortController', abortController); const uploadTask = async () => { @@ -372,7 +372,7 @@ export class FileItem extends UploaderBlock { source: entry.getValue('source'), onProgress: (progress) => { if (progress.isComputable) { - let percentage = progress.value * 100; + const percentage = progress.value * 100; entry.setValue('uploadProgress', percentage); } }, @@ -384,7 +384,7 @@ export class FileItem extends UploaderBlock { }; /** @type {import('@uploadcare/upload-client').UploadcareFile} */ - let fileInfo = await this.$['*uploadQueue'].add(uploadTask); + const fileInfo = await this.$['*uploadQueue'].add(uploadTask); entry.setMultipleValues({ fileInfo, isUploading: false, diff --git a/blocks/FormInput/FormInput.js b/blocks/FormInput/FormInput.js index 5a65b49ef..f992ee19b 100644 --- a/blocks/FormInput/FormInput.js +++ b/blocks/FormInput/FormInput.js @@ -75,7 +75,7 @@ export class FormInput extends UploaderBlock { const fr = new DocumentFragment(); - for (let value of cdnUrls) { + for (const value of cdnUrls) { const input = document.createElement('input'); input.type = 'hidden'; input.name = `${this.ctxName}[]`; diff --git a/blocks/Img/ImgBase.js b/blocks/Img/ImgBase.js index a095e0662..42c6c665d 100644 --- a/blocks/Img/ImgBase.js +++ b/blocks/Img/ImgBase.js @@ -1,18 +1,18 @@ -import { applyTemplateData } from '../../utils/template-utils.js'; import { createCdnUrl, createCdnUrlModifiers, createOriginalUrl } from '../../utils/cdn-utils.js'; import { stringToArray } from '../../utils/stringToArray.js'; +import { applyTemplateData } from '../../utils/template-utils.js'; import { uniqueArray } from '../../utils/uniqueArray.js'; -import { parseObjectToString } from './utils/parseObjectToString.js'; import { ImgConfig } from './ImgConfig.js'; import { DEV_MODE, HI_RES_K, - ULTRA_RES_K, - UNRESOLVED_ATTR, + ImgTypeEnum, MAX_WIDTH, MAX_WIDTH_JPG, - ImgTypeEnum, + ULTRA_RES_K, + UNRESOLVED_ATTR, } from './configurations.js'; +import { parseObjectToString } from './utils/parseObjectToString.js'; export class ImgBase extends ImgConfig { _img = new Image(); @@ -23,9 +23,9 @@ export class ImgBase extends ImgConfig { * @param {String} src */ _fmtAbs(src) { - let isRel = !src.includes('//'); + const isRel = !src.includes('//'); if (isRel && !DEV_MODE) { - src = new URL(src, document.baseURI).href; + return new URL(src, document.baseURI).href; } return src; } @@ -39,16 +39,17 @@ export class ImgBase extends ImgConfig { _validateSize(size) { if (size?.trim() !== '') { // Extract numeric part - let numericPart = size.match(/\d+/)[0]; + const numericPart = size.match(/\d+/)[0]; // Extract alphabetic part - let alphabeticPart = size.match(/[a-zA-Z]+/)[0]; + const alphabeticPart = size.match(/[a-zA-Z]+/)[0]; - const bp = parseInt(numericPart, 10); + const bp = Number.parseInt(numericPart, 10); if (Number(bp) > MAX_WIDTH_JPG && this.hasFormatJPG) { return MAX_WIDTH_JPG + alphabeticPart; - } else if (Number(bp) > MAX_WIDTH && !this.hasFormatJPG) { + } + if (Number(bp) > MAX_WIDTH && !this.hasFormatJPG) { return MAX_WIDTH + alphabeticPart; } } @@ -91,7 +92,7 @@ export class ImgBase extends ImgConfig { return this._proxyUrl(this.$$('src')); } - let cdnModifiers = this._getCdnModifiers(size, blur); + const cdnModifiers = this._getCdnModifiers(size, blur); if (this.$$('src').startsWith(this.$$('cdn-cname'))) { return createCdnUrl(this.$$('src'), cdnModifiers); @@ -103,8 +104,8 @@ export class ImgBase extends ImgConfig { createCdnUrl( // createOriginalUrl(this.$$('cdn-cname'), this.$$('uuid')), - cdnModifiers - ) + cdnModifiers, + ), ); } @@ -114,8 +115,8 @@ export class ImgBase extends ImgConfig { createCdnUrl( // createOriginalUrl(this.$$('cdn-cname'), this.$$('uuid')), - cdnModifiers - ) + cdnModifiers, + ), ); } @@ -126,8 +127,8 @@ export class ImgBase extends ImgConfig { // this.$$('proxy-cname'), cdnModifiers, - this._fmtAbs(this.$$('src')) - ) + this._fmtAbs(this.$$('src')), + ), ); } @@ -138,8 +139,8 @@ export class ImgBase extends ImgConfig { // `https://${this.$$('pubkey')}.ucr.io/`, cdnModifiers, - this._fmtAbs(this.$$('src')) - ) + this._fmtAbs(this.$$('src')), + ), ); } } @@ -150,14 +151,14 @@ export class ImgBase extends ImgConfig { * @returns {String} */ _proxyUrl(url) { - let previewProxy = this.$$('secure-delivery-proxy'); + const previewProxy = this.$$('secure-delivery-proxy'); if (!previewProxy) { return url; } return applyTemplateData( this.$$('secure-delivery-proxy'), { previewUrl: url }, - { transform: (value) => window.encodeURIComponent(value) } + { transform: (value) => window.encodeURIComponent(value) }, ); } @@ -167,27 +168,26 @@ export class ImgBase extends ImgConfig { * @param {Boolean} [wOnly] */ _getElSize(el, k = 1, wOnly = true) { - let rect = el.getBoundingClientRect(); - let w = k * Math.round(rect.width); - let h = wOnly ? '' : k * Math.round(rect.height); + const rect = el.getBoundingClientRect(); + const w = k * Math.round(rect.width); + const h = wOnly ? '' : k * Math.round(rect.height); if (w || h) { return `${w ? w : ''}x${h ? h : ''}`; - } else { - return null; } + return null; } /** @param {HTMLImageElement} img */ _setupEventProxy(img) { /** @param {Event} e */ - let proxifyEvent = (e) => { + const proxifyEvent = (e) => { e.stopPropagation(); - let event = new Event(e.type, e); + const event = new Event(e.type, e); this.dispatchEvent(event); }; - let EVENTS = ['load', 'error']; - for (let event of EVENTS) { + const EVENTS = ['load', 'error']; + for (const event of EVENTS) { img.addEventListener(event, proxifyEvent); } } @@ -224,10 +224,9 @@ export class ImgBase extends ImgConfig { get breakpoints() { if (this.$$('breakpoints')) { const list = stringToArray(this.$$('breakpoints')); - return uniqueArray(list.map((bp) => parseInt(bp, 10))); - } else { - return null; + return uniqueArray(list.map((bp) => Number.parseInt(bp, 10))); } + return null; } get hasFormatJPG() { @@ -236,7 +235,7 @@ export class ImgBase extends ImgConfig { /** @param {HTMLElement} el */ renderBg(el) { - let imgSet = new Set(); + const imgSet = new Set(); imgSet.add(`url("${this._getUrlBase(this._getElSize(el))}") 1x`); if (this.$$('hi-res-support')) { @@ -247,30 +246,30 @@ export class ImgBase extends ImgConfig { imgSet.add(`url("${this._getUrlBase(this._getElSize(el, ULTRA_RES_K))}") ${ULTRA_RES_K}x`); } - let iSet = `image-set(${[...imgSet].join(', ')})`; + const iSet = `image-set(${[...imgSet].join(', ')})`; el.style.setProperty('background-image', iSet); - el.style.setProperty('background-image', '-webkit-' + iSet); + el.style.setProperty('background-image', `-webkit-${iSet}`); } getSrcset() { - let srcset = new Set(); + const srcset = new Set(); if (this.breakpoints) { - this.breakpoints.forEach((bp) => { - srcset.add(this._getUrlBase(bp + 'x') + ` ${this._validateSize(bp + 'w')}`); + for (const bp of this.breakpoints) { + srcset.add(`${this._getUrlBase(`${bp}x`)} ${this._validateSize(`${bp}w`)}`); if (this.$$('hi-res-support')) { - srcset.add(this._getUrlBase(bp * HI_RES_K + 'x') + ` ${this._validateSize(bp * HI_RES_K + 'w')}`); + srcset.add(`${this._getUrlBase(`${bp * HI_RES_K}x`)} ${this._validateSize(`${bp * HI_RES_K}w`)}`); } if (this.$$('ultra-res-support')) { - srcset.add(this._getUrlBase(bp * ULTRA_RES_K + 'x') + ` ${this._validateSize(bp * ULTRA_RES_K + 'w')}`); + srcset.add(`${this._getUrlBase(`${bp * ULTRA_RES_K}x`)} ${this._validateSize(`${bp * ULTRA_RES_K}w`)}`); } - }); + } } else { - srcset.add(this._getUrlBase(this._getElSize(this.currentImg.img)) + ' 1x'); + srcset.add(`${this._getUrlBase(this._getElSize(this.currentImg.img))} 1x`); if (this.$$('hi-res-support')) { - srcset.add(this._getUrlBase(this._getElSize(this.currentImg.img, 2)) + ' 2x'); + srcset.add(`${this._getUrlBase(this._getElSize(this.currentImg.img, 2))} 2x`); } if (this.$$('ultra-res-support')) { - srcset.add(this._getUrlBase(this._getElSize(this.currentImg.img, 3)) + ' 3x'); + srcset.add(`${this._getUrlBase(this._getElSize(this.currentImg.img, 3))} 3x`); } } return [...srcset].join(); @@ -285,7 +284,7 @@ export class ImgBase extends ImgConfig { } renderBackground() { - [...document.querySelectorAll(this.bgSelector)].forEach((el) => { + for (const el of document.querySelectorAll(this.bgSelector)) { if (this.$$('intersection')) { this.initIntersection(el, () => { this.renderBg(el); @@ -293,7 +292,7 @@ export class ImgBase extends ImgConfig { } else { this.renderBg(el); } - }); + } } _appendURL({ elNode, src, srcset }) { diff --git a/blocks/Img/ImgConfig.js b/blocks/Img/ImgConfig.js index 4d01f5ec9..5ff67e4bb 100644 --- a/blocks/Img/ImgConfig.js +++ b/blocks/Img/ImgConfig.js @@ -1,10 +1,10 @@ import { BaseComponent, Data } from '@symbiotejs/symbiote'; -import { PROPS_MAP } from './props-map.js'; -import { CSS_PREF } from './configurations.js'; import { PACKAGE_NAME, PACKAGE_VERSION } from '../../env.js'; +import { CSS_PREF } from './configurations.js'; +import { PROPS_MAP } from './props-map.js'; const CSS_PROPS = Object.create(null); -for (let prop in PROPS_MAP) { +for (const prop in PROPS_MAP) { CSS_PROPS[CSS_PREF + prop] = PROPS_MAP[prop]?.default || ''; } @@ -21,7 +21,7 @@ export class ImgConfig extends BaseComponent { /** @param {Object} kvObj */ set$$(kvObj) { - for (let key in kvObj) { + for (const key in kvObj) { this.$[CSS_PREF + key] = kvObj[key]; } } @@ -46,11 +46,11 @@ export class ImgConfig extends BaseComponent { } initAttributes(el) { - [...this.attributes].forEach((attr) => { + for (const attr of this.attributes) { if (!PROPS_MAP[attr.name]) { el.setAttribute(attr.name, attr.value); } - }); + } } /** @@ -58,18 +58,18 @@ export class ImgConfig extends BaseComponent { * @param {() => void} cbkFn */ initIntersection(el, cbkFn) { - let opts = { + const opts = { root: null, rootMargin: '0px', }; /** @private */ this._isnObserver = new IntersectionObserver((entries) => { - entries.forEach((ent) => { - if (ent.isIntersecting) { + for (const entry of entries) { + if (entry.isIntersecting) { cbkFn(); this._isnObserver.unobserve(el); } - }); + } }, opts); this._isnObserver.observe(el); if (!this._observed) { @@ -82,9 +82,9 @@ export class ImgConfig extends BaseComponent { destroyCallback() { super.destroyCallback(); if (this._isnObserver) { - this._observed.forEach((el) => { + for (const el of this._observed) { this._isnObserver.unobserve(el); - }); + } this._isnObserver = null; } Data.deleteCtx(this); diff --git a/blocks/Modal/Modal.js b/blocks/Modal/Modal.js index 1f06eb5c4..141b6a5e8 100644 --- a/blocks/Modal/Modal.js +++ b/blocks/Modal/Modal.js @@ -64,7 +64,7 @@ export class Modal extends Block { this.ref.dialog.addEventListener('mouseup', this._handleDialogMouseUp); } else { this.setAttribute('dialog-fallback', ''); - let backdrop = document.createElement('div'); + const backdrop = document.createElement('div'); backdrop.className = 'backdrop'; this.appendChild(backdrop); backdrop.addEventListener('click', this._handleBackdropClick); diff --git a/blocks/ProgressBarCommon/ProgressBarCommon.js b/blocks/ProgressBarCommon/ProgressBarCommon.js index 19f8945f1..8a41325ea 100644 --- a/blocks/ProgressBarCommon/ProgressBarCommon.js +++ b/blocks/ProgressBarCommon/ProgressBarCommon.js @@ -13,8 +13,8 @@ export class ProgressBarCommon extends UploaderBlock { super.initCallback(); /** @private */ this._unobserveCollection = this.uploadCollection.observeProperties(() => { - let anyUploading = this.uploadCollection.items().some((id) => { - let item = this.uploadCollection.read(id); + const anyUploading = this.uploadCollection.items().some((id) => { + const item = this.uploadCollection.read(id); return item.getValue('isUploading'); }); diff --git a/blocks/Range/Range.js b/blocks/Range/Range.js index 3c89a4f07..4e39577ca 100644 --- a/blocks/Range/Range.js +++ b/blocks/Range/Range.js @@ -8,7 +8,7 @@ export class Range extends BaseComponent { onChange: (e) => { e.preventDefault(); e.stopPropagation(); - this.$.value = parseFloat(this._range.value); + this.$.value = Number.parseFloat(this._range.value); this.dispatchEvent(new Event('change')); }, }; @@ -17,14 +17,14 @@ export class Range extends BaseComponent { super.initCallback(); /** @type {HTMLInputElement} */ this._range = this.ref.range; - [...this.attributes].forEach((attr) => { - let exclude = ['style', 'ref']; + for (const attr of this.attributes) { + const exclude = ['style', 'ref']; if (!exclude.includes(attr.name)) { this.ref.range.setAttribute(attr.name, attr.value); } - }); + } this.sub('value', (val) => { - let pcnt = (val / 100) * 100; + const pcnt = (val / 100) * 100; this.$.cssLeft = `${pcnt}%`; }); this.defineAccessor('value', (val) => { diff --git a/blocks/Select/Select.js b/blocks/Select/Select.js index ad3c149a6..3af9dd81c 100644 --- a/blocks/Select/Select.js +++ b/blocks/Select/Select.js @@ -12,7 +12,7 @@ export class Select extends Block { this.value = this.ref.select.value; this.$.currentText = this.$.options.find((opt) => { - return opt.value == this.value; + return opt.value === this.value; })?.text || ''; this.dispatchEvent(new Event('change')); }, @@ -24,9 +24,11 @@ export class Select extends Block { this.sub('options', (/** @type {{ text: String; value: String }[]} */ options) => { this.$.currentText = options?.[0]?.text || ''; let html = ''; - options?.forEach((opt) => { - html += /* HTML */ ``; - }); + if (options) { + for (const opt of options) { + html += /* HTML */ ``; + } + } this.$.selectHtml = html; }); } diff --git a/blocks/SourceBtn/SourceBtn.js b/blocks/SourceBtn/SourceBtn.js index c0c514cee..ddab47bfc 100644 --- a/blocks/SourceBtn/SourceBtn.js +++ b/blocks/SourceBtn/SourceBtn.js @@ -1,6 +1,6 @@ // @ts-check -import { UploaderBlock } from '../../abstract/UploaderBlock.js'; import { ActivityBlock } from '../../abstract/ActivityBlock.js'; +import { UploaderBlock } from '../../abstract/UploaderBlock.js'; const L10N_PREFIX = 'src-type-'; @@ -65,7 +65,7 @@ export class SourceBtn extends UploaderBlock { icon: 'edit-draw', }); - for (let externalSourceType of Object.values(UploaderBlock.extSrcList)) { + for (const externalSourceType of Object.values(UploaderBlock.extSrcList)) { this.registerType({ type: externalSourceType, activity: ActivityBlock.activities.EXTERNAL, @@ -120,7 +120,7 @@ export class SourceBtn extends UploaderBlock { applyType(type) { const configType = this._registeredTypes[type]; if (!configType) { - console.warn('Unsupported source type: ' + type); + console.warn(`Unsupported source type: ${type}`); return; } const { textKey = type, icon = type } = configType; diff --git a/blocks/SourceList/SourceList.js b/blocks/SourceList/SourceList.js index cde4080f5..9b082c999 100644 --- a/blocks/SourceList/SourceList.js +++ b/blocks/SourceList/SourceList.js @@ -5,11 +5,11 @@ export class SourceList extends Block { initCallback() { super.initCallback(); this.subConfigValue('sourceList', (/** @type {String} */ val) => { - let list = stringToArray(val); + const list = stringToArray(val); let html = ''; - list.forEach((srcName) => { + for (const srcName of list) { html += /* HTML */ ``; - }); + } if (this.cfg.sourceListWrap) { this.innerHTML = html; } else { diff --git a/blocks/StartFrom/StartFrom.js b/blocks/StartFrom/StartFrom.js index 18ac4a098..cb5587a8d 100644 --- a/blocks/StartFrom/StartFrom.js +++ b/blocks/StartFrom/StartFrom.js @@ -1,8 +1,9 @@ +// @ts-check import { ActivityBlock } from '../../abstract/ActivityBlock.js'; export class StartFrom extends ActivityBlock { historyTracked = true; - /** @type {import('../../abstract/ActivityBlock.js').ActivityType} */ + /** @type {NonNullable} */ activityType = 'start-from'; initCallback() { @@ -11,4 +12,4 @@ export class StartFrom extends ActivityBlock { } } -StartFrom.template = /* HTML */ `
`; +StartFrom.template = /* HTML */ `
`; diff --git a/blocks/UrlSource/UrlSource.js b/blocks/UrlSource/UrlSource.js index d71d79008..f98e89f9e 100644 --- a/blocks/UrlSource/UrlSource.js +++ b/blocks/UrlSource/UrlSource.js @@ -1,5 +1,5 @@ -import { UploaderBlock } from '../../abstract/UploaderBlock.js'; import { ActivityBlock } from '../../abstract/ActivityBlock.js'; +import { UploaderBlock } from '../../abstract/UploaderBlock.js'; import { UploadSource } from '../utils/UploadSource.js'; export class UrlSource extends UploaderBlock { @@ -12,7 +12,7 @@ export class UrlSource extends UploaderBlock { onUpload: (e) => { e.preventDefault(); - let url = this.ref.input['value']; + const url = this.ref.input.value; this.addFileFromUrl(url, { source: UploadSource.URL_TAB }); this.$['*currentActivity'] = ActivityBlock.activities.UPLOAD_LIST; }, @@ -20,7 +20,7 @@ export class UrlSource extends UploaderBlock { this.historyBack(); }, onInput: (e) => { - let value = /** @type {HTMLInputElement} */ (e.target).value; + const value = /** @type {HTMLInputElement} */ (e.target).value; this.set$({ importDisabled: !value }); }, }; @@ -29,7 +29,7 @@ export class UrlSource extends UploaderBlock { super.initCallback(); this.registerActivity(this.activityType, { onActivate: () => { - this.ref.input['value'] = ''; + this.ref.input.value = ''; this.ref.input.focus(); }, }); diff --git a/blocks/svg-backgrounds/svg-backgrounds.js b/blocks/svg-backgrounds/svg-backgrounds.js index 042fc17c9..9f04c22ef 100644 --- a/blocks/svg-backgrounds/svg-backgrounds.js +++ b/blocks/svg-backgrounds/svg-backgrounds.js @@ -3,7 +3,7 @@ * @returns {String} */ function createSvgBlobUrl(svg) { - let blob = new Blob([svg], { + const blob = new Blob([svg], { type: 'image/svg+xml', }); return URL.createObjectURL(blob); diff --git a/blocks/utils/resizeImage.js b/blocks/utils/resizeImage.js index 17ba1d9aa..29c4e7741 100644 --- a/blocks/utils/resizeImage.js +++ b/blocks/utils/resizeImage.js @@ -6,12 +6,12 @@ export function generateThumb(imgFile, size = 40) { if (imgFile.type === 'image/svg+xml') { return URL.createObjectURL(imgFile); } - let canvas = document.createElement('canvas'); - let ctx = canvas.getContext('2d'); - let img = new Image(); - let promise = new Promise((resolve, reject) => { + const canvas = document.createElement('canvas'); + const ctx = canvas.getContext('2d'); + const img = new Image(); + const promise = new Promise((resolve, reject) => { img.onload = () => { - let ratio = img.height / img.width; + const ratio = img.height / img.width; if (ratio > 1) { canvas.width = size; canvas.height = size * ratio; @@ -27,7 +27,7 @@ export function generateThumb(imgFile, size = 40) { reject(); return; } - let url = URL.createObjectURL(blob); + const url = URL.createObjectURL(blob); resolve(url); }); }; diff --git a/blocks/utils/userAgent.js b/blocks/utils/userAgent.js index d879072a0..4ee1508ea 100644 --- a/blocks/utils/userAgent.js +++ b/blocks/utils/userAgent.js @@ -1,5 +1,5 @@ import { getUserAgent } from '@uploadcare/upload-client'; -import { PACKAGE_VERSION, PACKAGE_NAME } from '../../env.js'; +import { PACKAGE_NAME, PACKAGE_VERSION } from '../../env.js'; /** * @param {import('@uploadcare/upload-client').CustomUserAgentOptions} options diff --git a/build-ssr-stubs.js b/build-ssr-stubs.js index 0c382c729..43d731ab3 100644 --- a/build-ssr-stubs.js +++ b/build-ssr-stubs.js @@ -1,4 +1,4 @@ -import { writeFileSync } from 'fs'; +import { writeFileSync } from 'node:fs'; import { GlobalRegistrator } from '@happy-dom/global-registrator'; import prettier from 'prettier'; @@ -22,16 +22,17 @@ const getClassStaticProperties = (klass) => { if (proto === HTMLElement || proto === HTMLElement.prototype) { return; } - Object.getOwnPropertyNames(proto) - .filter((name) => { - const isPublic = !name.startsWith('_'); - const isOwn = !['arguments', 'prototype', 'caller', 'constructor', 'name', 'length'].includes(name); - const isDefined = isOwn && !!proto[name]; - return isPublic && isOwn && isDefined; - }) - .forEach((name) => { + + for (const name of Object.getOwnPropertyNames(proto)) { + const isPublic = !name.startsWith('_'); + const isOwn = !['arguments', 'prototype', 'caller', 'constructor', 'name', 'length'].includes(name); + const isDefined = isOwn && !!proto[name]; + + if (isPublic && isOwn && isDefined) { extractedProperties[name] = proto[name]; - }); + } + } + extract(Object.getPrototypeOf(proto)); }; extract(klass); diff --git a/build-svg-sprite.js b/build-svg-sprite.js index 64d3580f1..2c5da84fe 100644 --- a/build-svg-sprite.js +++ b/build-svg-sprite.js @@ -1,7 +1,7 @@ -import fs from 'fs'; -import path from 'path'; +import fs from 'node:fs'; +import path from 'node:path'; +import url from 'node:url'; import SVGSpriter from 'svg-sprite'; -import url from 'url'; const __dirname = url.fileURLToPath(new URL('.', import.meta.url)); @@ -50,7 +50,7 @@ const spriter = new SVGSpriter(config); console.log('Generating SVG sprite...'); -DATA.forEach((item) => { +for (const item of DATA) { fs.readdir(item.input, (err, files) => { if (err) { throw err; @@ -58,11 +58,11 @@ DATA.forEach((item) => { console.log(`Processing ${item.input}...`); - files.forEach((file) => { + for (const file of files) { const filePath = path.resolve(item.input, file); console.log(`Icon processed: ${filePath}`); spriter.add(filePath, null, fs.readFileSync(filePath, { encoding: 'utf-8' })); - }); + } spriter.compile((error, result) => { if (error) { @@ -74,4 +74,4 @@ DATA.forEach((item) => { fs.writeFileSync(item.output, jsTemplate); }); }); -}); +} diff --git a/build.js b/build.js index 3200297e9..92cf60098 100644 --- a/build.js +++ b/build.js @@ -1,24 +1,19 @@ // @ts-check +import fs from 'node:fs'; +import path, { dirname } from 'node:path'; +import { fileURLToPath } from 'node:url'; import esbuild from 'esbuild'; -import fs from 'fs'; -import path, { dirname } from 'path'; -import { fileURLToPath } from 'url'; import { buildItems } from './build-items.js'; -let __dirname = dirname(fileURLToPath(import.meta.url)); -let packageRootPath = __dirname; +const __dirname = dirname(fileURLToPath(import.meta.url)); +const packageRootPath = __dirname; function jsBanner() { - let license = fs.readFileSync(path.join(packageRootPath, './LICENSE')).toString(); - return ( - '/**\n' + - ' * @license\n' + - license - .split('\n') - .map((line) => ` * ${line}`) - .join('\n') + - '\n */' - ); + const license = fs.readFileSync(path.join(packageRootPath, './LICENSE')).toString(); + return `/**\n * @license\n${license + .split('\n') + .map((line) => ` * ${line}`) + .join('\n')}\n */`; } /** @param {import('./build-items.js').BuildItem} buildItem */ @@ -42,13 +37,13 @@ function build(buildItem) { if (!buildItem.minifyHtml) { return; } - let js = fs.readFileSync(buildItem.out).toString(); + const js = fs.readFileSync(buildItem.out).toString(); /** @param {string} str */ - let checkIfHtml = (str) => { + const checkIfHtml = (str) => { return str.includes('<') && (str.includes('')); }; /** @param {string} ch */ - let processChunk = (ch) => { + const processChunk = (ch) => { if (checkIfHtml(ch)) { let htmlMin = ch.split('\n').join(' '); while (htmlMin.includes(' ')) { @@ -59,7 +54,7 @@ function build(buildItem) { } return ch; }; - let result = js + const result = js .split('`') .map((chunk) => processChunk(chunk)) .join('`') @@ -70,6 +65,6 @@ function build(buildItem) { }); } -for (let buildItem of buildItems) { +for (const buildItem of buildItems) { build(buildItem); } diff --git a/demo/preview-proxy/secure-delivery-proxy.js b/demo/preview-proxy/secure-delivery-proxy.js index 4847ad689..03541ec74 100644 --- a/demo/preview-proxy/secure-delivery-proxy.js +++ b/demo/preview-proxy/secure-delivery-proxy.js @@ -1,20 +1,20 @@ -import http from 'http'; +import http from 'node:http'; const PORT = 3000; http - .createServer(function (request, response) { + .createServer((request, response) => { if (request.method !== 'GET') { return response.end('Only GET requests are supported'); } - let url = new URL(request.url, `http://localhost:${PORT}`); - let path = url.pathname.replace(/([^\/])$/, '$1/'); + const url = new URL(request.url, `http://localhost:${PORT}`); + const path = url.pathname.replace(/([^\/])$/, '$1/'); if (path !== '/preview/') { return response.end('Only `/preview/` path is supported'); } - let searchParams = url.searchParams; - let fileUrl = searchParams.get('url'); - let size = searchParams.get('size'); + const searchParams = url.searchParams; + const fileUrl = searchParams.get('url'); + const size = searchParams.get('size'); console.log(`Got request. Url: "${fileUrl}". Size: "${size}"`); if (!fileUrl) { return response.end('`url` parameter is required'); diff --git a/index.js b/index.js index 567a644dd..7ebce2c3b 100644 --- a/index.js +++ b/index.js @@ -47,5 +47,4 @@ export { toKebabCase } from './utils/toKebabCase.js'; export * from './env.js'; -// eslint-disable-next-line import/export export * from './types/index.js'; diff --git a/package-lock.json b/package-lock.json index 7b3cc16b3..3018ca15f 100644 --- a/package-lock.json +++ b/package-lock.json @@ -15,8 +15,8 @@ "keyux": "^0.7.1" }, "devDependencies": { - "@babel/eslint-parser": "^7.23.3", "@babel/preset-env": "^7.21.4", + "@biomejs/biome": "^1.8.2", "@esm-bundle/chai": "^4.3.4-fix.0", "@happy-dom/global-registrator": "^9.8.4", "@jam-do/jam-tools": "^0.0.4", @@ -28,9 +28,6 @@ "@web/dev-server": "^0.1.38", "@web/test-runner": "^0.15.3", "esbuild": "^0.19.9", - "eslint": "^8.56.0", - "eslint-config-prettier": "^9.1.0", - "eslint-plugin-import": "^2.29.1", "highlight.js": "^11.7.0", "husky": "^8.0.3", "lint-staged": "^13.2.1", @@ -76,15 +73,6 @@ "node": ">=12.17" } }, - "node_modules/@aashutoshrathi/word-wrap": { - "version": "1.2.6", - "resolved": "https://registry.npmjs.org/@aashutoshrathi/word-wrap/-/word-wrap-1.2.6.tgz", - "integrity": "sha512-1Yjs2SvM8TflER/OD3cOjhWWOZb58A2t7wpE2S9XfBYTiIl+XFhQG2bjy4Pu1I+EAlCNUzRDYDdFwFYUKvXcIA==", - "dev": true, - "engines": { - "node": ">=0.10.0" - } - }, "node_modules/@ampproject/remapping": { "version": "2.1.2", "resolved": "https://registry.npmjs.org/@ampproject/remapping/-/remapping-2.1.2.tgz", @@ -150,33 +138,6 @@ "url": "https://opencollective.com/babel" } }, - "node_modules/@babel/eslint-parser": { - "version": "7.23.3", - "resolved": "https://registry.npmjs.org/@babel/eslint-parser/-/eslint-parser-7.23.3.tgz", - "integrity": "sha512-9bTuNlyx7oSstodm1cR1bECj4fkiknsDa1YniISkJemMY3DGhJNYBECbe6QD/q54mp2J8VO66jW3/7uP//iFCw==", - "dev": true, - "dependencies": { - "@nicolo-ribaudo/eslint-scope-5-internals": "5.1.1-v1", - "eslint-visitor-keys": "^2.1.0", - "semver": "^6.3.1" - }, - "engines": { - "node": "^10.13.0 || ^12.13.0 || >=14.0.0" - }, - "peerDependencies": { - "@babel/core": "^7.11.0", - "eslint": "^7.5.0 || ^8.0.0" - } - }, - "node_modules/@babel/eslint-parser/node_modules/semver": { - "version": "6.3.1", - "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.1.tgz", - "integrity": "sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA==", - "dev": true, - "bin": { - "semver": "bin/semver.js" - } - }, "node_modules/@babel/generator": { "version": "7.21.4", "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.21.4.tgz", @@ -1722,6 +1683,161 @@ "node": ">=6.9.0" } }, + "node_modules/@biomejs/biome": { + "version": "1.8.2", + "resolved": "https://registry.npmjs.org/@biomejs/biome/-/biome-1.8.2.tgz", + "integrity": "sha512-XafCzLgs0xbH0bCjYKxQ63ig2V86fZQMq1jiy5pyLToWk9aHxA8GAUxyBtklPHtPYZPGEPOYglQHj4jyfUp+Iw==", + "dev": true, + "hasInstallScript": true, + "bin": { + "biome": "bin/biome" + }, + "engines": { + "node": ">=14.21.3" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/biome" + }, + "optionalDependencies": { + "@biomejs/cli-darwin-arm64": "1.8.2", + "@biomejs/cli-darwin-x64": "1.8.2", + "@biomejs/cli-linux-arm64": "1.8.2", + "@biomejs/cli-linux-arm64-musl": "1.8.2", + "@biomejs/cli-linux-x64": "1.8.2", + "@biomejs/cli-linux-x64-musl": "1.8.2", + "@biomejs/cli-win32-arm64": "1.8.2", + "@biomejs/cli-win32-x64": "1.8.2" + } + }, + "node_modules/@biomejs/cli-darwin-arm64": { + "version": "1.8.2", + "resolved": "https://registry.npmjs.org/@biomejs/cli-darwin-arm64/-/cli-darwin-arm64-1.8.2.tgz", + "integrity": "sha512-l9msLsTcSIAPqMsPIhodQmb50sEfaXPLQ0YW4cdj6INmd8iaOh/V9NceQb2366vACTJgcWDQ2RzlvURek1T68g==", + "cpu": [ + "arm64" + ], + "dev": true, + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">=14.21.3" + } + }, + "node_modules/@biomejs/cli-darwin-x64": { + "version": "1.8.2", + "resolved": "https://registry.npmjs.org/@biomejs/cli-darwin-x64/-/cli-darwin-x64-1.8.2.tgz", + "integrity": "sha512-Fc4y/FuIxRSiB3TJ+y27vFDE/HJt4QgBuymktsIKEcBZvnKfsRjxvzVDunccRn4xbKgepnp+fn6BoS+ZIg/I3Q==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">=14.21.3" + } + }, + "node_modules/@biomejs/cli-linux-arm64": { + "version": "1.8.2", + "resolved": "https://registry.npmjs.org/@biomejs/cli-linux-arm64/-/cli-linux-arm64-1.8.2.tgz", + "integrity": "sha512-Q99qwP0qibkZxm2kfnt37OxeIlliDYf5ogi3zX9ij2DULzc+KtPA9Uj0wCljcJofOBsBYaHc7597Q+Bf/251ww==", + "cpu": [ + "arm64" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=14.21.3" + } + }, + "node_modules/@biomejs/cli-linux-arm64-musl": { + "version": "1.8.2", + "resolved": "https://registry.npmjs.org/@biomejs/cli-linux-arm64-musl/-/cli-linux-arm64-musl-1.8.2.tgz", + "integrity": "sha512-WpT41QJJvkZa1eZq0WmD513zkC6AYaMI39HJKmKeiUeX2NZirG+bxv1YRDhqkns1NbBqo3+qrJqBkPmOW+xAVA==", + "cpu": [ + "arm64" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=14.21.3" + } + }, + "node_modules/@biomejs/cli-linux-x64": { + "version": "1.8.2", + "resolved": "https://registry.npmjs.org/@biomejs/cli-linux-x64/-/cli-linux-x64-1.8.2.tgz", + "integrity": "sha512-bjhhUVFchFid2gOjrvBe4fg8BShcpyFQTHuB/QQnfGxs1ddrGP30yq3fHfc6S6MoCcz9Tjd3Zzq1EfWfyy5iHA==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=14.21.3" + } + }, + "node_modules/@biomejs/cli-linux-x64-musl": { + "version": "1.8.2", + "resolved": "https://registry.npmjs.org/@biomejs/cli-linux-x64-musl/-/cli-linux-x64-musl-1.8.2.tgz", + "integrity": "sha512-rk1Wj4d3LIlAlIAS1m2jlyfOjkNbuY1lfwKvWIAeZC51yDMzwhRD7cReE5PE+jqLDtq60PX38hDPeKd7nA1S6A==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=14.21.3" + } + }, + "node_modules/@biomejs/cli-win32-arm64": { + "version": "1.8.2", + "resolved": "https://registry.npmjs.org/@biomejs/cli-win32-arm64/-/cli-win32-arm64-1.8.2.tgz", + "integrity": "sha512-EUbqmCmNWT5xhnxHrCAEBzJB1AnLqxTYoRjlxiCMzGvsy5jQzhCanJ8CT9kNsApW3pfPWBWkoTa7qrwWmwnEGA==", + "cpu": [ + "arm64" + ], + "dev": true, + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=14.21.3" + } + }, + "node_modules/@biomejs/cli-win32-x64": { + "version": "1.8.2", + "resolved": "https://registry.npmjs.org/@biomejs/cli-win32-x64/-/cli-win32-x64-1.8.2.tgz", + "integrity": "sha512-n9H5oRUCk1uNezMgyJh9+hZdtfD8PXLLeq8DUzTycIhl0I1BulIoZ/uxWgRVDFDwAR1JHu1AykISCRFNGnc4iA==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=14.21.3" + } + }, "node_modules/@colors/colors": { "version": "1.6.0", "resolved": "https://registry.npmjs.org/@colors/colors/-/colors-1.6.0.tgz", @@ -2156,101 +2272,6 @@ "node": ">=12" } }, - "node_modules/@eslint-community/eslint-utils": { - "version": "4.4.0", - "resolved": "https://registry.npmjs.org/@eslint-community/eslint-utils/-/eslint-utils-4.4.0.tgz", - "integrity": "sha512-1/sA4dwrzBAyeUoQ6oxahHKmrZvsnLCg4RfxW3ZFGGmQkSNQPFNLV9CUEFQP1x9EYXHTo5p6xdhZM1Ne9p/AfA==", - "dev": true, - "dependencies": { - "eslint-visitor-keys": "^3.3.0" - }, - "engines": { - "node": "^12.22.0 || ^14.17.0 || >=16.0.0" - }, - "peerDependencies": { - "eslint": "^6.0.0 || ^7.0.0 || >=8.0.0" - } - }, - "node_modules/@eslint-community/eslint-utils/node_modules/eslint-visitor-keys": { - "version": "3.4.0", - "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-3.4.0.tgz", - "integrity": "sha512-HPpKPUBQcAsZOsHAFwTtIKcYlCje62XB7SEAcxjtmW6TD1WVpkS6i6/hOVtTZIl4zGj/mBqpFVGvaDneik+VoQ==", - "dev": true, - "engines": { - "node": "^12.22.0 || ^14.17.0 || >=16.0.0" - }, - "funding": { - "url": "https://opencollective.com/eslint" - } - }, - "node_modules/@eslint-community/regexpp": { - "version": "4.10.0", - "resolved": "https://registry.npmjs.org/@eslint-community/regexpp/-/regexpp-4.10.0.tgz", - "integrity": "sha512-Cu96Sd2By9mCNTx2iyKOmq10v22jUVQv0lQnlGNy16oE9589yE+QADPbrMGCkA51cKZSg3Pu/aTJVTGfL/qjUA==", - "dev": true, - "engines": { - "node": "^12.0.0 || ^14.0.0 || >=16.0.0" - } - }, - "node_modules/@eslint/eslintrc": { - "version": "2.1.4", - "resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-2.1.4.tgz", - "integrity": "sha512-269Z39MS6wVJtsoUl10L60WdkhJVdPG24Q4eZTH3nnF6lpvSShEK3wQjDX9JRWAUPvPh7COouPpU9IrqaZFvtQ==", - "dev": true, - "dependencies": { - "ajv": "^6.12.4", - "debug": "^4.3.2", - "espree": "^9.6.0", - "globals": "^13.19.0", - "ignore": "^5.2.0", - "import-fresh": "^3.2.1", - "js-yaml": "^4.1.0", - "minimatch": "^3.1.2", - "strip-json-comments": "^3.1.1" - }, - "engines": { - "node": "^12.22.0 || ^14.17.0 || >=16.0.0" - }, - "funding": { - "url": "https://opencollective.com/eslint" - } - }, - "node_modules/@eslint/eslintrc/node_modules/globals": { - "version": "13.24.0", - "resolved": "https://registry.npmjs.org/globals/-/globals-13.24.0.tgz", - "integrity": "sha512-AhO5QUcj8llrbG09iWhPU2B204J1xnPeL8kQmVorSsy+Sjj1sk8gIyh6cUocGmH4L0UuhAJy+hJMRA4mgA4mFQ==", - "dev": true, - "dependencies": { - "type-fest": "^0.20.2" - }, - "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/@eslint/eslintrc/node_modules/type-fest": { - "version": "0.20.2", - "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.20.2.tgz", - "integrity": "sha512-Ne+eE4r0/iWnpAxD852z3A+N0Bt5RN//NjJwRd2VFHEmrywxf5vsZlh4R6lixl6B+wz/8d+maTSAkN1FIkI3LQ==", - "dev": true, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/@eslint/js": { - "version": "8.56.0", - "resolved": "https://registry.npmjs.org/@eslint/js/-/js-8.56.0.tgz", - "integrity": "sha512-gMsVel9D7f2HLkBma9VbtzZRehRogVRfbr++f06nL2vnCGCNlzOD+/MUov/F4p8myyAHspEhVobgjpX64q5m6A==", - "dev": true, - "engines": { - "node": "^12.22.0 || ^14.17.0 || >=16.0.0" - } - }, "node_modules/@esm-bundle/chai": { "version": "4.3.4-fix.0", "resolved": "https://registry.npmjs.org/@esm-bundle/chai/-/chai-4.3.4-fix.0.tgz", @@ -2269,39 +2290,6 @@ "happy-dom": "^9.8.4" } }, - "node_modules/@humanwhocodes/config-array": { - "version": "0.11.13", - "resolved": "https://registry.npmjs.org/@humanwhocodes/config-array/-/config-array-0.11.13.tgz", - "integrity": "sha512-JSBDMiDKSzQVngfRjOdFXgFfklaXI4K9nLF49Auh21lmBWRLIK3+xTErTWD4KU54pb6coM6ESE7Awz/FNU3zgQ==", - "dev": true, - "dependencies": { - "@humanwhocodes/object-schema": "^2.0.1", - "debug": "^4.1.1", - "minimatch": "^3.0.5" - }, - "engines": { - "node": ">=10.10.0" - } - }, - "node_modules/@humanwhocodes/module-importer": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/@humanwhocodes/module-importer/-/module-importer-1.0.1.tgz", - "integrity": "sha512-bxveV4V8v5Yb4ncFTT3rPSgZBOpCkjfK0y4oVVVJwIuDVBRMDXrPyXRL988i5ap9m9bnyEEjWfm5WkBmtffLfA==", - "dev": true, - "engines": { - "node": ">=12.22" - }, - "funding": { - "type": "github", - "url": "https://github.com/sponsors/nzakas" - } - }, - "node_modules/@humanwhocodes/object-schema": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/@humanwhocodes/object-schema/-/object-schema-2.0.1.tgz", - "integrity": "sha512-dvuCeX5fC9dXgJn9t+X5atfmgQAzUOWqS1254Gh0m6i8wKd10ebXkfNKiRK+1GWi/yTvvLDHpoxLr0xxxeslWw==", - "dev": true - }, "node_modules/@hutson/parse-repository-url": { "version": "3.0.2", "resolved": "https://registry.npmjs.org/@hutson/parse-repository-url/-/parse-repository-url-3.0.2.tgz", @@ -2377,15 +2365,6 @@ "@jridgewell/sourcemap-codec": "1.4.14" } }, - "node_modules/@nicolo-ribaudo/eslint-scope-5-internals": { - "version": "5.1.1-v1", - "resolved": "https://registry.npmjs.org/@nicolo-ribaudo/eslint-scope-5-internals/-/eslint-scope-5-internals-5.1.1-v1.tgz", - "integrity": "sha512-54/JRvkLIzzDWshCWfuhadfrfZVPiElY8Fcgmg1HroEly/EDSszzhBAsarCux+D/kOslTRquNzuyGSmUSTTHGg==", - "dev": true, - "dependencies": { - "eslint-scope": "5.1.1" - } - }, "node_modules/@nodelib/fs.scandir": { "version": "2.1.5", "resolved": "https://registry.npmjs.org/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz", @@ -3205,12 +3184,6 @@ "integrity": "sha512-U3PUjAudAdJBeC2pgN8uTIKgxrb4nlDF3SF0++EldXQvQBGkpFZMSnwQiIoDU77tv45VgNkl/L4ouD+rEomujw==", "dev": true }, - "node_modules/@types/json5": { - "version": "0.0.29", - "resolved": "https://registry.npmjs.org/@types/json5/-/json5-0.0.29.tgz", - "integrity": "sha512-dRLjCWHYg4oaA77cxO64oO+7JwCwnIzkZPdrrC71jQmQtlhM556pwKo5bUzqvZndkVbeFLIIi+9TC40JNF5hNQ==", - "dev": true - }, "node_modules/@types/keygrip": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/@types/keygrip/-/keygrip-1.0.2.tgz", @@ -3384,12 +3357,6 @@ "@types/node": "*" } }, - "node_modules/@ungap/structured-clone": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/@ungap/structured-clone/-/structured-clone-1.2.0.tgz", - "integrity": "sha512-zuVdFrMJiuCDQUMCzQaD6KL28MjnqqN8XnAqiEq9PNm/hCPTSGfrXCOfwj1ow4LFb/tNymJPwsNbVePc1xFqrQ==", - "dev": true - }, "node_modules/@uploadcare/image-shrink": { "version": "6.14.1", "resolved": "https://registry.npmjs.org/@uploadcare/image-shrink/-/image-shrink-6.14.1.tgz", @@ -3788,27 +3755,6 @@ "node": ">= 0.6" } }, - "node_modules/acorn": { - "version": "8.11.3", - "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.11.3.tgz", - "integrity": "sha512-Y9rRfJG5jcKOE0CLisYbojUjIrIEE7AGMzA/Sm4BslANhbS+cDMpgBdcPT91oJ7OuJ9hYJBx59RjbhxVnrF8Xg==", - "dev": true, - "bin": { - "acorn": "bin/acorn" - }, - "engines": { - "node": ">=0.4.0" - } - }, - "node_modules/acorn-jsx": { - "version": "5.3.2", - "resolved": "https://registry.npmjs.org/acorn-jsx/-/acorn-jsx-5.3.2.tgz", - "integrity": "sha512-rq9s+JNhf0IChjtDXxllJ7g41oZk5SlXtp0LHwyA5cejwn7vKmKp4pPri6YEePv2PU65sAsegbXtIinmDFDXgQ==", - "dev": true, - "peerDependencies": { - "acorn": "^6.0.0 || ^7.0.0 || ^8.0.0" - } - }, "node_modules/add-stream": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/add-stream/-/add-stream-1.0.0.tgz", @@ -3840,22 +3786,6 @@ "node": ">=8" } }, - "node_modules/ajv": { - "version": "6.12.6", - "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.6.tgz", - "integrity": "sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g==", - "dev": true, - "dependencies": { - "fast-deep-equal": "^3.1.1", - "fast-json-stable-stringify": "^2.0.0", - "json-schema-traverse": "^0.4.1", - "uri-js": "^4.2.2" - }, - "funding": { - "type": "github", - "url": "https://github.com/sponsors/epoberezkin" - } - }, "node_modules/ansi-escapes": { "version": "4.3.2", "resolved": "https://registry.npmjs.org/ansi-escapes/-/ansi-escapes-4.3.2.tgz", @@ -3945,25 +3875,6 @@ "integrity": "sha1-nlKHYrSpBmrRY6aWKjZEGOlibs4=", "dev": true }, - "node_modules/array-includes": { - "version": "3.1.7", - "resolved": "https://registry.npmjs.org/array-includes/-/array-includes-3.1.7.tgz", - "integrity": "sha512-dlcsNBIiWhPkHdOEEKnehA+RNUWDc4UqFtnIXU4uuYDPtA4LDkr7qip2p0VvFAEXNDr0yWZ9PJyIRiGjRLQzwQ==", - "dev": true, - "dependencies": { - "call-bind": "^1.0.2", - "define-properties": "^1.2.0", - "es-abstract": "^1.22.1", - "get-intrinsic": "^1.2.1", - "is-string": "^1.0.7" - }, - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, "node_modules/array-union": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/array-union/-/array-union-2.1.0.tgz", @@ -3973,74 +3884,19 @@ "node": ">=8" } }, - "node_modules/array.prototype.findlastindex": { - "version": "1.2.3", - "resolved": "https://registry.npmjs.org/array.prototype.findlastindex/-/array.prototype.findlastindex-1.2.3.tgz", - "integrity": "sha512-LzLoiOMAxvy+Gd3BAq3B7VeIgPdo+Q8hthvKtXybMvRV0jrXfJM/t8mw7nNlpEcVlVUnCnM2KSX4XU5HmpodOA==", + "node_modules/arraybuffer.prototype.slice": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/arraybuffer.prototype.slice/-/arraybuffer.prototype.slice-1.0.2.tgz", + "integrity": "sha512-yMBKppFur/fbHu9/6USUe03bZ4knMYiwFBcyiaXB8Go0qNehwX6inYPzK9U0NeQvGxKthcmHcaR8P5MStSRBAw==", "dev": true, "dependencies": { + "array-buffer-byte-length": "^1.0.0", "call-bind": "^1.0.2", "define-properties": "^1.2.0", "es-abstract": "^1.22.1", - "es-shim-unscopables": "^1.0.0", - "get-intrinsic": "^1.2.1" - }, - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/array.prototype.flat": { - "version": "1.3.2", - "resolved": "https://registry.npmjs.org/array.prototype.flat/-/array.prototype.flat-1.3.2.tgz", - "integrity": "sha512-djYB+Zx2vLewY8RWlNCUdHjDXs2XOgm602S9E7P/UpHgfeHL00cRiIF+IN/G/aUJ7kGPb6yO/ErDI5V2s8iycA==", - "dev": true, - "dependencies": { - "call-bind": "^1.0.2", - "define-properties": "^1.2.0", - "es-abstract": "^1.22.1", - "es-shim-unscopables": "^1.0.0" - }, - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/array.prototype.flatmap": { - "version": "1.3.2", - "resolved": "https://registry.npmjs.org/array.prototype.flatmap/-/array.prototype.flatmap-1.3.2.tgz", - "integrity": "sha512-Ewyx0c9PmpcsByhSW4r+9zDU7sGjFc86qf/kKtuSCRdhfbk0SNLLkaT5qvcHnRGgc5NP/ly/y+qkXkqONX54CQ==", - "dev": true, - "dependencies": { - "call-bind": "^1.0.2", - "define-properties": "^1.2.0", - "es-abstract": "^1.22.1", - "es-shim-unscopables": "^1.0.0" - }, - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/arraybuffer.prototype.slice": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/arraybuffer.prototype.slice/-/arraybuffer.prototype.slice-1.0.2.tgz", - "integrity": "sha512-yMBKppFur/fbHu9/6USUe03bZ4knMYiwFBcyiaXB8Go0qNehwX6inYPzK9U0NeQvGxKthcmHcaR8P5MStSRBAw==", - "dev": true, - "dependencies": { - "array-buffer-byte-length": "^1.0.0", - "call-bind": "^1.0.2", - "define-properties": "^1.2.0", - "es-abstract": "^1.22.1", - "get-intrinsic": "^1.2.1", - "is-array-buffer": "^3.0.2", - "is-shared-array-buffer": "^1.0.2" + "get-intrinsic": "^1.2.1", + "is-array-buffer": "^3.0.2", + "is-shared-array-buffer": "^1.0.2" }, "engines": { "node": ">= 0.4" @@ -5494,12 +5350,6 @@ "integrity": "sha1-9dJgKStmDghO/0zbyfCK0yR0SLU=", "dev": true }, - "node_modules/deep-is": { - "version": "0.1.4", - "resolved": "https://registry.npmjs.org/deep-is/-/deep-is-0.1.4.tgz", - "integrity": "sha512-oIPzksmTg4/MriiaYGO+okXDT7ztn/w3Eptv/+gSIdMdKsJo0u4CfYNFJPy+4SKMuCqGw2wxnA+URMg3t8a/bQ==", - "dev": true - }, "node_modules/deepmerge": { "version": "4.2.2", "resolved": "https://registry.npmjs.org/deepmerge/-/deepmerge-4.2.2.tgz", @@ -5654,18 +5504,6 @@ "node": ">=8" } }, - "node_modules/doctrine": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/doctrine/-/doctrine-3.0.0.tgz", - "integrity": "sha512-yS+Q5i3hBf7GBkd4KG8a7eBNNWNGLTaEwwYWUijIYM7zrlYDM0BFXHjjPWlWZ1Rg7UaddZeIDmi9jF3HmqiQ2w==", - "dev": true, - "dependencies": { - "esutils": "^2.0.2" - }, - "engines": { - "node": ">=6.0.0" - } - }, "node_modules/dom-serializer": { "version": "1.4.1", "resolved": "https://registry.npmjs.org/dom-serializer/-/dom-serializer-1.4.1.tgz", @@ -5912,15 +5750,6 @@ "node": ">= 0.4" } }, - "node_modules/es-shim-unscopables": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/es-shim-unscopables/-/es-shim-unscopables-1.0.2.tgz", - "integrity": "sha512-J3yBRXCzDu4ULnQwxyToo/OjdMx6akgVC7K6few0a7F/0wLtmKKN7I73AH5T2836UuXRqN7Qg+IIUw/+YJksRw==", - "dev": true, - "dependencies": { - "hasown": "^2.0.0" - } - }, "node_modules/es-to-primitive": { "version": "1.2.1", "resolved": "https://registry.npmjs.org/es-to-primitive/-/es-to-primitive-1.2.1.tgz", @@ -5999,73 +5828,6 @@ "node": ">=0.8.0" } }, - "node_modules/eslint": { - "version": "8.56.0", - "resolved": "https://registry.npmjs.org/eslint/-/eslint-8.56.0.tgz", - "integrity": "sha512-Go19xM6T9puCOWntie1/P997aXxFsOi37JIHRWI514Hc6ZnaHGKY9xFhrU65RT6CcBEzZoGG1e6Nq+DT04ZtZQ==", - "dev": true, - "dependencies": { - "@eslint-community/eslint-utils": "^4.2.0", - "@eslint-community/regexpp": "^4.6.1", - "@eslint/eslintrc": "^2.1.4", - "@eslint/js": "8.56.0", - "@humanwhocodes/config-array": "^0.11.13", - "@humanwhocodes/module-importer": "^1.0.1", - "@nodelib/fs.walk": "^1.2.8", - "@ungap/structured-clone": "^1.2.0", - "ajv": "^6.12.4", - "chalk": "^4.0.0", - "cross-spawn": "^7.0.2", - "debug": "^4.3.2", - "doctrine": "^3.0.0", - "escape-string-regexp": "^4.0.0", - "eslint-scope": "^7.2.2", - "eslint-visitor-keys": "^3.4.3", - "espree": "^9.6.1", - "esquery": "^1.4.2", - "esutils": "^2.0.2", - "fast-deep-equal": "^3.1.3", - "file-entry-cache": "^6.0.1", - "find-up": "^5.0.0", - "glob-parent": "^6.0.2", - "globals": "^13.19.0", - "graphemer": "^1.4.0", - "ignore": "^5.2.0", - "imurmurhash": "^0.1.4", - "is-glob": "^4.0.0", - "is-path-inside": "^3.0.3", - "js-yaml": "^4.1.0", - "json-stable-stringify-without-jsonify": "^1.0.1", - "levn": "^0.4.1", - "lodash.merge": "^4.6.2", - "minimatch": "^3.1.2", - "natural-compare": "^1.4.0", - "optionator": "^0.9.3", - "strip-ansi": "^6.0.1", - "text-table": "^0.2.0" - }, - "bin": { - "eslint": "bin/eslint.js" - }, - "engines": { - "node": "^12.22.0 || ^14.17.0 || >=16.0.0" - }, - "funding": { - "url": "https://opencollective.com/eslint" - } - }, - "node_modules/eslint-config-prettier": { - "version": "9.1.0", - "resolved": "https://registry.npmjs.org/eslint-config-prettier/-/eslint-config-prettier-9.1.0.tgz", - "integrity": "sha512-NSWl5BFQWEPi1j4TjVNItzYV7dZXZ+wP6I6ZhrBGpChQhZRUaElihE9uRRkcbRnNb76UMKDF3r+WTmNcGPKsqw==", - "dev": true, - "bin": { - "eslint-config-prettier": "bin/cli.js" - }, - "peerDependencies": { - "eslint": ">=7.0.0" - } - }, "node_modules/eslint-formatter-pretty": { "version": "4.1.0", "resolved": "https://registry.npmjs.org/eslint-formatter-pretty/-/eslint-formatter-pretty-4.1.0.tgz", @@ -6171,588 +5933,160 @@ "node": ">=8" } }, - "node_modules/eslint-import-resolver-node": { - "version": "0.3.9", - "resolved": "https://registry.npmjs.org/eslint-import-resolver-node/-/eslint-import-resolver-node-0.3.9.tgz", - "integrity": "sha512-WFj2isz22JahUv+B788TlO3N6zL3nNJGU8CcZbPZvVEkBPaJdCV4vy5wyghty5ROFbCRnm132v8BScu5/1BQ8g==", + "node_modules/eslint-rule-docs": { + "version": "1.1.235", + "resolved": "https://registry.npmjs.org/eslint-rule-docs/-/eslint-rule-docs-1.1.235.tgz", + "integrity": "sha512-+TQ+x4JdTnDoFEXXb3fDvfGOwnyNV7duH8fXWTPD1ieaBmB8omj7Gw/pMBBu4uI2uJCCU8APDaQJzWuXnTsH4A==", + "dev": true + }, + "node_modules/esm": { + "version": "3.2.25", + "resolved": "https://registry.npmjs.org/esm/-/esm-3.2.25.tgz", + "integrity": "sha512-U1suiZ2oDVWv4zPO56S0NcR5QriEahGtdN2OR6FiOG4WJvcjBVFB0qI4+eKoWFH483PKGuLuu6V8Z4T5g63UVA==", "dev": true, - "dependencies": { - "debug": "^3.2.7", - "is-core-module": "^2.13.0", - "resolve": "^1.22.4" + "engines": { + "node": ">=6" } }, - "node_modules/eslint-import-resolver-node/node_modules/debug": { - "version": "3.2.7", - "resolved": "https://registry.npmjs.org/debug/-/debug-3.2.7.tgz", - "integrity": "sha512-CFjzYYAi4ThfiQvizrFQevTTXHtnCqWfe7x1AhgEscTz6ZbLbfoLRLPugTQyBth6f8ZERVUSyWHFD/7Wu4t1XQ==", + "node_modules/estree-walker": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/estree-walker/-/estree-walker-1.0.1.tgz", + "integrity": "sha512-1fMXF3YP4pZZVozF8j/ZLfvnR8NSIljt56UhbZ5PeeDmmGHpgpdwQt7ITlGvYaQukCvuBRMLEiKiYC+oeIg4cg==", + "dev": true + }, + "node_modules/esutils": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/esutils/-/esutils-2.0.3.tgz", + "integrity": "sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g==", "dev": true, - "dependencies": { - "ms": "^2.1.1" + "engines": { + "node": ">=0.10.0" } }, - "node_modules/eslint-module-utils": { - "version": "2.8.0", - "resolved": "https://registry.npmjs.org/eslint-module-utils/-/eslint-module-utils-2.8.0.tgz", - "integrity": "sha512-aWajIYfsqCKRDgUfjEXNN/JlrzauMuSEy5sbd7WXbtW3EH6A6MpwEh42c7qD+MqQo9QMJ6fWLAeIJynx0g6OAw==", + "node_modules/etag": { + "version": "1.8.1", + "resolved": "https://registry.npmjs.org/etag/-/etag-1.8.1.tgz", + "integrity": "sha1-Qa4u62XvpiJorr/qg6x9eSmbCIc=", "dev": true, - "dependencies": { - "debug": "^3.2.7" - }, "engines": { - "node": ">=4" - }, - "peerDependenciesMeta": { - "eslint": { - "optional": true - } + "node": ">= 0.6" } }, - "node_modules/eslint-module-utils/node_modules/debug": { - "version": "3.2.7", - "resolved": "https://registry.npmjs.org/debug/-/debug-3.2.7.tgz", - "integrity": "sha512-CFjzYYAi4ThfiQvizrFQevTTXHtnCqWfe7x1AhgEscTz6ZbLbfoLRLPugTQyBth6f8ZERVUSyWHFD/7Wu4t1XQ==", + "node_modules/execa": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/execa/-/execa-1.0.0.tgz", + "integrity": "sha512-adbxcyWV46qiHyvSp50TKt05tB4tK3HcmF7/nxfAdhnox83seTDbwnaqKO4sXRy7roHAIFqJP/Rw/AuEbX61LA==", "dev": true, "dependencies": { - "ms": "^2.1.1" + "cross-spawn": "^6.0.0", + "get-stream": "^4.0.0", + "is-stream": "^1.1.0", + "npm-run-path": "^2.0.0", + "p-finally": "^1.0.0", + "signal-exit": "^3.0.0", + "strip-eof": "^1.0.0" + }, + "engines": { + "node": ">=6" } }, - "node_modules/eslint-plugin-import": { - "version": "2.29.1", - "resolved": "https://registry.npmjs.org/eslint-plugin-import/-/eslint-plugin-import-2.29.1.tgz", - "integrity": "sha512-BbPC0cuExzhiMo4Ff1BTVwHpjjv28C5R+btTOGaCRC7UEz801up0JadwkeSk5Ued6TG34uaczuVuH6qyy5YUxw==", + "node_modules/execa/node_modules/cross-spawn": { + "version": "6.0.5", + "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-6.0.5.tgz", + "integrity": "sha512-eTVLrBSt7fjbDygz805pMnstIs2VTBNkRm0qxZd+M7A5XDdxVRWO5MxGBXZhjY4cqLYLdtrGqRf8mBPmzwSpWQ==", "dev": true, "dependencies": { - "array-includes": "^3.1.7", - "array.prototype.findlastindex": "^1.2.3", - "array.prototype.flat": "^1.3.2", - "array.prototype.flatmap": "^1.3.2", - "debug": "^3.2.7", - "doctrine": "^2.1.0", - "eslint-import-resolver-node": "^0.3.9", - "eslint-module-utils": "^2.8.0", - "hasown": "^2.0.0", - "is-core-module": "^2.13.1", - "is-glob": "^4.0.3", - "minimatch": "^3.1.2", - "object.fromentries": "^2.0.7", - "object.groupby": "^1.0.1", - "object.values": "^1.1.7", - "semver": "^6.3.1", - "tsconfig-paths": "^3.15.0" + "nice-try": "^1.0.4", + "path-key": "^2.0.1", + "semver": "^5.5.0", + "shebang-command": "^1.2.0", + "which": "^1.2.9" }, "engines": { - "node": ">=4" - }, - "peerDependencies": { - "eslint": "^2 || ^3 || ^4 || ^5 || ^6 || ^7.2.0 || ^8" + "node": ">=4.8" } }, - "node_modules/eslint-plugin-import/node_modules/debug": { - "version": "3.2.7", - "resolved": "https://registry.npmjs.org/debug/-/debug-3.2.7.tgz", - "integrity": "sha512-CFjzYYAi4ThfiQvizrFQevTTXHtnCqWfe7x1AhgEscTz6ZbLbfoLRLPugTQyBth6f8ZERVUSyWHFD/7Wu4t1XQ==", + "node_modules/execa/node_modules/get-stream": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-4.1.0.tgz", + "integrity": "sha512-GMat4EJ5161kIy2HevLlr4luNjBgvmj413KaQA7jt4V8B4RDsfpHk7WQ9GVqfYyyx8OS/L66Kox+rJRNklLK7w==", "dev": true, "dependencies": { - "ms": "^2.1.1" + "pump": "^3.0.0" + }, + "engines": { + "node": ">=6" } }, - "node_modules/eslint-plugin-import/node_modules/doctrine": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/doctrine/-/doctrine-2.1.0.tgz", - "integrity": "sha512-35mSku4ZXK0vfCuHEDAwt55dg2jNajHZ1odvF+8SSr82EsZY4QmXfuWso8oEd8zRhVObSN18aM0CjSdoBX7zIw==", + "node_modules/execa/node_modules/is-stream": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-1.1.0.tgz", + "integrity": "sha1-EtSj3U5o4Lec6428hBc66A2RykQ=", "dev": true, - "dependencies": { - "esutils": "^2.0.2" - }, "engines": { "node": ">=0.10.0" } }, - "node_modules/eslint-plugin-import/node_modules/semver": { - "version": "6.3.1", - "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.1.tgz", - "integrity": "sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA==", + "node_modules/execa/node_modules/path-key": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/path-key/-/path-key-2.0.1.tgz", + "integrity": "sha1-QRyttXTFoUDTpLGRDUDYDMn0C0A=", + "dev": true, + "engines": { + "node": ">=4" + } + }, + "node_modules/execa/node_modules/semver": { + "version": "5.7.1", + "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz", + "integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==", "dev": true, "bin": { - "semver": "bin/semver.js" + "semver": "bin/semver" } }, - "node_modules/eslint-rule-docs": { - "version": "1.1.235", - "resolved": "https://registry.npmjs.org/eslint-rule-docs/-/eslint-rule-docs-1.1.235.tgz", - "integrity": "sha512-+TQ+x4JdTnDoFEXXb3fDvfGOwnyNV7duH8fXWTPD1ieaBmB8omj7Gw/pMBBu4uI2uJCCU8APDaQJzWuXnTsH4A==", - "dev": true - }, - "node_modules/eslint-scope": { - "version": "5.1.1", - "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-5.1.1.tgz", - "integrity": "sha512-2NxwbF/hZ0KpepYN0cNbo+FN6XoK7GaHlQhgx/hIZl6Va0bF45RQOOwhLIy8lQDbuCiadSLCBnH2CFYquit5bw==", + "node_modules/execa/node_modules/shebang-command": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-1.2.0.tgz", + "integrity": "sha1-RKrGW2lbAzmJaMOfNj/uXer98eo=", "dev": true, "dependencies": { - "esrecurse": "^4.3.0", - "estraverse": "^4.1.1" + "shebang-regex": "^1.0.0" }, "engines": { - "node": ">=8.0.0" + "node": ">=0.10.0" } }, - "node_modules/eslint-visitor-keys": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-2.1.0.tgz", - "integrity": "sha512-0rSmRBzXgDzIsD6mGdJgevzgezI534Cer5L/vyMX0kHzT/jiB43jRhd9YUlMGYLQy2zprNmoT8qasCGtY+QaKw==", + "node_modules/execa/node_modules/shebang-regex": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-1.0.0.tgz", + "integrity": "sha1-2kL0l0DAtC2yypcoVxyxkMmO/qM=", "dev": true, "engines": { - "node": ">=10" + "node": ">=0.10.0" } }, - "node_modules/eslint/node_modules/ansi-styles": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", - "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", + "node_modules/execa/node_modules/which": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/which/-/which-1.3.1.tgz", + "integrity": "sha512-HxJdYWq1MTIQbJ3nw0cqssHoTNU267KlrDuGZ1WYlxDStUtKUhOaJmh112/TZmHxxUfuJqPXSOm7tDyas0OSIQ==", "dev": true, "dependencies": { - "color-convert": "^2.0.1" - }, - "engines": { - "node": ">=8" + "isexe": "^2.0.0" }, - "funding": { - "url": "https://github.com/chalk/ansi-styles?sponsor=1" + "bin": { + "which": "bin/which" } }, - "node_modules/eslint/node_modules/chalk": { - "version": "4.1.2", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", - "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", + "node_modules/external-editor": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/external-editor/-/external-editor-3.1.0.tgz", + "integrity": "sha512-hMQ4CX1p1izmuLYyZqLMO/qGNw10wSv9QDCPfzXfyFrOaCSSoRfqE1Kf1s5an66J5JZC62NewG+mK49jOCtQew==", "dev": true, "dependencies": { - "ansi-styles": "^4.1.0", - "supports-color": "^7.1.0" - }, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/chalk/chalk?sponsor=1" - } - }, - "node_modules/eslint/node_modules/color-convert": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", - "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", - "dev": true, - "dependencies": { - "color-name": "~1.1.4" - }, - "engines": { - "node": ">=7.0.0" - } - }, - "node_modules/eslint/node_modules/color-name": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", - "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", - "dev": true - }, - "node_modules/eslint/node_modules/escape-string-regexp": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz", - "integrity": "sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA==", - "dev": true, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/eslint/node_modules/eslint-scope": { - "version": "7.2.2", - "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-7.2.2.tgz", - "integrity": "sha512-dOt21O7lTMhDM+X9mB4GX+DZrZtCUJPL/wlcTqxyrx5IvO0IYtILdtrQGQp+8n5S0gwSVmOf9NQrjMOgfQZlIg==", - "dev": true, - "dependencies": { - "esrecurse": "^4.3.0", - "estraverse": "^5.2.0" - }, - "engines": { - "node": "^12.22.0 || ^14.17.0 || >=16.0.0" - }, - "funding": { - "url": "https://opencollective.com/eslint" - } - }, - "node_modules/eslint/node_modules/eslint-visitor-keys": { - "version": "3.4.3", - "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-3.4.3.tgz", - "integrity": "sha512-wpc+LXeiyiisxPlEkUzU6svyS1frIO3Mgxj1fdy7Pm8Ygzguax2N3Fa/D/ag1WqbOprdI+uY6wMUl8/a2G+iag==", - "dev": true, - "engines": { - "node": "^12.22.0 || ^14.17.0 || >=16.0.0" - }, - "funding": { - "url": "https://opencollective.com/eslint" - } - }, - "node_modules/eslint/node_modules/estraverse": { - "version": "5.3.0", - "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-5.3.0.tgz", - "integrity": "sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA==", - "dev": true, - "engines": { - "node": ">=4.0" - } - }, - "node_modules/eslint/node_modules/find-up": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/find-up/-/find-up-5.0.0.tgz", - "integrity": "sha512-78/PXT1wlLLDgTzDs7sjq9hzz0vXD+zn+7wypEe4fXQxCmdmqfGsEPQxmiCSQI3ajFV91bVSsvNtrJRiW6nGng==", - "dev": true, - "dependencies": { - "locate-path": "^6.0.0", - "path-exists": "^4.0.0" - }, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/eslint/node_modules/glob-parent": { - "version": "6.0.2", - "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-6.0.2.tgz", - "integrity": "sha512-XxwI8EOhVQgWp6iDL+3b0r86f4d6AX6zSU55HfB4ydCEuXLXc5FcYeOu+nnGftS4TEju/11rt4KJPTMgbfmv4A==", - "dev": true, - "dependencies": { - "is-glob": "^4.0.3" - }, - "engines": { - "node": ">=10.13.0" - } - }, - "node_modules/eslint/node_modules/globals": { - "version": "13.20.0", - "resolved": "https://registry.npmjs.org/globals/-/globals-13.20.0.tgz", - "integrity": "sha512-Qg5QtVkCy/kv3FUSlu4ukeZDVf9ee0iXLAUYX13gbR17bnejFTzr4iS9bY7kwCf1NztRNm1t91fjOiyx4CSwPQ==", - "dev": true, - "dependencies": { - "type-fest": "^0.20.2" - }, - "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/eslint/node_modules/has-flag": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", - "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", - "dev": true, - "engines": { - "node": ">=8" - } - }, - "node_modules/eslint/node_modules/locate-path": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-6.0.0.tgz", - "integrity": "sha512-iPZK6eYjbxRu3uB4/WZ3EsEIMJFMqAoopl3R+zuq0UjcAm/MO6KCweDgPfP3elTztoKP3KtnVHxTn2NHBSDVUw==", - "dev": true, - "dependencies": { - "p-locate": "^5.0.0" - }, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/eslint/node_modules/p-limit": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-3.1.0.tgz", - "integrity": "sha512-TYOanM3wGwNGsZN2cVTYPArw454xnXj5qmWF1bEoAc4+cU/ol7GVh7odevjp1FNHduHc3KZMcFduxU5Xc6uJRQ==", - "dev": true, - "dependencies": { - "yocto-queue": "^0.1.0" - }, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/eslint/node_modules/p-locate": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-5.0.0.tgz", - "integrity": "sha512-LaNjtRWUBY++zB5nE/NwcaoMylSPk+S+ZHNB1TzdbMJMny6dynpAGt7X/tl/QYq3TIeE6nxHppbo2LGymrG5Pw==", - "dev": true, - "dependencies": { - "p-limit": "^3.0.2" - }, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/eslint/node_modules/supports-color": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", - "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", - "dev": true, - "dependencies": { - "has-flag": "^4.0.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/eslint/node_modules/type-fest": { - "version": "0.20.2", - "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.20.2.tgz", - "integrity": "sha512-Ne+eE4r0/iWnpAxD852z3A+N0Bt5RN//NjJwRd2VFHEmrywxf5vsZlh4R6lixl6B+wz/8d+maTSAkN1FIkI3LQ==", - "dev": true, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/esm": { - "version": "3.2.25", - "resolved": "https://registry.npmjs.org/esm/-/esm-3.2.25.tgz", - "integrity": "sha512-U1suiZ2oDVWv4zPO56S0NcR5QriEahGtdN2OR6FiOG4WJvcjBVFB0qI4+eKoWFH483PKGuLuu6V8Z4T5g63UVA==", - "dev": true, - "engines": { - "node": ">=6" - } - }, - "node_modules/espree": { - "version": "9.6.1", - "resolved": "https://registry.npmjs.org/espree/-/espree-9.6.1.tgz", - "integrity": "sha512-oruZaFkjorTpF32kDSI5/75ViwGeZginGGy2NoOSg3Q9bnwlnmDm4HLnkl0RE3n+njDXR037aY1+x58Z/zFdwQ==", - "dev": true, - "dependencies": { - "acorn": "^8.9.0", - "acorn-jsx": "^5.3.2", - "eslint-visitor-keys": "^3.4.1" - }, - "engines": { - "node": "^12.22.0 || ^14.17.0 || >=16.0.0" - }, - "funding": { - "url": "https://opencollective.com/eslint" - } - }, - "node_modules/espree/node_modules/eslint-visitor-keys": { - "version": "3.4.3", - "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-3.4.3.tgz", - "integrity": "sha512-wpc+LXeiyiisxPlEkUzU6svyS1frIO3Mgxj1fdy7Pm8Ygzguax2N3Fa/D/ag1WqbOprdI+uY6wMUl8/a2G+iag==", - "dev": true, - "engines": { - "node": "^12.22.0 || ^14.17.0 || >=16.0.0" - }, - "funding": { - "url": "https://opencollective.com/eslint" - } - }, - "node_modules/esquery": { - "version": "1.5.0", - "resolved": "https://registry.npmjs.org/esquery/-/esquery-1.5.0.tgz", - "integrity": "sha512-YQLXUplAwJgCydQ78IMJywZCceoqk1oH01OERdSAJc/7U2AylwjhSCLDEtqwg811idIS/9fIU5GjG73IgjKMVg==", - "dev": true, - "dependencies": { - "estraverse": "^5.1.0" - }, - "engines": { - "node": ">=0.10" - } - }, - "node_modules/esquery/node_modules/estraverse": { - "version": "5.3.0", - "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-5.3.0.tgz", - "integrity": "sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA==", - "dev": true, - "engines": { - "node": ">=4.0" - } - }, - "node_modules/esrecurse": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/esrecurse/-/esrecurse-4.3.0.tgz", - "integrity": "sha512-KmfKL3b6G+RXvP8N1vr3Tq1kL/oCFgn2NYXEtqP8/L3pKapUA4G8cFVaoF3SU323CD4XypR/ffioHmkti6/Tag==", - "dev": true, - "dependencies": { - "estraverse": "^5.2.0" - }, - "engines": { - "node": ">=4.0" - } - }, - "node_modules/esrecurse/node_modules/estraverse": { - "version": "5.3.0", - "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-5.3.0.tgz", - "integrity": "sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA==", - "dev": true, - "engines": { - "node": ">=4.0" - } - }, - "node_modules/estraverse": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-4.3.0.tgz", - "integrity": "sha512-39nnKffWz8xN1BU/2c79n9nB9HDzo0niYUqx6xyqUnyoAnQyyWpOTdZEeiCch8BBu515t4wp9ZmgVfVhn9EBpw==", - "dev": true, - "engines": { - "node": ">=4.0" - } - }, - "node_modules/estree-walker": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/estree-walker/-/estree-walker-1.0.1.tgz", - "integrity": "sha512-1fMXF3YP4pZZVozF8j/ZLfvnR8NSIljt56UhbZ5PeeDmmGHpgpdwQt7ITlGvYaQukCvuBRMLEiKiYC+oeIg4cg==", - "dev": true - }, - "node_modules/esutils": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/esutils/-/esutils-2.0.3.tgz", - "integrity": "sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g==", - "dev": true, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/etag": { - "version": "1.8.1", - "resolved": "https://registry.npmjs.org/etag/-/etag-1.8.1.tgz", - "integrity": "sha1-Qa4u62XvpiJorr/qg6x9eSmbCIc=", - "dev": true, - "engines": { - "node": ">= 0.6" - } - }, - "node_modules/execa": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/execa/-/execa-1.0.0.tgz", - "integrity": "sha512-adbxcyWV46qiHyvSp50TKt05tB4tK3HcmF7/nxfAdhnox83seTDbwnaqKO4sXRy7roHAIFqJP/Rw/AuEbX61LA==", - "dev": true, - "dependencies": { - "cross-spawn": "^6.0.0", - "get-stream": "^4.0.0", - "is-stream": "^1.1.0", - "npm-run-path": "^2.0.0", - "p-finally": "^1.0.0", - "signal-exit": "^3.0.0", - "strip-eof": "^1.0.0" - }, - "engines": { - "node": ">=6" - } - }, - "node_modules/execa/node_modules/cross-spawn": { - "version": "6.0.5", - "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-6.0.5.tgz", - "integrity": "sha512-eTVLrBSt7fjbDygz805pMnstIs2VTBNkRm0qxZd+M7A5XDdxVRWO5MxGBXZhjY4cqLYLdtrGqRf8mBPmzwSpWQ==", - "dev": true, - "dependencies": { - "nice-try": "^1.0.4", - "path-key": "^2.0.1", - "semver": "^5.5.0", - "shebang-command": "^1.2.0", - "which": "^1.2.9" - }, - "engines": { - "node": ">=4.8" - } - }, - "node_modules/execa/node_modules/get-stream": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-4.1.0.tgz", - "integrity": "sha512-GMat4EJ5161kIy2HevLlr4luNjBgvmj413KaQA7jt4V8B4RDsfpHk7WQ9GVqfYyyx8OS/L66Kox+rJRNklLK7w==", - "dev": true, - "dependencies": { - "pump": "^3.0.0" - }, - "engines": { - "node": ">=6" - } - }, - "node_modules/execa/node_modules/is-stream": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-1.1.0.tgz", - "integrity": "sha1-EtSj3U5o4Lec6428hBc66A2RykQ=", - "dev": true, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/execa/node_modules/path-key": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/path-key/-/path-key-2.0.1.tgz", - "integrity": "sha1-QRyttXTFoUDTpLGRDUDYDMn0C0A=", - "dev": true, - "engines": { - "node": ">=4" - } - }, - "node_modules/execa/node_modules/semver": { - "version": "5.7.1", - "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz", - "integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==", - "dev": true, - "bin": { - "semver": "bin/semver" - } - }, - "node_modules/execa/node_modules/shebang-command": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-1.2.0.tgz", - "integrity": "sha1-RKrGW2lbAzmJaMOfNj/uXer98eo=", - "dev": true, - "dependencies": { - "shebang-regex": "^1.0.0" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/execa/node_modules/shebang-regex": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-1.0.0.tgz", - "integrity": "sha1-2kL0l0DAtC2yypcoVxyxkMmO/qM=", - "dev": true, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/execa/node_modules/which": { - "version": "1.3.1", - "resolved": "https://registry.npmjs.org/which/-/which-1.3.1.tgz", - "integrity": "sha512-HxJdYWq1MTIQbJ3nw0cqssHoTNU267KlrDuGZ1WYlxDStUtKUhOaJmh112/TZmHxxUfuJqPXSOm7tDyas0OSIQ==", - "dev": true, - "dependencies": { - "isexe": "^2.0.0" - }, - "bin": { - "which": "bin/which" - } - }, - "node_modules/external-editor": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/external-editor/-/external-editor-3.1.0.tgz", - "integrity": "sha512-hMQ4CX1p1izmuLYyZqLMO/qGNw10wSv9QDCPfzXfyFrOaCSSoRfqE1Kf1s5an66J5JZC62NewG+mK49jOCtQew==", - "dev": true, - "dependencies": { - "chardet": "^0.7.0", - "iconv-lite": "^0.4.24", - "tmp": "^0.0.33" + "chardet": "^0.7.0", + "iconv-lite": "^0.4.24", + "tmp": "^0.0.33" }, "engines": { "node": ">=4" @@ -6815,18 +6149,6 @@ "node": ">=8.6.0" } }, - "node_modules/fast-json-stable-stringify": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz", - "integrity": "sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw==", - "dev": true - }, - "node_modules/fast-levenshtein": { - "version": "2.0.6", - "resolved": "https://registry.npmjs.org/fast-levenshtein/-/fast-levenshtein-2.0.6.tgz", - "integrity": "sha512-DCXu6Ifhqcks7TZKY3Hxp3y6qphY5SJZmrWMDrKcERSOXWQdMhU9Ig/PYrzyw/ul9jOIyh0N4M0tbC5hodg8dw==", - "dev": true - }, "node_modules/fastest-levenshtein": { "version": "1.0.16", "resolved": "https://registry.npmjs.org/fastest-levenshtein/-/fastest-levenshtein-1.0.16.tgz", @@ -7415,12 +6737,6 @@ "integrity": "sha512-NtNxqUcXgpW2iMrfqSfR73Glt39K+BLwWsPs94yR63v45T0Wbej7eRmL5cWfwEgqXnmjQp3zaJTshdRW/qC2ZQ==", "dev": true }, - "node_modules/graphemer": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/graphemer/-/graphemer-1.4.0.tgz", - "integrity": "sha512-EtKwoO6kxCL9WO5xipiHTZlSzBm7WLT627TqC/uVRd0HKmq8NXyebnNYxDoBi7wt8eTWrUrKXCOVaFq9x1kgag==", - "dev": true - }, "node_modules/handlebars": { "version": "4.7.7", "resolved": "https://registry.npmjs.org/handlebars/-/handlebars-4.7.7.tgz", @@ -8184,15 +7500,6 @@ "node": ">=8" } }, - "node_modules/is-path-inside": { - "version": "3.0.3", - "resolved": "https://registry.npmjs.org/is-path-inside/-/is-path-inside-3.0.3.tgz", - "integrity": "sha512-Fd4gABb+ycGAmKou8eMftCupSir5lRxqf4aD/vd0cD2qc4HL07OjCeuHMr8Ro4CoMaeCKDB0/ECBOVWjTwUvPQ==", - "dev": true, - "engines": { - "node": ">=8" - } - }, "node_modules/is-plain-obj": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/is-plain-obj/-/is-plain-obj-1.1.0.tgz", @@ -8655,18 +7962,6 @@ "integrity": "sha512-xyFwyhro/JEof6Ghe2iz2NcXoj2sloNsWr/XsERDK/oiPCfaNhl5ONfp+jQdAZRQQ0IJWNzH9zIZF7li91kh2w==", "dev": true }, - "node_modules/json-schema-traverse": { - "version": "0.4.1", - "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz", - "integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==", - "dev": true - }, - "node_modules/json-stable-stringify-without-jsonify": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/json-stable-stringify-without-jsonify/-/json-stable-stringify-without-jsonify-1.0.1.tgz", - "integrity": "sha1-nbe1lJatPzz+8wp1FC0tkwrXJlE=", - "dev": true - }, "node_modules/json-stringify-safe": { "version": "5.0.1", "resolved": "https://registry.npmjs.org/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz", @@ -8862,19 +8157,6 @@ "integrity": "sha512-Xq9nH7KlWZmXAtodXDDRE7vs6DU1gTU8zYDHDiWLSip45Egwq3plLHzPn27NgvzL2r1LMPC1vdqh98sQxtqj4A==", "dev": true }, - "node_modules/levn": { - "version": "0.4.1", - "resolved": "https://registry.npmjs.org/levn/-/levn-0.4.1.tgz", - "integrity": "sha512-+bT2uH4E5LGE7h/n3evcS/sQlJXCpIp6ym8OWJ5eV6+67Dsql/LaaT7qJBAt2rzfoa/5QBGBhxDix1dMt2kQKQ==", - "dev": true, - "dependencies": { - "prelude-ls": "^1.2.1", - "type-check": "~0.4.0" - }, - "engines": { - "node": ">= 0.8.0" - } - }, "node_modules/lighthouse-logger": { "version": "1.3.0", "resolved": "https://registry.npmjs.org/lighthouse-logger/-/lighthouse-logger-1.3.0.tgz", @@ -10294,12 +9576,6 @@ "node": "^10 || ^12 || ^13.7 || ^14 || >=15.0.1" } }, - "node_modules/natural-compare": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/natural-compare/-/natural-compare-1.4.0.tgz", - "integrity": "sha1-Sr6/7tdUHywnrPspvbvRXI1bpPc=", - "dev": true - }, "node_modules/negotiator": { "version": "0.6.3", "resolved": "https://registry.npmjs.org/negotiator/-/negotiator-0.6.3.tgz", @@ -10627,52 +9903,6 @@ "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/object.fromentries": { - "version": "2.0.7", - "resolved": "https://registry.npmjs.org/object.fromentries/-/object.fromentries-2.0.7.tgz", - "integrity": "sha512-UPbPHML6sL8PI/mOqPwsH4G6iyXcCGzLin8KvEPenOZN5lpCNBZZQ+V62vdjB1mQHrmqGQt5/OJzemUA+KJmEA==", - "dev": true, - "dependencies": { - "call-bind": "^1.0.2", - "define-properties": "^1.2.0", - "es-abstract": "^1.22.1" - }, - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/object.groupby": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/object.groupby/-/object.groupby-1.0.1.tgz", - "integrity": "sha512-HqaQtqLnp/8Bn4GL16cj+CUYbnpe1bh0TtEaWvybszDG4tgxCJuRpV8VGuvNaI1fAnI4lUJzDG55MXcOH4JZcQ==", - "dev": true, - "dependencies": { - "call-bind": "^1.0.2", - "define-properties": "^1.2.0", - "es-abstract": "^1.22.1", - "get-intrinsic": "^1.2.1" - } - }, - "node_modules/object.values": { - "version": "1.1.7", - "resolved": "https://registry.npmjs.org/object.values/-/object.values-1.1.7.tgz", - "integrity": "sha512-aU6xnDFYT3x17e/f0IiiwlGPTy2jzMySGfUB4fq6z7CV8l85CWHDk5ErhyhpfDHhrOMwGFhSQkhMGHaIotA6Ng==", - "dev": true, - "dependencies": { - "call-bind": "^1.0.2", - "define-properties": "^1.2.0", - "es-abstract": "^1.22.1" - }, - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, "node_modules/on-finished": { "version": "2.4.1", "resolved": "https://registry.npmjs.org/on-finished/-/on-finished-2.4.1.tgz", @@ -10741,23 +9971,6 @@ "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/optionator": { - "version": "0.9.3", - "resolved": "https://registry.npmjs.org/optionator/-/optionator-0.9.3.tgz", - "integrity": "sha512-JjCoypp+jKn1ttEFExxhetCKeJt9zhAgAve5FXHixTvFDW/5aEktX9bufBKLRRMdU7bNtpLfcGu94B3cdEJgjg==", - "dev": true, - "dependencies": { - "@aashutoshrathi/word-wrap": "^1.2.3", - "deep-is": "^0.1.3", - "fast-levenshtein": "^2.0.6", - "levn": "^0.4.1", - "prelude-ls": "^1.2.1", - "type-check": "^0.4.0" - }, - "engines": { - "node": ">= 0.8.0" - } - }, "node_modules/os-name": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/os-name/-/os-name-3.1.0.tgz", @@ -11215,15 +10428,6 @@ "integrity": "sha512-1NNCs6uurfkVbeXG4S8JFT9t19m45ICnif8zWLd5oPSZ50QnwMfK+H3jv408d4jw/7Bttv5axS5IiHoLaVNHeQ==", "dev": true }, - "node_modules/prelude-ls": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.2.1.tgz", - "integrity": "sha512-vkcDPrRZo1QZLbn5RLGPpg/WmIQ65qoWWhcGKf/b5eplkkarX0m9z8ppCat4mlOqUsWpyNuYgO3VRyrYHSzX5g==", - "dev": true, - "engines": { - "node": ">= 0.8.0" - } - }, "node_modules/prettier": { "version": "3.2.4", "resolved": "https://registry.npmjs.org/prettier/-/prettier-3.2.4.tgz", @@ -12816,18 +12020,6 @@ "node": ">=8" } }, - "node_modules/strip-json-comments": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-3.1.1.tgz", - "integrity": "sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig==", - "dev": true, - "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, "node_modules/style-search": { "version": "0.1.0", "resolved": "https://registry.npmjs.org/style-search/-/style-search-0.1.0.tgz", @@ -13525,12 +12717,6 @@ "integrity": "sha512-uuVGNWzgJ4yhRaNSiubPY7OjISw4sw4E5Uv0wbjp+OzcbmVU/rsT8ujgcXJhn9ypzsgr5vlzpPqP+MBBKcGvbg==", "dev": true }, - "node_modules/text-table": { - "version": "0.2.0", - "resolved": "https://registry.npmjs.org/text-table/-/text-table-0.2.0.tgz", - "integrity": "sha1-f17oI66AUgfACvLfSoTsP8+lcLQ=", - "dev": true - }, "node_modules/through": { "version": "2.3.8", "resolved": "https://registry.npmjs.org/through/-/through-2.3.8.tgz", @@ -13618,30 +12804,6 @@ "node": ">= 14.0.0" } }, - "node_modules/tsconfig-paths": { - "version": "3.15.0", - "resolved": "https://registry.npmjs.org/tsconfig-paths/-/tsconfig-paths-3.15.0.tgz", - "integrity": "sha512-2Ac2RgzDe/cn48GvOe3M+o82pEFewD3UPbyoUHHdKasHwJKjds4fLXWf/Ux5kATBKN20oaFGu+jbElp1pos0mg==", - "dev": true, - "dependencies": { - "@types/json5": "^0.0.29", - "json5": "^1.0.2", - "minimist": "^1.2.6", - "strip-bom": "^3.0.0" - } - }, - "node_modules/tsconfig-paths/node_modules/json5": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/json5/-/json5-1.0.2.tgz", - "integrity": "sha512-g1MWMLBiz8FKi1e4w0UyVL3w+iJceWAFBAaBnnGKOpNa5f8TLktkbre1+s6oICydWAm+HRUGTmI+//xv2hvXYA==", - "dev": true, - "dependencies": { - "minimist": "^1.2.0" - }, - "bin": { - "json5": "lib/cli.js" - } - }, "node_modules/tsd": { "version": "0.29.0", "resolved": "https://registry.npmjs.org/tsd/-/tsd-0.29.0.tgz", @@ -13804,18 +12966,6 @@ "node": ">=0.6.x" } }, - "node_modules/type-check": { - "version": "0.4.0", - "resolved": "https://registry.npmjs.org/type-check/-/type-check-0.4.0.tgz", - "integrity": "sha512-XleUoc9uwGXqjWwXaUTZAmzMcFZ5858QA2vvx1Ur5xIcixXIP+8LnFDgRplU30us6teqdlskFfu+ae4K79Ooew==", - "dev": true, - "dependencies": { - "prelude-ls": "^1.2.1" - }, - "engines": { - "node": ">= 0.8.0" - } - }, "node_modules/type-detect": { "version": "4.0.8", "resolved": "https://registry.npmjs.org/type-detect/-/type-detect-4.0.8.tgz", @@ -14522,18 +13672,6 @@ "engines": { "node": ">= 4.0.0" } - }, - "node_modules/yocto-queue": { - "version": "0.1.0", - "resolved": "https://registry.npmjs.org/yocto-queue/-/yocto-queue-0.1.0.tgz", - "integrity": "sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q==", - "dev": true, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } } }, "dependencies": { @@ -14555,12 +13693,6 @@ } } }, - "@aashutoshrathi/word-wrap": { - "version": "1.2.6", - "resolved": "https://registry.npmjs.org/@aashutoshrathi/word-wrap/-/word-wrap-1.2.6.tgz", - "integrity": "sha512-1Yjs2SvM8TflER/OD3cOjhWWOZb58A2t7wpE2S9XfBYTiIl+XFhQG2bjy4Pu1I+EAlCNUzRDYDdFwFYUKvXcIA==", - "dev": true - }, "@ampproject/remapping": { "version": "2.1.2", "resolved": "https://registry.npmjs.org/@ampproject/remapping/-/remapping-2.1.2.tgz", @@ -14610,25 +13742,6 @@ "semver": "^6.3.0" } }, - "@babel/eslint-parser": { - "version": "7.23.3", - "resolved": "https://registry.npmjs.org/@babel/eslint-parser/-/eslint-parser-7.23.3.tgz", - "integrity": "sha512-9bTuNlyx7oSstodm1cR1bECj4fkiknsDa1YniISkJemMY3DGhJNYBECbe6QD/q54mp2J8VO66jW3/7uP//iFCw==", - "dev": true, - "requires": { - "@nicolo-ribaudo/eslint-scope-5-internals": "5.1.1-v1", - "eslint-visitor-keys": "^2.1.0", - "semver": "^6.3.1" - }, - "dependencies": { - "semver": { - "version": "6.3.1", - "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.1.tgz", - "integrity": "sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA==", - "dev": true - } - } - }, "@babel/generator": { "version": "7.21.4", "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.21.4.tgz", @@ -15705,6 +14818,78 @@ "to-fast-properties": "^2.0.0" } }, + "@biomejs/biome": { + "version": "1.8.2", + "resolved": "https://registry.npmjs.org/@biomejs/biome/-/biome-1.8.2.tgz", + "integrity": "sha512-XafCzLgs0xbH0bCjYKxQ63ig2V86fZQMq1jiy5pyLToWk9aHxA8GAUxyBtklPHtPYZPGEPOYglQHj4jyfUp+Iw==", + "dev": true, + "requires": { + "@biomejs/cli-darwin-arm64": "1.8.2", + "@biomejs/cli-darwin-x64": "1.8.2", + "@biomejs/cli-linux-arm64": "1.8.2", + "@biomejs/cli-linux-arm64-musl": "1.8.2", + "@biomejs/cli-linux-x64": "1.8.2", + "@biomejs/cli-linux-x64-musl": "1.8.2", + "@biomejs/cli-win32-arm64": "1.8.2", + "@biomejs/cli-win32-x64": "1.8.2" + } + }, + "@biomejs/cli-darwin-arm64": { + "version": "1.8.2", + "resolved": "https://registry.npmjs.org/@biomejs/cli-darwin-arm64/-/cli-darwin-arm64-1.8.2.tgz", + "integrity": "sha512-l9msLsTcSIAPqMsPIhodQmb50sEfaXPLQ0YW4cdj6INmd8iaOh/V9NceQb2366vACTJgcWDQ2RzlvURek1T68g==", + "dev": true, + "optional": true + }, + "@biomejs/cli-darwin-x64": { + "version": "1.8.2", + "resolved": "https://registry.npmjs.org/@biomejs/cli-darwin-x64/-/cli-darwin-x64-1.8.2.tgz", + "integrity": "sha512-Fc4y/FuIxRSiB3TJ+y27vFDE/HJt4QgBuymktsIKEcBZvnKfsRjxvzVDunccRn4xbKgepnp+fn6BoS+ZIg/I3Q==", + "dev": true, + "optional": true + }, + "@biomejs/cli-linux-arm64": { + "version": "1.8.2", + "resolved": "https://registry.npmjs.org/@biomejs/cli-linux-arm64/-/cli-linux-arm64-1.8.2.tgz", + "integrity": "sha512-Q99qwP0qibkZxm2kfnt37OxeIlliDYf5ogi3zX9ij2DULzc+KtPA9Uj0wCljcJofOBsBYaHc7597Q+Bf/251ww==", + "dev": true, + "optional": true + }, + "@biomejs/cli-linux-arm64-musl": { + "version": "1.8.2", + "resolved": "https://registry.npmjs.org/@biomejs/cli-linux-arm64-musl/-/cli-linux-arm64-musl-1.8.2.tgz", + "integrity": "sha512-WpT41QJJvkZa1eZq0WmD513zkC6AYaMI39HJKmKeiUeX2NZirG+bxv1YRDhqkns1NbBqo3+qrJqBkPmOW+xAVA==", + "dev": true, + "optional": true + }, + "@biomejs/cli-linux-x64": { + "version": "1.8.2", + "resolved": "https://registry.npmjs.org/@biomejs/cli-linux-x64/-/cli-linux-x64-1.8.2.tgz", + "integrity": "sha512-bjhhUVFchFid2gOjrvBe4fg8BShcpyFQTHuB/QQnfGxs1ddrGP30yq3fHfc6S6MoCcz9Tjd3Zzq1EfWfyy5iHA==", + "dev": true, + "optional": true + }, + "@biomejs/cli-linux-x64-musl": { + "version": "1.8.2", + "resolved": "https://registry.npmjs.org/@biomejs/cli-linux-x64-musl/-/cli-linux-x64-musl-1.8.2.tgz", + "integrity": "sha512-rk1Wj4d3LIlAlIAS1m2jlyfOjkNbuY1lfwKvWIAeZC51yDMzwhRD7cReE5PE+jqLDtq60PX38hDPeKd7nA1S6A==", + "dev": true, + "optional": true + }, + "@biomejs/cli-win32-arm64": { + "version": "1.8.2", + "resolved": "https://registry.npmjs.org/@biomejs/cli-win32-arm64/-/cli-win32-arm64-1.8.2.tgz", + "integrity": "sha512-EUbqmCmNWT5xhnxHrCAEBzJB1AnLqxTYoRjlxiCMzGvsy5jQzhCanJ8CT9kNsApW3pfPWBWkoTa7qrwWmwnEGA==", + "dev": true, + "optional": true + }, + "@biomejs/cli-win32-x64": { + "version": "1.8.2", + "resolved": "https://registry.npmjs.org/@biomejs/cli-win32-x64/-/cli-win32-x64-1.8.2.tgz", + "integrity": "sha512-n9H5oRUCk1uNezMgyJh9+hZdtfD8PXLLeq8DUzTycIhl0I1BulIoZ/uxWgRVDFDwAR1JHu1AykISCRFNGnc4iA==", + "dev": true, + "optional": true + }, "@colors/colors": { "version": "1.6.0", "resolved": "https://registry.npmjs.org/@colors/colors/-/colors-1.6.0.tgz", @@ -15903,69 +15088,6 @@ "dev": true, "optional": true }, - "@eslint-community/eslint-utils": { - "version": "4.4.0", - "resolved": "https://registry.npmjs.org/@eslint-community/eslint-utils/-/eslint-utils-4.4.0.tgz", - "integrity": "sha512-1/sA4dwrzBAyeUoQ6oxahHKmrZvsnLCg4RfxW3ZFGGmQkSNQPFNLV9CUEFQP1x9EYXHTo5p6xdhZM1Ne9p/AfA==", - "dev": true, - "requires": { - "eslint-visitor-keys": "^3.3.0" - }, - "dependencies": { - "eslint-visitor-keys": { - "version": "3.4.0", - "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-3.4.0.tgz", - "integrity": "sha512-HPpKPUBQcAsZOsHAFwTtIKcYlCje62XB7SEAcxjtmW6TD1WVpkS6i6/hOVtTZIl4zGj/mBqpFVGvaDneik+VoQ==", - "dev": true - } - } - }, - "@eslint-community/regexpp": { - "version": "4.10.0", - "resolved": "https://registry.npmjs.org/@eslint-community/regexpp/-/regexpp-4.10.0.tgz", - "integrity": "sha512-Cu96Sd2By9mCNTx2iyKOmq10v22jUVQv0lQnlGNy16oE9589yE+QADPbrMGCkA51cKZSg3Pu/aTJVTGfL/qjUA==", - "dev": true - }, - "@eslint/eslintrc": { - "version": "2.1.4", - "resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-2.1.4.tgz", - "integrity": "sha512-269Z39MS6wVJtsoUl10L60WdkhJVdPG24Q4eZTH3nnF6lpvSShEK3wQjDX9JRWAUPvPh7COouPpU9IrqaZFvtQ==", - "dev": true, - "requires": { - "ajv": "^6.12.4", - "debug": "^4.3.2", - "espree": "^9.6.0", - "globals": "^13.19.0", - "ignore": "^5.2.0", - "import-fresh": "^3.2.1", - "js-yaml": "^4.1.0", - "minimatch": "^3.1.2", - "strip-json-comments": "^3.1.1" - }, - "dependencies": { - "globals": { - "version": "13.24.0", - "resolved": "https://registry.npmjs.org/globals/-/globals-13.24.0.tgz", - "integrity": "sha512-AhO5QUcj8llrbG09iWhPU2B204J1xnPeL8kQmVorSsy+Sjj1sk8gIyh6cUocGmH4L0UuhAJy+hJMRA4mgA4mFQ==", - "dev": true, - "requires": { - "type-fest": "^0.20.2" - } - }, - "type-fest": { - "version": "0.20.2", - "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.20.2.tgz", - "integrity": "sha512-Ne+eE4r0/iWnpAxD852z3A+N0Bt5RN//NjJwRd2VFHEmrywxf5vsZlh4R6lixl6B+wz/8d+maTSAkN1FIkI3LQ==", - "dev": true - } - } - }, - "@eslint/js": { - "version": "8.56.0", - "resolved": "https://registry.npmjs.org/@eslint/js/-/js-8.56.0.tgz", - "integrity": "sha512-gMsVel9D7f2HLkBma9VbtzZRehRogVRfbr++f06nL2vnCGCNlzOD+/MUov/F4p8myyAHspEhVobgjpX64q5m6A==", - "dev": true - }, "@esm-bundle/chai": { "version": "4.3.4-fix.0", "resolved": "https://registry.npmjs.org/@esm-bundle/chai/-/chai-4.3.4-fix.0.tgz", @@ -15984,29 +15106,6 @@ "happy-dom": "^9.8.4" } }, - "@humanwhocodes/config-array": { - "version": "0.11.13", - "resolved": "https://registry.npmjs.org/@humanwhocodes/config-array/-/config-array-0.11.13.tgz", - "integrity": "sha512-JSBDMiDKSzQVngfRjOdFXgFfklaXI4K9nLF49Auh21lmBWRLIK3+xTErTWD4KU54pb6coM6ESE7Awz/FNU3zgQ==", - "dev": true, - "requires": { - "@humanwhocodes/object-schema": "^2.0.1", - "debug": "^4.1.1", - "minimatch": "^3.0.5" - } - }, - "@humanwhocodes/module-importer": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/@humanwhocodes/module-importer/-/module-importer-1.0.1.tgz", - "integrity": "sha512-bxveV4V8v5Yb4ncFTT3rPSgZBOpCkjfK0y4oVVVJwIuDVBRMDXrPyXRL988i5ap9m9bnyEEjWfm5WkBmtffLfA==", - "dev": true - }, - "@humanwhocodes/object-schema": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/@humanwhocodes/object-schema/-/object-schema-2.0.1.tgz", - "integrity": "sha512-dvuCeX5fC9dXgJn9t+X5atfmgQAzUOWqS1254Gh0m6i8wKd10ebXkfNKiRK+1GWi/yTvvLDHpoxLr0xxxeslWw==", - "dev": true - }, "@hutson/parse-repository-url": { "version": "3.0.2", "resolved": "https://registry.npmjs.org/@hutson/parse-repository-url/-/parse-repository-url-3.0.2.tgz", @@ -16067,15 +15166,6 @@ "@jridgewell/sourcemap-codec": "1.4.14" } }, - "@nicolo-ribaudo/eslint-scope-5-internals": { - "version": "5.1.1-v1", - "resolved": "https://registry.npmjs.org/@nicolo-ribaudo/eslint-scope-5-internals/-/eslint-scope-5-internals-5.1.1-v1.tgz", - "integrity": "sha512-54/JRvkLIzzDWshCWfuhadfrfZVPiElY8Fcgmg1HroEly/EDSszzhBAsarCux+D/kOslTRquNzuyGSmUSTTHGg==", - "dev": true, - "requires": { - "eslint-scope": "5.1.1" - } - }, "@nodelib/fs.scandir": { "version": "2.1.5", "resolved": "https://registry.npmjs.org/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz", @@ -16726,13 +15816,7 @@ "@types/json-schema": { "version": "7.0.14", "resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.14.tgz", - "integrity": "sha512-U3PUjAudAdJBeC2pgN8uTIKgxrb4nlDF3SF0++EldXQvQBGkpFZMSnwQiIoDU77tv45VgNkl/L4ouD+rEomujw==", - "dev": true - }, - "@types/json5": { - "version": "0.0.29", - "resolved": "https://registry.npmjs.org/@types/json5/-/json5-0.0.29.tgz", - "integrity": "sha512-dRLjCWHYg4oaA77cxO64oO+7JwCwnIzkZPdrrC71jQmQtlhM556pwKo5bUzqvZndkVbeFLIIi+9TC40JNF5hNQ==", + "integrity": "sha512-U3PUjAudAdJBeC2pgN8uTIKgxrb4nlDF3SF0++EldXQvQBGkpFZMSnwQiIoDU77tv45VgNkl/L4ouD+rEomujw==", "dev": true }, "@types/keygrip": { @@ -16908,12 +15992,6 @@ "@types/node": "*" } }, - "@ungap/structured-clone": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/@ungap/structured-clone/-/structured-clone-1.2.0.tgz", - "integrity": "sha512-zuVdFrMJiuCDQUMCzQaD6KL28MjnqqN8XnAqiEq9PNm/hCPTSGfrXCOfwj1ow4LFb/tNymJPwsNbVePc1xFqrQ==", - "dev": true - }, "@uploadcare/image-shrink": { "version": "6.14.1", "resolved": "https://registry.npmjs.org/@uploadcare/image-shrink/-/image-shrink-6.14.1.tgz", @@ -17227,19 +16305,6 @@ "negotiator": "0.6.3" } }, - "acorn": { - "version": "8.11.3", - "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.11.3.tgz", - "integrity": "sha512-Y9rRfJG5jcKOE0CLisYbojUjIrIEE7AGMzA/Sm4BslANhbS+cDMpgBdcPT91oJ7OuJ9hYJBx59RjbhxVnrF8Xg==", - "dev": true - }, - "acorn-jsx": { - "version": "5.3.2", - "resolved": "https://registry.npmjs.org/acorn-jsx/-/acorn-jsx-5.3.2.tgz", - "integrity": "sha512-rq9s+JNhf0IChjtDXxllJ7g41oZk5SlXtp0LHwyA5cejwn7vKmKp4pPri6YEePv2PU65sAsegbXtIinmDFDXgQ==", - "dev": true, - "requires": {} - }, "add-stream": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/add-stream/-/add-stream-1.0.0.tgz", @@ -17265,18 +16330,6 @@ "indent-string": "^4.0.0" } }, - "ajv": { - "version": "6.12.6", - "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.6.tgz", - "integrity": "sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g==", - "dev": true, - "requires": { - "fast-deep-equal": "^3.1.1", - "fast-json-stable-stringify": "^2.0.0", - "json-schema-traverse": "^0.4.1", - "uri-js": "^4.2.2" - } - }, "ansi-escapes": { "version": "4.3.2", "resolved": "https://registry.npmjs.org/ansi-escapes/-/ansi-escapes-4.3.2.tgz", @@ -17345,62 +16398,12 @@ "integrity": "sha1-nlKHYrSpBmrRY6aWKjZEGOlibs4=", "dev": true }, - "array-includes": { - "version": "3.1.7", - "resolved": "https://registry.npmjs.org/array-includes/-/array-includes-3.1.7.tgz", - "integrity": "sha512-dlcsNBIiWhPkHdOEEKnehA+RNUWDc4UqFtnIXU4uuYDPtA4LDkr7qip2p0VvFAEXNDr0yWZ9PJyIRiGjRLQzwQ==", - "dev": true, - "requires": { - "call-bind": "^1.0.2", - "define-properties": "^1.2.0", - "es-abstract": "^1.22.1", - "get-intrinsic": "^1.2.1", - "is-string": "^1.0.7" - } - }, "array-union": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/array-union/-/array-union-2.1.0.tgz", "integrity": "sha512-HGyxoOTYUyCM6stUe6EJgnd4EoewAI7zMdfqO+kGjnlZmBDz/cR5pf8r/cR4Wq60sL/p0IkcjUEEPwS3GFrIyw==", "dev": true }, - "array.prototype.findlastindex": { - "version": "1.2.3", - "resolved": "https://registry.npmjs.org/array.prototype.findlastindex/-/array.prototype.findlastindex-1.2.3.tgz", - "integrity": "sha512-LzLoiOMAxvy+Gd3BAq3B7VeIgPdo+Q8hthvKtXybMvRV0jrXfJM/t8mw7nNlpEcVlVUnCnM2KSX4XU5HmpodOA==", - "dev": true, - "requires": { - "call-bind": "^1.0.2", - "define-properties": "^1.2.0", - "es-abstract": "^1.22.1", - "es-shim-unscopables": "^1.0.0", - "get-intrinsic": "^1.2.1" - } - }, - "array.prototype.flat": { - "version": "1.3.2", - "resolved": "https://registry.npmjs.org/array.prototype.flat/-/array.prototype.flat-1.3.2.tgz", - "integrity": "sha512-djYB+Zx2vLewY8RWlNCUdHjDXs2XOgm602S9E7P/UpHgfeHL00cRiIF+IN/G/aUJ7kGPb6yO/ErDI5V2s8iycA==", - "dev": true, - "requires": { - "call-bind": "^1.0.2", - "define-properties": "^1.2.0", - "es-abstract": "^1.22.1", - "es-shim-unscopables": "^1.0.0" - } - }, - "array.prototype.flatmap": { - "version": "1.3.2", - "resolved": "https://registry.npmjs.org/array.prototype.flatmap/-/array.prototype.flatmap-1.3.2.tgz", - "integrity": "sha512-Ewyx0c9PmpcsByhSW4r+9zDU7sGjFc86qf/kKtuSCRdhfbk0SNLLkaT5qvcHnRGgc5NP/ly/y+qkXkqONX54CQ==", - "dev": true, - "requires": { - "call-bind": "^1.0.2", - "define-properties": "^1.2.0", - "es-abstract": "^1.22.1", - "es-shim-unscopables": "^1.0.0" - } - }, "arraybuffer.prototype.slice": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/arraybuffer.prototype.slice/-/arraybuffer.prototype.slice-1.0.2.tgz", @@ -18517,12 +17520,6 @@ "integrity": "sha1-9dJgKStmDghO/0zbyfCK0yR0SLU=", "dev": true }, - "deep-is": { - "version": "0.1.4", - "resolved": "https://registry.npmjs.org/deep-is/-/deep-is-0.1.4.tgz", - "integrity": "sha512-oIPzksmTg4/MriiaYGO+okXDT7ztn/w3Eptv/+gSIdMdKsJo0u4CfYNFJPy+4SKMuCqGw2wxnA+URMg3t8a/bQ==", - "dev": true - }, "deepmerge": { "version": "4.2.2", "resolved": "https://registry.npmjs.org/deepmerge/-/deepmerge-4.2.2.tgz", @@ -18633,15 +17630,6 @@ "path-type": "^4.0.0" } }, - "doctrine": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/doctrine/-/doctrine-3.0.0.tgz", - "integrity": "sha512-yS+Q5i3hBf7GBkd4KG8a7eBNNWNGLTaEwwYWUijIYM7zrlYDM0BFXHjjPWlWZ1Rg7UaddZeIDmi9jF3HmqiQ2w==", - "dev": true, - "requires": { - "esutils": "^2.0.2" - } - }, "dom-serializer": { "version": "1.4.1", "resolved": "https://registry.npmjs.org/dom-serializer/-/dom-serializer-1.4.1.tgz", @@ -18819,290 +17807,88 @@ "string.prototype.trimend": "^1.0.7", "string.prototype.trimstart": "^1.0.7", "typed-array-buffer": "^1.0.0", - "typed-array-byte-length": "^1.0.0", - "typed-array-byte-offset": "^1.0.0", - "typed-array-length": "^1.0.4", - "unbox-primitive": "^1.0.2", - "which-typed-array": "^1.1.13" - } - }, - "es-module-lexer": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/es-module-lexer/-/es-module-lexer-1.2.1.tgz", - "integrity": "sha512-9978wrXM50Y4rTMmW5kXIC09ZdXQZqkE4mxhwkd8VbzsGkXGPgV4zWuqQJgCEzYngdo2dYDa0l8xhX4fkSwJSg==", - "dev": true - }, - "es-set-tostringtag": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/es-set-tostringtag/-/es-set-tostringtag-2.0.1.tgz", - "integrity": "sha512-g3OMbtlwY3QewlqAiMLI47KywjWZoEytKr8pf6iTC8uJq5bIAH52Z9pnQ8pVL6whrCto53JZDuUIsifGeLorTg==", - "dev": true, - "requires": { - "get-intrinsic": "^1.1.3", - "has": "^1.0.3", - "has-tostringtag": "^1.0.0" - } - }, - "es-shim-unscopables": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/es-shim-unscopables/-/es-shim-unscopables-1.0.2.tgz", - "integrity": "sha512-J3yBRXCzDu4ULnQwxyToo/OjdMx6akgVC7K6few0a7F/0wLtmKKN7I73AH5T2836UuXRqN7Qg+IIUw/+YJksRw==", - "dev": true, - "requires": { - "hasown": "^2.0.0" - } - }, - "es-to-primitive": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/es-to-primitive/-/es-to-primitive-1.2.1.tgz", - "integrity": "sha512-QCOllgZJtaUo9miYBcLChTUaHNjJF3PYs1VidD7AwiEj1kYxKeQTctLAezAOH5ZKRH0g2IgPn6KwB4IT8iRpvA==", - "dev": true, - "requires": { - "is-callable": "^1.1.4", - "is-date-object": "^1.0.1", - "is-symbol": "^1.0.2" - } - }, - "esbuild": { - "version": "0.19.9", - "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.19.9.tgz", - "integrity": "sha512-U9CHtKSy+EpPsEBa+/A2gMs/h3ylBC0H0KSqIg7tpztHerLi6nrrcoUJAkNCEPumx8yJ+Byic4BVwHgRbN0TBg==", - "dev": true, - "requires": { - "@esbuild/android-arm": "0.19.9", - "@esbuild/android-arm64": "0.19.9", - "@esbuild/android-x64": "0.19.9", - "@esbuild/darwin-arm64": "0.19.9", - "@esbuild/darwin-x64": "0.19.9", - "@esbuild/freebsd-arm64": "0.19.9", - "@esbuild/freebsd-x64": "0.19.9", - "@esbuild/linux-arm": "0.19.9", - "@esbuild/linux-arm64": "0.19.9", - "@esbuild/linux-ia32": "0.19.9", - "@esbuild/linux-loong64": "0.19.9", - "@esbuild/linux-mips64el": "0.19.9", - "@esbuild/linux-ppc64": "0.19.9", - "@esbuild/linux-riscv64": "0.19.9", - "@esbuild/linux-s390x": "0.19.9", - "@esbuild/linux-x64": "0.19.9", - "@esbuild/netbsd-x64": "0.19.9", - "@esbuild/openbsd-x64": "0.19.9", - "@esbuild/sunos-x64": "0.19.9", - "@esbuild/win32-arm64": "0.19.9", - "@esbuild/win32-ia32": "0.19.9", - "@esbuild/win32-x64": "0.19.9" - } - }, - "escalade": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/escalade/-/escalade-3.1.1.tgz", - "integrity": "sha512-k0er2gUkLf8O0zKJiAhmkTnJlTvINGv7ygDNPbeIsX/TJjGJZHuh9B2UxbsaEkmlEo9MfhrSzmhIlhRlI2GXnw==", - "dev": true - }, - "escape-html": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/escape-html/-/escape-html-1.0.3.tgz", - "integrity": "sha1-Aljq5NPQwJdN4cFpGI7wBR0dGYg=", - "dev": true - }, - "escape-string-regexp": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", - "integrity": "sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ=", - "dev": true - }, - "eslint": { - "version": "8.56.0", - "resolved": "https://registry.npmjs.org/eslint/-/eslint-8.56.0.tgz", - "integrity": "sha512-Go19xM6T9puCOWntie1/P997aXxFsOi37JIHRWI514Hc6ZnaHGKY9xFhrU65RT6CcBEzZoGG1e6Nq+DT04ZtZQ==", - "dev": true, - "requires": { - "@eslint-community/eslint-utils": "^4.2.0", - "@eslint-community/regexpp": "^4.6.1", - "@eslint/eslintrc": "^2.1.4", - "@eslint/js": "8.56.0", - "@humanwhocodes/config-array": "^0.11.13", - "@humanwhocodes/module-importer": "^1.0.1", - "@nodelib/fs.walk": "^1.2.8", - "@ungap/structured-clone": "^1.2.0", - "ajv": "^6.12.4", - "chalk": "^4.0.0", - "cross-spawn": "^7.0.2", - "debug": "^4.3.2", - "doctrine": "^3.0.0", - "escape-string-regexp": "^4.0.0", - "eslint-scope": "^7.2.2", - "eslint-visitor-keys": "^3.4.3", - "espree": "^9.6.1", - "esquery": "^1.4.2", - "esutils": "^2.0.2", - "fast-deep-equal": "^3.1.3", - "file-entry-cache": "^6.0.1", - "find-up": "^5.0.0", - "glob-parent": "^6.0.2", - "globals": "^13.19.0", - "graphemer": "^1.4.0", - "ignore": "^5.2.0", - "imurmurhash": "^0.1.4", - "is-glob": "^4.0.0", - "is-path-inside": "^3.0.3", - "js-yaml": "^4.1.0", - "json-stable-stringify-without-jsonify": "^1.0.1", - "levn": "^0.4.1", - "lodash.merge": "^4.6.2", - "minimatch": "^3.1.2", - "natural-compare": "^1.4.0", - "optionator": "^0.9.3", - "strip-ansi": "^6.0.1", - "text-table": "^0.2.0" - }, - "dependencies": { - "ansi-styles": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", - "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", - "dev": true, - "requires": { - "color-convert": "^2.0.1" - } - }, - "chalk": { - "version": "4.1.2", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", - "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", - "dev": true, - "requires": { - "ansi-styles": "^4.1.0", - "supports-color": "^7.1.0" - } - }, - "color-convert": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", - "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", - "dev": true, - "requires": { - "color-name": "~1.1.4" - } - }, - "color-name": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", - "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", - "dev": true - }, - "escape-string-regexp": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz", - "integrity": "sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA==", - "dev": true - }, - "eslint-scope": { - "version": "7.2.2", - "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-7.2.2.tgz", - "integrity": "sha512-dOt21O7lTMhDM+X9mB4GX+DZrZtCUJPL/wlcTqxyrx5IvO0IYtILdtrQGQp+8n5S0gwSVmOf9NQrjMOgfQZlIg==", - "dev": true, - "requires": { - "esrecurse": "^4.3.0", - "estraverse": "^5.2.0" - } - }, - "eslint-visitor-keys": { - "version": "3.4.3", - "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-3.4.3.tgz", - "integrity": "sha512-wpc+LXeiyiisxPlEkUzU6svyS1frIO3Mgxj1fdy7Pm8Ygzguax2N3Fa/D/ag1WqbOprdI+uY6wMUl8/a2G+iag==", - "dev": true - }, - "estraverse": { - "version": "5.3.0", - "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-5.3.0.tgz", - "integrity": "sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA==", - "dev": true - }, - "find-up": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/find-up/-/find-up-5.0.0.tgz", - "integrity": "sha512-78/PXT1wlLLDgTzDs7sjq9hzz0vXD+zn+7wypEe4fXQxCmdmqfGsEPQxmiCSQI3ajFV91bVSsvNtrJRiW6nGng==", - "dev": true, - "requires": { - "locate-path": "^6.0.0", - "path-exists": "^4.0.0" - } - }, - "glob-parent": { - "version": "6.0.2", - "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-6.0.2.tgz", - "integrity": "sha512-XxwI8EOhVQgWp6iDL+3b0r86f4d6AX6zSU55HfB4ydCEuXLXc5FcYeOu+nnGftS4TEju/11rt4KJPTMgbfmv4A==", - "dev": true, - "requires": { - "is-glob": "^4.0.3" - } - }, - "globals": { - "version": "13.20.0", - "resolved": "https://registry.npmjs.org/globals/-/globals-13.20.0.tgz", - "integrity": "sha512-Qg5QtVkCy/kv3FUSlu4ukeZDVf9ee0iXLAUYX13gbR17bnejFTzr4iS9bY7kwCf1NztRNm1t91fjOiyx4CSwPQ==", - "dev": true, - "requires": { - "type-fest": "^0.20.2" - } - }, - "has-flag": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", - "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", - "dev": true - }, - "locate-path": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-6.0.0.tgz", - "integrity": "sha512-iPZK6eYjbxRu3uB4/WZ3EsEIMJFMqAoopl3R+zuq0UjcAm/MO6KCweDgPfP3elTztoKP3KtnVHxTn2NHBSDVUw==", - "dev": true, - "requires": { - "p-locate": "^5.0.0" - } - }, - "p-limit": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-3.1.0.tgz", - "integrity": "sha512-TYOanM3wGwNGsZN2cVTYPArw454xnXj5qmWF1bEoAc4+cU/ol7GVh7odevjp1FNHduHc3KZMcFduxU5Xc6uJRQ==", - "dev": true, - "requires": { - "yocto-queue": "^0.1.0" - } - }, - "p-locate": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-5.0.0.tgz", - "integrity": "sha512-LaNjtRWUBY++zB5nE/NwcaoMylSPk+S+ZHNB1TzdbMJMny6dynpAGt7X/tl/QYq3TIeE6nxHppbo2LGymrG5Pw==", - "dev": true, - "requires": { - "p-limit": "^3.0.2" - } - }, - "supports-color": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", - "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", - "dev": true, - "requires": { - "has-flag": "^4.0.0" - } - }, - "type-fest": { - "version": "0.20.2", - "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.20.2.tgz", - "integrity": "sha512-Ne+eE4r0/iWnpAxD852z3A+N0Bt5RN//NjJwRd2VFHEmrywxf5vsZlh4R6lixl6B+wz/8d+maTSAkN1FIkI3LQ==", - "dev": true - } + "typed-array-byte-length": "^1.0.0", + "typed-array-byte-offset": "^1.0.0", + "typed-array-length": "^1.0.4", + "unbox-primitive": "^1.0.2", + "which-typed-array": "^1.1.13" } }, - "eslint-config-prettier": { - "version": "9.1.0", - "resolved": "https://registry.npmjs.org/eslint-config-prettier/-/eslint-config-prettier-9.1.0.tgz", - "integrity": "sha512-NSWl5BFQWEPi1j4TjVNItzYV7dZXZ+wP6I6ZhrBGpChQhZRUaElihE9uRRkcbRnNb76UMKDF3r+WTmNcGPKsqw==", + "es-module-lexer": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/es-module-lexer/-/es-module-lexer-1.2.1.tgz", + "integrity": "sha512-9978wrXM50Y4rTMmW5kXIC09ZdXQZqkE4mxhwkd8VbzsGkXGPgV4zWuqQJgCEzYngdo2dYDa0l8xhX4fkSwJSg==", + "dev": true + }, + "es-set-tostringtag": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/es-set-tostringtag/-/es-set-tostringtag-2.0.1.tgz", + "integrity": "sha512-g3OMbtlwY3QewlqAiMLI47KywjWZoEytKr8pf6iTC8uJq5bIAH52Z9pnQ8pVL6whrCto53JZDuUIsifGeLorTg==", "dev": true, - "requires": {} + "requires": { + "get-intrinsic": "^1.1.3", + "has": "^1.0.3", + "has-tostringtag": "^1.0.0" + } + }, + "es-to-primitive": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/es-to-primitive/-/es-to-primitive-1.2.1.tgz", + "integrity": "sha512-QCOllgZJtaUo9miYBcLChTUaHNjJF3PYs1VidD7AwiEj1kYxKeQTctLAezAOH5ZKRH0g2IgPn6KwB4IT8iRpvA==", + "dev": true, + "requires": { + "is-callable": "^1.1.4", + "is-date-object": "^1.0.1", + "is-symbol": "^1.0.2" + } + }, + "esbuild": { + "version": "0.19.9", + "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.19.9.tgz", + "integrity": "sha512-U9CHtKSy+EpPsEBa+/A2gMs/h3ylBC0H0KSqIg7tpztHerLi6nrrcoUJAkNCEPumx8yJ+Byic4BVwHgRbN0TBg==", + "dev": true, + "requires": { + "@esbuild/android-arm": "0.19.9", + "@esbuild/android-arm64": "0.19.9", + "@esbuild/android-x64": "0.19.9", + "@esbuild/darwin-arm64": "0.19.9", + "@esbuild/darwin-x64": "0.19.9", + "@esbuild/freebsd-arm64": "0.19.9", + "@esbuild/freebsd-x64": "0.19.9", + "@esbuild/linux-arm": "0.19.9", + "@esbuild/linux-arm64": "0.19.9", + "@esbuild/linux-ia32": "0.19.9", + "@esbuild/linux-loong64": "0.19.9", + "@esbuild/linux-mips64el": "0.19.9", + "@esbuild/linux-ppc64": "0.19.9", + "@esbuild/linux-riscv64": "0.19.9", + "@esbuild/linux-s390x": "0.19.9", + "@esbuild/linux-x64": "0.19.9", + "@esbuild/netbsd-x64": "0.19.9", + "@esbuild/openbsd-x64": "0.19.9", + "@esbuild/sunos-x64": "0.19.9", + "@esbuild/win32-arm64": "0.19.9", + "@esbuild/win32-ia32": "0.19.9", + "@esbuild/win32-x64": "0.19.9" + } + }, + "escalade": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/escalade/-/escalade-3.1.1.tgz", + "integrity": "sha512-k0er2gUkLf8O0zKJiAhmkTnJlTvINGv7ygDNPbeIsX/TJjGJZHuh9B2UxbsaEkmlEo9MfhrSzmhIlhRlI2GXnw==", + "dev": true + }, + "escape-html": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/escape-html/-/escape-html-1.0.3.tgz", + "integrity": "sha1-Aljq5NPQwJdN4cFpGI7wBR0dGYg=", + "dev": true + }, + "escape-string-regexp": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", + "integrity": "sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ=", + "dev": true }, "eslint-formatter-pretty": { "version": "4.1.0", @@ -19181,186 +17967,18 @@ } } }, - "eslint-import-resolver-node": { - "version": "0.3.9", - "resolved": "https://registry.npmjs.org/eslint-import-resolver-node/-/eslint-import-resolver-node-0.3.9.tgz", - "integrity": "sha512-WFj2isz22JahUv+B788TlO3N6zL3nNJGU8CcZbPZvVEkBPaJdCV4vy5wyghty5ROFbCRnm132v8BScu5/1BQ8g==", - "dev": true, - "requires": { - "debug": "^3.2.7", - "is-core-module": "^2.13.0", - "resolve": "^1.22.4" - }, - "dependencies": { - "debug": { - "version": "3.2.7", - "resolved": "https://registry.npmjs.org/debug/-/debug-3.2.7.tgz", - "integrity": "sha512-CFjzYYAi4ThfiQvizrFQevTTXHtnCqWfe7x1AhgEscTz6ZbLbfoLRLPugTQyBth6f8ZERVUSyWHFD/7Wu4t1XQ==", - "dev": true, - "requires": { - "ms": "^2.1.1" - } - } - } - }, - "eslint-module-utils": { - "version": "2.8.0", - "resolved": "https://registry.npmjs.org/eslint-module-utils/-/eslint-module-utils-2.8.0.tgz", - "integrity": "sha512-aWajIYfsqCKRDgUfjEXNN/JlrzauMuSEy5sbd7WXbtW3EH6A6MpwEh42c7qD+MqQo9QMJ6fWLAeIJynx0g6OAw==", - "dev": true, - "requires": { - "debug": "^3.2.7" - }, - "dependencies": { - "debug": { - "version": "3.2.7", - "resolved": "https://registry.npmjs.org/debug/-/debug-3.2.7.tgz", - "integrity": "sha512-CFjzYYAi4ThfiQvizrFQevTTXHtnCqWfe7x1AhgEscTz6ZbLbfoLRLPugTQyBth6f8ZERVUSyWHFD/7Wu4t1XQ==", - "dev": true, - "requires": { - "ms": "^2.1.1" - } - } - } - }, - "eslint-plugin-import": { - "version": "2.29.1", - "resolved": "https://registry.npmjs.org/eslint-plugin-import/-/eslint-plugin-import-2.29.1.tgz", - "integrity": "sha512-BbPC0cuExzhiMo4Ff1BTVwHpjjv28C5R+btTOGaCRC7UEz801up0JadwkeSk5Ued6TG34uaczuVuH6qyy5YUxw==", - "dev": true, - "requires": { - "array-includes": "^3.1.7", - "array.prototype.findlastindex": "^1.2.3", - "array.prototype.flat": "^1.3.2", - "array.prototype.flatmap": "^1.3.2", - "debug": "^3.2.7", - "doctrine": "^2.1.0", - "eslint-import-resolver-node": "^0.3.9", - "eslint-module-utils": "^2.8.0", - "hasown": "^2.0.0", - "is-core-module": "^2.13.1", - "is-glob": "^4.0.3", - "minimatch": "^3.1.2", - "object.fromentries": "^2.0.7", - "object.groupby": "^1.0.1", - "object.values": "^1.1.7", - "semver": "^6.3.1", - "tsconfig-paths": "^3.15.0" - }, - "dependencies": { - "debug": { - "version": "3.2.7", - "resolved": "https://registry.npmjs.org/debug/-/debug-3.2.7.tgz", - "integrity": "sha512-CFjzYYAi4ThfiQvizrFQevTTXHtnCqWfe7x1AhgEscTz6ZbLbfoLRLPugTQyBth6f8ZERVUSyWHFD/7Wu4t1XQ==", - "dev": true, - "requires": { - "ms": "^2.1.1" - } - }, - "doctrine": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/doctrine/-/doctrine-2.1.0.tgz", - "integrity": "sha512-35mSku4ZXK0vfCuHEDAwt55dg2jNajHZ1odvF+8SSr82EsZY4QmXfuWso8oEd8zRhVObSN18aM0CjSdoBX7zIw==", - "dev": true, - "requires": { - "esutils": "^2.0.2" - } - }, - "semver": { - "version": "6.3.1", - "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.1.tgz", - "integrity": "sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA==", - "dev": true - } - } - }, "eslint-rule-docs": { "version": "1.1.235", "resolved": "https://registry.npmjs.org/eslint-rule-docs/-/eslint-rule-docs-1.1.235.tgz", "integrity": "sha512-+TQ+x4JdTnDoFEXXb3fDvfGOwnyNV7duH8fXWTPD1ieaBmB8omj7Gw/pMBBu4uI2uJCCU8APDaQJzWuXnTsH4A==", "dev": true }, - "eslint-scope": { - "version": "5.1.1", - "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-5.1.1.tgz", - "integrity": "sha512-2NxwbF/hZ0KpepYN0cNbo+FN6XoK7GaHlQhgx/hIZl6Va0bF45RQOOwhLIy8lQDbuCiadSLCBnH2CFYquit5bw==", - "dev": true, - "requires": { - "esrecurse": "^4.3.0", - "estraverse": "^4.1.1" - } - }, - "eslint-visitor-keys": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-2.1.0.tgz", - "integrity": "sha512-0rSmRBzXgDzIsD6mGdJgevzgezI534Cer5L/vyMX0kHzT/jiB43jRhd9YUlMGYLQy2zprNmoT8qasCGtY+QaKw==", - "dev": true - }, "esm": { "version": "3.2.25", "resolved": "https://registry.npmjs.org/esm/-/esm-3.2.25.tgz", "integrity": "sha512-U1suiZ2oDVWv4zPO56S0NcR5QriEahGtdN2OR6FiOG4WJvcjBVFB0qI4+eKoWFH483PKGuLuu6V8Z4T5g63UVA==", "dev": true }, - "espree": { - "version": "9.6.1", - "resolved": "https://registry.npmjs.org/espree/-/espree-9.6.1.tgz", - "integrity": "sha512-oruZaFkjorTpF32kDSI5/75ViwGeZginGGy2NoOSg3Q9bnwlnmDm4HLnkl0RE3n+njDXR037aY1+x58Z/zFdwQ==", - "dev": true, - "requires": { - "acorn": "^8.9.0", - "acorn-jsx": "^5.3.2", - "eslint-visitor-keys": "^3.4.1" - }, - "dependencies": { - "eslint-visitor-keys": { - "version": "3.4.3", - "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-3.4.3.tgz", - "integrity": "sha512-wpc+LXeiyiisxPlEkUzU6svyS1frIO3Mgxj1fdy7Pm8Ygzguax2N3Fa/D/ag1WqbOprdI+uY6wMUl8/a2G+iag==", - "dev": true - } - } - }, - "esquery": { - "version": "1.5.0", - "resolved": "https://registry.npmjs.org/esquery/-/esquery-1.5.0.tgz", - "integrity": "sha512-YQLXUplAwJgCydQ78IMJywZCceoqk1oH01OERdSAJc/7U2AylwjhSCLDEtqwg811idIS/9fIU5GjG73IgjKMVg==", - "dev": true, - "requires": { - "estraverse": "^5.1.0" - }, - "dependencies": { - "estraverse": { - "version": "5.3.0", - "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-5.3.0.tgz", - "integrity": "sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA==", - "dev": true - } - } - }, - "esrecurse": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/esrecurse/-/esrecurse-4.3.0.tgz", - "integrity": "sha512-KmfKL3b6G+RXvP8N1vr3Tq1kL/oCFgn2NYXEtqP8/L3pKapUA4G8cFVaoF3SU323CD4XypR/ffioHmkti6/Tag==", - "dev": true, - "requires": { - "estraverse": "^5.2.0" - }, - "dependencies": { - "estraverse": { - "version": "5.3.0", - "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-5.3.0.tgz", - "integrity": "sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA==", - "dev": true - } - } - }, - "estraverse": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-4.3.0.tgz", - "integrity": "sha512-39nnKffWz8xN1BU/2c79n9nB9HDzo0niYUqx6xyqUnyoAnQyyWpOTdZEeiCch8BBu515t4wp9ZmgVfVhn9EBpw==", - "dev": true - }, "estree-walker": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/estree-walker/-/estree-walker-1.0.1.tgz", @@ -19513,18 +18131,6 @@ "micromatch": "^4.0.4" } }, - "fast-json-stable-stringify": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz", - "integrity": "sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw==", - "dev": true - }, - "fast-levenshtein": { - "version": "2.0.6", - "resolved": "https://registry.npmjs.org/fast-levenshtein/-/fast-levenshtein-2.0.6.tgz", - "integrity": "sha512-DCXu6Ifhqcks7TZKY3Hxp3y6qphY5SJZmrWMDrKcERSOXWQdMhU9Ig/PYrzyw/ul9jOIyh0N4M0tbC5hodg8dw==", - "dev": true - }, "fastest-levenshtein": { "version": "1.0.16", "resolved": "https://registry.npmjs.org/fastest-levenshtein/-/fastest-levenshtein-1.0.16.tgz", @@ -19971,12 +18577,6 @@ "integrity": "sha512-NtNxqUcXgpW2iMrfqSfR73Glt39K+BLwWsPs94yR63v45T0Wbej7eRmL5cWfwEgqXnmjQp3zaJTshdRW/qC2ZQ==", "dev": true }, - "graphemer": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/graphemer/-/graphemer-1.4.0.tgz", - "integrity": "sha512-EtKwoO6kxCL9WO5xipiHTZlSzBm7WLT627TqC/uVRd0HKmq8NXyebnNYxDoBi7wt8eTWrUrKXCOVaFq9x1kgag==", - "dev": true - }, "handlebars": { "version": "4.7.7", "resolved": "https://registry.npmjs.org/handlebars/-/handlebars-4.7.7.tgz", @@ -20514,12 +19114,6 @@ "integrity": "sha512-drqDG3cbczxxEJRoOXcOjtdp1J/lyp1mNn0xaznRs8+muBhgQcrnbspox5X5fOw0HnMnbfDzvnEMEtqDEJEo8w==", "dev": true }, - "is-path-inside": { - "version": "3.0.3", - "resolved": "https://registry.npmjs.org/is-path-inside/-/is-path-inside-3.0.3.tgz", - "integrity": "sha512-Fd4gABb+ycGAmKou8eMftCupSir5lRxqf4aD/vd0cD2qc4HL07OjCeuHMr8Ro4CoMaeCKDB0/ECBOVWjTwUvPQ==", - "dev": true - }, "is-plain-obj": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/is-plain-obj/-/is-plain-obj-1.1.0.tgz", @@ -20850,18 +19444,6 @@ "integrity": "sha512-xyFwyhro/JEof6Ghe2iz2NcXoj2sloNsWr/XsERDK/oiPCfaNhl5ONfp+jQdAZRQQ0IJWNzH9zIZF7li91kh2w==", "dev": true }, - "json-schema-traverse": { - "version": "0.4.1", - "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz", - "integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==", - "dev": true - }, - "json-stable-stringify-without-jsonify": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/json-stable-stringify-without-jsonify/-/json-stable-stringify-without-jsonify-1.0.1.tgz", - "integrity": "sha1-nbe1lJatPzz+8wp1FC0tkwrXJlE=", - "dev": true - }, "json-stringify-safe": { "version": "5.0.1", "resolved": "https://registry.npmjs.org/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz", @@ -21017,16 +19599,6 @@ "integrity": "sha512-Xq9nH7KlWZmXAtodXDDRE7vs6DU1gTU8zYDHDiWLSip45Egwq3plLHzPn27NgvzL2r1LMPC1vdqh98sQxtqj4A==", "dev": true }, - "levn": { - "version": "0.4.1", - "resolved": "https://registry.npmjs.org/levn/-/levn-0.4.1.tgz", - "integrity": "sha512-+bT2uH4E5LGE7h/n3evcS/sQlJXCpIp6ym8OWJ5eV6+67Dsql/LaaT7qJBAt2rzfoa/5QBGBhxDix1dMt2kQKQ==", - "dev": true, - "requires": { - "prelude-ls": "^1.2.1", - "type-check": "~0.4.0" - } - }, "lighthouse-logger": { "version": "1.3.0", "resolved": "https://registry.npmjs.org/lighthouse-logger/-/lighthouse-logger-1.3.0.tgz", @@ -21975,12 +20547,6 @@ "integrity": "sha512-eSRppjcPIatRIMC1U6UngP8XFcz8MQWGQdt1MTBQ7NaAmvXDfvNxbvWV3x2y6CdEUciCSsDHDQZbhYaB8QEo2g==", "dev": true }, - "natural-compare": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/natural-compare/-/natural-compare-1.4.0.tgz", - "integrity": "sha1-Sr6/7tdUHywnrPspvbvRXI1bpPc=", - "dev": true - }, "negotiator": { "version": "0.6.3", "resolved": "https://registry.npmjs.org/negotiator/-/negotiator-0.6.3.tgz", @@ -22242,40 +20808,6 @@ "object-keys": "^1.1.1" } }, - "object.fromentries": { - "version": "2.0.7", - "resolved": "https://registry.npmjs.org/object.fromentries/-/object.fromentries-2.0.7.tgz", - "integrity": "sha512-UPbPHML6sL8PI/mOqPwsH4G6iyXcCGzLin8KvEPenOZN5lpCNBZZQ+V62vdjB1mQHrmqGQt5/OJzemUA+KJmEA==", - "dev": true, - "requires": { - "call-bind": "^1.0.2", - "define-properties": "^1.2.0", - "es-abstract": "^1.22.1" - } - }, - "object.groupby": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/object.groupby/-/object.groupby-1.0.1.tgz", - "integrity": "sha512-HqaQtqLnp/8Bn4GL16cj+CUYbnpe1bh0TtEaWvybszDG4tgxCJuRpV8VGuvNaI1fAnI4lUJzDG55MXcOH4JZcQ==", - "dev": true, - "requires": { - "call-bind": "^1.0.2", - "define-properties": "^1.2.0", - "es-abstract": "^1.22.1", - "get-intrinsic": "^1.2.1" - } - }, - "object.values": { - "version": "1.1.7", - "resolved": "https://registry.npmjs.org/object.values/-/object.values-1.1.7.tgz", - "integrity": "sha512-aU6xnDFYT3x17e/f0IiiwlGPTy2jzMySGfUB4fq6z7CV8l85CWHDk5ErhyhpfDHhrOMwGFhSQkhMGHaIotA6Ng==", - "dev": true, - "requires": { - "call-bind": "^1.0.2", - "define-properties": "^1.2.0", - "es-abstract": "^1.22.1" - } - }, "on-finished": { "version": "2.4.1", "resolved": "https://registry.npmjs.org/on-finished/-/on-finished-2.4.1.tgz", @@ -22329,20 +20861,6 @@ "is-wsl": "^2.2.0" } }, - "optionator": { - "version": "0.9.3", - "resolved": "https://registry.npmjs.org/optionator/-/optionator-0.9.3.tgz", - "integrity": "sha512-JjCoypp+jKn1ttEFExxhetCKeJt9zhAgAve5FXHixTvFDW/5aEktX9bufBKLRRMdU7bNtpLfcGu94B3cdEJgjg==", - "dev": true, - "requires": { - "@aashutoshrathi/word-wrap": "^1.2.3", - "deep-is": "^0.1.3", - "fast-levenshtein": "^2.0.6", - "levn": "^0.4.1", - "prelude-ls": "^1.2.1", - "type-check": "^0.4.0" - } - }, "os-name": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/os-name/-/os-name-3.1.0.tgz", @@ -22669,12 +21187,6 @@ "integrity": "sha512-1NNCs6uurfkVbeXG4S8JFT9t19m45ICnif8zWLd5oPSZ50QnwMfK+H3jv408d4jw/7Bttv5axS5IiHoLaVNHeQ==", "dev": true }, - "prelude-ls": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.2.1.tgz", - "integrity": "sha512-vkcDPrRZo1QZLbn5RLGPpg/WmIQ65qoWWhcGKf/b5eplkkarX0m9z8ppCat4mlOqUsWpyNuYgO3VRyrYHSzX5g==", - "dev": true - }, "prettier": { "version": "3.2.4", "resolved": "https://registry.npmjs.org/prettier/-/prettier-3.2.4.tgz", @@ -23856,12 +22368,6 @@ "min-indent": "^1.0.0" } }, - "strip-json-comments": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-3.1.1.tgz", - "integrity": "sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig==", - "dev": true - }, "style-search": { "version": "0.1.0", "resolved": "https://registry.npmjs.org/style-search/-/style-search-0.1.0.tgz", @@ -24401,12 +22907,6 @@ "integrity": "sha512-uuVGNWzgJ4yhRaNSiubPY7OjISw4sw4E5Uv0wbjp+OzcbmVU/rsT8ujgcXJhn9ypzsgr5vlzpPqP+MBBKcGvbg==", "dev": true }, - "text-table": { - "version": "0.2.0", - "resolved": "https://registry.npmjs.org/text-table/-/text-table-0.2.0.tgz", - "integrity": "sha1-f17oI66AUgfACvLfSoTsP8+lcLQ=", - "dev": true - }, "through": { "version": "2.3.8", "resolved": "https://registry.npmjs.org/through/-/through-2.3.8.tgz", @@ -24473,29 +22973,6 @@ "integrity": "sha512-aZbgViZrg1QNcG+LULa7nhZpJTZSLm/mXnHXnbAbjmN5aSa0y7V+wvv6+4WaBtpISJzThKy+PIPxc1Nq1EJ9mg==", "dev": true }, - "tsconfig-paths": { - "version": "3.15.0", - "resolved": "https://registry.npmjs.org/tsconfig-paths/-/tsconfig-paths-3.15.0.tgz", - "integrity": "sha512-2Ac2RgzDe/cn48GvOe3M+o82pEFewD3UPbyoUHHdKasHwJKjds4fLXWf/Ux5kATBKN20oaFGu+jbElp1pos0mg==", - "dev": true, - "requires": { - "@types/json5": "^0.0.29", - "json5": "^1.0.2", - "minimist": "^1.2.6", - "strip-bom": "^3.0.0" - }, - "dependencies": { - "json5": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/json5/-/json5-1.0.2.tgz", - "integrity": "sha512-g1MWMLBiz8FKi1e4w0UyVL3w+iJceWAFBAaBnnGKOpNa5f8TLktkbre1+s6oICydWAm+HRUGTmI+//xv2hvXYA==", - "dev": true, - "requires": { - "minimist": "^1.2.0" - } - } - } - }, "tsd": { "version": "0.29.0", "resolved": "https://registry.npmjs.org/tsd/-/tsd-0.29.0.tgz", @@ -24614,15 +23091,6 @@ "integrity": "sha512-LxhtAkPDTkVCMQjt2h6eBVY28KCjikZqZfMcC15YBeNjkgUpdCfBu5HoiOTDu86v6smE8yOjyEktJ8hlbANHQA==", "dev": true }, - "type-check": { - "version": "0.4.0", - "resolved": "https://registry.npmjs.org/type-check/-/type-check-0.4.0.tgz", - "integrity": "sha512-XleUoc9uwGXqjWwXaUTZAmzMcFZ5858QA2vvx1Ur5xIcixXIP+8LnFDgRplU30us6teqdlskFfu+ae4K79Ooew==", - "dev": true, - "requires": { - "prelude-ls": "^1.2.1" - } - }, "type-detect": { "version": "4.0.8", "resolved": "https://registry.npmjs.org/type-detect/-/type-detect-4.0.8.tgz", @@ -25140,12 +23608,6 @@ "resolved": "https://registry.npmjs.org/ylru/-/ylru-1.3.2.tgz", "integrity": "sha512-RXRJzMiK6U2ye0BlGGZnmpwJDPgakn6aNQ0A7gHRbD4I0uvK4TW6UqkK1V0pp9jskjJBAXd3dRrbzWkqJ+6cxA==", "dev": true - }, - "yocto-queue": { - "version": "0.1.0", - "resolved": "https://registry.npmjs.org/yocto-queue/-/yocto-queue-0.1.0.tgz", - "integrity": "sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q==", - "dev": true } } } diff --git a/package.json b/package.json index 5399193c0..58a5df924 100644 --- a/package.json +++ b/package.json @@ -76,25 +76,25 @@ "build:svg-sprites": "node ./build-svg-sprite.js", "build": "run-s build:svg-sprites build:ssr-stubs build:web build:types build:jsx:types", "tsc": "tsc --project tsconfig.json", - "lint:js": "eslint ./", - "lint:js:fix": "eslint ./ --fix", + "lint:js": "biome check ./", + "lint:js:fix": "biome check --write ./", "lint:css": "stylelint './**/*.css'", "lint:css:fix": "stylelint './**/*.css' --fix", "lint": "run-s lint:js lint:css", "clean:web": "rimraf -g './web/**/*.{js,css}'", "clean:types": "rimraf -g './{abstract,blocks,solutions,web,utils,test,locales}/**/*.{d.ts,d.ts.map}' && rimraf -g './*.{d.ts,d.ts.map}'", "clean": "run-s clean:*", - "format:js": "prettier --write './**/*.{js,cjs}'", + "format:js": "biome check --write './'", "format:css": "prettier --write --parser css './**/*.css'", "format:html": "prettier --write --parser html './**/*.html'", - "format:json": "prettier --write --parser json './**/*.json'", + "format:json": "biome check --write './'", "format:md": "prettier --write --parser markdown './**/*.md'", "format": "run-s lint:js:fix lint:css:fix format:js format:css format:json format:md", "prepare": "husky install" }, "devDependencies": { - "@babel/eslint-parser": "^7.23.3", "@babel/preset-env": "^7.21.4", + "@biomejs/biome": "^1.8.2", "@esm-bundle/chai": "^4.3.4-fix.0", "@happy-dom/global-registrator": "^9.8.4", "@jam-do/jam-tools": "^0.0.4", @@ -106,9 +106,6 @@ "@web/dev-server": "^0.1.38", "@web/test-runner": "^0.15.3", "esbuild": "^0.19.9", - "eslint": "^8.56.0", - "eslint-config-prettier": "^9.1.0", - "eslint-plugin-import": "^2.29.1", "highlight.js": "^11.7.0", "husky": "^8.0.3", "lint-staged": "^13.2.1", diff --git a/ship.config.mjs b/ship.config.mjs index 4c4c45e8c..dc97bf9d5 100644 --- a/ship.config.mjs +++ b/ship.config.mjs @@ -1,5 +1,5 @@ -import fs from 'fs'; -import path from 'path'; +import fs from 'node:fs'; +import path from 'node:path'; export default { buildCommand: () => 'npm run build', @@ -7,10 +7,10 @@ export default { versionUpdated: ({ version, dir }) => { function generateEnvFile(variables) { let template = fs.readFileSync(path.join(dir, './env.template.js')).toString(); - template = template.replaceAll(/{{(.+?)}}/g, (match, p1) => { + template = template.replaceAll(/{{(.+?)}}/g, (_, p1) => { return variables[p1]; }); - template = `/** Do not edit this file manually. It's generated during build process. */\n` + template; + template = `/** Do not edit this file manually. It's generated during build process. */\n${template}`; fs.writeFileSync(path.join(dir, './env.js'), template); } diff --git a/solutions/file-uploader/inline/FileUploaderInline.js b/solutions/file-uploader/inline/FileUploaderInline.js index 655cf63b2..0d2617355 100644 --- a/solutions/file-uploader/inline/FileUploaderInline.js +++ b/solutions/file-uploader/inline/FileUploaderInline.js @@ -51,7 +51,7 @@ export class FileUploaderInline extends SolutionBlock { }); this.sub('*history', () => { - this.$['couldCancel'] = this.couldHistoryBack || this.couldShowList; + this.$.couldCancel = this.couldHistoryBack || this.couldShowList; }); } } diff --git a/stylelint-force-app-name-prefix.cjs b/stylelint-force-app-name-prefix.cjs index 2be735e10..545afbc63 100644 --- a/stylelint-force-app-name-prefix.cjs +++ b/stylelint-force-app-name-prefix.cjs @@ -6,109 +6,105 @@ * - Use `.lr-` prefix instead of `.lr ` * - Add support for tag prefixes: `lr-` */ -var _ = require('lodash'); -var stylelint = require('stylelint'); +const _ = require('lodash'); +const stylelint = require('stylelint'); -var ruleName = 'plugin/stylelint-force-app-name-prefix'; +const ruleName = 'plugin/stylelint-force-app-name-prefix'; -var optionsSchema = { +const optionsSchema = { appName: _.isString, }; const messages = stylelint.utils.ruleMessages(ruleName, { - invalid: (selector, appName) => 'Selector "' + selector + '" is out of control, please wrap within .' + appName, + invalid: (selector, appName) => `Selector "${selector}" is out of control, please wrap within .${appName}`, invalidKeyFrames: (keyframesName, appName) => - 'Keyframes name "' + keyframesName + '" is out of control, please prefix with ' + appName + '-', + `Keyframes name "${keyframesName}" is out of control, please prefix with ${appName}-`, invalidFontFace: (fontFamily, appName) => - 'Custom font-family "' + fontFamily + '" is out of control, please prefix with ' + appName + '-', + `Custom font-family "${fontFamily}" is out of control, please prefix with ${appName}-`, }); function findTopParentSelector(node) { if (node.parent.type === 'root' || node.parent.type === 'atrule') { return node.selector; - } else { - return findTopParentSelector(node.parent); } + return findTopParentSelector(node.parent); } function isInsideAtRule(node) { if (node.parent.type === 'atrule') { return true; - } else if (node.parent.type === 'root') { + } + if (node.parent.type === 'root') { return false; - } else { - return findTopParentSelector(node.parent); } + return findTopParentSelector(node.parent); } -module.exports = stylelint.createPlugin(ruleName, function (options) { - return function (root, result) { - if (!options) return; - var validOptions = stylelint.utils.validateOptions(result, ruleName, { - actual: options, - possible: optionsSchema, - }); - if (!validOptions) return; +module.exports = stylelint.createPlugin(ruleName, (options) => (root, result) => { + if (!options) return; + const validOptions = stylelint.utils.validateOptions(result, ruleName, { + actual: options, + possible: optionsSchema, + }); + if (!validOptions) return; - const whiteList = ['.' + options.appName, /^:.*/]; + const whiteList = [`.${options.appName}`, /^:.*/]; - root.walkAtRules('keyframes', (rule) => { - const keyframesName = rule.params; + root.walkAtRules('keyframes', (rule) => { + const keyframesName = rule.params; + + if (keyframesName.indexOf(`${options.appName}-`) === -1) { + stylelint.utils.report({ + ruleName: ruleName, + result: result, + node: rule, + message: messages.invalidKeyFrames(keyframesName, options.appName), + }); + } + }); - if (keyframesName.indexOf(options.appName + '-') === -1) { + root.walkAtRules('font-face', (rule) => { + rule.walkDecls('font-family', (decl) => { + if (decl.value.indexOf(`${options.appName}-`) === -1) { stylelint.utils.report({ ruleName: ruleName, result: result, node: rule, - message: messages.invalidKeyFrames(keyframesName, options.appName), + message: messages.invalidFontFace(decl.value, options.appName), }); } }); + }); - root.walkAtRules('font-face', (rule) => { - rule.walkDecls('font-family', (decl) => { - if (decl.value.indexOf(options.appName + '-') === -1) { - stylelint.utils.report({ - ruleName: ruleName, - result: result, - node: rule, - message: messages.invalidFontFace(decl.value, options.appName), - }); + root.walkRules((rule) => { + if (isInsideAtRule(rule)) return; + const topParentSelector = findTopParentSelector(rule); + if ( + whiteList.find((whiteRule) => { + if (whiteRule instanceof RegExp) { + return whiteRule.test(topParentSelector); } - }); - }); - - root.walkRules((rule) => { - if (isInsideAtRule(rule)) return; - const topParentSelector = findTopParentSelector(rule); - if ( - whiteList.find(function (whiteRule) { - if (whiteRule instanceof RegExp) { - return whiteRule.test(topParentSelector); - } else { - return whiteRule === topParentSelector; - } - }) - ) { - // in white list, skipped - return; - } + return whiteRule === topParentSelector; + }) + ) { + // in white list, skipped + return; + } - if ( - topParentSelector.indexOf('.' + options.appName + '-') === 0 || - topParentSelector.indexOf(options.appName + '-') === 0 - ) { - // good - } else { - stylelint.utils.report({ - ruleName: ruleName, - result: result, - node: rule, - message: messages.invalid(rule.selector, options.appName), - }); - } - }); - }; + if ( + topParentSelector.indexOf(`.${options.appName}-`) === 0 || + topParentSelector.indexOf(`${options.appName}-`) === 0 + ) { + // good + } else { + stylelint.utils.report({ + ruleName: ruleName, + result: result, + node: rule, + message: messages.invalid(rule.selector, options.appName), + }); + } + }); }); module.exports.ruleName = ruleName; diff --git a/test-locales.js b/test-locales.js index ec10e4b77..580ad5cfc 100644 --- a/test-locales.js +++ b/test-locales.js @@ -1,6 +1,6 @@ +import fs from 'node:fs/promises'; +import path from 'node:path'; import { chromium } from 'playwright'; -import fs from 'fs/promises'; -import path from 'path'; const REFERENCE_LOCALE = 'en'; const SOCIAL_SOURCE_LANGS = ['de', 'en', 'es', 'fr', 'he', 'it', 'nl', 'pl', 'pt', 'ru', 'tr', 'uk', 'zh-TW', 'zh']; diff --git a/types/events.d.ts b/types/events.d.ts index 5e1ca1a30..050dcafc8 100644 --- a/types/events.d.ts +++ b/types/events.d.ts @@ -2,4 +2,4 @@ import type { EventPayload } from '../blocks/UploadCtxProvider/EventEmitter'; export type EventMap = { [T in keyof EventPayload]: CustomEvent; -}; \ No newline at end of file +}; diff --git a/types/exported.d.ts b/types/exported.d.ts index ba034a1d6..d83e6b4a0 100644 --- a/types/exported.d.ts +++ b/types/exported.d.ts @@ -1,6 +1,6 @@ +import type { FuncCollectionValidator, FuncFileValidator } from '../abstract/ValidationManager'; import type { LocaleDefinition } from '../abstract/localeRegistry'; import type { complexConfigKeys } from '../blocks/Config/Config'; -import type { FuncFileValidator, FuncCollectionValidator } from '../abstract/ValidationManager'; export type { FuncFileValidator, FuncCollectionValidator } from '../abstract/ValidationManager'; @@ -83,8 +83,8 @@ export type ConfigAttributesType = KebabCaseKeys & LowerCaseKey export type KebabCase = S extends `${infer C}${infer T}` ? T extends Uncapitalize - ? `${Uncapitalize}${KebabCase}` - : `${Uncapitalize}-${KebabCase}` + ? `${Uncapitalize}${KebabCase}` + : `${Uncapitalize}-${KebabCase}` : S; export type KebabCaseKeys> = { [Key in keyof T as KebabCase]: T[Key] }; export type LowerCase = Lowercase; @@ -92,9 +92,10 @@ export type LowerCaseKeys> = { [Key in keyof T export type OutputFileStatus = 'idle' | 'uploading' | 'success' | 'failed' | 'removed'; -export type OutputCustomErrorType = 'CUSTOM_ERROR' +export type OutputCustomErrorType = 'CUSTOM_ERROR'; -export type OutputFileErrorType = OutputCustomErrorType +export type OutputFileErrorType = + | OutputCustomErrorType | 'NOT_AN_IMAGE' | 'FORBIDDEN_FILE_TYPE' | 'FILE_SIZE_EXCEEDED' @@ -102,7 +103,11 @@ export type OutputFileErrorType = OutputCustomErrorType | 'NETWORK_ERROR' | 'UNKNOWN_ERROR'; -export type OutputCollectionErrorType = OutputCustomErrorType | 'SOME_FILES_HAS_ERRORS' | 'TOO_MANY_FILES' | 'TOO_FEW_FILES'; +export type OutputCollectionErrorType = + | OutputCustomErrorType + | 'SOME_FILES_HAS_ERRORS' + | 'TOO_MANY_FILES' + | 'TOO_FEW_FILES'; export type OutputFileErrorPayload = { entry: OutputFileEntry; @@ -113,7 +118,7 @@ export type OutputErrorTypePayload = { FORBIDDEN_FILE_TYPE: OutputFileErrorPayload; FILE_SIZE_EXCEEDED: OutputFileErrorPayload; - SOME_FILES_HAS_ERRORS: {}; + SOME_FILES_HAS_ERRORS: Record; TOO_MANY_FILES: { min: number; max: number; @@ -136,22 +141,23 @@ export type OutputErrorTypePayload = { CUSTOM_ERROR: Record; }; -export type OutputError = - T extends OutputCustomErrorType +export type OutputError = T extends OutputCustomErrorType ? { - type?: T; - message: string; - payload?: OutputErrorTypePayload[T]; - } - : T extends keyof OutputErrorTypePayload ? { - type: T; - message: string; - payload?: OutputErrorTypePayload[T]; - } : never + type?: T; + message: string; + payload?: OutputErrorTypePayload[T]; + } + : T extends keyof OutputErrorTypePayload + ? { + type: T; + message: string; + payload?: OutputErrorTypePayload[T]; + } + : never; -export type OutputErrorFile = OutputError +export type OutputErrorFile = OutputError; -export type OutputErrorCollection = OutputError +export type OutputErrorCollection = OutputError; export type OutputFileEntry = { status: TStatus; @@ -168,7 +174,7 @@ export type OutputFileEntry uploadProgress: number; fullPath: string | null; } & ( - | { + | { status: 'success'; fileInfo: UploadcareFile; uuid: string; @@ -180,7 +186,7 @@ export type OutputFileEntry isRemoved: false; errors: []; } - | { + | { status: 'failed'; fileInfo: UploadcareFile | null; uuid: string | null; @@ -192,7 +198,7 @@ export type OutputFileEntry isRemoved: false; errors: OutputError[]; } - | { + | { status: 'uploading'; fileInfo: null; uuid: null; @@ -204,7 +210,7 @@ export type OutputFileEntry isRemoved: false; errors: []; } - | { + | { status: 'removed'; fileInfo: UploadcareFile | null; uuid: string | null; @@ -216,7 +222,7 @@ export type OutputFileEntry isRemoved: true; errors: OutputError[]; } - | { + | { status: 'idle'; fileInfo: null; uuid: null; @@ -228,7 +234,7 @@ export type OutputFileEntry isRemoved: false; errors: []; } - ); +); export type OutputCollectionStatus = 'idle' | 'uploading' | 'success' | 'failed'; @@ -252,43 +258,41 @@ export type OutputCollectionState< } & (TGroupFlag extends 'has-group' ? { group: UploadcareGroup } : TGroupFlag extends 'maybe-has-group' - ? { group: UploadcareGroup | null } - : never) & + ? { group: UploadcareGroup | null } + : never) & ( | { - status: 'idle'; - isFailed: false; - isUploading: false; - isSuccess: false; - errors: []; - allEntries: OutputFileEntry<'idle' | 'success'>[]; - } + status: 'idle'; + isFailed: false; + isUploading: false; + isSuccess: false; + errors: []; + allEntries: OutputFileEntry<'idle' | 'success'>[]; + } | { - status: 'uploading'; - isFailed: false; - isUploading: true; - isSuccess: false; - errors: []; - allEntries: OutputFileEntry[]; - } + status: 'uploading'; + isFailed: false; + isUploading: true; + isSuccess: false; + errors: []; + allEntries: OutputFileEntry[]; + } | { - status: 'success'; - isFailed: false; - isUploading: false; - isSuccess: true; - errors: []; - allEntries: OutputFileEntry<'success'>[]; - } + status: 'success'; + isFailed: false; + isUploading: false; + isSuccess: true; + errors: []; + allEntries: OutputFileEntry<'success'>[]; + } | { - status: 'failed'; - isFailed: true; - isUploading: false; - isSuccess: false; - errors: OutputError[]; - allEntries: OutputFileEntry[]; - } + status: 'failed'; + isFailed: true; + isUploading: false; + isSuccess: false; + errors: OutputError[]; + allEntries: OutputFileEntry[]; + } ); export { EventType, EventPayload } from '../blocks/UploadCtxProvider/EventEmitter'; - -export { }; diff --git a/types/global.d.ts b/types/global.d.ts index 8b3d08dca..2ca9f08f2 100644 --- a/types/global.d.ts +++ b/types/global.d.ts @@ -1,5 +1,5 @@ import { LR_WINDOW_KEY } from '../abstract/connectBlocksFrom.js'; -import * as blocks from '../index.js'; +import type * as blocks from '../index.js'; declare global { interface Window { diff --git a/types/index.d.ts b/types/index.d.ts index aa5d590dc..14b006d18 100644 --- a/types/index.d.ts +++ b/types/index.d.ts @@ -1,2 +1,2 @@ -export * from "./events.js"; -export * from "./exported.js"; +export * from './events.js'; +export * from './exported.js'; diff --git a/types/index.js b/types/index.js index 66165808e..6e7dd8acc 100644 --- a/types/index.js +++ b/types/index.js @@ -1,3 +1,2 @@ -/* eslint-disable import/export */ export * from './exported.js'; export * from './events.js'; diff --git a/types/jsx.d.ts b/types/jsx.d.ts index e1e61b1a9..5b5e819f1 100644 --- a/types/jsx.d.ts +++ b/types/jsx.d.ts @@ -15,39 +15,42 @@ type CommonHtmlAttributes = Partial< Pick, 'id' | 'children' | 'hidden'> & { class: React.HTMLAttributes['className'] } >; -type CustomElement = React.DetailedHTMLProps, C> & A; +type CustomElement = React.DetailedHTMLProps, C> & A; + +// biome-ignore lint/suspicious/noExplicitAny: +type UntypedElement = any; declare namespace JSX { interface IntrinsicElements { - 'lr-crop-frame': any; - 'lr-editor-crop-button-control': any; - 'lr-editor-filter-control': any; - 'lr-editor-operation-control': any; - 'lr-editor-image-cropper': any; - 'lr-editor-image-fader': any; - 'lr-editor-scroller': any; - 'lr-editor-slider': any; - 'lr-editor-toolbar': any; - 'lr-lr-btn-ui': any; - 'lr-line-loader-ui': any; - 'lr-presence-toggle': any; - 'lr-slider-ui': any; - 'lr-icon': any; - 'lr-img': any; - 'lr-simple-btn': any; - 'lr-start-from': any; - 'lr-drop-area': any; - 'lr-source-btn': any; - 'lr-source-list': any; - 'lr-file-item': any; - 'lr-modal': any; - 'lr-upload-list': any; - 'lr-url-source': any; - 'lr-camera-source': any; - 'lr-progress-bar-common': any; - 'lr-progress-bar': any; - 'lr-external-source': any; - 'lr-cloud-image-editor-activity': any; + 'lr-crop-frame': UntypedElement; + 'lr-editor-crop-button-control': UntypedElement; + 'lr-editor-filter-control': UntypedElement; + 'lr-editor-operation-control': UntypedElement; + 'lr-editor-image-cropper': UntypedElement; + 'lr-editor-image-fader': UntypedElement; + 'lr-editor-scroller': UntypedElement; + 'lr-editor-slider': UntypedElement; + 'lr-editor-toolbar': UntypedElement; + 'lr-lr-btn-ui': UntypedElement; + 'lr-line-loader-ui': UntypedElement; + 'lr-presence-toggle': UntypedElement; + 'lr-slider-ui': UntypedElement; + 'lr-icon': UntypedElement; + 'lr-img': UntypedElement; + 'lr-simple-btn': UntypedElement; + 'lr-start-from': UntypedElement; + 'lr-drop-area': UntypedElement; + 'lr-source-btn': UntypedElement; + 'lr-source-list': UntypedElement; + 'lr-file-item': UntypedElement; + 'lr-modal': UntypedElement; + 'lr-upload-list': UntypedElement; + 'lr-url-source': UntypedElement; + 'lr-camera-source': UntypedElement; + 'lr-progress-bar-common': UntypedElement; + 'lr-progress-bar': UntypedElement; + 'lr-external-source': UntypedElement; + 'lr-cloud-image-editor-activity': UntypedElement; 'lr-cloud-image-editor-block': CustomElement< CloudImageEditorBlock, CtxAttributes & ({ uuid: string } | { 'cdn-url': string }) & Partial<{ tabs: string; 'crop-preset': string }> diff --git a/types/test/lr-config.test-d.tsx b/types/test/lr-config.test-d.tsx index f5e8ca914..b17a3a629 100644 --- a/types/test/lr-config.test-d.tsx +++ b/types/test/lr-config.test-d.tsx @@ -1,25 +1,25 @@ import React from 'react'; import { expectType } from 'tsd'; import '../jsx.js'; -import { OutputFileEntry, FuncCollectionValidator, FuncFileValidator } from '../index.js'; +import type { FuncCollectionValidator, FuncFileValidator, OutputFileEntry } from '../index.js'; // @ts-expect-error untyped props -() => ; +() => ; // @ts-expect-error missing ctx-name -() => ; +() => ; // allow common html attributes and required ctx-name -() => ; +() =>