Skip to content

Commit

Permalink
Merge pull request #4258 from Hacker0x01/prettier
Browse files Browse the repository at this point in the history
Run prettier on all files
  • Loading branch information
martijnrusschen authored Sep 15, 2023
2 parents 3db28d2 + 3eb4460 commit 5899ec3
Show file tree
Hide file tree
Showing 18 changed files with 57 additions and 57 deletions.
2 changes: 1 addition & 1 deletion docs-site/config-overrides.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ module.exports = function override(config, env) {
use: "raw-loader",
});
config.resolve.plugins = config.resolve.plugins.filter(
(plugin) => !(plugin instanceof ModuleScopePlugin)
(plugin) => !(plugin instanceof ModuleScopePlugin),
);
// Enable it, so that our custom .eslintrc for the examples will work
for (let i = 0; i < config.module.rules.length; i++) {
Expand Down
2 changes: 1 addition & 1 deletion docs-site/src/components/Examples/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -531,7 +531,7 @@ export default class exampleComponents extends React.Component {
onClick={(e) =>
this.handleAnchorClick(
e,
`example-${slugify(example.title, { lower: true })}`
`example-${slugify(example.title, { lower: true })}`,
)
}
>
Expand Down
2 changes: 1 addition & 1 deletion docs-site/src/examples/excludeTimePeriod.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
() => {
const [startDate, setStartDate] = useState(
setHours(setMinutes(new Date(), 30), 17)
setHours(setMinutes(new Date(), 30), 17),
);
return (
<DatePicker
Expand Down
2 changes: 1 addition & 1 deletion docs-site/src/examples/excludeTimes.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
() => {
const [startDate, setStartDate] = useState(
setHours(setMinutes(new Date(), 30), 16)
setHours(setMinutes(new Date(), 30), 16),
);
return (
<DatePicker
Expand Down
2 changes: 1 addition & 1 deletion docs-site/src/examples/filterTimes.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
() => {
const [startDate, setStartDate] = useState(
setHours(setMinutes(new Date(), 0), 9)
setHours(setMinutes(new Date(), 0), 9),
);
const filterPassedTime = (time) => {
const currentDate = new Date();
Expand Down
2 changes: 1 addition & 1 deletion docs-site/src/examples/includeTimes.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
() => {
const [startDate, setStartDate] = useState(
setHours(setMinutes(new Date(), 30), 16)
setHours(setMinutes(new Date(), 30), 16),
);
return (
<DatePicker
Expand Down
2 changes: 1 addition & 1 deletion docs-site/src/examples/injectTimes.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
() => {
const [startDate, setStartDate] = useState(
setHours(setMinutes(new Date(), 30), 16)
setHours(setMinutes(new Date(), 30), 16),
);
return (
<DatePicker
Expand Down
62 changes: 31 additions & 31 deletions src/date_utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ export function formatDate(date, formatStr, locale) {
let localeObj = getLocaleObject(locale);
if (locale && !localeObj) {
console.warn(
`A locale object was not found for the provided string ["${locale}"].`
`A locale object was not found for the provided string ["${locale}"].`,
);
}
if (
Expand All @@ -168,7 +168,7 @@ export function safeDateFormat(date, { dateFormat, locale }) {
formatDate(
date,
Array.isArray(dateFormat) ? dateFormat[0] : dateFormat,
locale
locale,
)) ||
""
);
Expand Down Expand Up @@ -404,21 +404,21 @@ export function isDayDisabled(
includeDates,
includeDateIntervals,
filterDate,
} = {}
} = {},
) {
return (
isOutOfBounds(day, { minDate, maxDate }) ||
(excludeDates &&
excludeDates.some((excludeDate) => isSameDay(day, excludeDate))) ||
(excludeDateIntervals &&
excludeDateIntervals.some(({ start, end }) =>
isWithinInterval(day, { start, end })
isWithinInterval(day, { start, end }),
)) ||
(includeDates &&
!includeDates.some((includeDate) => isSameDay(day, includeDate))) ||
(includeDateIntervals &&
!includeDateIntervals.some(({ start, end }) =>
isWithinInterval(day, { start, end })
isWithinInterval(day, { start, end }),
)) ||
(filterDate && !filterDate(newDate(day))) ||
false
Expand All @@ -427,11 +427,11 @@ export function isDayDisabled(

export function isDayExcluded(
day,
{ excludeDates, excludeDateIntervals } = {}
{ excludeDates, excludeDateIntervals } = {},
) {
if (excludeDateIntervals && excludeDateIntervals.length > 0) {
return excludeDateIntervals.some(({ start, end }) =>
isWithinInterval(day, { start, end })
isWithinInterval(day, { start, end }),
);
}
return (
Expand All @@ -443,7 +443,7 @@ export function isDayExcluded(

export function isMonthDisabled(
month,
{ minDate, maxDate, excludeDates, includeDates, filterDate } = {}
{ minDate, maxDate, excludeDates, includeDates, filterDate } = {},
) {
return (
isOutOfBounds(month, {
Expand Down Expand Up @@ -478,17 +478,17 @@ export function isMonthinRange(startDate, endDate, m, day) {

export function isQuarterDisabled(
quarter,
{ minDate, maxDate, excludeDates, includeDates, filterDate } = {}
{ minDate, maxDate, excludeDates, includeDates, filterDate } = {},
) {
return (
isOutOfBounds(quarter, { minDate, maxDate }) ||
(excludeDates &&
excludeDates.some((excludeDate) =>
isSameQuarter(quarter, excludeDate)
isSameQuarter(quarter, excludeDate),
)) ||
(includeDates &&
!includeDates.some((includeDate) =>
isSameQuarter(quarter, includeDate)
isSameQuarter(quarter, includeDate),
)) ||
(filterDate && !filterDate(newDate(quarter))) ||
false
Expand All @@ -511,7 +511,7 @@ export function isYearInRange(year, start, end) {

export function isYearDisabled(
year,
{ minDate, maxDate, excludeDates, includeDates, filterDate } = {}
{ minDate, maxDate, excludeDates, includeDates, filterDate } = {},
) {
const date = new Date(year, 0, 1);
return (
Expand Down Expand Up @@ -556,13 +556,13 @@ export function isTimeInList(time, times) {
return times.some(
(listTime) =>
getHours(listTime) === getHours(time) &&
getMinutes(listTime) === getMinutes(time)
getMinutes(listTime) === getMinutes(time),
);
}

export function isTimeDisabled(
time,
{ excludeTimes, includeTimes, filterTime } = {}
{ excludeTimes, includeTimes, filterTime } = {},
) {
return (
(excludeTimes && isTimeInList(time, excludeTimes)) ||
Expand All @@ -580,11 +580,11 @@ export function isTimeInDisabledRange(time, { minTime, maxTime }) {
const baseTime = setHours(setMinutes(base, getMinutes(time)), getHours(time));
const min = setHours(
setMinutes(base, getMinutes(minTime)),
getHours(minTime)
getHours(minTime),
);
const max = setHours(
setMinutes(base, getMinutes(maxTime)),
getHours(maxTime)
getHours(maxTime),
);

let valid;
Expand All @@ -603,7 +603,7 @@ export function monthDisabledBefore(day, { minDate, includeDates } = {}) {
(includeDates &&
includeDates.every(
(includeDate) =>
differenceInCalendarMonths(includeDate, previousMonth) > 0
differenceInCalendarMonths(includeDate, previousMonth) > 0,
)) ||
false
);
Expand All @@ -615,7 +615,7 @@ export function monthDisabledAfter(day, { maxDate, includeDates } = {}) {
(maxDate && differenceInCalendarMonths(nextMonth, maxDate) > 0) ||
(includeDates &&
includeDates.every(
(includeDate) => differenceInCalendarMonths(nextMonth, includeDate) > 0
(includeDate) => differenceInCalendarMonths(nextMonth, includeDate) > 0,
)) ||
false
);
Expand All @@ -628,15 +628,15 @@ export function yearDisabledBefore(day, { minDate, includeDates } = {}) {
(includeDates &&
includeDates.every(
(includeDate) =>
differenceInCalendarYears(includeDate, previousYear) > 0
differenceInCalendarYears(includeDate, previousYear) > 0,
)) ||
false
);
}

export function yearsDisabledBefore(
day,
{ minDate, yearItemNumber = DEFAULT_YEAR_ITEM_NUMBER } = {}
{ minDate, yearItemNumber = DEFAULT_YEAR_ITEM_NUMBER } = {},
) {
const previousYear = getStartOfYear(subYears(day, yearItemNumber));
const { endPeriod } = getYearsPeriod(previousYear, yearItemNumber);
Expand All @@ -650,15 +650,15 @@ export function yearDisabledAfter(day, { maxDate, includeDates } = {}) {
(maxDate && differenceInCalendarYears(nextYear, maxDate) > 0) ||
(includeDates &&
includeDates.every(
(includeDate) => differenceInCalendarYears(nextYear, includeDate) > 0
(includeDate) => differenceInCalendarYears(nextYear, includeDate) > 0,
)) ||
false
);
}

export function yearsDisabledAfter(
day,
{ maxDate, yearItemNumber = DEFAULT_YEAR_ITEM_NUMBER } = {}
{ maxDate, yearItemNumber = DEFAULT_YEAR_ITEM_NUMBER } = {},
) {
const nextYear = addYears(day, yearItemNumber);
const { startPeriod } = getYearsPeriod(nextYear, yearItemNumber);
Expand All @@ -669,7 +669,7 @@ export function yearsDisabledAfter(
export function getEffectiveMinDate({ minDate, includeDates }) {
if (includeDates && minDate) {
let minDates = includeDates.filter(
(includeDate) => differenceInCalendarDays(includeDate, minDate) >= 0
(includeDate) => differenceInCalendarDays(includeDate, minDate) >= 0,
);
return min(minDates);
} else if (includeDates) {
Expand All @@ -682,7 +682,7 @@ export function getEffectiveMinDate({ minDate, includeDates }) {
export function getEffectiveMaxDate({ maxDate, includeDates }) {
if (includeDates && maxDate) {
let maxDates = includeDates.filter(
(includeDate) => differenceInCalendarDays(includeDate, maxDate) <= 0
(includeDate) => differenceInCalendarDays(includeDate, maxDate) <= 0,
);
return max(maxDates);
} else if (includeDates) {
Expand All @@ -694,7 +694,7 @@ export function getEffectiveMaxDate({ maxDate, includeDates }) {

export function getHightLightDaysMap(
highlightDates = [],
defaultClassName = "react-datepicker__day--highlighted"
defaultClassName = "react-datepicker__day--highlighted",
) {
const dateClasses = new Map();
for (let i = 0, len = highlightDates.length; i < len; i++) {
Expand Down Expand Up @@ -747,7 +747,7 @@ export function arraysAreEqual(array1, array2) {
*/
export function getHolidaysMap(
holidayDates = [],
defaultClassName = "react-datepicker__day--holidays"
defaultClassName = "react-datepicker__day--holidays",
) {
const dateClasses = new Map();
holidayDates.forEach((holiday) => {
Expand Down Expand Up @@ -781,18 +781,18 @@ export function timesToInjectAfter(
currentTime,
currentMultiplier,
intervals,
injectedTimes
injectedTimes,
) {
const l = injectedTimes.length;
const times = [];
for (let i = 0; i < l; i++) {
const injectedTime = addMinutes(
addHours(startOfDay, getHours(injectedTimes[i])),
getMinutes(injectedTimes[i])
getMinutes(injectedTimes[i]),
);
const nextTime = addMinutes(
startOfDay,
(currentMultiplier + 1) * intervals
(currentMultiplier + 1) * intervals,
);

if (
Expand All @@ -812,7 +812,7 @@ export function addZero(i) {

export function getYearsPeriod(
date,
yearItemNumber = DEFAULT_YEAR_ITEM_NUMBER
yearItemNumber = DEFAULT_YEAR_ITEM_NUMBER,
) {
const endPeriod = Math.ceil(getYear(date) / yearItemNumber) * yearItemNumber;
const startPeriod = endPeriod - (yearItemNumber - 1);
Expand All @@ -825,7 +825,7 @@ export function getHoursInDay(d) {
d.getFullYear(),
d.getMonth(),
d.getDate(),
24
24,
);

return Math.round((+startOfTheNextDay - +startOfDay) / 3_600_000);
Expand Down
2 changes: 1 addition & 1 deletion src/month_dropdown.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ export default class MonthDropdown extends React.Component {
const monthNames = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11].map(
this.props.useShortMonthInDropdown
? (M) => utils.getMonthShortInLocale(M, this.props.locale)
: (M) => utils.getMonthInLocale(M, this.props.locale)
: (M) => utils.getMonthInLocale(M, this.props.locale),
);

let renderedDropdown;
Expand Down
4 changes: 2 additions & 2 deletions src/month_year_dropdown.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ export default class MonthYearDropdown extends React.Component {
options.push(
<option key={timepoint} value={timepoint}>
{formatDate(currDate, this.props.dateFormat, this.props.locale)}
</option>
</option>,
);

currDate = addMonths(currDate, 1);
Expand All @@ -68,7 +68,7 @@ export default class MonthYearDropdown extends React.Component {
const yearMonth = formatDate(
this.props.date,
this.props.dateFormat,
this.props.locale
this.props.locale,
);

return (
Expand Down
2 changes: 1 addition & 1 deletion src/month_year_dropdown_options.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ export default class MonthYearDropdownOptions extends React.Component {
this.state = {
monthYearsList: generateMonthYears(
this.props.minDate,
this.props.maxDate
this.props.maxDate,
),
};
}
Expand Down
2 changes: 1 addition & 1 deletion src/popper_component.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ export default class PopperComponent extends React.Component {

const wrapperClasses = classnames(
"react-datepicker-wrapper",
wrapperClassName
wrapperClassName,
);

return (
Expand Down
2 changes: 1 addition & 1 deletion src/portal.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export default class Portal extends React.Component {

componentDidMount() {
this.portalRoot = (this.props.portalHost || document).getElementById(
this.props.portalId
this.props.portalId,
);
if (!this.portalRoot) {
this.portalRoot = document.createElement("div");
Expand Down
2 changes: 1 addition & 1 deletion src/tab_loop.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ export default class TabLoop extends React.Component {
.call(
this.tabLoopRef.current.querySelectorAll(focusableElementsSelector),
1,
-1
-1,
)
.filter(focusableFilter);

Expand Down
4 changes: 2 additions & 2 deletions src/time.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ export default class Time extends React.Component {
this.props.monthRef
? this.props.monthRef.clientHeight - this.header.clientHeight
: this.list.clientHeight,
this.centerLi
this.centerLi,
);
if (this.props.monthRef && this.header) {
this.setState({
Expand Down Expand Up @@ -177,7 +177,7 @@ export default class Time extends React.Component {
currentTime,
i,
intervals,
sortedInjectTimes
sortedInjectTimes,
);
times = times.concat(timesToInject);
}
Expand Down
Loading

0 comments on commit 5899ec3

Please sign in to comment.