From c80cc7bdf69ddbebe1166581358e1e8d92f06a15 Mon Sep 17 00:00:00 2001 From: Kyle Hill Date: Thu, 6 May 2021 13:23:46 -0400 Subject: [PATCH] Updates Typescript to 4.2.4, updates eslint typescript plugins, fixes all type check warnings and errors --- package.json | 6 +- .../FooterExtendedNavList.test.tsx | 4 +- .../IdentifierMasthead/IdentifierMasthead.tsx | 2 +- .../SiteAlert/SiteAlert.stories.tsx | 10 +- src/components/Table/Table.stories.tsx | 14 ++- src/components/Tooltip/Tooltip.test.tsx | 3 +- .../forms/DatePicker/Calendar.stories.tsx | 19 +++- .../forms/DatePicker/DatePicker.stories.tsx | 9 +- .../forms/DatePicker/Day.stories.tsx | 42 +++++--- .../forms/DatePicker/MonthPicker.stories.tsx | 12 ++- .../forms/DatePicker/YearPicker.stories.tsx | 21 +++- .../DateRangePicker.stories.tsx | 19 +++- .../forms/FileInput/FileInput.stories.tsx | 11 +- .../forms/TimePicker/TimePicker.stories.tsx | 21 +++- .../grid/GridContainer/GridContainer.tsx | 14 ++- yarn.lock | 101 +++++++++++------- 16 files changed, 214 insertions(+), 94 deletions(-) diff --git a/package.json b/package.json index 287ce978ce..9e3b6edd16 100644 --- a/package.json +++ b/package.json @@ -79,8 +79,8 @@ "@types/jest": "^26.0.0", "@types/react": "^17.0.0", "@types/react-dom": "^17.0.0", - "@typescript-eslint/eslint-plugin": "^2.3.2", - "@typescript-eslint/parser": "^2.3.2", + "@typescript-eslint/eslint-plugin": "^4.22.1", + "@typescript-eslint/parser": "^4.22.1", "all-contributors-cli": "^6.20.0", "awesome-typescript-loader": "^5.2.1", "babel-eslint": "^10.0.3", @@ -124,7 +124,7 @@ "stylelint-prettier": "^1.1.1", "stylelint-scss": "^3.17.1", "ts-jest": "^26.1.2", - "typescript": "^3.8.0", + "typescript": "^4.2.4", "url-loader": "^4.0.0", "uswds": "2.10.3", "webpack": "^4.41.0", diff --git a/src/components/Footer/FooterExtendedNavList/FooterExtendedNavList.test.tsx b/src/components/Footer/FooterExtendedNavList/FooterExtendedNavList.test.tsx index 4b637356d3..250e9d884f 100644 --- a/src/components/Footer/FooterExtendedNavList/FooterExtendedNavList.test.tsx +++ b/src/components/Footer/FooterExtendedNavList/FooterExtendedNavList.test.tsx @@ -122,14 +122,14 @@ describe('FooterExtendedNavList component', () => { describe('when client window width is less than mobile threshold', () => { beforeEach(() => { // Mobile width is less than 480 - //eslint-disable-next-line @typescript-eslint/ban-ts-ignore + //eslint-disable-next-line @typescript-eslint/ban-ts-comment //@ts-ignore window.innerWidth = 479 }) afterEach(() => { // Return to JSDOM default - //eslint-disable-next-line @typescript-eslint/ban-ts-ignore + //eslint-disable-next-line @typescript-eslint/ban-ts-comment //@ts-ignore window.innerWidth = 1024 }) diff --git a/src/components/Identifier/IdentifierMasthead/IdentifierMasthead.tsx b/src/components/Identifier/IdentifierMasthead/IdentifierMasthead.tsx index db3d1fe55d..e7a6e6d8ca 100644 --- a/src/components/Identifier/IdentifierMasthead/IdentifierMasthead.tsx +++ b/src/components/Identifier/IdentifierMasthead/IdentifierMasthead.tsx @@ -1,4 +1,4 @@ -import React, { ReactElement } from 'react' +import React from 'react' import classnames from 'classnames' interface IdentifierMastheadProps { diff --git a/src/components/SiteAlert/SiteAlert.stories.tsx b/src/components/SiteAlert/SiteAlert.stories.tsx index 83bcff27d5..321fe85006 100644 --- a/src/components/SiteAlert/SiteAlert.stories.tsx +++ b/src/components/SiteAlert/SiteAlert.stories.tsx @@ -40,6 +40,12 @@ Source: http://designsystem.digital.gov/components/site-alert }, } +type StorybookArguments = { + slim: boolean + showIcon: boolean + variant: 'info' | 'emergency' +} + const infoHeading = 'Short alert message' const additionalContext = ( @@ -139,7 +145,9 @@ export const emergencyAlertNoIcon = (): React.ReactElement => ( ) -export const alertWithCustomControls = (argTypes): React.ReactElement => ( +export const alertWithCustomControls = ( + argTypes: StorybookArguments +): React.ReactElement => ( @@ -335,13 +341,13 @@ export const scrollable = (): React.ReactElement => ( ) -export const striped = (argTypes): React.ReactElement => ( +export const striped = (argTypes: StorybookArguments): React.ReactElement => ( {testContent}
) -export const compact = (argTypes): React.ReactElement => ( +export const compact = (argTypes: StorybookArguments): React.ReactElement => ( (
) -export const stackedStylesDemo = (argTypes): React.ReactElement => ( +export const stackedStylesDemo = ( + argTypes: StorybookArguments +): React.ReactElement => ( void + setStatuses: (statuses: string[]) => void +} + const defaultProps = { minDate: new Date('0000-01-01'), focusMode: FocusMode.None, } -export const defaultCalendar = (argTypes): React.ReactElement => ( +export const defaultCalendar = ( + argTypes: StorybookArguments +): React.ReactElement => ( ( /> ) -export const givenDate = (argTypes): React.ReactElement => ( +export const givenDate = (argTypes: StorybookArguments): React.ReactElement => ( ( /> ) -export const selectedDate = (argTypes): React.ReactElement => ( +export const selectedDate = ( + argTypes: StorybookArguments +): React.ReactElement => ( ( /> ) -export const minAndMax = (argTypes): React.ReactElement => ( +export const minAndMax = (argTypes: StorybookArguments): React.ReactElement => ( ( /> ) -export const rangeDate = (argTypes): React.ReactElement => ( +export const rangeDate = (argTypes: StorybookArguments): React.ReactElement => ( ( +type StorybookArguments = { + onSubmit: React.FormEventHandler + disabled?: boolean +} + +export const completeDatePicker = ( + argTypes: StorybookArguments +): React.ReactElement => (