Skip to content

Commit

Permalink
ran linter
Browse files Browse the repository at this point in the history
  • Loading branch information
mark-tate committed Nov 5, 2024
1 parent 192cc69 commit 535b412
Show file tree
Hide file tree
Showing 8 changed files with 29 additions and 14 deletions.
7 changes: 4 additions & 3 deletions packages/lab/src/date-adapters/date-fns.ts
Original file line number Diff line number Diff line change
Expand Up @@ -465,14 +465,15 @@ export class AdapterDateFns implements SaltDateAdapter<Date, Locale> {
format: "long" | "short" | "narrow",
locale: Locale,
): string {
const startOfWeekDate = startOfWeek(new Date(), { locale: locale ?? this.locale });
const startOfWeekDate = startOfWeek(new Date(), {
locale: locale ?? this.locale,
});
const targetDate = addDaysFns(startOfWeekDate, dow);
return new Intl.DateTimeFormat( locale?.code ?? this.locale?.code, {
return new Intl.DateTimeFormat(locale?.code ?? this.locale?.code, {
weekday: format,
}).format(targetDate);
}


/**
* Gets the day of the month for a Date object.
* @param date - The Date object.
Expand Down
6 changes: 3 additions & 3 deletions packages/lab/src/date-adapters/dayjs.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import defaultDayjs, { type Dayjs } from "dayjs";
import customParseFormat from "dayjs/plugin/customParseFormat";
import localeData from "dayjs/plugin/localeData";
import timezone from "dayjs/plugin/timezone";
import utc from "dayjs/plugin/utc";
import weekday from "dayjs/plugin/weekday";
import localeData from 'dayjs/plugin/localeData';
import type {
AdapterOptions,
RecommendedFormats,
Expand Down Expand Up @@ -508,15 +508,15 @@ export class AdapterDayjs implements SaltDateAdapter<Dayjs, string> {
public getDayOfWeekName(
dow: number,
format: "long" | "short" | "narrow",
locale?: string
locale?: string,
): string {
const dayjsInstance = this.dayjs().locale(locale || this.locale);
if (format === "narrow") {
return dayjsInstance.localeData().weekdaysMin()[dow];
} else if (format === "short") {
return dayjsInstance.localeData().weekdaysShort()[dow];
}

Check failure on line 518 in packages/lab/src/date-adapters/dayjs.ts

View workflow job for this annotation

GitHub Actions / lint

lint/style/noUselessElse

This else clause can be omitted because previous branches break early.
return dayjsInstance.localeData().weekdays()[dow];
return dayjsInstance.localeData().weekdays()[dow];
}

/**
Expand Down
4 changes: 2 additions & 2 deletions packages/lab/src/date-picker/DatePicker.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import {
type ReactNode,
type Ref,
forwardRef,
useRef,
useImperativeHandle,
type Ref
useRef,
} from "react";
import type { DateFrameworkType } from "../date-adapters";
import {
Expand Down
10 changes: 9 additions & 1 deletion packages/lab/src/date-picker/DatePickerRangeInput.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,15 @@ export const DatePickerRangeInput = forwardRef(function DatePickerRangeInput<
const { CalendarIcon } = useIcon();

const {
state: { selectedDate, disabled, readOnly, cancelled, minDate, maxDate, resetRequired },
state: {
selectedDate,
disabled,
readOnly,
cancelled,
minDate,
maxDate,
resetRequired,
},
helpers: { select },
} = useDatePickerContext<TDate>({ selectionVariant: "range" });
const {
Expand Down
10 changes: 9 additions & 1 deletion packages/lab/src/date-picker/DatePickerSingleInput.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,15 @@ export const DatePickerSingleInput = forwardRef<
} = props;

const {
state: { selectedDate, disabled, readOnly, cancelled, minDate, maxDate, resetRequired },
state: {
selectedDate,
disabled,
readOnly,
cancelled,
minDate,
maxDate,
resetRequired,
},
helpers: { select },
} = useDatePickerContext<TDate>({ selectionVariant: "single" });
const {
Expand Down
3 changes: 1 addition & 2 deletions packages/lab/src/date-picker/DatePickerTrigger.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { makePrefixer, useForkRef } from "@salt-ds/core";
import { clsx } from "clsx";
import { forwardRef, type ReactNode } from "react";
import { type DateFrameworkType } from "../date-adapters";
import { type ReactNode, forwardRef } from "react";
import { useDatePickerOverlay } from "./DatePickerOverlayProvider";

const withBaseName = makePrefixer("saltDatePickerTrigger");
Expand Down
1 change: 0 additions & 1 deletion packages/lab/src/date-picker/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,3 @@ export * from "./DatePickerRangePanel";
export * from "./DatePickerSingleInput";
export * from "./DatePickerSinglePanel";
export * from "./DatePickerTrigger";

2 changes: 1 addition & 1 deletion packages/lab/stories/date-picker/date-picker.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ import {
DatePickerSinglePanel,
type DatePickerSinglePanelProps,
type DatePickerSingleProps,
type DateRangeSelection,
DatePickerTrigger,
type DateRangeSelection,
LocalizationProvider,
type LocalizationProviderProps,
type SingleDatePickerState,
Expand Down

0 comments on commit 535b412

Please sign in to comment.