diff --git a/.eslintrc.es6.json b/.eslintrc.es6.json index 46e299ad2f..9e37af70c1 100644 --- a/.eslintrc.es6.json +++ b/.eslintrc.es6.json @@ -31,7 +31,6 @@ "react/jsx-boolean-value": 0, "react/jsx-no-bind": 0, "react/no-array-index-key": 0, - "react/prefer-stateless-function": 0, "jsx-a11y/label-has-for": 0, "jsx-a11y/no-static-element-interactions": 0, "jsx-a11y/alt-text": 0, diff --git a/assets/js/src/form/fields/date.jsx b/assets/js/src/form/fields/date.jsx index 1a31eb7d5e..d2e69ed11d 100644 --- a/assets/js/src/form/fields/date.jsx +++ b/assets/js/src/form/fields/date.jsx @@ -5,97 +5,91 @@ define([ React, Moment ) => { - class FormFieldDateYear extends React.Component { - render() { - const yearsRange = 100; - const years = []; + function FormFieldDateYear(props) { + const yearsRange = 100; + const years = []; - if (this.props.placeholder !== undefined) { - years.push(( - - )); - } - - const currentYear = Moment().year(); - for (let i = currentYear; i >= currentYear - yearsRange; i -= 1) { - years.push(( - - )); - } - return ( - - ); + if (props.placeholder !== undefined) { + years.push(( + + )); } + + const currentYear = Moment().year(); + for (let i = currentYear; i >= currentYear - yearsRange; i -= 1) { + years.push(( + + )); + } + return ( + + ); } - class FormFieldDateMonth extends React.Component { - render() { - const months = []; + function FormFieldDateMonth(props) { + const months = []; - if (this.props.placeholder !== undefined) { - months.push(( - - )); - } - - for (let i = 1; i <= 12; i += 1) { - months.push(( - - )); - } - return ( - - ); + if (props.placeholder !== undefined) { + months.push(( + + )); } + + for (let i = 1; i <= 12; i += 1) { + months.push(( + + )); + } + return ( + + ); } - class FormFieldDateDay extends React.Component { - render() { - const days = []; + function FormFieldDateDay(props) { + const days = []; - if (this.props.placeholder !== undefined) { - days.push(( - - )); - } - - for (let i = 1; i <= 31; i += 1) { - days.push(( - - )); - } - - return ( - - ); + if (props.placeholder !== undefined) { + days.push(( + + )); } + + for (let i = 1; i <= 31; i += 1) { + days.push(( + + )); + } + + return ( + + ); } class FormFieldDate extends React.Component { diff --git a/assets/js/src/newsletters/badges/badge.jsx b/assets/js/src/newsletters/badges/badge.jsx index 93a99cab18..fd8c5b4a3e 100644 --- a/assets/js/src/newsletters/badges/badge.jsx +++ b/assets/js/src/newsletters/badges/badge.jsx @@ -2,36 +2,34 @@ import React from 'react'; import classNames from 'classnames'; import ReactTooltip from 'react-tooltip'; -class Badge extends React.Component { - render() { - const badgeClasses = classNames( - 'mailpoet_badge', - this.props.type ? `mailpoet_badge_${this.props.type}` : '' - ); +function Badge(props) { + const badgeClasses = classNames( + 'mailpoet_badge', + props.type ? `mailpoet_badge_${props.type}` : '' + ); - const tooltip = this.props.tooltip ? this.props.tooltip.replace(/\n/g, '
') : false; - // tooltip ID must be unique, defaults to tooltip text - const tooltipId = this.props.tooltipId || tooltip; + const tooltip = props.tooltip ? props.tooltip.replace(/\n/g, '
') : false; + // tooltip ID must be unique, defaults to tooltip text + const tooltipId = props.tooltipId || tooltip; - return ( - - - {this.props.name} - - { tooltip && ( - - ) } + return ( + + + {props.name} - ); - } + { tooltip && ( + + ) } + + ); } export default Badge; diff --git a/assets/js/src/newsletters/send/standard.jsx b/assets/js/src/newsletters/send/standard.jsx index ba5a8a7bd6..00017162ea 100644 --- a/assets/js/src/newsletters/send/standard.jsx +++ b/assets/js/src/newsletters/send/standard.jsx @@ -278,7 +278,7 @@ define( }, handleCheckboxChange: function (event) { const changeEvent = event; - changeEvent.target.value = this.refs.isScheduledInput.checked ? '1' : '0'; + changeEvent.target.value = this.isScheduledInput.checked ? '1' : '0'; return this.handleValueChange(changeEvent); }, isScheduled: function () { diff --git a/assets/js/src/newsletters/types/automatic_emails/breadcrumb.jsx b/assets/js/src/newsletters/types/automatic_emails/breadcrumb.jsx index 6a4a247c1f..8adade39ca 100644 --- a/assets/js/src/newsletters/types/automatic_emails/breadcrumb.jsx +++ b/assets/js/src/newsletters/types/automatic_emails/breadcrumb.jsx @@ -2,40 +2,38 @@ import Breadcrumb from 'newsletters/breadcrumb.jsx'; import React from 'react'; import MailPoet from 'mailpoet'; -class AutomaticEmailsBreadcrumb extends React.Component { - render() { - const steps = [ - { - name: 'type', - label: MailPoet.I18n.t('selectType'), - link: '/new', - }, - { - name: 'events', - label: MailPoet.I18n.t('events'), - }, - { - name: 'conditions', - label: MailPoet.I18n.t('conditions'), - }, - { - name: 'template', - label: MailPoet.I18n.t('template'), - }, - { - name: 'editor', - label: MailPoet.I18n.t('designer'), - }, - { - name: 'send', - label: MailPoet.I18n.t('send'), - }, - ]; +function AutomaticEmailsBreadcrumb(props) { + const steps = [ + { + name: 'type', + label: MailPoet.I18n.t('selectType'), + link: '/new', + }, + { + name: 'events', + label: MailPoet.I18n.t('events'), + }, + { + name: 'conditions', + label: MailPoet.I18n.t('conditions'), + }, + { + name: 'template', + label: MailPoet.I18n.t('template'), + }, + { + name: 'editor', + label: MailPoet.I18n.t('designer'), + }, + { + name: 'send', + label: MailPoet.I18n.t('send'), + }, + ]; - return ( - - ); - } + return ( + + ); } module.exports = AutomaticEmailsBreadcrumb;