Fix eslint rules

[MAILPOET-1348]
This commit is contained in:
Pavel Dohnal
2018-04-18 15:40:51 +01:00
parent afd801694d
commit 0ce72c05f3

View File

@@ -1,27 +1,16 @@
define(
[
'react',
'jquery',
'underscore',
'mailpoet',
'wp-js-hooks',
],
(
React,
jq,
_,
MailPoet,
Hooks
) => {
const jQuery = jq;
import React from 'react';
import jQuery from 'jquery';
import _ from 'underscore';
import MailPoet from 'mailpoet';
import Hooks from 'wp-js-hooks';
const currentTime = window.mailpoet_current_time || '00:00';
const defaultDateTime = `${window.mailpoet_current_date} 00:00:00`;
const timeOfDayItems = window.mailpoet_schedule_time_of_day;
const dateDisplayFormat = window.mailpoet_date_display_format;
const dateStorageFormat = window.mailpoet_date_storage_format;
const currentTime = window.mailpoet_current_time || '00:00';
const defaultDateTime = `${window.mailpoet_current_date} 00:00:00`;
const timeOfDayItems = window.mailpoet_schedule_time_of_day;
const dateDisplayFormat = window.mailpoet_date_display_format;
const dateStorageFormat = window.mailpoet_date_storage_format;
const datepickerTranslations = {
const datepickerTranslations = {
closeText: MailPoet.I18n.t('close'),
currentText: MailPoet.I18n.t('today'),
nextText: MailPoet.I18n.t('next'),
@@ -81,9 +70,9 @@ define(
MailPoet.I18n.t('fridayMin'),
MailPoet.I18n.t('saturdayMin'),
],
};
};
const DateText = React.createClass({
const DateText = React.createClass({
onChange: function onChange(event) {
const changeEvent = event;
// Swap display format to storage format
@@ -156,7 +145,7 @@ define(
size="10"
name={this.getFieldName()}
value={this.getDisplayDate(this.props.value)}
readOnly={true}
readOnly
disabled={this.props.disabled}
onChange={this.onChange}
ref={(c) => { this.dateInput = c; }}
@@ -164,14 +153,14 @@ define(
/>
);
},
});
});
const TimeSelect = React.createClass({
const TimeSelect = React.createClass({
render: function render() {
const options = Object.keys(timeOfDayItems).map(
(value, index) => (
value => (
<option
key={`option-${index}`}
key={`option-${timeOfDayItems[value]}`}
value={value}
>
{ timeOfDayItems[value] }
@@ -191,9 +180,9 @@ define(
</select>
);
},
});
});
const DateTime = React.createClass({
const DateTime = React.createClass({
DATE_TIME_SEPARATOR: ' ',
getInitialState: function getInitialState() {
return this.buildStateFromProps(this.props);
@@ -250,9 +239,9 @@ define(
</span>
);
},
});
});
const StandardScheduling = React.createClass({
const StandardScheduling = React.createClass({
getCurrentValue: function getCurrentValue() {
return _.defaults(
this.props.item[this.props.field.name] || {},
@@ -325,9 +314,9 @@ define(
</div>
);
},
});
});
let fields = [
let fields = [
{
name: 'subject',
label: MailPoet.I18n.t('subjectLine'),
@@ -414,11 +403,11 @@ define(
type: 'reactComponent',
component: StandardScheduling,
},
];
];
fields = Hooks.applyFilters('mailpoet_newsletters_3rd_step_fields', fields);
fields = Hooks.applyFilters('mailpoet_newsletters_3rd_step_fields', fields);
return {
module.exports = {
getFields: function getFields() {
return fields;
},
@@ -442,6 +431,4 @@ define(
return options;
},
};
}
);
};