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