Skip to content

Commit 2f209b9

Browse files
authored
Update Node to v22. (#352)
* Update Node to v22. * Fix some JS console and eslint warnings.
1 parent a9bc847 commit 2f209b9

File tree

10 files changed

+33
-28
lines changed

10 files changed

+33
-28
lines changed

Dockerfile

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM node:18.17.0-bullseye-slim AS static_files
1+
FROM node:22.18.0-bullseye-slim AS static_files
22

33
WORKDIR /code
44
ENV PATH=/code/node_modules/.bin:$PATH
@@ -164,8 +164,10 @@ RUN --mount=type=cache,target=/var/cache/apt --mount=type=cache,target=/var/lib/
164164
# docker
165165
&& curl https://download.docker.com/linux/ubuntu/gpg | gpg --dearmor | tee /etc/apt/trusted.gpg.d/docker.gpg >/dev/null \
166166
&& echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/trusted.gpg.d/docker.gpg] https://download.docker.com/linux/debian $(lsb_release -cs) stable" | tee /etc/apt/sources.list.d/docker.list > /dev/null \
167-
# nodejs
168-
&& sh -c 'echo "deb https://deb.nodesource.com/node_18.x $(lsb_release -cs) main" > /etc/apt/sources.list.d/nodesource.list' \
167+
# nodejs (https://github.com/nodesource/distributions/wiki/Repository-Manual-Installation#debian-systems)
168+
&& mkdir -p /etc/apt/keyrings \
169+
&& curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg \
170+
&& sh -c 'echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_22.x nodistro main" > /etc/apt/sources.list.d/nodesource.list' \
169171
&& wget --quiet -O- https://deb.nodesource.com/gpgkey/nodesource.gpg.key | apt-key add - \
170172
# PostgreSQL
171173
&& sh -c 'echo "deb https://apt.postgresql.org/pub/repos/apt $(lsb_release -cs)-pgdg main" > /etc/apt/sources.list.d/pgdg.list' \

docs/dev-setup.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ Stops project. To begin you should have the following applications installed on
66
your local development system:
77

88
- Python 3.13
9-
- NodeJS >= 12.6.0
9+
- NodeJS >= 22
1010
- `Install uv <https://docs.astral.sh/uv/getting-started/installation/>`_
1111
- Postgres >= 16
1212

frontend/src/Components/AgencyData/AgencyHeader.js

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -81,18 +81,16 @@ function AgencyHeader({
8181
)}
8282
<P size={SIZES[0]} color={COLORS[0]} weight={WEIGHTS[0]}>
8383
{lastReportedStop()} {agencyDetails.last_reported_stop && 'on'}
84-
<S.ReportedDate size={SIZES[0]} color={COLORS[0]} weight={WEIGHTS[1]}>
84+
<strong>
8585
{' '}
86-
<S.ReportedDate size={SIZES[0]} color={COLORS[0]} weight={WEIGHTS[1]}>
87-
{agencyDetails.last_reported_stop
88-
? new Intl.DateTimeFormat('en-US', {
89-
year: 'numeric',
90-
month: 'short',
91-
day: 'numeric',
92-
}).format(new Date(agencyDetails.last_reported_stop))
93-
: 'Unknown'}
94-
</S.ReportedDate>
95-
</S.ReportedDate>
86+
{agencyDetails.last_reported_stop
87+
? new Intl.DateTimeFormat('en-US', {
88+
year: 'numeric',
89+
month: 'short',
90+
day: 'numeric',
91+
}).format(new Date(agencyDetails.last_reported_stop))
92+
: 'Unknown'}
93+
</strong>
9694
</P>
9795
</S.EntityDetails>
9896
<CensusData

frontend/src/Components/AgencyData/AgencyHeader.styled.js

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -74,10 +74,6 @@ export const AgencyTitle = styled(H2)`
7474
font-size: 18px;
7575
`;
7676

77-
export const ReportedDate = styled(P)`
78-
display: inline;
79-
`;
80-
8177
export const Other = styled(P)`
8278
font-size: 14px;
8379
`;

frontend/src/Components/AgencyData/CensusData.js

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -76,12 +76,10 @@ export default function CensusData({ agencyDetails, showCompareDepartments }) {
7676
<summary>
7777
<S.CensusTitleMobile>CENSUS DEMOGRAPHICS</S.CensusTitleMobile>
7878
</summary>
79-
<p>
80-
{censusData()}
81-
<a href={ABOUT_SLUG}>
82-
Sourced from most recent U.S. Census Bureau. See About page for more info.
83-
</a>
84-
</p>
79+
<S.CensusRowMobile>{censusData()}</S.CensusRowMobile>
80+
<a href={ABOUT_SLUG}>
81+
Sourced from most recent U.S. Census Bureau. See About page for more info.
82+
</a>
8583
</S.CensusDemographicsMobile>
8684
</>
8785
);

frontend/src/Components/AgencyData/CensusData.styled.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,14 @@ export const CensusRow = styled.ul`
6565
}
6666
`;
6767

68+
export const CensusRowMobile = styled.ul`
69+
margin: 0;
70+
padding: 0;
71+
display: flex;
72+
flex-direction: column;
73+
list-style-type: none;
74+
`;
75+
6876
export const CensusDatum = styled.li`
6977
display: flex;
7078
flex-direction: column;

frontend/src/Components/Charts/SearchRate/SearchRate.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,7 @@ function SearchRate(props) {
181181
census. A Stop Rate Ratio of 1.0 (or 100%) indicates equal stop likelihood across
182182
groups, while values above or below 1.0 suggest disparities. ${subjectObserving()}`;
183183
}
184+
return '';
184185
};
185186

186187
const getBarChartModalHeading = (title) => {

frontend/src/Components/NewCharts/HorizontalBarChart.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { Bar } from 'react-chartjs-2';
22
import DataLoading from '../Charts/ChartPrimitives/DataLoading';
33
import React, { useRef, useState } from 'react';
44
import { usePopper } from 'react-popper';
5-
import { tooltipLanguage } from '../../util/tooltipLanguage';
5+
import tooltipLanguage from '../../util/tooltipLanguage';
66
import styled from 'styled-components';
77
import ChartModal from './ChartModal';
88
import { EmptyMessage } from '../Charts/ChartSections/EmptyChartMessage';

frontend/src/Components/NewCharts/LineChart.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import React, { useRef, useState } from 'react';
22
import { Line } from 'react-chartjs-2';
3-
import { tooltipLanguage } from '../../util/tooltipLanguage';
3+
import tooltipLanguage from '../../util/tooltipLanguage';
44
import { usePopper } from 'react-popper';
55
import styled from 'styled-components';
66
import DataLoading from '../Charts/ChartPrimitives/DataLoading';

frontend/src/util/tooltipLanguage.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
export const tooltipLanguage = (stopCause) => {
1+
const tooltipLanguage = (stopCause) => {
22
const regEquip =
33
'The "Regulatory and Equipment" category is comprised of: Vehicle Equipment Violations, Vehicle Regulatory Violations, Other Motor Vehicle Violations and Seat Belt Violations.';
44
const definitions = {
@@ -32,3 +32,5 @@ export const tooltipLanguage = (stopCause) => {
3232
};
3333
return definitions[stopCause];
3434
};
35+
36+
export default tooltipLanguage;

0 commit comments

Comments
 (0)