diff --git a/.eslintrc.es6.json b/.eslintrc.es6.json index c03494a7a6..d5ae589e4c 100644 --- a/.eslintrc.es6.json +++ b/.eslintrc.es6.json @@ -28,7 +28,6 @@ "no-restricted-globals": 0, // todo - "max-len": 0, // todo "prefer-destructuring": 0, // todo "react/default-props-match-prop-types": 0, // todo "react/no-access-state-in-setstate": 0, // todo diff --git a/assets/js/src/form/fields/selection.jsx b/assets/js/src/form/fields/selection.jsx index cecee9245f..7acecb6d96 100644 --- a/assets/js/src/form/fields/selection.jsx +++ b/assets/js/src/form/fields/selection.jsx @@ -141,11 +141,17 @@ class Selection extends React.Component { }; }, processResults: function processResults(response) { - return { - results: (!_.has(response, 'data')) - ? [] - : response.data.map(item => ({ id: item.id || item.value, text: item.name || item.text })), - }; + let results; + if (!_.has(response, 'data')) { + results = []; + } else { + results = response.data.map((item) => { + const id = item.id || item.value; + const text = item.name || item.text; + return { id, text }; + }); + } + return { results }; }, }, minimumInputLength: remoteQuery.minimumInputLength || 2,