From 7241418ebafbbd58749de92e54e35421b823ebb6 Mon Sep 17 00:00:00 2001 From: "J. Ryan Stinnett" Date: Thu, 7 Mar 2019 14:34:55 +0000 Subject: [PATCH] Appease the linter This checks `onValidate` in `render` to make the linter happy. --- src/components/views/elements/Field.js | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/components/views/elements/Field.js b/src/components/views/elements/Field.js index 8a203c3667..b710872d2d 100644 --- a/src/components/views/elements/Field.js +++ b/src/components/views/elements/Field.js @@ -95,10 +95,13 @@ export default class Field extends React.PureComponent { prefixContainer = {prefix}; } - const validClass = classNames({ - mx_Field_valid: this.state.valid === true, - mx_Field_invalid: this.state.valid === false, - }); + let validClass; + if (onValidate) { + validClass = classNames({ + mx_Field_valid: this.state.valid === true, + mx_Field_invalid: this.state.valid === false, + }); + } const fieldClasses = classNames("mx_Field", `mx_Field_${inputElement}`, { // If we have a prefix element, leave the label always at the top left and