Skip to content
This repository was archived by the owner on Oct 29, 2020. It is now read-only.

Commit aa8f3ef

Browse files
test(lint): fix remaining lint warnings
These were being treated as errors in CI.
1 parent c351555 commit aa8f3ef

17 files changed

+29
-21
lines changed

.eslintrc.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@ module.exports = {
8383
'react/jsx-fragments': ['error', 'element'],
8484
'react/jsx-props-no-spreading': 'off',
8585
'react/require-default-props': 'off',
86+
'react/prop-types': 'off',
8687
strict: 0,
8788
'@typescript-eslint/explicit-function-return-type': 'off', // Want to use it, but it requires return types for all built-in React lifecycle methods.
8889
'@typescript-eslint/no-non-null-assertion': 'off',

src/App.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import './App.css'
55

66
import AppRoot from './AppRoot'
77

8-
const App = () => (
8+
const App: React.FC = () => (
99
<BrowserRouter>
1010
<Route path="/">
1111
<AppRoot />

src/AppRoot.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,7 @@ const App: React.FC = () => {
180180
})
181181
).json()
182182
if (result.status !== 'ok') {
183+
// eslint-disable-next-line no-alert
183184
window.alert(`could not scan: ${result.status}`)
184185
setIsScanning(false)
185186
}
@@ -252,6 +253,7 @@ const App: React.FC = () => {
252253
setIsExportingCVRs(false)
253254

254255
if (response.status !== 200) {
256+
// eslint-disable-next-line no-console
255257
console.log('error downloading CVRs')
256258
return
257259
}

src/components/Button.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,11 +63,11 @@ export interface Props extends StyledButtonProps {
6363
onPress: MouseEventHandler
6464
}
6565

66-
const Button = ({
66+
const Button: React.FC<Props> = ({
6767
component: Component = StyledButton,
6868
onPress,
6969
...rest
70-
}: Props) => {
70+
}) => {
7171
const [startCoordinates, setStartCoordinates] = useState([0, 0])
7272

7373
const onTouchStart = (event: React.TouchEvent) => {

src/components/ElectionConfiguration.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ export interface Props {
1313
acceptFiles(files: readonly File[]): void
1414
}
1515

16-
const ElectionConfiguration = ({ acceptFiles }: Props) => {
16+
const ElectionConfiguration: React.FC<Props> = ({ acceptFiles }) => {
1717
const { getRootProps, getInputProps, isDragActive } = useDropzone({
1818
onDrop(files: readonly File[]) {
1919
acceptFiles(files)

src/components/MainNav.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ interface Props {
4545
isTestMode?: boolean
4646
}
4747

48-
const MainNav = ({ children, isTestMode = false }: Props) => (
48+
const MainNav: React.FC<Props> = ({ children, isTestMode = false }) => (
4949
<Nav>
5050
<StyledNav>
5151
<Brand>

src/components/StatusFooter.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ export interface Props {
1818
electionHash?: string
1919
}
2020

21-
const StatusFooter = ({ election, electionHash }: Props) => {
21+
const StatusFooter: React.FC<Props> = ({ election, electionHash }) => {
2222
const electionDate =
2323
election && localeWeedkayAndDate.format(new Date(election?.date))
2424

src/components/Text.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ const Text = styled('p')<Props>`
6969
${({ warningIcon, voteIcon }) => (warningIcon || voteIcon) && iconStyles}
7070
`
7171

72-
export const TextWithLineBreaks = ({ text }: { text: string }) => (
72+
export const TextWithLineBreaks: React.FC<{ text: string }> = ({ text }) => (
7373
<React.Fragment>
7474
{text.split(/[\n|\r]{2}/g).map((x) => (
7575
<p key={x}>

src/components/USBControllerButton.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import { UsbDriveStatus } from '../lib/usbstick'
88
// eslint-disable-next-line @typescript-eslint/no-empty-function
99
const doNothing = () => {}
1010

11-
const USBControllerButton = () => {
11+
const USBControllerButton: React.FC = () => {
1212
const { usbDriveStatus: status, usbDriveEject } = useContext(AppContext)
1313

1414
if (status === UsbDriveStatus.notavailable) {

src/hooks/useInterval.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// TODO: Replace with library: https://github.com/votingworks/bas/issues/16
22
import { useEffect } from 'react'
33

4-
function useInterval(callback: () => void, delay: number) {
4+
function useInterval(callback: () => void, delay: number): void {
55
useEffect(() => {
66
const id = setInterval(callback, delay)
77
return () => clearInterval(id)

src/screens/AdvancedOptionsScreen.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,15 +18,15 @@ interface Props {
1818
toggleTestMode: () => Promise<void>
1919
}
2020

21-
const AdvancedOptionsScreen = ({
21+
const AdvancedOptionsScreen: React.FC<Props> = ({
2222
unconfigureServer,
2323
zeroData,
2424
backup,
2525
hasBatches,
2626
isTestMode,
2727
togglingTestMode,
2828
toggleTestMode,
29-
}: Props) => {
29+
}) => {
3030
const [isConfirmingFactoryReset, setIsConfirmingFactoryReset] = useState(
3131
false
3232
)

src/screens/BallotEjectScreen.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,10 @@ const doNothing = () => {
5757
console.log('disabled') // eslint-disable-line no-console
5858
}
5959

60-
const BallotEjectScreen = ({ continueScanning, isTestMode }: Props) => {
60+
const BallotEjectScreen: React.FC<Props> = ({
61+
continueScanning,
62+
isTestMode,
63+
}) => {
6164
const [sheetInfo, setSheetInfo] = useState<BallotSheetInfo | undefined>()
6265

6366
const [ballotState, setBallotState] = useState<EjectState>(undefined)

src/screens/BallotReviewScreen.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,10 +71,10 @@ export interface Props {
7171
adjudicationStatus: AdjudicationStatus
7272
}
7373

74-
export default function BallotReviewScreen({
74+
const BallotReviewScreen: React.FC<Props> = ({
7575
isTestMode,
7676
adjudicationStatus,
77-
}: Props) {
77+
}) => {
7878
const history = useHistory()
7979
const { ballotId } = useParams<{
8080
ballotId?: string
@@ -337,3 +337,5 @@ export default function BallotReviewScreen({
337337
</Screen>
338338
)
339339
}
340+
341+
export default BallotReviewScreen

src/screens/DashboardScreen.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,12 +31,12 @@ interface Props {
3131
deleteBatch(batchId: number): void
3232
}
3333

34-
const DashboardScreen = ({
34+
const DashboardScreen: React.FC<Props> = ({
3535
adjudicationStatus,
3636
isScanning,
3737
status,
3838
deleteBatch,
39-
}: Props) => {
39+
}) => {
4040
const { batches } = status
4141
const batchCount = batches.length
4242
const ballotCount =

src/screens/LoadElectionScreen.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ interface Props {
1313
setElection: SetElection
1414
}
1515

16-
const LoadElectionScreen = ({ setElection }: Props) => {
16+
const LoadElectionScreen: React.FC<Props> = ({ setElection }) => {
1717
const [
1818
currentUploadingBallotIndex,
1919
setCurrentUploadingBallotIndex,

src/serviceWorker.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
// To learn more about the benefits of this model and instructions on how to
1111
// opt-in, read https://bit.ly/CRA-PWA
1212

13-
async function registerValidSW(swUrl: string, config?: Config) {
13+
async function registerValidSW(swUrl: string, config?: Config): Promise<void> {
1414
let registration: ServiceWorkerRegistration
1515

1616
try {
@@ -103,7 +103,7 @@ interface Config {
103103
onUpdate?: (registration: ServiceWorkerRegistration) => void
104104
}
105105

106-
export function register(config?: Config) {
106+
export function register(config?: Config): void {
107107
if (process.env.NODE_ENV === 'production' && 'serviceWorker' in navigator) {
108108
// The URL constructor is available in all browsers that support SW.
109109
const publicUrl = new URL(
@@ -141,7 +141,7 @@ export function register(config?: Config) {
141141
}
142142
}
143143

144-
export function unregister() {
144+
export function unregister(): void {
145145
if ('serviceWorker' in navigator) {
146146
navigator.serviceWorker.ready.then((registration) => {
147147
registration.unregister()

src/util/focusVisible.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// This is a "polyfill" for the css psudo-class :focus-visible
22
// https://caniuse.com/#feat=css-focus-visible
33

4-
const focusVisible = () => {
4+
const focusVisible = (): void => {
55
// Let the document know when the mouse is being used
66
document.body.addEventListener('mousedown', () => {
77
document.body.classList.remove('using-keyboard')

0 commit comments

Comments
 (0)