Skip to content

Commit 75b581e

Browse files
alexwizprbrtjkibanamachine
committed
Auto-fix violations of the @elastic/eui/consistent-is-invalid-props ESLint rule (#226787)
## Summary This PR applies the auto-fix for the newly introduced `@elastic/eui/consistent-is-invalid-props` ESLint rule across the codebase. The rule ensures consistent validation state handling between `EuiFormRow` components and their child form controls. ## Changes - Auto-fixed instances where `isInvalid` prop values were inconsistent between parent `EuiFormRow` components and their form control children ## Related - elastic/eui#8843 --------- Co-authored-by: Robert Jaszczurek <92210485+rbrtj@users.noreply.github.com> Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com> (cherry picked from commit 00082ef)
1 parent e341bce commit 75b581e

114 files changed

Lines changed: 189 additions & 15 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

src/platform/packages/shared/response-ops/alerts-delete/components/modal.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -420,6 +420,7 @@ export const AlertDeleteModal = ({
420420
isInvalid={!validations.isDeleteConfirmationValid}
421421
>
422422
<EuiFieldText
423+
isInvalid={!validations.isDeleteConfirmationValid}
423424
value={deleteConfirmation}
424425
disabled={isDisabled || !currentSettingsWouldDeleteAlerts}
425426
onChange={onChangeDeleteConfirmation}

src/platform/packages/shared/response-ops/rule_form/src/rule_definition/rule_consumer_selection.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,7 @@ export const RuleConsumerSelection = (props: RuleConsumerSelectionProps) => {
101101
aria-label={CONSUMER_SELECT_TITLE}
102102
>
103103
<EuiComboBox
104+
isInvalid={!!baseErrors?.consumer?.length}
104105
fullWidth
105106
data-test-subj="ruleConsumerSelectionInput"
106107
aria-label={CONSUMER_SELECT_COMBO_BOX_TITLE}

src/platform/packages/shared/response-ops/rule_form/src/rule_details/rule_details.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,7 @@ export const RuleDetails = () => {
127127
error={baseErrors?.tags}
128128
>
129129
<EuiComboBox
130+
isInvalid={!!baseErrors?.tags?.length}
130131
fullWidth
131132
noSuggestions
132133
placeholder={RULE_TAG_PLACEHOLDER}

src/platform/plugins/private/image_embeddable/public/components/image_editor/image_editor_flyout.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -276,6 +276,7 @@ export function ImageEditorFlyout(props: ImageEditorFlyoutProps) {
276276
error={srcUrlError}
277277
>
278278
<EuiTextArea
279+
isInvalid={!!srcUrlError}
279280
data-test-subj={'imageEmbeddableEditorUrlInput'}
280281
fullWidth
281282
compressed={true}

src/platform/plugins/private/vis_default_editor/public/components/options/required_number_input.tsx

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ import { EuiFormRow, EuiFieldNumber } from '@elastic/eui';
1313
interface NumberInputOptionProps<ParamName extends string> {
1414
disabled?: boolean;
1515
error?: ReactNode;
16-
isInvalid?: boolean;
1716
label?: React.ReactNode;
1817
max?: number;
1918
min?: number;
@@ -34,7 +33,6 @@ interface NumberInputOptionProps<ParamName extends string> {
3433
function RequiredNumberInputOption<ParamName extends string>({
3534
disabled,
3635
error,
37-
isInvalid,
3836
label,
3937
max,
4038
min,
@@ -60,7 +58,7 @@ function RequiredNumberInputOption<ParamName extends string>({
6058
);
6159

6260
return (
63-
<EuiFormRow label={label} error={error} isInvalid={isInvalid} fullWidth display="rowCompressed">
61+
<EuiFormRow label={label} error={error} isInvalid={!isValid} fullWidth display="rowCompressed">
6462
<EuiFieldNumber
6563
compressed
6664
fullWidth

src/platform/plugins/shared/data_view_field_editor/public/components/field_format_editor/editors/url/url.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -223,6 +223,7 @@ export class UrlFormatEditor extends DefaultFormatEditor<
223223
error={error}
224224
>
225225
<EuiFieldText
226+
isInvalid={!!error}
226227
data-test-subj="urlEditorUrlTemplate"
227228
value={formatParams.urlTemplate || ''}
228229
onChange={(e) => {
@@ -253,6 +254,7 @@ export class UrlFormatEditor extends DefaultFormatEditor<
253254
error={error}
254255
>
255256
<EuiFieldText
257+
isInvalid={!!error}
256258
data-test-subj="urlEditorLabelTemplate"
257259
value={formatParams.labelTemplate || ''}
258260
onChange={(e) => {

src/platform/plugins/shared/es_ui_shared/static/forms/components/fields/combobox_field.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@ export const ComboBoxField = ({ field, euiFieldProps = {}, idAria, ...rest }: Pr
8282
{...rest}
8383
>
8484
<EuiComboBox
85+
isInvalid={isInvalid}
8586
noSuggestions
8687
placeholder={i18n.translate('esUi.forms.comboBoxField.placeHolderText', {
8788
defaultMessage: 'Type and then hit "ENTER"',

x-pack/platform/packages/private/ml/creation_wizard_utils/components/destination_index_form.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,9 @@ export const DestinationIndexForm: FC<DestinationIndexFormProps> = ({
9393
defaultMessage: 'Choose a unique destination index name.',
9494
}
9595
)}
96-
isInvalid={!destinationIndexNameEmpty && !destinationIndexNameValid}
96+
isInvalid={
97+
destinationIndexNameEmpty || (!destinationIndexNameEmpty && !destinationIndexNameValid)
98+
}
9799
data-test-subj="mlCreationWizardUtilsDestinationIndexInput"
98100
/>
99101
</EuiFormRow>

x-pack/platform/packages/shared/kbn-inference-endpoint-ui-common/src/components/additional_options_fields.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -255,6 +255,7 @@ export const AdditionalOptionsFields: React.FC<AdditionalOptionsFieldsProps> = (
255255
}
256256
>
257257
<EuiFieldText
258+
isInvalid={isInvalid}
258259
data-test-subj="inference-endpoint-input-field"
259260
fullWidth
260261
disabled={isEdit}

x-pack/platform/plugins/private/data_visualizer/public/application/common/components/combined_fields/semantic_text.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,7 @@ export const SemanticTextForm: FC<Props> = ({ addCombinedField, hasNameCollision
170170
error={[fieldError]}
171171
>
172172
<EuiFieldText
173+
isInvalid={fieldError !== undefined}
173174
placeholder={i18n.translate(
174175
'xpack.dataVisualizer.file.semanticTextForm.copyFieldLabel.placeholder',
175176
{

0 commit comments

Comments
 (0)