diff --git a/src/App.js b/src/App.js index 8ab249de..c6555836 100644 --- a/src/App.js +++ b/src/App.js @@ -1,3 +1,4 @@ +/* eslint-disable import/first */ import React from 'react'; import '../node_modules/font-awesome/css/font-awesome.css'; import './styles/App.css'; diff --git a/src/components/builder/BuilderPage.js b/src/components/builder/BuilderPage.js index f088f9f1..e1db5aa6 100644 --- a/src/components/builder/BuilderPage.js +++ b/src/components/builder/BuilderPage.js @@ -133,7 +133,7 @@ class BuilderPage extends Component { if (elementIndex !== undefined) { // get relevant parameter const paramIndex = elements[elementIndex].parameters.findIndex( - param => state.hasOwnProperty(param.id) === true); + param => Object.prototype.hasOwnProperty.call(state, param.id)); // edit element with new value using immutability-helper const editedElements = update(elements, { diff --git a/src/components/builder/BuilderTarget.js b/src/components/builder/BuilderTarget.js index cfd6d038..98b6aa6e 100644 --- a/src/components/builder/BuilderTarget.js +++ b/src/components/builder/BuilderTarget.js @@ -53,12 +53,13 @@ const spec = { /* On drop, copy the element to create a new TemplateInstance. - TODO: clone is required because we are setting value on the parameter. this may not be the best approach + TODO: clone is required because we are setting value on the parameter. + This may not be the best approach */ const clone = JSON.parse(JSON.stringify(item)); clone.uniqueId = _.uniqueId(clone.id); clone.parameters.forEach((param) => { - param.value = ''; + param.value = ''; // eslint-disable-line no-param-reassign }); props.updateTemplateInstances(props.templateInstances.concat(clone)); }, diff --git a/src/components/builder/TemplateInstance.js b/src/components/builder/TemplateInstance.js index c94685ca..bb9bbaa6 100644 --- a/src/components/builder/TemplateInstance.js +++ b/src/components/builder/TemplateInstance.js @@ -78,7 +78,7 @@ class TemplateInstance extends Component { updateInstance={this.updateInstance} /> ); default: - return null; + return undefined; } } diff --git a/src/components/builder/parameters/StringParameter.js b/src/components/builder/parameters/StringParameter.js index eb5d3071..19c8db22 100644 --- a/src/components/builder/parameters/StringParameter.js +++ b/src/components/builder/parameters/StringParameter.js @@ -16,12 +16,15 @@ class StringParameter extends Component { render() { const id = _.uniqueId('parameter-'); const helpId = _.uniqueId('parameter-help-'); + let validityClassName = null; + if (this.state.valid) { + validityClassName = 'form__group-valid'; + } else if (this.state.valid === false) { + validityClassName = 'form__group-invalid'; + } return ( -
+