Fix ES6 dot-notation eslint rule [MAILPOET-1137]

This commit is contained in:
stoletniy
2017-10-26 14:09:58 +03:00
committed by Vlad
parent bf15bda84f
commit e4f16eda49
14 changed files with 24 additions and 25 deletions

View File

@@ -48,7 +48,6 @@
"camelcase": 0,
"eqeqeq": 0,
"space-unary-ops": 0,
"dot-notation": 0,
"no-shadow": 0,
"no-alert": 0,
"no-script-url": 0,

View File

@@ -32,7 +32,7 @@ define([
let field = false;
let dataField = data.field;
if (data.field['field'] !== undefined) {
if (data.field.field !== undefined) {
dataField = jQuery.merge(dataField, data.field.field);
}
@@ -89,7 +89,7 @@ define([
render: function () {
let field = false;
if (this.props.field['fields'] !== undefined) {
if (this.props.field.fields !== undefined) {
field = this.props.field.fields.map((subfield, index) => {
return this.renderField({
index: index,

View File

@@ -17,7 +17,7 @@ const FormFieldSelect = React.createClass({
);
}
if (this.props.field['filter'] !== undefined) {
if (this.props.field.filter !== undefined) {
filter = this.props.field.filter;
}

View File

@@ -84,8 +84,8 @@ define([
this.setState({ select2: true });
},
getSelectedValues: function () {
if (this.props.field['selected'] !== undefined) {
return this.props.field['selected'](this.props.item);
if (this.props.field.selected !== undefined) {
return this.props.field.selected(this.props.item);
} else if (this.props.item !== undefined && this.props.field.name !== undefined) {
if (this.allowMultipleValues()) {
if (Array.isArray(this.props.item[this.props.field.name])) {
@@ -104,7 +104,7 @@ define([
let items = window['mailpoet_' + this.props.field.endpoint];
if (this.props.field['filter'] !== undefined) {
if (this.props.field.filter !== undefined) {
items = items.filter(this.props.field.filter);
}
@@ -131,19 +131,19 @@ define([
}
},
getLabel: function (item) {
if (this.props.field['getLabel'] !== undefined) {
if (this.props.field.getLabel !== undefined) {
return this.props.field.getLabel(item, this.props.item);
}
return item.name;
},
getSearchLabel: function (item) {
if (this.props.field['getSearchLabel'] !== undefined) {
if (this.props.field.getSearchLabel !== undefined) {
return this.props.field.getSearchLabel(item, this.props.item);
}
return null;
},
getValue: function (item) {
if (this.props.field['getValue'] !== undefined) {
if (this.props.field.getValue !== undefined) {
return this.props.field.getValue(item, this.props.item);
}
return item.id;
@@ -152,7 +152,7 @@ define([
// this function may be used to transform the placeholder value into
// desired value.
transformChangedValue: function (value) {
if (typeof this.props.field['transformChangedValue'] === 'function') {
if (typeof this.props.field.transformChangedValue === 'function') {
return this.props.field.transformChangedValue.call(this, value);
}
return value;

View File

@@ -11,7 +11,7 @@ const FormFieldText = React.createClass({
<input
type="text"
disabled={
(this.props.field['disabled'] !== undefined)
(this.props.field.disabled !== undefined)
? this.props.field.disabled(this.props.item)
: false
}

View File

@@ -101,7 +101,7 @@ define(
// only get values from displayed fields
const item = {};
this.props.fields.map((field) => {
if (field['fields'] !== undefined) {
if (field.fields !== undefined) {
field.fields.map((subfield) => {
item[subfield.name] = this.state.item[subfield.name];
});

View File

@@ -21,7 +21,7 @@ define([
const action = this.getSelectedAction();
// action on select callback
if (action !== null && action['onSelect'] !== undefined) {
if (action !== null && action.onSelect !== undefined) {
this.setState({
extra: action.onSelect(e),
});
@@ -41,14 +41,14 @@ define([
? this.props.selected_ids
: [];
const data = (action['getData'] !== undefined)
const data = (action.getData !== undefined)
? action.getData()
: {};
data.action = this.state.action;
let onSuccess = function () {};
if (action['onSuccess'] !== undefined) {
if (action.onSuccess !== undefined) {
onSuccess = action.onSuccess;
}

View File

@@ -513,7 +513,7 @@ const Listing = React.createClass({
}).done((response) => {
if (
this.props.messages !== undefined
&& this.props.messages['onRestore'] !== undefined
&& this.props.messages.onRestore !== undefined
) {
this.props.messages.onRestore(response);
}
@@ -541,7 +541,7 @@ const Listing = React.createClass({
}).done((response) => {
if (
this.props.messages !== undefined
&& this.props.messages['onTrash'] !== undefined
&& this.props.messages.onTrash !== undefined
) {
this.props.messages.onTrash(response);
}
@@ -569,7 +569,7 @@ const Listing = React.createClass({
}).done((response) => {
if (
this.props.messages !== undefined
&& this.props.messages['onDelete'] !== undefined
&& this.props.messages.onDelete !== undefined
) {
this.props.messages.onDelete(response);
}

View File

@@ -46,7 +46,7 @@ define(
let label = step.label;
if (step['link'] !== undefined && this.props.step !== step.name) {
if (step.link !== undefined && this.props.step !== step.name) {
label = (
<Link to={step.link}>{ step.label }</Link>
);

View File

@@ -13,7 +13,7 @@ import {
MailerMixin,
} from 'newsletters/listings/mixins.jsx';
const mailpoet_tracking_enabled = (!!(window['mailpoet_tracking_enabled']));
const mailpoet_tracking_enabled = (!!(window.mailpoet_tracking_enabled));
const columns = [
{

View File

@@ -13,7 +13,7 @@ import {
MailerMixin,
} from 'newsletters/listings/mixins.jsx';
const mailpoet_tracking_enabled = (!!(window['mailpoet_tracking_enabled']));
const mailpoet_tracking_enabled = (!!(window.mailpoet_tracking_enabled));
const messages = {
onTrash: (response) => {

View File

@@ -13,7 +13,7 @@ import Hooks from 'wp-js-hooks';
const mailpoet_roles = window.mailpoet_roles || {};
const mailpoet_segments = window.mailpoet_segments || {};
const mailpoet_tracking_enabled = (!!(window['mailpoet_tracking_enabled']));
const mailpoet_tracking_enabled = (!!(window.mailpoet_tracking_enabled));
const messages = {
onTrash: (response) => {

View File

@@ -331,7 +331,7 @@ define(
{MailPoet.I18n.t('goBackToDesign')}
</a>.
</p>
{ !isPaused && sendButtonOptions['disabled'] && sendButtonOptions['disabled'] === 'disabled' && (
{ !isPaused && sendButtonOptions.disabled && sendButtonOptions.disabled === 'disabled' && (
<HelpTooltip
tooltip={MailPoet.I18n.t('helpTooltipSendEmail')}
tooltipId="helpTooltipSendEmail"

View File

@@ -437,7 +437,7 @@ define(
if (newsletterOptions.status === 'sent'
|| newsletterOptions.status === 'sending') {
options['disabled'] = 'disabled';
options.disabled = 'disabled';
}
return options;