Skip to content

Commit

Permalink
fix: correct lint errors
Browse files Browse the repository at this point in the history
  • Loading branch information
sbolel committed Dec 11, 2024
1 parent c2956f2 commit 427fafc
Show file tree
Hide file tree
Showing 34 changed files with 49 additions and 27 deletions.
1 change: 1 addition & 0 deletions src/bundles.test.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import React from 'react'
import jsxRuntime from 'react/jsx-runtime'
import reactDom from 'react-dom'
import FocusTrap from 'focus-trap-react'
Expand Down
4 changes: 2 additions & 2 deletions src/components/ButtonGroup/ButtonGroup.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { JSX } from 'react'
import { Children, JSX } from 'react'
import classnames from 'classnames'

type ButtonGroupProps = {
Expand All @@ -23,7 +23,7 @@ export const ButtonGroup = ({

return (
<ul className={classes} {...restProps}>
{React.Children.map(children, (child: React.ReactNode) => {
{Children.map(children, (child: React.ReactNode) => {
return <li className="usa-button-group__item">{child}</li>
})}
</ul>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export const FooterExtendedNavList = ({
const classes = classnames('grid-row grid-gap-4', className)
const isClient = window && typeof window === 'object'

const [isMobileFallback, setIsMobileFallback] = React.useState<boolean>(
const [isMobileFallback, setIsMobileFallback] = useState<boolean>(
isClient && window.innerWidth < 480
)
const [sectionsOpenState, setSectionsOpenState] = useState<boolean[]>(
Expand Down
4 changes: 2 additions & 2 deletions src/components/IconList/IconList.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { ReactElement, JSX } from 'react'
import { JSX } from 'react'
import classnames from 'classnames'

interface IconListProps {
Expand All @@ -9,7 +9,7 @@ interface IconListProps {
export const IconList = ({
children,
className,
}: IconListProps & JSX.IntrinsicElements['ul']): ReactElement => {
}: IconListProps & JSX.IntrinsicElements['ul']): React.ReactElement => {
const classes = classnames(className, 'usa-icon-list')

return (
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { JSX } from 'react'
import classnames from 'classnames'

interface IdentifierLogosProps {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { JSX } from 'react'
import classnames from 'classnames'

interface IdentifierMastheadProps {
Expand Down
2 changes: 1 addition & 1 deletion src/components/LanguageSelector/LanguageSelector.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { useState } from 'react'
import { useState, JSX } from 'react'
import classnames from 'classnames'
import { LanguageSelectorButton } from './LanguageSelectorButton'
import LanguageSelectorDropdown from './LanguageSelectorDropdown'
Expand Down
1 change: 1 addition & 0 deletions src/components/LanguageSelector/LanguageSelectorButton.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { JSX } from 'react'
import classnames from 'classnames'

type LanguageSelectorButtonProps = {
Expand Down
1 change: 1 addition & 0 deletions src/components/Link/Link.stories.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { JSX } from 'react'
import { Link } from './Link'

export default {
Expand Down
4 changes: 2 additions & 2 deletions src/components/Link/Link.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { JSX } from 'react'
import { createElement, JSX } from 'react'
import classnames from 'classnames'

// These props we want to require always, even on custom components
Expand Down Expand Up @@ -74,7 +74,7 @@ export function Link<
//
const linkProps: FCProps = remainingProps as unknown as FCProps
const classes = linkClasses(variant, className)
return React.createElement(
return createElement(
asCustom,
{
className: classes,
Expand Down
1 change: 1 addition & 0 deletions src/components/Modal/ModalCloseButton/ModalCloseButton.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { JSX } from 'react'
import { Icon } from '../../Icon/Icons'
import { Button } from '../../Button/Button'

Expand Down
1 change: 1 addition & 0 deletions src/components/Modal/ModalFooter/ModalFooter.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { JSX } from 'react'
import classnames from 'classnames'

interface ModalFooterProps {
Expand Down
1 change: 1 addition & 0 deletions src/components/Modal/ModalOpenLink.test.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { JSX } from 'react'
import { render, screen, waitFor } from '@testing-library/react'

import { ModalRef } from './Modal'
Expand Down
2 changes: 1 addition & 1 deletion src/components/Modal/ModalToggleButton.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@

import { JSX } from 'react'
import { ModalRef } from './Modal'
import { ButtonProps, Button } from '../Button/Button'

Expand Down
1 change: 1 addition & 0 deletions src/components/Pagination/Pagination.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { JSX } from 'react'
import classnames from 'classnames'
import { Icon } from '../Icon/Icons'
import { Link } from '../Link/Link'
Expand Down
1 change: 1 addition & 0 deletions src/components/ProcessList/ProcessList/ProcessList.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { JSX } from 'react'
import classnames from 'classnames'
import { ProcessListItemProps } from '../ProcessListItem/ProcessListItem'

Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { JSX } from 'react'
import classnames from 'classnames'
import { HeadingLevel } from '../../../types/headingLevel'

Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { JSX } from 'react'
import classnames from 'classnames'

export interface ProcessListItemProps {
Expand Down
1 change: 1 addition & 0 deletions src/components/SiteAlert/SiteAlert.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { JSX } from 'react'
import classnames from 'classnames'

type SiteAlertProps = {
Expand Down
2 changes: 1 addition & 1 deletion src/components/SummaryBox/SummaryBox/SummaryBox.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@

import { JSX } from 'react'
import classnames from 'classnames'

type SummaryBoxProps = {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { JSX } from 'react'
import classnames from 'classnames'

interface SummaryBoxTextProps {
Expand Down
1 change: 1 addition & 0 deletions src/components/Tag/Tag.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { JSX } from 'react'
import classnames from 'classnames'

type TagProps = {
Expand Down
2 changes: 1 addition & 1 deletion src/components/Tooltip/Tooltip.stories.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React from 'react'
import { forwardRef, JSX } from 'react'
import { Tooltip } from './Tooltip'

export default {
Expand Down
2 changes: 1 addition & 1 deletion src/components/Tooltip/Tooltip.test.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React from 'react'
import React, { JSX } from 'react'
import { fireEvent, render, screen } from '@testing-library/react'

import { Tooltip } from './Tooltip'
Expand Down
5 changes: 3 additions & 2 deletions src/components/forms/CharacterCount/CharacterCount.test.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { createRef } from 'react'
import { render, fireEvent } from '@testing-library/react'

import { CharacterCount } from './CharacterCount'
Expand Down Expand Up @@ -46,7 +47,7 @@ describe('CharacterCount component', () => {
})

it('handles own props', () => {
const tRef = React.createRef<HTMLTextAreaElement>()
const tRef = createRef<HTMLTextAreaElement>()
const { getByRole } = render(
<CharacterCount
id="character-count-id"
Expand Down Expand Up @@ -145,7 +146,7 @@ describe('CharacterCount component', () => {
})

it('handles own props', () => {
const tRef = React.createRef<HTMLTextAreaElement>()
const tRef = createRef<HTMLTextAreaElement>()
const { getByDisplayValue } = render(
<>
<CharacterCount
Expand Down
5 changes: 3 additions & 2 deletions src/components/forms/ComboBox/ComboBox.test.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { createRef } from 'react'
import { screen, render, waitFor } from '@testing-library/react'
import { userEvent } from '@testing-library/user-event'

Expand Down Expand Up @@ -1754,7 +1755,7 @@ describe('ComboBox component', () => {

describe('exposed ref', () => {
it('can be used to focus on the text input', async () => {
const comboRef = React.createRef<ComboBoxRef>()
const comboRef = createRef<ComboBoxRef>()
const onChange = vi.fn()
const handleFocus = (): void => comboRef.current?.focus()

Expand All @@ -1781,7 +1782,7 @@ describe('ComboBox component', () => {
})

it('can be used to clear the selected value', async () => {
const comboRef = React.createRef<ComboBoxRef>()
const comboRef = createRef<ComboBoxRef>()
const onChange = vi.fn()
const handleClearSelection = (): void =>
comboRef.current?.clearSelection()
Expand Down
5 changes: 3 additions & 2 deletions src/components/forms/FileInput/FileInput.test.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { createRef } from 'react'
import { fireEvent, render, screen, within } from '@testing-library/react'
import { userEvent } from '@testing-library/user-event'

Expand Down Expand Up @@ -363,7 +364,7 @@ describe('FileInput component', () => {

describe('exposed ref', () => {
it('can be used to access the files', async () => {
const fileInputRef = React.createRef<FileInputRef>()
const fileInputRef = createRef<FileInputRef>()

render(<FileInput {...testProps} ref={fileInputRef} />)

Expand All @@ -376,7 +377,7 @@ describe('FileInput component', () => {
})

it('can be used to clear the files', async () => {
const fileInputRef = React.createRef<FileInputRef>()
const fileInputRef = createRef<FileInputRef>()
const handleClearFiles = (): void => fileInputRef.current?.clearFiles()

render(
Expand Down
6 changes: 3 additions & 3 deletions src/components/forms/Form/Form.stories.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* eslint-disable jsx-a11y/anchor-is-valid */
import { useState } from 'react'
import { Form } from './Form'

import { Alert } from '../../Alert/Alert'
import { Button } from '../../Button/Button'
import { ErrorMessage } from '../ErrorMessage/ErrorMessage'
Expand Down Expand Up @@ -205,7 +205,7 @@ export const AddressForm = (): React.ReactElement => (
)

export const SignInForm = (): React.ReactElement => {
const [showPassword, setShowPassword] = React.useState(false)
const [showPassword, setShowPassword] = useState(false)

return (
<Form onSubmit={mockSubmit} large>
Expand Down Expand Up @@ -254,7 +254,7 @@ export const SignInForm = (): React.ReactElement => {
)
}
export const PasswordResetForm = (): React.ReactElement => {
const [showPassword, setShowPassword] = React.useState(false)
const [showPassword, setShowPassword] = useState(false)

return (
<Form onSubmit={mockSubmit} large>
Expand Down
3 changes: 2 additions & 1 deletion src/components/forms/RangeInput/RangeInput.test.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { createRef } from 'react'
import { render } from '@testing-library/react'

import { RangeInput } from './RangeInput'
Expand Down Expand Up @@ -67,7 +68,7 @@ describe('RangeInput component', () => {
})

it('renders with attached ref', () => {
const rangeRef: React.RefObject<HTMLInputElement> = React.createRef()
const rangeRef: React.RefObject<HTMLInputElement> = createRef()

const { queryByTestId } = render(
<RangeInput id="range-slider-id" name="rangeName" inputRef={rangeRef} />
Expand Down
1 change: 1 addition & 0 deletions src/components/forms/Textarea/Textarea.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { JSX } from 'react'
import classnames from 'classnames'

type TextareaRef =
Expand Down
4 changes: 2 additions & 2 deletions src/components/grid/Grid/Grid.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { JSX } from 'react'
import { createElement, JSX } from 'react'
import classnames from 'classnames'

import { GridItemProps, BreakpointKeys, breakpoints } from '../types'
Expand Down Expand Up @@ -138,7 +138,7 @@ export function Grid<FCProps = DefaultGridProps>(
const { asCustom, ...remainingProps } = otherProps

const gridProps: FCProps = remainingProps as unknown as FCProps
return React.createElement(
return createElement(
asCustom,
{
className: classes,
Expand Down
3 changes: 2 additions & 1 deletion src/components/grid/GridContainer/GridContainer.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { createElement } from 'react'
import classnames from 'classnames'

import { ContainerSizes } from '../types'
Expand Down Expand Up @@ -53,7 +54,7 @@ export function GridContainer<
props
const gridContainerProps: FCProps = remainingProps as unknown as FCProps
const classes = gridContainerClasses(className, containerSize)
return React.createElement(
return createElement(
asCustom,
{
'data-testid': 'gridContainer',
Expand Down
4 changes: 2 additions & 2 deletions src/components/mediablock/MediaBlockBody/MediaBlockBody.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { ReactElement } from 'react'
import { JSX } from 'react'
import classNames from 'classnames'

export const MediaBlockBody = ({
children,
className,
...divProps
}: JSX.IntrinsicElements['div']): ReactElement => {
}: JSX.IntrinsicElements['div']): React.ReactElement => {
const classes = classNames('usa-media-block__body', className)

return (
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { JSX } from 'react'
import classnames from 'classnames'

import { StepStatusText } from '../StepIndicator/StepIndicator'
Expand Down

0 comments on commit 427fafc

Please sign in to comment.