From 35cc68a457965d4dd2a8401aedbacb11ab4fb6ce Mon Sep 17 00:00:00 2001 From: silverwind Date: Thu, 14 Mar 2024 23:19:38 +0100 Subject: [PATCH] Run `eslint . --ext .js,.ts --fix` --- src/duration-format-ponyfill.ts | 4 ++-- src/duration.ts | 2 +- src/relative-time-element.ts | 9 +++++++-- 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/src/duration-format-ponyfill.ts b/src/duration-format-ponyfill.ts index 15ccd7d..a86be7a 100644 --- a/src/duration-format-ponyfill.ts +++ b/src/duration-format-ponyfill.ts @@ -108,8 +108,8 @@ export default class DurationFormat { unitStyle === '2-digit' ? twoDigitFormatOptions : unitStyle === 'numeric' - ? {} - : {style: 'unit', unit: nfUnit, unitDisplay: unitStyle} + ? {} + : {style: 'unit', unit: nfUnit, unitDisplay: unitStyle} list.push(new Intl.NumberFormat(locale, nfOpts).format(value)) } return new ListFormat(locale, { diff --git a/src/duration.ts b/src/duration.ts index a0529e3..1bfee39 100644 --- a/src/duration.ts +++ b/src/duration.ts @@ -2,7 +2,7 @@ import DurationFormat from './duration-format-ponyfill.js' import type {DurationFormatOptions} from './duration-format-ponyfill.js' const durationRe = /^[-+]?P(?:(\d+)Y)?(?:(\d+)M)?(?:(\d+)W)?(?:(\d+)D)?(?:T(?:(\d+)H)?(?:(\d+)M)?(?:(\d+)S)?)?$/ export const unitNames = ['year', 'month', 'week', 'day', 'hour', 'minute', 'second', 'millisecond'] as const -export type Unit = typeof unitNames[number] +export type Unit = (typeof unitNames)[number] export const isDuration = (str: string) => durationRe.test(str) type Sign = -1 | 0 | 1 diff --git a/src/relative-time-element.ts b/src/relative-time-element.ts index 1d43534..01a11a2 100644 --- a/src/relative-time-element.ts +++ b/src/relative-time-element.ts @@ -1,5 +1,5 @@ import {Duration, elapsedTime, getRelativeTimeUnit, isDuration, roundToSingleUnit, Unit, unitNames} from './duration.js' -const HTMLElement = globalThis.HTMLElement || (null as unknown as typeof window['HTMLElement']) +const HTMLElement = globalThis.HTMLElement || (null as unknown as (typeof window)['HTMLElement']) export type DeprecatedFormat = 'auto' | 'micro' | 'elapsed' export type ResolvedFormat = 'duration' | 'relative' | 'datetime' @@ -11,7 +11,12 @@ const emptyDuration = new Duration() const microEmptyDuration = new Duration(0, 0, 0, 0, 0, 1) export class RelativeTimeUpdatedEvent extends Event { - constructor(public oldText: string, public newText: string, public oldTitle: string, public newTitle: string) { + constructor( + public oldText: string, + public newText: string, + public oldTitle: string, + public newTitle: string, + ) { super('relative-time-updated', {bubbles: true, composed: true}) } }