From 75f51963a29d516c8cbabf9690a588c2aaddc65d Mon Sep 17 00:00:00 2001 From: oskosk Date: Fri, 16 Feb 2018 12:45:23 -0300 Subject: [PATCH 01/10] Run eslint --fix on the codebase --- _inc/client/admin.js | 26 +- _inc/client/at-a-glance/monitor.jsx | 2 +- _inc/client/at-a-glance/photon.jsx | 2 +- _inc/client/at-a-glance/protect.jsx | 2 +- .../components/button-group/docs/example.jsx | 6 +- _inc/client/components/card/compact.jsx | 4 +- _inc/client/components/card/index.jsx | 22 +- .../client/components/chart/bar-container.jsx | 12 +- _inc/client/components/chart/bar.jsx | 22 +- _inc/client/components/chart/index.jsx | 18 +- _inc/client/components/chart/label.jsx | 6 +- _inc/client/components/chart/legend.jsx | 17 +- _inc/client/components/chart/x-axis.jsx | 14 +- _inc/client/components/count/docs/example.jsx | 4 +- _inc/client/components/count/test/index.jsx | 16 +- .../data/query-akismet-data/index.jsx | 2 +- .../data/query-dash-protect/index.jsx | 2 +- .../data/query-plugin-updates/index.jsx | 2 +- .../data/query-vaultpress-data/index.jsx | 2 +- .../client/components/foldable-card/index.jsx | 12 +- _inc/client/components/form/action-bar.jsx | 6 +- .../form/clipboard-button/index.jsx | 8 +- .../components/form/form-toggle/compact.jsx | 4 +- .../form/form-toggle/test/index.jsx | 22 +- _inc/client/components/form/index.jsx | 22 +- .../form/input-checkbox-multiple.jsx | 30 +- .../client/components/form/input-checkbox.jsx | 34 +- _inc/client/components/form/input-hidden.jsx | 8 +- _inc/client/components/form/input-radio.jsx | 20 +- .../form/input-select-country-2.jsx | 4 +- .../components/form/input-select-country.jsx | 502 +++++++++--------- _inc/client/components/form/input-select.jsx | 22 +- _inc/client/components/form/input-text.js | 50 +- _inc/client/components/form/label.jsx | 8 +- _inc/client/components/form/row.jsx | 2 +- _inc/client/components/form/section.jsx | 6 +- _inc/client/components/form/submit.jsx | 8 +- .../components/global-notices/index.jsx | 2 +- _inc/client/components/gridicon/index.jsx | 306 +++++------ .../components/info-popover/docs/example.jsx | 6 +- _inc/client/components/modal/index.jsx | 36 +- .../components/notice/notice-action.jsx | 2 +- _inc/client/components/popover/menu-item.jsx | 6 +- _inc/client/components/popover/menu.jsx | 12 +- _inc/client/components/root-child/index.jsx | 2 +- .../client/components/search/docs/example.jsx | 8 +- .../components/search/search-collection.jsx | 2 +- _inc/client/components/search/test/index.jsx | 2 +- .../components/section-nav/docs/example.jsx | 14 +- _inc/client/components/section-nav/index.jsx | 14 +- _inc/client/components/section-nav/item.jsx | 10 +- .../components/section-nav/segmented.jsx | 12 +- _inc/client/components/section-nav/tabs.jsx | 22 +- .../components/section-nav/test/index.jsx | 18 +- .../select-dropdown/docs/example.jsx | 8 +- .../components/select-dropdown/index.jsx | 20 +- .../components/select-dropdown/item.jsx | 10 +- .../components/select-dropdown/separator.jsx | 4 +- .../components/spinner/docs/example.jsx | 4 +- _inc/client/components/spinner/index.jsx | 8 +- _inc/client/components/textarea/index.jsx | 2 +- .../upgrade-notice-content/index.jsx | 6 +- _inc/client/config.js | 2 +- _inc/client/lib/accessible-focus/index.js | 2 +- _inc/client/lib/analytics/index.js | 24 +- _inc/client/lib/viewport/index.js | 6 +- _inc/client/mixins/emitter/index.js | 2 +- _inc/client/mixins/url-search/build-url.js | 4 +- _inc/client/mixins/url-search/index.js | 6 +- _inc/client/notices/index.js | 18 +- _inc/client/notices/validation-error-list.jsx | 4 +- _inc/client/plans/plan-body.jsx | 2 +- _inc/client/plans/plan-header.jsx | 2 +- _inc/client/state/connection/reducer.js | 6 +- _inc/client/state/dev-version/reducer.js | 2 +- _inc/client/state/initial-state/actions.js | 4 +- _inc/client/state/jetpack-notices/actions.js | 8 +- _inc/client/state/jetpack-notices/reducer.js | 6 +- _inc/client/state/modules/reducer.js | 10 +- _inc/client/state/settings/reducer.js | 4 +- _inc/client/state/site/plugins/actions.js | 2 +- _inc/client/state/site/plugins/reducer.js | 2 +- _inc/client/state/site/reducer.js | 2 +- _inc/client/static.jsx | 16 +- 84 files changed, 809 insertions(+), 810 deletions(-) diff --git a/_inc/client/admin.js b/_inc/client/admin.js index 89b20c84438af..2a659c3b2a9bc 100644 --- a/_inc/client/admin.js +++ b/_inc/client/admin.js @@ -6,7 +6,7 @@ import React from 'react'; import { Provider } from 'react-redux'; import { Route, Router, useRouterHistory } from 'react-router'; import { syncHistoryWithStore } from 'react-router-redux'; -import { createHashHistory } from 'history' +import { createHashHistory } from 'history'; import assign from 'lodash/assign'; import injectTapEventPlugin from 'react-tap-event-plugin'; injectTapEventPlugin(); @@ -70,18 +70,18 @@ function render() {
- - - - - - - - - - - - + + + + + + + + + + + + diff --git a/_inc/client/at-a-glance/monitor.jsx b/_inc/client/at-a-glance/monitor.jsx index 6a2f5de397b19..58a5672716d45 100644 --- a/_inc/client/at-a-glance/monitor.jsx +++ b/_inc/client/at-a-glance/monitor.jsx @@ -27,7 +27,7 @@ class DashMonitor extends Component { } ); - this.props.updateOptions( { 'monitor': true } ); + this.props.updateOptions( { monitor: true } ); }; if ( this.props.getOptionValue( 'monitor' ) ) { diff --git a/_inc/client/at-a-glance/photon.jsx b/_inc/client/at-a-glance/photon.jsx index 9c5f6fd775bfe..dac57198aa2ba 100644 --- a/_inc/client/at-a-glance/photon.jsx +++ b/_inc/client/at-a-glance/photon.jsx @@ -17,7 +17,7 @@ import { isDevMode } from 'state/connection'; class DashPhoton extends Component { getContent() { const labelName = __( 'Image Performance' ), - activatePhoton = () => this.props.updateOptions( { 'photon': true } ); + activatePhoton = () => this.props.updateOptions( { photon: true } ); if ( this.props.getOptionValue( 'photon' ) ) { return ( diff --git a/_inc/client/at-a-glance/protect.jsx b/_inc/client/at-a-glance/protect.jsx index c7f2f1da1e43d..95933d6d633a3 100644 --- a/_inc/client/at-a-glance/protect.jsx +++ b/_inc/client/at-a-glance/protect.jsx @@ -18,7 +18,7 @@ import { isDevMode } from 'state/connection'; class DashProtect extends Component { getContent() { - const activateProtect = () => this.props.updateOptions( { 'protect': true } ); + const activateProtect = () => this.props.updateOptions( { protect: true } ); if ( this.props.getOptionValue( 'protect' ) ) { const protectCount = this.props.protectCount; diff --git a/_inc/client/components/button-group/docs/example.jsx b/_inc/client/components/button-group/docs/example.jsx index 24ebb88713d0d..80eb77bf22c8e 100644 --- a/_inc/client/components/button-group/docs/example.jsx +++ b/_inc/client/components/button-group/docs/example.jsx @@ -3,18 +3,18 @@ /** * External dependencies */ -var React = require( 'react' ), +let React = require( 'react' ), PureRenderMixin = require( 'react-pure-render/mixin' ); /** * Internal dependencies */ -var ButtonGroup = require( 'components/button-group' ), +let ButtonGroup = require( 'components/button-group' ), Button = require( 'components/button' ), Card = require( 'components/card' ), Gridicon = require( 'components/gridicon' ); -var Buttons = React.createClass( { +const Buttons = React.createClass( { displayName: 'ButtonGroup', mixins: [ PureRenderMixin ], diff --git a/_inc/client/components/card/compact.jsx b/_inc/client/components/card/compact.jsx index e626d345eee4c..e545fe2108c00 100644 --- a/_inc/client/components/card/compact.jsx +++ b/_inc/client/components/card/compact.jsx @@ -1,14 +1,14 @@ /** * External dependencies */ -var React = require( 'react' ), +let React = require( 'react' ), assign = require( 'lodash/assign' ), classnames = require( 'classnames' ); /** * Internal dependencies */ -var Card = require( 'components/card' ); +const Card = require( 'components/card' ); module.exports = React.createClass( { displayName: 'CompactCard', diff --git a/_inc/client/components/card/index.jsx b/_inc/client/components/card/index.jsx index 1443ec58da8c5..87af1b44449e7 100644 --- a/_inc/client/components/card/index.jsx +++ b/_inc/client/components/card/index.jsx @@ -1,5 +1,5 @@ const PropTypes = require( 'prop-types' ); -var React = require( 'react' ), +let React = require( 'react' ), Gridicon = require( '../gridicon' ), classnames = require( 'classnames' ); @@ -8,14 +8,14 @@ import omit from 'lodash/omit'; require( './style.scss' ); -let CardSection = React.createClass( { +const CardSection = React.createClass( { propTypes: { title: PropTypes.any, vertical: PropTypes.any, style: PropTypes.object, className: PropTypes.string, - device: PropTypes.oneOf( ['desktop', 'tablet', 'phone'] ) + device: PropTypes.oneOf( [ 'desktop', 'tablet', 'phone' ] ) }, getDefaultProps: function() { @@ -24,7 +24,7 @@ let CardSection = React.createClass( { render: function() { return ( -
+
{this.props.title ? this._renderWithTitle() : this.props.children @@ -34,11 +34,11 @@ let CardSection = React.createClass( { }, _renderWithTitle: function() { - var orientation = this.props.vertical ? 'vertical' : 'horizontal'; - var wrapperClassName = 'dops-card-section-orient-' + orientation; + const orientation = this.props.vertical ? 'vertical' : 'horizontal'; + const wrapperClassName = 'dops-card-section-orient-' + orientation; return ( -
+

{this.props.title}

@@ -50,7 +50,7 @@ let CardSection = React.createClass( { } } ); -let CardFooter = React.createClass( { +const CardFooter = React.createClass( { render: function() { return ( @@ -61,7 +61,7 @@ let CardFooter = React.createClass( { } } ); -let Card = React.createClass( { +const Card = React.createClass( { propTypes: { meta: PropTypes.any, @@ -127,8 +127,8 @@ let Card = React.createClass( { _renderIcon: function() { return ( - - { this.props.icon && } + + { this.props.icon && } { this.props.iconLabel } ); diff --git a/_inc/client/components/chart/bar-container.jsx b/_inc/client/components/chart/bar-container.jsx index aa574c8834c61..8d978e4ec1671 100644 --- a/_inc/client/components/chart/bar-container.jsx +++ b/_inc/client/components/chart/bar-container.jsx @@ -1,13 +1,13 @@ /** * External dependencies */ -var PropTypes = require( 'prop-types' ); -var React = require( 'react' ); +const PropTypes = require( 'prop-types' ); +const React = require( 'react' ); /** * Internal dependencies */ -var Bar = require( './bar' ), +let Bar = require( './bar' ), XAxis = require( './x-axis' ); module.exports = React.createClass( { @@ -22,14 +22,14 @@ module.exports = React.createClass( { }, buildBars: function( max ) { - var bars, + let bars, numberBars = this.props.data.length, tooltipPosition = 'bottom right', width = this.props.chartWidth, barWidth = ( width / numberBars ); - bars = this.props.data.map( function ( item, index ) { - var barOffset = barWidth * ( index + 1 ); + bars = this.props.data.map( function( item, index ) { + const barOffset = barWidth * ( index + 1 ); if ( ( ( barOffset + 230 ) > width ) && diff --git a/_inc/client/components/chart/bar.jsx b/_inc/client/components/chart/bar.jsx index 640f0b232a38f..1e8db1977ecac 100644 --- a/_inc/client/components/chart/bar.jsx +++ b/_inc/client/components/chart/bar.jsx @@ -4,13 +4,13 @@ * External dependencies */ const PropTypes = require( 'prop-types' ); -var React = require( 'react' ), +let React = require( 'react' ), classNames = require( 'classnames' ); /** * Internal dependencies */ -var Tooltip = require( 'components/tooltip' ), +let Tooltip = require( 'components/tooltip' ), Gridicon = require( 'components/gridicon' ); module.exports = React.createClass( { @@ -31,7 +31,7 @@ module.exports = React.createClass( { }, buildSections: function() { - var value = this.props.data.value, + let value = this.props.data.value, max = this.props.max, percentage = max ? Math.ceil( ( value / max ) * 10000 ) / 100 : 0, remain = 100 - percentage, @@ -74,13 +74,13 @@ module.exports = React.createClass( { return sections; }, - clickHandler: function(){ + clickHandler: function() { if ( 'function' === typeof( this.props.clickHandler ) ) { this.props.clickHandler( this.props.data ); } }, - mouseEnter: function(){ + mouseEnter: function() { this.setState( { showPopover: true } ); }, @@ -100,7 +100,7 @@ module.exports = React.createClass( { const { tooltipData } = this.props.data; const listItemElements = tooltipData.map( function( options, i ) { - var wrapperClasses = [ 'module-content-list-item' ], + let wrapperClasses = [ 'module-content-list-item' ], gridiconSpan; if ( options.icon ) { @@ -111,9 +111,9 @@ module.exports = React.createClass( { return (
  • - - { options.value } - { gridiconSpan }{ options.label } + + { options.value } + { gridiconSpan }{ options.label }
  • ); @@ -136,13 +136,13 @@ module.exports = React.createClass( { }, render: function() { - var barStyle, + let barStyle, barClass, count = this.props.count || 1; barClass = { 'dops-chart__bar': true }; - if ( this.props.className ){ + if ( this.props.className ) { barClass[ this.props.className ] = true; } diff --git a/_inc/client/components/chart/index.jsx b/_inc/client/components/chart/index.jsx index 70082600c423a..52056b8e27251 100644 --- a/_inc/client/components/chart/index.jsx +++ b/_inc/client/components/chart/index.jsx @@ -1,7 +1,7 @@ /** * External dependencies */ -var React = require( 'react' ), +let React = require( 'react' ), PropTypes = require( 'prop-types' ), noop = require( 'lodash/noop' ), throttle = require( 'lodash/throttle' ); @@ -9,7 +9,7 @@ var React = require( 'react' ), /** * Internal dependencies */ -var BarContainer = require( './bar-container' ), +let BarContainer = require( './bar-container' ), touchDetect = require( 'lib/touch-detect' ); require( './style.scss' ); @@ -59,7 +59,7 @@ module.exports = React.createClass( { }, resize: function() { - var node = this.refs.chart, + let node = this.refs.chart, width = node.clientWidth - 82, maxBars; @@ -77,7 +77,7 @@ module.exports = React.createClass( { }, getYAxisMax: function( values ) { - var max = Math.max.apply( null, values ), + let max = Math.max.apply( null, values ), operand = Math.pow( 10, ( max.toString().length - 1 ) ), rounded = ( Math.ceil( ( max + 1 ) / operand ) * operand ); @@ -89,7 +89,7 @@ module.exports = React.createClass( { }, getData: function() { - var data = this.props.data; + let data = this.props.data; data = data.slice( 0 - this.state.maxBars ); @@ -97,9 +97,9 @@ module.exports = React.createClass( { }, getValues: function() { - var data = this.getData(); + let data = this.getData(); - data = data.map( function ( item ) { + data = data.map( function( item ) { return item.value; }, this ); @@ -115,7 +115,7 @@ module.exports = React.createClass( { }, render: function() { - var values = this.getValues(), + let values = this.getValues(), yAxisMax = this.getYAxisMax( values ), data = this.getData(), emptyChart; @@ -134,7 +134,7 @@ module.exports = React.createClass( { } return ( -
    +
    diff --git a/_inc/client/components/chart/label.jsx b/_inc/client/components/chart/label.jsx index cc62bda29b715..a6651167a62fb 100644 --- a/_inc/client/components/chart/label.jsx +++ b/_inc/client/components/chart/label.jsx @@ -1,8 +1,8 @@ /** * External dependencies */ -var PropTypes = require( 'prop-types' ); -var React = require( 'react' ); +const PropTypes = require( 'prop-types' ); +const React = require( 'react' ); module.exports = React.createClass( { displayName: 'ModuleChartLabel', @@ -14,7 +14,7 @@ module.exports = React.createClass( { }, render: function() { - var labelStyle, + let labelStyle, dir = 'left'; labelStyle = { diff --git a/_inc/client/components/chart/legend.jsx b/_inc/client/components/chart/legend.jsx index b27fc94564855..87bb6818f79aa 100644 --- a/_inc/client/components/chart/legend.jsx +++ b/_inc/client/components/chart/legend.jsx @@ -3,15 +3,15 @@ /** * External dependencies */ -var PropTypes = require( 'prop-types' ); -var React = require( 'react' ), +const PropTypes = require( 'prop-types' ); +let React = require( 'react' ), PureRenderMixin = require( 'react-pure-render/mixin' ); /** * Internal dependencies */ -var LegendItem = React.createClass( { +const LegendItem = React.createClass( { displayName: 'ModuleChartLegendItem', mixins: [ PureRenderMixin ], @@ -31,7 +31,7 @@ var LegendItem = React.createClass( { return (
  • @@ -40,7 +40,7 @@ var LegendItem = React.createClass( { } ); -var Legend = React.createClass( { +const Legend = React.createClass( { displayName: 'ModuleChartLegend', propTypes: { @@ -56,12 +56,12 @@ var Legend = React.createClass( { }, render: function() { - var legendColors = [ 'dops-chart__legend-color is-dark-blue' ], + let legendColors = [ 'dops-chart__legend-color is-dark-blue' ], tab = this.props.activeTab, legendItems; legendItems = this.props.availableCharts.map( function( legendItem, index ) { - var colorClass = legendColors[ index ], + let colorClass = legendColors[ index ], checked = ( -1 !== this.props.activeCharts.indexOf( legendItem ) ), tab; @@ -72,11 +72,10 @@ var Legend = React.createClass( { return ; }, this ); - return (
      -
    • { tab.label }
    • +
    • { tab.label }
    • { legendItems }
    diff --git a/_inc/client/components/chart/x-axis.jsx b/_inc/client/components/chart/x-axis.jsx index 05a127467b3ba..9b57e09269d3b 100644 --- a/_inc/client/components/chart/x-axis.jsx +++ b/_inc/client/components/chart/x-axis.jsx @@ -1,14 +1,14 @@ /** * External dependencies */ -var React = require( 'react' ), +let React = require( 'react' ), PropTypes = require( 'prop-types' ), throttle = require( 'lodash/throttle' ); /** * Internal dependencies */ -var Label = require( './label' ); +const Label = require( './label' ); module.exports = React.createClass( { displayName: 'ModuleChartXAxis', @@ -34,7 +34,7 @@ module.exports = React.createClass( { // Remove listener componentWillUnmount: function() { - if( this.resizeThrottled.cancel ) { + if ( this.resizeThrottled.cancel ) { this.resizeThrottled.cancel(); } window.removeEventListener( 'resize', this.resizeThrottled ); @@ -45,7 +45,7 @@ module.exports = React.createClass( { }, resize: function( nextProps ) { - var node, + let node, props = this.props, width, dataCount, @@ -80,11 +80,11 @@ module.exports = React.createClass( { }, render: function() { - var labels, + let labels, data = this.props.data; - labels = data.map( function ( item, index ) { - var x = ( index * this.state.spacing ) + ( ( this.state.spacing - this.props.labelWidth ) / 2 ), + labels = data.map( function( item, index ) { + let x = ( index * this.state.spacing ) + ( ( this.state.spacing - this.props.labelWidth ) / 2 ), rightIndex = data.length - index - 1, label; diff --git a/_inc/client/components/count/docs/example.jsx b/_inc/client/components/count/docs/example.jsx index b0f62c22a5124..33d05a5ec2747 100644 --- a/_inc/client/components/count/docs/example.jsx +++ b/_inc/client/components/count/docs/example.jsx @@ -1,13 +1,13 @@ /** * External dependencies */ -var React = require( 'react' ), +let React = require( 'react' ), PureRenderMixin = require( 'react-pure-render/mixin' ); /** * Internal dependencies */ -var Count = require( 'components/count' ); +const Count = require( 'components/count' ); module.exports = React.createClass( { displayName: 'Count', diff --git a/_inc/client/components/count/test/index.jsx b/_inc/client/components/count/test/index.jsx index fd6da9a230d7f..55c93688bcbab 100644 --- a/_inc/client/components/count/test/index.jsx +++ b/_inc/client/components/count/test/index.jsx @@ -1,7 +1,7 @@ /** * External dependencies */ -var expect = require( 'chai' ).expect, +let expect = require( 'chai' ).expect, useMockery = require( 'test/helpers/use-mockery' ); /** @@ -10,7 +10,7 @@ var expect = require( 'chai' ).expect, import useI18n from 'test/helpers/use-i18n'; describe( 'Count', function() { - var React, ReactInjection, TestUtils, Count, renderer; + let React, ReactInjection, TestUtils, Count, renderer; // really only using Mockery for the clean module cache useMockery(); @@ -30,7 +30,7 @@ describe( 'Count', function() { } ); it( 'should render the passed count', function() { - var result; + let result; renderer.render( ); result = renderer.getRenderOutput(); @@ -40,7 +40,7 @@ describe( 'Count', function() { } ); it( 'should use the correct class name', function() { - var result; + let result; renderer.render( ); result = renderer.getRenderOutput(); @@ -49,7 +49,7 @@ describe( 'Count', function() { } ); it( 'should internationalize the passed count', function() { - var result; + let result; renderer.render( ); result = renderer.getRenderOutput(); @@ -58,7 +58,7 @@ describe( 'Count', function() { } ); it( 'should render zero', function() { - var result; + let result; renderer.render( ); result = renderer.getRenderOutput(); @@ -67,7 +67,7 @@ describe( 'Count', function() { } ); it( 'should render negative numbers', function() { - var result; + let result; renderer.render( ); result = renderer.getRenderOutput(); @@ -76,7 +76,7 @@ describe( 'Count', function() { } ); it( 'should cut off floating point numbers', function() { - var result; + let result; renderer.render( ); result = renderer.getRenderOutput(); diff --git a/_inc/client/components/data/query-akismet-data/index.jsx b/_inc/client/components/data/query-akismet-data/index.jsx index 8662396f62233..4f6b746639b56 100644 --- a/_inc/client/components/data/query-akismet-data/index.jsx +++ b/_inc/client/components/data/query-akismet-data/index.jsx @@ -13,7 +13,7 @@ import { isFetchingAkismetData, fetchAkismetData } from 'state/at-a-glance'; class QueryAkismetData extends Component { componentWillMount() { if ( ! this.props.fetchingAkismetData ) { - this.props.fetchAkismetData() + this.props.fetchAkismetData(); } } diff --git a/_inc/client/components/data/query-dash-protect/index.jsx b/_inc/client/components/data/query-dash-protect/index.jsx index 8eb15626d73bd..5ba483866a13e 100644 --- a/_inc/client/components/data/query-dash-protect/index.jsx +++ b/_inc/client/components/data/query-dash-protect/index.jsx @@ -14,7 +14,7 @@ import { isModuleActivated as _isModuleActivated } from 'state/modules'; class QueryProtectCount extends Component { componentWillMount() { if ( ! this.props.fetchingProtectData && this.props.isModuleActivated( 'protect' ) ) { - this.props.fetchProtectCount() + this.props.fetchProtectCount(); } } diff --git a/_inc/client/components/data/query-plugin-updates/index.jsx b/_inc/client/components/data/query-plugin-updates/index.jsx index dc8a7c83d8c84..deb151f5e1a28 100644 --- a/_inc/client/components/data/query-plugin-updates/index.jsx +++ b/_inc/client/components/data/query-plugin-updates/index.jsx @@ -13,7 +13,7 @@ import { isFetchingPluginUpdates, fetchPluginUpdates } from 'state/at-a-glance'; class QueryPluginUpdates extends Component { componentWillMount() { if ( ! this.props.fetchingPluginUpdates ) { - this.props.fetchPluginUpdates() + this.props.fetchPluginUpdates(); } } diff --git a/_inc/client/components/data/query-vaultpress-data/index.jsx b/_inc/client/components/data/query-vaultpress-data/index.jsx index 8e79ba480c694..8a63a11b7e116 100644 --- a/_inc/client/components/data/query-vaultpress-data/index.jsx +++ b/_inc/client/components/data/query-vaultpress-data/index.jsx @@ -14,7 +14,7 @@ import { isModuleActivated as _isModuleActivated } from 'state/modules'; class QueryVaultPressData extends Component { componentWillMount() { if ( ! this.props.fetchingVaultPressData && this.props.isModuleActivated( 'vaultpress' ) ) { - this.props.fetchVaultPressData() + this.props.fetchVaultPressData(); } } diff --git a/_inc/client/components/foldable-card/index.jsx b/_inc/client/components/foldable-card/index.jsx index b64ae1964419e..97a95bbf77a7c 100644 --- a/_inc/client/components/foldable-card/index.jsx +++ b/_inc/client/components/foldable-card/index.jsx @@ -2,21 +2,21 @@ * External Dependencies */ const PropTypes = require( 'prop-types' ); -var React = require( 'react' ), +let React = require( 'react' ), classNames = require( 'classnames' ), noop = require( 'lodash/noop' ); /** * Internal Dependencies */ -var Card = require( 'components/card' ), +let Card = require( 'components/card' ), CompactCard = require( 'components/card/compact' ), Gridicon = require( 'components/gridicon' ), onKeyDownCallback = require( 'utils/onkeydown-callback' ); require( './style.scss' ); -var FoldableCard = React.createClass( { +const FoldableCard = React.createClass( { propTypes: { actionButton: PropTypes.element, @@ -93,7 +93,7 @@ var FoldableCard = React.createClass( { ); } if ( this.props.children ) { - let iconSize = 24; + const iconSize = 24; return ( + ); } } ); diff --git a/_inc/client/components/global-notices/index.jsx b/_inc/client/components/global-notices/index.jsx index 5de0a2d3cdd49..3ba7082479779 100644 --- a/_inc/client/components/global-notices/index.jsx +++ b/_inc/client/components/global-notices/index.jsx @@ -13,7 +13,7 @@ import NoticeAction from 'components/notice/notice-action'; import notices from 'notices'; import { connect } from 'react-redux'; import { bindActionCreators } from 'redux'; -import { removeNotice } from './state/notices/actions' +import { removeNotice } from './state/notices/actions'; const debug = debugModule( 'calypso:notices' ); diff --git a/_inc/client/components/gridicon/index.jsx b/_inc/client/components/gridicon/index.jsx index cbb4efbf5913a..8bd9ad89f4eb3 100644 --- a/_inc/client/components/gridicon/index.jsx +++ b/_inc/client/components/gridicon/index.jsx @@ -11,7 +11,7 @@ OR if you're looking to change now SVGs get output, you'll need to edit strings * External dependencies */ const PropTypes = require( 'prop-types' ); -var React = require( 'react' ), +let React = require( 'react' ), PureRenderMixin = require( 'react-pure-render/mixin' ), classNames = require( 'classnames' ); @@ -36,7 +36,7 @@ const Gridicon = React.createClass( { }, needsOffset: function( icon, size ) { - var iconNeedsOffset = [ + const iconNeedsOffset = [ 'gridicons-add-outline', 'gridicons-add', 'gridicons-align-image-center', @@ -96,7 +96,7 @@ const Gridicon = React.createClass( { }, needsOffsetX: function( icon, size ) { - var iconNeedsOffsetX = [ + const iconNeedsOffsetX = [ 'gridicons-arrow-down', 'gridicons-arrow-up', 'gridicons-comment', @@ -114,7 +114,7 @@ const Gridicon = React.createClass( { }, needsOffsetY: function( icon, size ) { - var iconNeedsOffsetY = [ + const iconNeedsOffsetY = [ 'gridicons-align-center', 'gridicons-align-justify', 'gridicons-align-left', @@ -140,7 +140,7 @@ const Gridicon = React.createClass( { }, render: function() { - var icon = 'gridicons-' + this.props.icon, + let icon = 'gridicons-' + this.props.icon, needsOffset = this.needsOffset( icon, this.props.size ), needsOffsetX = this.needsOffsetX( icon, this.props.size ), needsOffsetY = this.needsOffsetY( icon, this.props.size ), @@ -157,448 +157,448 @@ const Gridicon = React.createClass( { svg = ; break; case 'gridicons-add-image': - svg = ; + svg = ; break; case 'gridicons-add-outline': - svg = ; + svg = ; break; case 'gridicons-add': - svg = ; + svg = ; break; case 'gridicons-align-center': - svg = ; + svg = ; break; case 'gridicons-align-image-center': - svg = ; + svg = ; break; case 'gridicons-align-image-left': - svg = ; + svg = ; break; case 'gridicons-align-image-none': - svg = ; + svg = ; break; case 'gridicons-align-image-right': - svg = ; + svg = ; break; case 'gridicons-align-justify': - svg = ; + svg = ; break; case 'gridicons-align-left': - svg = ; + svg = ; break; case 'gridicons-align-right': - svg = ; + svg = ; break; case 'gridicons-arrow-down': - svg = ; + svg = ; break; case 'gridicons-arrow-left': - svg = ; + svg = ; break; case 'gridicons-arrow-right': - svg = ; + svg = ; break; case 'gridicons-arrow-up': - svg = ; + svg = ; break; case 'gridicons-aside': - svg = ; + svg = ; break; case 'gridicons-attachment': - svg = ; + svg = ; break; case 'gridicons-audio': - svg = ; + svg = ; break; case 'gridicons-backspace': - svg = ; + svg = ; break; case 'gridicons-bell': - svg = ; + svg = ; break; case 'gridicons-block': - svg = ; + svg = ; break; case 'gridicons-bold': - svg = ; + svg = ; break; case 'gridicons-book': - svg = ; + svg = ; break; case 'gridicons-bookmark-outline': - svg = ; + svg = ; break; case 'gridicons-bookmark': - svg = ; + svg = ; break; case 'gridicons-briefcase': - svg = ; + svg = ; break; case 'gridicons-calendar': - svg = ; + svg = ; break; case 'gridicons-camera': - svg = ; + svg = ; break; case 'gridicons-cart': - svg = ; + svg = ; break; case 'gridicons-checkmark-circle': - svg = ; + svg = ; break; case 'gridicons-checkmark': - svg = ; + svg = ; break; case 'gridicons-chevron-down': - svg = ; + svg = ; break; case 'gridicons-chevron-left': - svg = ; + svg = ; break; case 'gridicons-chevron-right': - svg = ; + svg = ; break; case 'gridicons-chevron-up': - svg = ; + svg = ; break; case 'gridicons-clear-formatting': - svg = ; + svg = ; break; case 'gridicons-clipboard': - svg = ; + svg = ; break; case 'gridicons-cloud-download': - svg = ; + svg = ; break; case 'gridicons-cloud-outline': - svg = ; + svg = ; break; case 'gridicons-cloud-upload': - svg = ; + svg = ; break; case 'gridicons-cloud': - svg = ; + svg = ; break; case 'gridicons-code': - svg = ; + svg = ; break; case 'gridicons-cog': - svg = ; + svg = ; break; case 'gridicons-comment': - svg = ; + svg = ; break; case 'gridicons-computer': - svg = ; + svg = ; break; case 'gridicons-create': - svg = ; + svg = ; break; case 'gridicons-credit-card': - svg = ; + svg = ; break; case 'gridicons-crop': - svg = ; + svg = ; break; case 'gridicons-cross-small': - svg = ; + svg = ; break; case 'gridicons-cross': - svg = ; + svg = ; break; case 'gridicons-custom-post-type': - svg = ; + svg = ; break; case 'gridicons-customize': - svg = ; + svg = ; break; case 'gridicons-dropdown': - svg = ; + svg = ; break; case 'gridicons-ellipsis': - svg = ; + svg = ; break; case 'gridicons-external': - svg = ; + svg = ; break; case 'gridicons-flag': - svg = ; + svg = ; break; case 'gridicons-flip-horizontal': - svg = ; + svg = ; break; case 'gridicons-flip-vertical': - svg = ; + svg = ; break; case 'gridicons-folder-multiple': - svg = ; + svg = ; break; case 'gridicons-folder': - svg = ; + svg = ; break; case 'gridicons-globe': - svg = ; + svg = ; break; case 'gridicons-grid': - svg = ; + svg = ; break; case 'gridicons-heading': - svg = ; + svg = ; break; case 'gridicons-heart-outline': - svg = ; + svg = ; break; case 'gridicons-heart': - svg = ; + svg = ; break; case 'gridicons-help-outline': - svg = ; + svg = ; break; case 'gridicons-help': - svg = ; + svg = ; break; case 'gridicons-history': - svg = ; + svg = ; break; case 'gridicons-house': - svg = ; + svg = ; break; case 'gridicons-image-multiple': - svg = ; + svg = ; break; case 'gridicons-image': - svg = ; + svg = ; break; case 'gridicons-indent-left': - svg = ; + svg = ; break; case 'gridicons-indent-right': - svg = ; + svg = ; break; case 'gridicons-info-outline': - svg = ; + svg = ; break; case 'gridicons-info': - svg = ; + svg = ; break; case 'gridicons-ink': - svg = ; + svg = ; break; case 'gridicons-institution': - svg = ; + svg = ; break; case 'gridicons-italic': - svg = ; + svg = ; break; case 'gridicons-layout-blocks': - svg = ; + svg = ; break; case 'gridicons-layout': - svg = ; + svg = ; break; case 'gridicons-link-break': - svg = ; + svg = ; break; case 'gridicons-link': - svg = ; + svg = ; break; case 'gridicons-list-checkmark': - svg = ; + svg = ; break; case 'gridicons-list-ordered': - svg = ; + svg = ; break; case 'gridicons-list-unordered': - svg = ; + svg = ; break; case 'gridicons-location': - svg = ; + svg = ; break; case 'gridicons-lock': - svg = ; + svg = ; break; case 'gridicons-mail': - svg = ; + svg = ; break; case 'gridicons-mention': - svg = ; + svg = ; break; case 'gridicons-menu': - svg = ; + svg = ; break; case 'gridicons-menus': - svg = ; + svg = ; break; case 'gridicons-microphone': - svg = ; + svg = ; break; case 'gridicons-minus-small': - svg = ; + svg = ; break; case 'gridicons-minus': - svg = ; + svg = ; break; case 'gridicons-my-sites-horizon': - svg = ; + svg = ; break; case 'gridicons-my-sites': - svg = ; + svg = ; break; case 'gridicons-not-visible': - svg = ; + svg = ; break; case 'gridicons-notice-outline': - svg = ; + svg = ; break; case 'gridicons-notice': - svg = ; + svg = ; break; case 'gridicons-pages': - svg = ; + svg = ; break; case 'gridicons-pencil': - svg = ; + svg = ; break; case 'gridicons-phone': - svg = ; + svg = ; break; case 'gridicons-plugins': - svg = ; + svg = ; break; case 'gridicons-plus-small': - svg = ; + svg = ; break; case 'gridicons-plus': - svg = ; + svg = ; break; case 'gridicons-popout': - svg = ; + svg = ; break; case 'gridicons-posts': - svg = ; + svg = ; break; case 'gridicons-print': - svg = ; + svg = ; break; case 'gridicons-quote': - svg = ; + svg = ; break; case 'gridicons-reader': - svg = ; + svg = ; break; case 'gridicons-reader-following': - svg = ; + svg = ; break; case 'gridicons-reblog': - svg = ; + svg = ; break; case 'gridicons-redo': - svg = ; + svg = ; break; case 'gridicons-refresh': - svg = ; + svg = ; break; case 'gridicons-reply': - svg = ; + svg = ; break; case 'gridicons-rotate': - svg = ; + svg = ; break; case 'gridicons-scheduled': - svg = ; + svg = ; break; case 'gridicons-search': - svg = ; + svg = ; break; case 'gridicons-share-ios': - svg = ; + svg = ; break; case 'gridicons-share': - svg = ; + svg = ; break; case 'gridicons-sign-out': - svg = ; + svg = ; break; case 'gridicons-spam': - svg = ; + svg = ; break; case 'gridicons-speaker': - svg = ; + svg = ; break; case 'gridicons-special-character': - svg = ; + svg = ; break; case 'gridicons-star-outline': - svg = ; + svg = ; break; case 'gridicons-star': - svg = ; + svg = ; break; case 'gridicons-stats-alt': - svg = ; + svg = ; break; case 'gridicons-stats': - svg = ; + svg = ; break; case 'gridicons-status': - svg = ; + svg = ; break; case 'gridicons-strikethrough': - svg = ; + svg = ; break; case 'gridicons-sync': - svg = ; + svg = ; break; case 'gridicons-tablet': - svg = ; + svg = ; break; case 'gridicons-tag': - svg = ; + svg = ; break; case 'gridicons-text-color': - svg = ; + svg = ; break; case 'gridicons-themes': - svg = ; + svg = ; break; case 'gridicons-thumbs-up': - svg = ; + svg = ; break; case 'gridicons-time': - svg = ; + svg = ; break; case 'gridicons-trash': - svg = ; + svg = ; break; case 'gridicons-trophy': - svg = ; + svg = ; break; case 'gridicons-types': - svg = ; + svg = ; break; case 'gridicons-underline': - svg = ; + svg = ; break; case 'gridicons-undo': - svg = ; + svg = ; break; case 'gridicons-user-circle': - svg = ; + svg = ; break; case 'gridicons-user': - svg = ; + svg = ; break; case 'gridicons-video-camera': - svg = ; + svg = ; break; case 'gridicons-video': - svg = ; + svg = ; break; case 'gridicons-visible': - svg = ; + svg = ; break; case 'gridicons-chat': - svg = ; + svg = ; break; } diff --git a/_inc/client/components/info-popover/docs/example.jsx b/_inc/client/components/info-popover/docs/example.jsx index 0aefc46138f89..c9c2b5b378641 100644 --- a/_inc/client/components/info-popover/docs/example.jsx +++ b/_inc/client/components/info-popover/docs/example.jsx @@ -2,15 +2,15 @@ /** * External dependencies */ -var React = require( 'react' ), +let React = require( 'react' ), PureRenderMixin = require( 'react-pure-render/mixin' ); /** * Internal dependencies */ -var InfoPopover = require( 'components/info-popover' ); +const InfoPopover = require( 'components/info-popover' ); -var InfoPopoverExample = React.createClass( { +const InfoPopoverExample = React.createClass( { displayName: 'InfoPopover', mixins: [ PureRenderMixin ], diff --git a/_inc/client/components/modal/index.jsx b/_inc/client/components/modal/index.jsx index 512d50d39eaa7..00fb5dbb0df94 100644 --- a/_inc/client/components/modal/index.jsx +++ b/_inc/client/components/modal/index.jsx @@ -3,21 +3,21 @@ /* eslint-disable jsx-a11y/no-static-element-interactions */ /* eslint-disable jsx-a11y/no-noninteractive-element-interactions */ -var PropTypes = require( 'prop-types' ); -var React = require( 'react' ), +const PropTypes = require( 'prop-types' ); +let React = require( 'react' ), ReactDOM = require( 'react-dom' ), classNames = require( 'classnames' ), assign = require( 'lodash/assign' ), omit = require( 'lodash/omit' ); -var focusTrap = require( 'focus-trap' ); +const focusTrap = require( 'focus-trap' ); // this flag will prevent ANY modals from closing. // use with caution! // e.g. Modal.preventClose(); // Modal.allowClose(); // this is for important processes that must not be interrupted, e.g. payments -var preventCloseFlag = false; +let preventCloseFlag = false; require( './style.scss' ); @@ -29,11 +29,11 @@ function allowClose() { preventCloseFlag = false; } -let Modal = React.createClass( { +const Modal = React.createClass( { propTypes: { style: PropTypes.object, - width: PropTypes.oneOf( ['wide', 'medium', 'narrow'] ), + width: PropTypes.oneOf( [ 'wide', 'medium', 'narrow' ] ), className: PropTypes.string, title: PropTypes.string, initialFocus: PropTypes.string, @@ -82,7 +82,7 @@ let Modal = React.createClass( { }, maybeClose: function() { - if ( this.props.onRequestClose && !preventCloseFlag ) { + if ( this.props.onRequestClose && ! preventCloseFlag ) { this.props.onRequestClose(); } }, @@ -98,7 +98,7 @@ let Modal = React.createClass( { handleClickOverlay: function( e ) { e.preventDefault(); e.stopPropagation(); - if ( this.state.overlayMouseDown && this.props.onRequestClose && !preventCloseFlag ) { + if ( this.state.overlayMouseDown && this.props.onRequestClose && ! preventCloseFlag ) { this.setState( { overlayMouseDown: false } ); this.props.onRequestClose(); } @@ -110,10 +110,10 @@ let Modal = React.createClass( { }, render: function() { - var containerStyle, combinedStyle; + let containerStyle, combinedStyle; - var { style, className, width, title, ...other } = this.props; - var { forwardedProps } = omit( other, 'onRequestClose' ); + let { style, className, width, title, ...other } = this.props; + const { forwardedProps } = omit( other, 'onRequestClose' ); switch ( width ) { case 'wide': containerStyle = { maxWidth: 'inherit', width: 'inherit' }; @@ -127,14 +127,14 @@ let Modal = React.createClass( { combinedStyle = assign( {}, style, containerStyle ); return ( -
    -
    +
    {this.props.children}
    diff --git a/_inc/client/components/notice/notice-action.jsx b/_inc/client/components/notice/notice-action.jsx index 24355070dc918..c02e5a1ae0d05 100644 --- a/_inc/client/components/notice/notice-action.jsx +++ b/_inc/client/components/notice/notice-action.jsx @@ -39,7 +39,7 @@ export default React.createClass( { } return ( - + { this.props.children } { this.props.icon && } { this.props.external && } diff --git a/_inc/client/components/popover/menu-item.jsx b/_inc/client/components/popover/menu-item.jsx index f21a34487d531..8fcbf4ec4e272 100644 --- a/_inc/client/components/popover/menu-item.jsx +++ b/_inc/client/components/popover/menu-item.jsx @@ -1,11 +1,11 @@ /** * External dependencies */ -var React = require( 'react' ), +let React = require( 'react' ), noop = require( 'lodash/noop' ), classnames = require( 'classnames' ); -var MenuItem = React.createClass( { +const MenuItem = React.createClass( { getDefaultProps: function() { return { isVisible: false, @@ -15,7 +15,7 @@ var MenuItem = React.createClass( { }, render: function() { - var onMouseOver = this.props.focusOnHover ? this._onMouseOver : null; + const onMouseOver = this.props.focusOnHover ? this._onMouseOver : null; return (