Fix lint errors

This commit is contained in:
Thomas Roberts 2022-08-15 15:09:12 +01:00 committed by Alex Florisca
parent d13d5b3fdd
commit aa9fd66e8e
5 changed files with 15 additions and 23 deletions

View File

@ -54,9 +54,8 @@ const Combobox = ( {
instanceId = '0',
autoComplete = 'off',
}: ComboboxProps ): JSX.Element => {
const { setValidationErrors, clearValidationError } = useDispatch(
VALIDATION_STORE_KEY
);
const { setValidationErrors, clearValidationError } =
useDispatch( VALIDATION_STORE_KEY );
const getValidationError = useSelect( ( select ) => {
const store = select( VALIDATION_STORE_KEY );
return store.getValidationError();

View File

@ -36,9 +36,8 @@ const Template: Story< CountryInputWithCountriesProps > = ( args ) => {
const [ selectedCountry, selectCountry ] = useState< CountryCode | '' >(
''
);
const { clearValidationError, showValidationError } = useDispatch(
VALIDATION_STORE_KEY
);
const { clearValidationError, showValidationError } =
useDispatch( VALIDATION_STORE_KEY );
useEffect( () => {
showValidationError( 'country' );

View File

@ -13,11 +13,8 @@ import { VALIDATION_STORE_KEY } from '@woocommerce/block-data';
* Custom hook for setting for adding errors to the validation system.
*/
export const useValidation = (): ValidationData => {
const {
clearValidationError,
hideValidationError,
setValidationErrors,
} = useDispatch( VALIDATION_STORE_KEY );
const { clearValidationError, hideValidationError, setValidationErrors } =
useDispatch( VALIDATION_STORE_KEY );
const { hasValidationErrors, getValidationError } = useSelect(
( select ) => {
const store = select( VALIDATION_STORE_KEY );

View File

@ -33,9 +33,9 @@ declare module '@wordpress/data' {
function dispatch(
key: typeof STORE_KEY
): DispatchFromMap< typeof actions >;
function select(
key: typeof STORE_KEY
): SelectFromMap< typeof selectors > & {
function select( key: typeof STORE_KEY ): SelectFromMap<
typeof selectors
> & {
hasFinishedResolution: ( selector: string ) => boolean;
};
}

View File

@ -16,9 +16,8 @@ describe( 'Validation selectors', () => {
hidden: false,
},
};
const validationError = getValidationError( state )(
'validationError'
);
const validationError =
getValidationError( state )( 'validationError' );
expect( validationError ).toEqual( {
message: 'This is a test message',
hidden: false,
@ -32,9 +31,8 @@ describe( 'Validation selectors', () => {
hidden: false,
},
};
const validationErrorID = getValidationErrorId( state )(
'validationError'
);
const validationErrorID =
getValidationErrorId( state )( 'validationError' );
expect( validationErrorID ).toEqual( `validate-error-validationError` );
} );
@ -48,9 +46,8 @@ describe( 'Validation selectors', () => {
const validationErrors = hasValidationErrors( state );
expect( validationErrors ).toEqual( true );
const stateWithNoErrors: Record< string, FieldValidationStatus > = {};
const stateWithNoErrorsCheckResult = hasValidationErrors(
stateWithNoErrors
);
const stateWithNoErrorsCheckResult =
hasValidationErrors( stateWithNoErrors );
expect( stateWithNoErrorsCheckResult ).toEqual( false );
} );
} );