Fix ESLint warnings
Also switch on enforcing of some rules Change-Id: I8bf6186eb800daad18ba4ec665c65452b3ce5ea3
This commit is contained in:
parent
4c07aa9e6a
commit
22345bd82e
10
.eslintrc
10
.eslintrc
|
@ -8,14 +8,14 @@
|
|||
"rules": {
|
||||
"no-cond-assign": 2,
|
||||
"no-console": 2,
|
||||
"no-constant-condition": 1,
|
||||
"no-constant-condition": 2,
|
||||
"no-debugger": 2,
|
||||
"no-dupe-args": 2,
|
||||
"no-dupe-keys": 2,
|
||||
"no-duplicate-case": 2,
|
||||
"no-empty-character-class": 2,
|
||||
"no-ex-assign": 2,
|
||||
"no-extra-boolean-cast": 1,
|
||||
"no-extra-boolean-cast": 2,
|
||||
"no-extra-parens": 0,
|
||||
"no-extra-semi": 2,
|
||||
"no-func-assign": 2,
|
||||
|
@ -79,15 +79,15 @@
|
|||
"max-nested-callbacks": [0, 5],
|
||||
"no-array-constructor": 2,
|
||||
"no-new-object": 2,
|
||||
"no-lonely-if": 1,
|
||||
"no-lonely-if": 2,
|
||||
"no-unneeded-ternary": 2,
|
||||
"id-match": [1, "^([A-Za-z\\d_$]+)$", {"properties": true}],
|
||||
"id-match": [2, "^([A-Za-z\\d_$]+)$", {"properties": true}],
|
||||
"quotes": [2, "single", "avoid-escape"],
|
||||
|
||||
"react/jsx-curly-spacing": [2, "never"],
|
||||
"react/jsx-no-duplicate-props": 2,
|
||||
"react/jsx-no-undef": 2,
|
||||
"react/jsx-quotes": [1, "single", "avoid-escape"],
|
||||
"react/jsx-quotes": [2, "single", "avoid-escape"],
|
||||
"react/jsx-uses-react": 2,
|
||||
"react/jsx-uses-vars": 2,
|
||||
"react/no-unknown-property": 2,
|
||||
|
|
|
@ -755,11 +755,9 @@ define([
|
|||
model: models.Interface,
|
||||
generateBondName: function(base) {
|
||||
var index, proposedName;
|
||||
for (index = 0; true; index += 1) {
|
||||
for (index = 0;; index += 1) {
|
||||
proposedName = base + index;
|
||||
if (!this.where({name: proposedName}).length) {
|
||||
return proposedName;
|
||||
}
|
||||
if (!this.any({name: proposedName})) return proposedName;
|
||||
}
|
||||
},
|
||||
comparator: function(ifc1, ifc2) {
|
||||
|
|
|
@ -59,16 +59,16 @@ function(_, i18n, $, React, utils, models, dispatcher, dialogs, componentMixins,
|
|||
getTitle: function() {
|
||||
var title = 'title_new',
|
||||
cluster = this.props.cluster;
|
||||
if (!!cluster.get('nodes').length) {
|
||||
if (cluster.get('nodes').length) {
|
||||
title = 'title_ready';
|
||||
}
|
||||
if (cluster.get('status') != 'new') {
|
||||
title = null;
|
||||
}
|
||||
if (!!cluster.task({group: 'deployment', status: 'running'})) {
|
||||
if (cluster.task({group: 'deployment', status: 'running'})) {
|
||||
title = 'deploy_progress';
|
||||
}
|
||||
if (!!cluster.task({group: 'deployment', status: 'error'})) {
|
||||
if (cluster.task({group: 'deployment', status: 'error'})) {
|
||||
title = 'title_error';
|
||||
}
|
||||
return title;
|
||||
|
@ -875,10 +875,8 @@ function(_, i18n, $, React, utils, models, dispatcher, dialogs, componentMixins,
|
|||
this.setState({disabled: false});
|
||||
this.props.endRenaming();
|
||||
}, this));
|
||||
} else {
|
||||
if (cluster.validationError) {
|
||||
this.setState({error: cluster.validationError.name});
|
||||
}
|
||||
} else if (cluster.validationError) {
|
||||
this.setState({error: cluster.validationError.name});
|
||||
}
|
||||
} else {
|
||||
this.props.endRenaming();
|
||||
|
|
|
@ -159,14 +159,12 @@ function($, _, i18n, Backbone, React, models, dispatcher, utils, componentMixins
|
|||
|
||||
if (this.props.autoIncreaseWith) {
|
||||
valuesToSet = newValue;
|
||||
} else {
|
||||
} else if (_.contains(name, 'range-start')) {
|
||||
// if first range field
|
||||
if (_.contains(name, 'range-start')) {
|
||||
valuesToModify[0] = newValue;
|
||||
// if end field
|
||||
} else if (_.contains(name, 'range-end')) {
|
||||
valuesToModify[1] = newValue;
|
||||
}
|
||||
valuesToModify[0] = newValue;
|
||||
} else if (_.contains(name, 'range-end')) {
|
||||
// if end field
|
||||
valuesToModify[1] = newValue;
|
||||
}
|
||||
|
||||
this.setValue(attribute, valuesToSet, {isInteger: this.props.integerValue});
|
||||
|
|
|
@ -622,8 +622,8 @@ function($, _, i18n, Backbone, React, utils, models, dispatcher, controls, dialo
|
|||
var data = {id: node.id, pending_roles: node.get('pending_roles')};
|
||||
if (node.get('pending_roles').length) {
|
||||
if (this.props.mode == 'add') return _.extend(data, {cluster_id: this.props.cluster.id, pending_addition: true});
|
||||
} else {
|
||||
if (node.get('pending_addition')) return _.extend(data, {cluster_id: null, pending_addition: false});
|
||||
} else if (node.get('pending_addition')) {
|
||||
return _.extend(data, {cluster_id: null, pending_addition: false});
|
||||
}
|
||||
return data;
|
||||
}, this));
|
||||
|
|
|
@ -323,7 +323,7 @@ function($, _, i18n, React, utils, models, Expression, componentMixins, controls
|
|||
message: messages.join(' ')
|
||||
};
|
||||
},
|
||||
areCalсulationsPossible: function(setting) {
|
||||
areCalculationsPossible: function(setting) {
|
||||
return _.contains(['checkbox', 'radio'], setting.type);
|
||||
},
|
||||
getValuesToCheck: function(setting, valueAttribute) {
|
||||
|
@ -342,7 +342,7 @@ function($, _, i18n, React, utils, models, Expression, componentMixins, controls
|
|||
if (!this.props.allocatedRoles.length) return [];
|
||||
var path = this.props.makePath(groupName, settingName),
|
||||
setting = this.props.settings.get(path);
|
||||
if (!this.areCalсulationsPossible(setting)) return [];
|
||||
if (!this.areCalculationsPossible(setting)) return [];
|
||||
var valueAttribute = this.props.getValueAttribute(settingName),
|
||||
valuesToCheck = this.getValuesToCheck(setting, valueAttribute),
|
||||
pathToCheck = this.props.makePath(path, valueAttribute),
|
||||
|
@ -360,7 +360,7 @@ function($, _, i18n, React, utils, models, Expression, componentMixins, controls
|
|||
checkDependentSettings: function(groupName, settingName) {
|
||||
var path = this.props.makePath(groupName, settingName),
|
||||
currentSetting = this.props.settings.get(path);
|
||||
if (!this.areCalсulationsPossible(currentSetting)) return [];
|
||||
if (!this.areCalculationsPossible(currentSetting)) return [];
|
||||
var dependentRestrictions = {};
|
||||
var addDependentRestrictions = _.bind(function(pathToCheck, label) {
|
||||
var result = _.filter(this.props.settings.expandedRestrictions[pathToCheck], function(restriction) {
|
||||
|
@ -377,7 +377,7 @@ function($, _, i18n, React, utils, models, Expression, componentMixins, controls
|
|||
_.each(group, function(setting, settingName) {
|
||||
// we support dependecies on checkboxes, toggleable setting groups, dropdowns and radio groups
|
||||
var pathToCheck = this.props.makePath(groupName, settingName);
|
||||
if (!this.areCalсulationsPossible(setting) || pathToCheck == path || this.props.checkRestrictions('hide', pathToCheck).result) return;
|
||||
if (!this.areCalculationsPossible(setting) || pathToCheck == path || this.props.checkRestrictions('hide', pathToCheck).result) return;
|
||||
if (setting[this.props.getValueAttribute(settingName)] == true) {
|
||||
addDependentRestrictions(pathToCheck, setting.label);
|
||||
} else {
|
||||
|
|
|
@ -92,7 +92,7 @@ function($, _, i18n, Backbone, React, utils, models, dispatcher, controls, compo
|
|||
var classes = {'modal fade': true};
|
||||
classes[this.props.modalClass] = this.props.modalClass;
|
||||
return (
|
||||
<div className={utils.classNames(classes)} tabIndex="-1" onClick={this.closeOnLinkClick} onKeyDown={this.closeOnEscapeKey}>
|
||||
<div className={utils.classNames(classes)} tabIndex='-1' onClick={this.closeOnLinkClick} onKeyDown={this.closeOnEscapeKey}>
|
||||
<div className='modal-dialog'>
|
||||
<div className='modal-content'>
|
||||
<div className='modal-header'>
|
||||
|
|
|
@ -340,7 +340,7 @@ function($, _, i18n, Backbone, React, utils, models, controls, componentMixins,
|
|||
return (
|
||||
<div className='footer'>
|
||||
{_.contains(version.get('feature_groups'), 'mirantis') && [
|
||||
<a key='logo' className="mirantis-logo-white" href='http://www.mirantis.com/' target='_blank'></a>,
|
||||
<a key='logo' className='mirantis-logo-white' href='http://www.mirantis.com/' target='_blank'></a>,
|
||||
<div key='copyright'>{i18n('common.copyright')}</div>
|
||||
]}
|
||||
<div key='version'>{i18n('common.version')}: {version.get('release')}</div>
|
||||
|
|
Loading…
Reference in New Issue