Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bump prettier from 2.3.2 to 3.2.5 in /assets #316

Merged
merged 2 commits into from
Apr 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
94 changes: 45 additions & 49 deletions assets/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,52 +1,48 @@
module.exports = {
root: true,
parser: "@typescript-eslint/parser",
plugins: [
"@typescript-eslint",
"react",
"jsx-a11y",
],
extends: [
"eslint:recommended",
"plugin:@typescript-eslint/recommended",
"plugin:react/recommended",
"plugin:jsx-a11y/recommended",
],
"settings": {
"react": {
"version": "detect",
},
root: true,
parser: "@typescript-eslint/parser",
plugins: ["@typescript-eslint", "react", "jsx-a11y"],
extends: [
"eslint:recommended",
"plugin:@typescript-eslint/recommended",
"plugin:react/recommended",
"plugin:jsx-a11y/recommended",
],
settings: {
react: {
version: "detect",
},
"parserOptions": {
"ecmaFeatures": {
"jsx": true,
},
},
parserOptions: {
ecmaFeatures: {
jsx: true,
},
"reportUnusedDisableDirectives": true,
"rules": {
"no-console": 0,
"prefer-rest-params": "off",
"@typescript-eslint/ban-ts-comment": "off",
"@typescript-eslint/no-explicit-any": "off",
"@typescript-eslint/no-unused-vars": [
"error",
{
"argsIgnorePattern": "^_.*",
"varsIgnorePattern": "^_.*",
"destructuredArrayIgnorePattern": "^_.*",
}
],
"react/display-name": "off",
"react/function-component-definition": [
"error",
{
"namedComponents": "arrow-function",
"unnamedComponents": "arrow-function",
},
],
"react/hook-use-state": "error",
"react/no-danger": "error",
"jsx-a11y/no-static-element-interactions": "off",
"jsx-a11y/click-events-have-key-events": "off"
}
};
},
reportUnusedDisableDirectives: true,
rules: {
"no-console": 0,
"prefer-rest-params": "off",
"@typescript-eslint/ban-ts-comment": "off",
"@typescript-eslint/no-explicit-any": "off",
"@typescript-eslint/no-unused-vars": [
"error",
{
argsIgnorePattern: "^_.*",
varsIgnorePattern: "^_.*",
destructuredArrayIgnorePattern: "^_.*",
},
],
"react/display-name": "off",
"react/function-component-definition": [
"error",
{
namedComponents: "arrow-function",
unnamedComponents: "arrow-function",
},
],
"react/hook-use-state": "error",
"react/no-danger": "error",
"jsx-a11y/no-static-element-interactions": "off",
"jsx-a11y/click-events-have-key-events": "off",
},
};
2 changes: 1 addition & 1 deletion assets/index.d.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
declare module "*.png";
declare module "*.jpg";
declare module '*.svg';
declare module "*.svg";
2 changes: 1 addition & 1 deletion assets/js/components/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { Routes, Route, BrowserRouter } from "react-router-dom";
import { ScreenplayProvider } from "../hooks/useScreenplayContext";

const OutfrontTakeoverTool = React.lazy(
() => import("./OutfrontTakeoverTool/OutfrontTakeoverTool")
() => import("./OutfrontTakeoverTool/OutfrontTakeoverTool"),
);
const Dashboard = React.lazy(() => import("./Dashboard/Dashboard"));
const PlacesPage = React.lazy(() => import("./Dashboard/PlacesPage"));
Expand Down
4 changes: 2 additions & 2 deletions assets/js/components/Dashboard/AlertBanner.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ const AlertBanner: ComponentType<AlertBannerProps> = ({
return translateRouteID(alert.affected_list[0]);
} else if (
alert.affected_list.every((routeId: string) =>
routeId.startsWith("green")
routeId.startsWith("green"),
)
) {
return "Green Line";
Expand Down Expand Up @@ -72,7 +72,7 @@ const AlertBanner: ComponentType<AlertBannerProps> = ({
<>
<span className="bold">
{`${aOrAn(
affectedListString
affectedListString,
)} ${affectedListString} ${formatEffect(alert.effect)}
alert was just closed.`}
</span>{" "}
Expand Down
2 changes: 1 addition & 1 deletion assets/js/components/Dashboard/AlertCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ const AlertCard = (props: AlertCardProps): JSX.Element => {
numberOfScreens,
],
prevAlert,
showAnimationOnMount
showAnimationOnMount,
);
const isRecurring = alert.active_period.length > 1;

Expand Down
6 changes: 3 additions & 3 deletions assets/js/components/Dashboard/AlertDetails.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -54,11 +54,11 @@ const AlertDetails: ComponentType = () => {

const [placesListState, placesListDispatch] = useReducer(
placesListReducer,
initialPlacesListState
initialPlacesListState,
);

const validAlertId = contextState.allAPIAlertIds.find(
(alert) => alert === id
(alert) => alert === id,
);

return selectedAlert ? (
Expand Down Expand Up @@ -93,7 +93,7 @@ const AlertDetails: ComponentType = () => {
places={placesWithSelectedAlert(
selectedAlert,
places,
screensByAlertMap
screensByAlertMap,
)}
noModeFilter
isAlertPlacesList
Expand Down
16 changes: 8 additions & 8 deletions assets/js/components/Dashboard/AlertsPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ const AlertsPage: ComponentType = () => {
const { places, alerts, screensByAlertMap } = useScreenplayContext();

const alertsWithPlaces = alerts.filter(
(alert) => screensByAlertMap[alert.id]
(alert) => screensByAlertMap[alert.id],
);

return (
Expand Down Expand Up @@ -117,7 +117,7 @@ const AlertsList: ComponentType<AlertsListProps> = ({
numPlaces = placesWithSelectedAlert(
alert,
places,
screensByAlertMap
screensByAlertMap,
).length;
}

Expand Down Expand Up @@ -145,22 +145,22 @@ const AlertsList: ComponentType<AlertsListProps> = ({
if (screenTypeFilterValue !== SCREEN_TYPES[0]) {
filteredAlerts = filterAlertsByScreenType(
filteredAlerts,
screenTypeFilterValue
screenTypeFilterValue,
);
}

if (modeLineFilterValue !== MODES_AND_LINES[0]) {
filteredAlerts = filterAlertsByModeOrLine(
filteredAlerts,
modeLineFilterValue
modeLineFilterValue,
);
}
return filteredAlerts;
};

const filterAlertsByModeOrLine = (
alerts: Alert[],
{ label, ids }: { label: string; ids: string[] }
{ label, ids }: { label: string; ids: string[] },
) => {
const isRelevantIE: (ie: InformedEntity) => boolean = (() => {
switch (label) {
Expand Down Expand Up @@ -197,23 +197,23 @@ const AlertsList: ComponentType<AlertsListProps> = ({

const filterAlertsByScreenType = (
alerts: Alert[],
{ ids }: { label: string; ids: string[] }
{ ids }: { label: string; ids: string[] },
) => {
return alerts.filter((alert) => {
// Get this alert's list of affected screens.
const screensWithAlert = screensByAlertMap[alert.id];

return screensWithAlert
? screensWithAlert.find((screen_id) =>
ids.includes(screenMetaData[screen_id].type)
ids.includes(screenMetaData[screen_id].type),
)
: false;
});
};

const compareAlerts = (
{ active_period: active_period_1 }: Alert,
{ active_period: active_period_2 }: Alert
{ active_period: active_period_2 }: Alert,
) => {
// Get the soonest start time
const start1 = moment(active_period_1[0].start);
Expand Down
6 changes: 3 additions & 3 deletions assets/js/components/Dashboard/Dashboard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ const Dashboard: ComponentType = () => {
});

fetchPlaces((placesList) =>
dispatch({ type: "SET_PLACES", places: placesList })
dispatch({ type: "SET_PLACES", places: placesList }),
);
}, []);

Expand Down Expand Up @@ -114,7 +114,7 @@ const Dashboard: ComponentType = () => {
})
// sort them in descending order to get the most recently created or updated alert
.sort((a1, a2) =>
new Date(a1.updated_at) < new Date(a2.updated_at) ? 1 : -1
new Date(a1.updated_at) < new Date(a2.updated_at) ? 1 : -1,
)
// get the first alert in the list or underfined if there are none
.find((alert) => alert)
Expand All @@ -128,7 +128,7 @@ const Dashboard: ComponentType = () => {
type: "SET_BANNER_ALERT",
bannerAlert: undefined,
}),
5000
5000,
);
};

Expand Down
8 changes: 4 additions & 4 deletions assets/js/components/Dashboard/FilterDropdown.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ const CustomMenu = React.forwardRef<HTMLElement, CustomMenuProps>(
<ul>{children}</ul>
</div>
);
}
},
);

/**
Expand All @@ -62,7 +62,7 @@ const FilterDropdown = (props: FilterDropdownProps): JSX.Element => {
"filter-dropdown__dropdown-button--small": !isDefault(),
"filter-dropdown__dropdown-button--large": isDefault(),
disabled: props.disabled,
}
},
)}
title={props.disabled ? "Coming Soon!" : selectedValue.label}
data-testid="filter-dropdown-button"
Expand All @@ -79,7 +79,7 @@ const FilterDropdown = (props: FilterDropdownProps): JSX.Element => {
<ButtonGroup
className={classWithModifier(
"filter-dropdown__button-group",
props.className
props.className,
)}
>
{!isDefault() && (
Expand All @@ -98,7 +98,7 @@ const FilterDropdown = (props: FilterDropdownProps): JSX.Element => {
onSelect={onSelect}
className={classWithModifier(
"filter-dropdown__dropdown",
props.className
props.className,
)}
>
{props.disabled ? (
Expand Down
15 changes: 8 additions & 7 deletions assets/js/components/Dashboard/PaessDetailContainer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ interface PaessDetailContainerProps {
}

const PaessDetailContainer = (
props: PaessDetailContainerProps
props: PaessDetailContainerProps,
): JSX.Element => {
const zonePositions = {
left: ["s", "w"],
Expand All @@ -18,14 +18,15 @@ const PaessDetailContainer = (

const stationCode = props.screens[0].station_code;
const leftScreens = props.screens.filter(
(screen) => screen.zone != null && zonePositions.left.includes(screen.zone)
(screen) => screen.zone != null && zonePositions.left.includes(screen.zone),
);
const centerScreens = props.screens.filter(
(screen) =>
screen.zone != null && zonePositions.center.includes(screen.zone)
screen.zone != null && zonePositions.center.includes(screen.zone),
);
const rightScreens = props.screens.filter(
(screen) => screen.zone != null && zonePositions.right.includes(screen.zone)
(screen) =>
screen.zone != null && zonePositions.right.includes(screen.zone),
);

return (
Expand All @@ -47,7 +48,7 @@ const PaessDetailContainer = (
zone={screen.zone}
label={screen.label}
/>
)
),
)}
</div>
)}
Expand All @@ -69,7 +70,7 @@ const PaessDetailContainer = (
zone={screen.zone}
label={screen.label}
/>
)
),
)}
</div>
)}
Expand All @@ -91,7 +92,7 @@ const PaessDetailContainer = (
zone={screen.zone}
label={screen.label}
/>
)
),
)}
</div>
)}
Expand Down
Loading
Loading