Skip to content
Closed
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
7 changes: 0 additions & 7 deletions .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -85,16 +85,9 @@
},
{
"files": [
"app/javascript/packages/address-search/components/in-person-locations.spec.tsx",
"app/javascript/packages/components/spinner-dots.jsx",
"app/javascript/packages/document-capture/components/acuant-capture.tsx",
"app/javascript/packages/document-capture/components/acuant-selfie-capture-canvas.jsx",
"app/javascript/packages/document-capture/components/document-side-acuant-capture.jsx",
"app/javascript/packages/document-capture/components/file-image.jsx",
"app/javascript/packages/document-capture/components/file-input.tsx",
"app/javascript/packages/document-capture/components/in-person-location-full-address-entry-post-office-search-step.tsx",
"app/javascript/packages/document-capture/components/in-person-location-post-office-search-step.tsx",
"app/javascript/packages/document-capture/components/in-person-prepare-step.tsx",
"app/javascript/packages/document-capture/components/submission-interstitial.jsx",
"app/javascript/packages/document-capture/components/submission.jsx",
"spec/javascript/packages/document-capture/context/failed-capture-attempts-spec.jsx",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import sinon from 'sinon';
import type { FormattedLocation } from './in-person-locations';
import InPersonLocations from './in-person-locations';

function NoLocationsViewMock({ address }) {
function NoLocationsViewMock({ address }: { address: string }) {
return (
<div data-testid="no-results-found">
<p>No PO found</p>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
/**
* @typedef SpinnerDotsProps
*
* @prop {boolean=} isCentered Whether to absolutely-position the element at its container's center.
* Defaults to false.
* @prop {string=} className Optional class name.
*/
interface SpinnerDotsProps {
// Optional whether to absolutely-position the element at its container's center. Defaults to false.
isCentered?: boolean;
// Optional class name.
className?: string;
}

/**
* @param {SpinnerDotsProps} props
*/
function SpinnerDots({ isCentered, className }) {
function SpinnerDots({ isCentered, className }: SpinnerDotsProps) {
const classes = ['spinner-dots', isCentered && 'spinner-dots--centered', className]
.filter(Boolean)
.join(' ');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,15 @@ function LoadingSpinner() {
);
}

function AcuantSelfieCaptureCanvas({ imageCaptureText, onSelfieCaptureClosed }) {
interface AcuantSelfieCaptureCanvasProps {
imageCaptureText: string;
onSelfieCaptureClosed: () => void;
}

function AcuantSelfieCaptureCanvas({
imageCaptureText,
onSelfieCaptureClosed,
}: AcuantSelfieCaptureCanvasProps) {
const { isReady } = useContext(AcuantContext);
const { t } = useI18n();
// The Acuant SDK script AcuantPassiveLiveness attaches to whatever element has
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ const USPS_RESPONSE = [
const DEFAULT_PROPS = {
toPreviousStep() {},
onChange() {},
registerField() {},
registerField: (_string) => undefined,
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we're going to list the unused argument, I'd think we should name it the same as it's named in the original type signature (field). There's also technically an options parameter as well if we wanted to be exhaustive.

Personally, I don't think it matters much to list the arguments, which is why I left it out in my previous recommendations.

field: string,
options?: Partial<FormStepRegisterFieldOptions>,

};

describe('InPersonLocationFullAddressEntryPostOfficeSearchStep', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,23 @@ import { request } from '@18f/identity-request';
import { forceRedirect } from '@18f/identity-url';
import { FullAddressSearch, transformKeys, snakeCase } from '@18f/identity-address-search';
import type { FormattedLocation } from '@18f/identity-address-search/types';
import type { RegisterFieldCallback } from '@18f/identity-form-steps';
import BackButton from './back-button';
import AnalyticsContext from '../context/analytics';
import { InPersonContext } from '../context';
import UploadContext from '../context/upload';

interface InPersonLocationFullAddressEntryPostOfficeSearchStepProps {
onChange: ({ selectedLocationAddress }: { selectedLocationAddress: string }) => void;
toPreviousStep: () => void;
registerField: RegisterFieldCallback;
}

function InPersonLocationFullAddressEntryPostOfficeSearchStep({
onChange,
toPreviousStep,
registerField,
}) {
}: InPersonLocationFullAddressEntryPostOfficeSearchStepProps) {
const { inPersonURL, locationsURL, usStatesTerritories } = useContext(InPersonContext);
const [inProgress, setInProgress] = useState<boolean>(false);
const [autoSubmit, setAutoSubmit] = useState<boolean>(false);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ const DEFAULT_PROPS = {
toPreviousStep() {},
onChange() {},
value: {},
registerField() {},
registerField: (_string) => undefined,
};

describe('InPersonLocationPostOfficeSearchStep', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,23 @@ import { request } from '@18f/identity-request';
import { forceRedirect } from '@18f/identity-url';
import AddressSearch, { transformKeys, snakeCase } from '@18f/identity-address-search';
import type { FormattedLocation } from '@18f/identity-address-search/types';
import type { RegisterFieldCallback } from '@18f/identity-form-steps';
import BackButton from './back-button';
import AnalyticsContext from '../context/analytics';
import { InPersonContext } from '../context';
import UploadContext from '../context/upload';

function InPersonLocationPostOfficeSearchStep({ onChange, toPreviousStep, registerField }) {
interface InPersonLocationPostOfficeSearchStepProps {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Elsewhere we extend an interface exposed by FormSteps which helps avoid repeating the type signatures, and also surfaces additional props that are available. Maybe we should do the same here and in InPersonPrepareStep and InPersonLocationFullAddressEntryPostOfficeSearchStep?

interface ReviewIssuesStepProps extends FormStepComponentProps<ReviewIssuesStepValue> {

onChange: ({ selectedLocationAddress }: { selectedLocationAddress: string }) => void;
toPreviousStep: () => void;
registerField: RegisterFieldCallback;
}

function InPersonLocationPostOfficeSearchStep({
onChange,
toPreviousStep,
registerField,
}: InPersonLocationPostOfficeSearchStepProps) {
const { inPersonURL, locationsURL, addressSearchURL } = useContext(InPersonContext);
const [inProgress, setInProgress] = useState<boolean>(false);
const [autoSubmit, setAutoSubmit] = useState<boolean>(false);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import InPersonTroubleshootingOptions from './in-person-troubleshooting-options'
import { InPersonContext } from '../context';
import InPersonOutageAlert from './in-person-outage-alert';

function InPersonPrepareStep({ toPreviousStep }) {
function InPersonPrepareStep({ toPreviousStep }: { toPreviousStep: () => void }) {
const { t } = useI18n();
const { flowPath } = useContext(UploadContext);
const { securityAndPrivacyHowItWorksURL } = useContext(MarketingSiteContext);
Expand Down
1 change: 0 additions & 1 deletion scripts/enforce-typescript-files.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ const LEGACY_FILE_EXCEPTIONS = [
'app/javascript/packages/device/index.js',
'app/javascript/packages/document-capture/index.js',
'app/javascript/packages/document-capture/components/acuant-capture-canvas.jsx',
'app/javascript/packages/document-capture/components/acuant-selfie-capture-canvas.jsx',
'app/javascript/packages/document-capture/components/callback-on-mount.jsx',
'app/javascript/packages/document-capture/components/file-image.jsx',
'app/javascript/packages/document-capture/components/submission-interstitial.jsx',
Expand Down