From b23124b7deb7e804c0d3c74b82e855219e21eb10 Mon Sep 17 00:00:00 2001 From: nssw Date: Sat, 6 Aug 2016 14:08:00 +0200 Subject: [PATCH 1/2] Remove eslint rule, lives in eslint-config-wpcalypso Remove the rule, as it is already set to error in the config Calypso depends on --- .eslintrc.js | 1 - 1 file changed, 1 deletion(-) diff --git a/.eslintrc.js b/.eslintrc.js index 1db5fe8cb14b2d..f1ffd57a16e35f 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -44,7 +44,6 @@ module.exports = { 'no-unreachable': 1, // Allows Chai `expect` expressions 'no-unused-expressions': 0, - 'no-unused-vars': 1, 'no-var': 1, 'object-curly-spacing': [ 1, 'always' ], 'operator-linebreak': [ 1, 'after', { overrides: { From 0a9b73edeac9feb5adb30910a2bcc7f4748d93da Mon Sep 17 00:00:00 2001 From: nssw Date: Sat, 6 Aug 2016 12:26:24 +0200 Subject: [PATCH 2/2] Fix no-unused-vars issues --- client/blocks/reader-full-post/index.jsx | 2 +- client/blocks/reader-related-card/index.jsx | 17 ++------- client/blocks/site/index.jsx | 3 -- client/boot/index.js | 1 - client/components/chart/bar.jsx | 13 +++---- .../email-verification-gate.jsx | 1 - client/components/search/test/index.jsx | 1 - client/components/seo-preview-pane/index.jsx | 8 ++-- .../contact-form/dialog/field-list.jsx | 3 +- .../plugins/insert-menu/menu-items.jsx | 8 ---- .../tinymce/plugins/wpcom-view/plugin.js | 3 +- client/components/token-field/index.jsx | 2 +- client/components/token-field/test/index.jsx | 8 ++-- client/devdocs/controller.js | 6 +-- client/devdocs/main.jsx | 3 +- client/lib/accept/test/index.js | 1 - client/lib/analytics/index.js | 5 ++- client/lib/design-preview/index.js | 2 +- client/lib/domains/nameservers/index.js | 1 - client/lib/human-date/index.js | 1 - client/lib/menu-data/menu-data.js | 1 - client/lib/perfmon/index.js | 27 +++++++------- client/lib/plugins/wporg-data/actions.js | 4 +- client/lib/posts/post-edit-store.js | 2 - client/lib/products-list/index.js | 1 - client/lib/purchases/test/index.js | 1 - client/lib/query-manager/paginated/index.js | 1 - client/lib/reader-lists/actions.js | 3 -- client/lib/service-worker/service-worker.js | 6 +-- client/lib/sites-list/list.js | 10 ++--- client/lib/states-list/index.js | 3 +- client/lib/stats/stats-list/stats-parser.js | 12 ------ client/lib/wp/localization/test/index.js | 2 +- client/lib/wpcom-undocumented/lib/site.js | 3 +- client/me/billing-history/receipt.jsx | 4 +- client/me/purchases/manage-purchase/index.jsx | 2 +- .../payment/edit-card-details/index.jsx | 1 - client/my-sites/customize/actions.js | 1 - client/my-sites/customize/main.jsx | 11 +++--- .../exporter/guided-transfer-card/index.jsx | 2 - client/my-sites/menus/menu.jsx | 1 - client/my-sites/pages/controller.js | 3 +- client/my-sites/pages/page-list.jsx | 27 ++++++-------- client/my-sites/plugins-wpcom/index.jsx | 2 +- .../plugins-wpcom/standard-plugins-panel.jsx | 1 - .../my-sites/plugins/plugins-list/index.jsx | 7 ++-- client/my-sites/posts/post-list.jsx | 7 +--- .../sharing/connections/service-action.jsx | 2 - client/my-sites/sharing/controller.js | 1 - .../site-settings/section-discussion.jsx | 9 ++--- .../site-settings/start-over/index.jsx | 13 +++---- client/my-sites/sites/sites.jsx | 1 - .../stats/stats-download-csv/index.jsx | 2 +- client/my-sites/upgrades/controller.jsx | 1 - .../dns/delete-email-forwards-dialog.jsx | 23 ++++++------ .../domain-management/dns/dns-add-new.jsx | 3 ++ .../email-forwarding-details.jsx | 4 +- .../upgrades/domain-search/domain-search.jsx | 2 - client/notifications/index.jsx | 37 +++++++++---------- .../editor-ground-control/test/index.jsx | 6 ++- .../reader/comments/post-comment-content.jsx | 1 - client/reader/daily-post/test/index.jsx | 1 - .../reader/following-edit/sort-controls.jsx | 2 - client/reader/full-post/main.jsx | 3 +- .../description-edit/index.jsx | 3 -- client/reader/post-byline/test/index.jsx | 2 +- client/state/analytics/test/middleware.js | 3 +- client/state/comments/test/utils.js | 6 +-- client/state/jetpack-connect/reducer.js | 1 - client/state/notices/test/reducer.js | 1 - client/state/plans/test/fixture.js | 2 - client/state/posts/selectors.js | 1 - client/state/reader/posts/reducer.js | 2 - .../ui/editor/contact-form/test/reducer.js | 4 -- client/vip/controller.js | 3 +- server/bundler/utils.js | 6 +-- 76 files changed, 133 insertions(+), 246 deletions(-) diff --git a/client/blocks/reader-full-post/index.jsx b/client/blocks/reader-full-post/index.jsx index 3c37265bf04db2..1e12a2e4015fb8 100644 --- a/client/blocks/reader-full-post/index.jsx +++ b/client/blocks/reader-full-post/index.jsx @@ -232,7 +232,7 @@ export class FullPostFluxContainer extends React.Component { } export default connect( - state => { + state => { // eslint-disable-line no-unused-vars return { }; }, dispatch => { diff --git a/client/blocks/reader-related-card/index.jsx b/client/blocks/reader-related-card/index.jsx index 637f6ad1b8cadd..2aa13076cf948f 100644 --- a/client/blocks/reader-related-card/index.jsx +++ b/client/blocks/reader-related-card/index.jsx @@ -15,22 +15,13 @@ import safeImageUrl from 'lib/safe-image-url'; import resizeImageUrl from 'lib/resize-image-url'; import AuthorAndSite from 'blocks/reader-author-and-site'; -export function SmallPostCard( { translate, post, site, onPostClick = noop, onSiteClick = noop } ) { +/* eslint-disable no-unused-vars */ +export function SmallPostCard( { post, site, onPostClick = noop, onSiteClick = noop } ) { +// onSiteClick is not being used +/* eslint-enable no-unused-vars */ const classes = classnames( 'reader-related-card', { 'has-image': post.canonical_image } ); - const displayName = post.author.name; - const siteName = site && site.title || post.site_name; - - const username = ( - - { displayName } - - ); - - const sitename = ( - { siteName } - ); const thumbnailUrl = post.canonical_image && resizeImageUrl( safeImageUrl( post.canonical_image.uri ), { resize: '96,72' } ); diff --git a/client/blocks/site/index.jsx b/client/blocks/site/index.jsx index dc8de4c53843eb..ccf64f3b1a5ea8 100644 --- a/client/blocks/site/index.jsx +++ b/client/blocks/site/index.jsx @@ -12,14 +12,11 @@ import SiteIcon from 'components/site-icon'; import Gridicon from 'components/gridicon'; import SiteIndicator from 'my-sites/site-indicator'; import { getCustomizeUrl } from 'my-sites/themes/helpers'; -import sitesList from 'lib/sites-list'; import { userCan } from 'lib/site/utils'; import Tooltip from 'components/tooltip'; import ExternalLink from 'components/external-link'; import analytics from 'lib/analytics'; -const sites = sitesList(); - export default React.createClass( { displayName: 'Site', diff --git a/client/boot/index.js b/client/boot/index.js index 335bc00162fd18..4f6279301dbea9 100644 --- a/client/boot/index.js +++ b/client/boot/index.js @@ -25,7 +25,6 @@ var React = require( 'react' ), // lib/local-storage must be run before lib/user var config = require( 'config' ), abtestModule = require( 'lib/abtest' ), - abtest = abtestModule.abtest, getSavedVariations = abtestModule.getSavedVariations, switchLocale = require( 'lib/i18n-utils/switch-locale' ), analytics = require( 'lib/analytics' ), diff --git a/client/components/chart/bar.jsx b/client/components/chart/bar.jsx index c218e6a63e5ac5..e7fe319faa9105 100644 --- a/client/components/chart/bar.jsx +++ b/client/components/chart/bar.jsx @@ -3,14 +3,12 @@ */ var React = require( 'react' ), classNames = require( 'classnames' ), - noop = require( 'lodash/noop' ), debug = require( 'debug' )( 'calypso:module-chart:bar' ); /** * Internal dependencies */ -var Popover = require( 'components/popover' ), - Tooltip = require( 'components/tooltip' ), +var Tooltip = require( 'components/tooltip' ), Gridicon = require( 'components/gridicon' ); module.exports = React.createClass( { @@ -141,8 +139,7 @@ module.exports = React.createClass( { var barStyle, barClass, - count = this.props.count || 1, - tooltip; + count = this.props.count || 1; barClass = { chart__bar: true }; @@ -155,10 +152,10 @@ module.exports = React.createClass( { }; return ( -
{ this.buildSections() }
@@ -168,4 +165,4 @@ module.exports = React.createClass( {
); } -} ); \ No newline at end of file +} ); diff --git a/client/components/email-verification/email-verification-gate.jsx b/client/components/email-verification/email-verification-gate.jsx index 323184a99dd6c1..8a23b77ec132b7 100644 --- a/client/components/email-verification/email-verification-gate.jsx +++ b/client/components/email-verification/email-verification-gate.jsx @@ -11,7 +11,6 @@ import EmailUnverifiedNotice from './email-unverified-notice.jsx'; import userUtils from 'lib/user/utils'; import sitesFactory from 'lib/sites-list'; import userFactory from 'lib/user'; -import config from 'config'; const sites = sitesFactory(); const user = userFactory(); diff --git a/client/components/search/test/index.jsx b/client/components/search/test/index.jsx index ddd4162d6a5757..baa0d255bc8a13 100644 --- a/client/components/search/test/index.jsx +++ b/client/components/search/test/index.jsx @@ -5,7 +5,6 @@ import { expect } from 'chai'; import sinon from 'sinon'; import useMockery from 'test/helpers/use-mockery'; import useFakeDom from 'test/helpers/use-fake-dom'; -import noop from 'lodash/noop'; describe( 'Search', function() { var React, TestUtils, EMPTY_COMPONENT; diff --git a/client/components/seo-preview-pane/index.jsx b/client/components/seo-preview-pane/index.jsx index c1175c5f24267d..9be922ea6c091f 100644 --- a/client/components/seo-preview-pane/index.jsx +++ b/client/components/seo-preview-pane/index.jsx @@ -3,7 +3,7 @@ /** * External dependencies */ -import React, { PropTypes } from 'react'; +import React from 'react'; import PureComponent from 'react-pure-render/component'; import { connect } from 'react-redux'; import { localize } from 'i18n-calypso'; @@ -207,10 +207,8 @@ export class SeoPreviewPane extends PureComponent {

{ translate( - `Below you'll find previews that ` + - `represent how your post will look ` + - `when it's found or shared across a ` + - `variety of networks.` + "Below you'll find previews that represent how your post will look " + + "when it's found or shared across a variety of networks." ) }

diff --git a/client/components/tinymce/plugins/contact-form/dialog/field-list.jsx b/client/components/tinymce/plugins/contact-form/dialog/field-list.jsx index 654ecfdc90fbd7..44747f0393c418 100644 --- a/client/components/tinymce/plugins/contact-form/dialog/field-list.jsx +++ b/client/components/tinymce/plugins/contact-form/dialog/field-list.jsx @@ -24,7 +24,6 @@ export default React.createClass( { return (
{ this.props.fields.map( ( field, index ) => { - const { label, type, options, required } = field; return ( + isCompact={ true } />; } } ); diff --git a/client/components/tinymce/plugins/insert-menu/menu-items.jsx b/client/components/tinymce/plugins/insert-menu/menu-items.jsx index 7a7f8327bc15ac..0dff1e63d58870 100644 --- a/client/components/tinymce/plugins/insert-menu/menu-items.jsx +++ b/client/components/tinymce/plugins/insert-menu/menu-items.jsx @@ -1,7 +1,6 @@ import React from 'react'; import Gridicon from 'components/gridicon'; -import SocialLogo from 'components/social-logo'; import i18n from 'i18n-calypso'; const GridiconButton = ( { icon, label } ) => ( @@ -11,13 +10,6 @@ const GridiconButton = ( { icon, label } ) => (
); -const SocialLogoButton = ( { icon, label } ) => ( -
- - { label } -
-); - export default [ { name: 'insert_media_item', diff --git a/client/components/tinymce/plugins/wpcom-view/plugin.js b/client/components/tinymce/plugins/wpcom-view/plugin.js index ae01048694695b..bcf289c0c0ffbb 100644 --- a/client/components/tinymce/plugins/wpcom-view/plugin.js +++ b/client/components/tinymce/plugins/wpcom-view/plugin.js @@ -271,8 +271,7 @@ function wpview( editor ) { // matching view patterns, and transform the matches into // view wrappers. editor.on( 'BeforeSetContent', function( event ) { - var site = sites.getSelectedSite(), - node; + var node; if ( ! event.selection ) { $( '.wpview-wrap .wpview-body' ).each( function( i, viewBody ) { diff --git a/client/components/token-field/index.jsx b/client/components/token-field/index.jsx index 1133f4359f565f..b82abaac3286c7 100644 --- a/client/components/token-field/index.jsx +++ b/client/components/token-field/index.jsx @@ -195,7 +195,7 @@ var TokenField = React.createClass( { } }, - _onBlur: function( event ) { + _onBlur: function( event ) { // eslint-disable-line no-unused-vars if ( this._inputHasValidValue() ) { debug( '_onBlur adding current token' ); this.setState( { isActive: false }, this._addCurrentToken ); diff --git a/client/components/token-field/test/index.jsx b/client/components/token-field/test/index.jsx index def19dd6e9d263..e71898be99461f 100644 --- a/client/components/token-field/test/index.jsx +++ b/client/components/token-field/test/index.jsx @@ -296,7 +296,7 @@ describe( 'TokenField', function() { expect( wrapper.state( 'tokens' ) ).to.deep.equal( [ 'foo', 'bar', 'baz' ] ); } ); - function testOnBlur( initialText, selectSuggestion, expectedSuggestion, expectedTokens, clock ) { + function testOnBlur( initialText, selectSuggestion, expectedSuggestion, expectedTokens ) { setText( initialText ); if ( selectSuggestion ) { sendKeyDown( keyCodes.downArrow ); // 'the' @@ -323,8 +323,7 @@ describe( 'TokenField', function() { 't', // initialText false, // selectSuggestion null, // expectedSuggestion - [ 'foo', 'bar', 't' ], // expectedTokens - this.clock + [ 'foo', 'bar', 't' ] // expectedTokens ); } ) ); @@ -333,8 +332,7 @@ describe( 'TokenField', function() { 't', // initialText true, // selectSuggestion [ 't', 'o' ], // expectedSuggestion - [ 'foo', 'bar', 'to' ], // expectedTokens - this.clock + [ 'foo', 'bar', 'to' ] // expectedTokens ); } ) ); diff --git a/client/devdocs/controller.js b/client/devdocs/controller.js index a29ce974cd2181..c2b9ef56caa671 100644 --- a/client/devdocs/controller.js +++ b/client/devdocs/controller.js @@ -84,7 +84,7 @@ const devdocs = { React.createElement( SingleDocComponent, { path: context.params.path, term: context.query.term, - sectionId: Object.keys( context.hash )[0] + sectionId: Object.keys( context.hash )[ 0 ] } ), document.getElementById( 'primary' ) ); @@ -132,7 +132,7 @@ const devdocs = { ); }, - pleaseLogIn: function( context ) { + pleaseLogIn: function( context ) { // eslint-disable-line no-unused-vars const currentUrl = url.parse( location.href ); const redirectUrl = currentUrl.protocol + '//' + currentUrl.host + '/devdocs/welcome'; @@ -153,7 +153,7 @@ const devdocs = { }, // Welcome screen - welcome: function( context ) { + welcome: function( context ) { // eslint-disable-line no-unused-vars ReactDom.render( React.createElement( DevWelcome, {} ), document.getElementById( 'primary' ) diff --git a/client/devdocs/main.jsx b/client/devdocs/main.jsx index 2efa5d6273ef3d..b4e4d96d26f4e9 100644 --- a/client/devdocs/main.jsx +++ b/client/devdocs/main.jsx @@ -2,8 +2,7 @@ * External dependencies */ var React = require( 'react' ), - isFunction = require( 'lodash/isFunction' ), - classNames = require( 'classnames' ); + isFunction = require( 'lodash/isFunction' ); /** * Internal dependencies diff --git a/client/lib/accept/test/index.js b/client/lib/accept/test/index.js index b25bae2088d9cc..39366fd14069a2 100644 --- a/client/lib/accept/test/index.js +++ b/client/lib/accept/test/index.js @@ -3,7 +3,6 @@ */ import { expect } from 'chai'; import mockery from 'mockery'; -import noop from 'lodash/noop'; /** * Internal dependencies diff --git a/client/lib/analytics/index.js b/client/lib/analytics/index.js index 78d52b7f458980..fde5012355053e 100644 --- a/client/lib/analytics/index.js +++ b/client/lib/analytics/index.js @@ -194,8 +194,11 @@ var analytics = { }, statsd: { + /* eslint-disable no-unused-vars */ recordTiming: function( pageUrl, eventType, duration, triggerName ) { - // ignore triggerName for now, it has no obvious place in statsd + // ignore triggerName for now, it has no obvious place in statsd + /* eslint-enable no-unused-vars */ + if ( config( 'boom_analytics_enabled' ) ) { var featureSlug = pageUrl === '/' ? 'homepage' : pageUrl.replace(/^\//, '').replace(/\.|\/|:/g, '_'); var matched; diff --git a/client/lib/design-preview/index.js b/client/lib/design-preview/index.js index c8d47d16635398..85c4c2a79af857 100644 --- a/client/lib/design-preview/index.js +++ b/client/lib/design-preview/index.js @@ -1,3 +1,3 @@ -export function updatePreviewWithChanges( previewDocument, customizations ) { +export function updatePreviewWithChanges( previewDocument, customizations ) { // eslint-disable-line no-unused-vars // Update the preview here } diff --git a/client/lib/domains/nameservers/index.js b/client/lib/domains/nameservers/index.js index 9b24c377373e92..159185d84dbed6 100644 --- a/client/lib/domains/nameservers/index.js +++ b/client/lib/domains/nameservers/index.js @@ -3,7 +3,6 @@ */ import update from 'react-addons-update'; import reject from 'lodash/reject'; -import constant from 'lodash/constant'; import every from 'lodash/every'; const WPCOM_DEFAULTS = [ diff --git a/client/lib/human-date/index.js b/client/lib/human-date/index.js index 18d1e0974aba88..8eac74f7bb47e9 100644 --- a/client/lib/human-date/index.js +++ b/client/lib/human-date/index.js @@ -14,7 +14,6 @@ module.exports = function humanDate( dateOrMoment ) { } if ( millisAgo < MILLIS_IN_MINUTE ) { - let seconds = Math.ceil( millisAgo / 1000 ); return i18n.translate( 'just now' ); } diff --git a/client/lib/menu-data/menu-data.js b/client/lib/menu-data/menu-data.js index c9f121c2de5cb0..0181087801bf83 100644 --- a/client/lib/menu-data/menu-data.js +++ b/client/lib/menu-data/menu-data.js @@ -11,7 +11,6 @@ import cloneDeep from 'lodash/cloneDeep'; import cloneDeepWith from 'lodash/cloneDeepWith'; import findIndex from 'lodash/findIndex'; import iteratee from 'lodash/iteratee'; -import isArray from 'lodash/isArray'; import i18n from 'i18n-calypso'; /** diff --git a/client/lib/perfmon/index.js b/client/lib/perfmon/index.js index 62889de0b2ccb5..b3e91aa71e28ce 100644 --- a/client/lib/perfmon/index.js +++ b/client/lib/perfmon/index.js @@ -1,4 +1,4 @@ -/** +/** * Internal dependencies */ import analytics from 'lib/analytics'; @@ -47,8 +47,7 @@ function observeDomChanges( MutationObserver ) { } ); // this is fired for matching mutations (childList and class attr changes) - var observer = new MutationObserver(function(mutations, observer) { - + var observer = new MutationObserver( function( mutations ) { // record all the nodes that match our placeholder classes in the "activePlaceholders" array mutations.forEach( recordPlaceholders ); @@ -56,8 +55,8 @@ function observeDomChanges( MutationObserver ) { // check each node for: // a. whether it's still in the DOM at all, and if so: // b. whether it still has a placeholder class - var removed = remove( activePlaceholders, function( node ) { - return !OBSERVE_ROOT.contains( node ) || !isPlaceholder( node ); + remove( activePlaceholders, function( node ) { + return ! OBSERVE_ROOT.contains( node ) || ! isPlaceholder( node ); } ); checkForVisiblePlaceholders( 'mutation' ); @@ -77,10 +76,10 @@ function observeDomChanges( MutationObserver ) { // has navigated function checkForVisiblePlaceholders( trigger ) { // determine how many placeholders are active in the viewport - const visibleCount = activePlaceholders.reduce( - function( count, node ) { - return count + ( isElementVisibleInViewport( node ) ? 1 : 0 ); - }, 0 + const visibleCount = activePlaceholders.reduce( + function( count, node ) { + return count + ( isElementVisibleInViewport( node ) ? 1 : 0 ); + }, 0 ); // record event and reset timer if all placeholders are loaded OR user has just navigated @@ -106,12 +105,12 @@ function checkForVisiblePlaceholders( trigger ) { function isPlaceholder( node ) { var className = node.className; - return className && className.indexOf - && PLACEHOLDER_CLASSES.some( function( clazz ) { - return (className.indexOf( clazz ) >= 0); + return className && className.indexOf + && PLACEHOLDER_CLASSES.some( function( clazz ) { + return (className.indexOf( clazz ) >= 0); } ) && !EXCLUDE_PLACEHOLDER_CLASSES.some( function( clazz ) { - return (className.indexOf( clazz ) >= 0); + return (className.indexOf( clazz ) >= 0); } ); } @@ -135,7 +134,7 @@ function isElementVisibleInViewport( node ) { ); } -function recordPlaceholders( mutation ) { +function recordPlaceholders( mutation ) { var nodes = []; if ( mutation.attributeName === 'class' ) { // mutation.type === 'attributes' is redundant diff --git a/client/lib/plugins/wporg-data/actions.js b/client/lib/plugins/wporg-data/actions.js index 15b542a787892f..87a2218aeca355 100644 --- a/client/lib/plugins/wporg-data/actions.js +++ b/client/lib/plugins/wporg-data/actions.js @@ -20,8 +20,7 @@ var _LIST_DEFAULT_SIZE = 24, /** * Local variables; */ -var _fetching = {}, - _fetchingLists = {}, +var _fetchingLists = {}, _currentSearchTerm = null, _lastFetchedPagePerCategory = {}, _totalPagesPerCategory = {}; @@ -100,7 +99,6 @@ var PluginsDataActions = { }, reset: function() { - _fetching = {}; _fetchingLists = {}; _lastFetchedPagePerCategory = {}; _totalPagesPerCategory = {}; diff --git a/client/lib/posts/post-edit-store.js b/client/lib/posts/post-edit-store.js index a1e4d19c389e2c..b4afb79e84e49e 100644 --- a/client/lib/posts/post-edit-store.js +++ b/client/lib/posts/post-edit-store.js @@ -10,8 +10,6 @@ var assign = require( 'lodash/assign' ), without = require( 'lodash/without' ), map = require( 'lodash/map' ), pickBy = require( 'lodash/pickBy' ); -import mapValues from 'lodash/mapValues'; -import omit from 'lodash/omit'; /** * Internal dependencies diff --git a/client/lib/products-list/index.js b/client/lib/products-list/index.js index d2f4f477bb3b76..66e3e0821925e2 100644 --- a/client/lib/products-list/index.js +++ b/client/lib/products-list/index.js @@ -2,7 +2,6 @@ * External dependencies */ var debug = require( 'debug' )( 'calypso:ProductsList' ), - omit = require( 'lodash/omit' ), store = require( 'store' ); /** diff --git a/client/lib/purchases/test/index.js b/client/lib/purchases/test/index.js index a57dbd90a60780..3ac9fe1b36958b 100644 --- a/client/lib/purchases/test/index.js +++ b/client/lib/purchases/test/index.js @@ -9,7 +9,6 @@ import { expect } from 'chai'; import { DOMAIN_PURCHASE, DOMAIN_PURCHASE_EXPIRED, - DOMAIN_PURCHASE_CANCELATION_PERIOD_EXPIRED, DOMAIN_PURCHASE_INCLUDED_IN_PLAN, DOMAIN_MAPPING_PURCHASE, DOMAIN_MAPPING_PURCHASE_EXPIRED, diff --git a/client/lib/query-manager/paginated/index.js b/client/lib/query-manager/paginated/index.js index e6714451099e09..ee6bb190374e4b 100644 --- a/client/lib/query-manager/paginated/index.js +++ b/client/lib/query-manager/paginated/index.js @@ -2,7 +2,6 @@ * External dependencies */ import omit from 'lodash/omit'; -import isEqual from 'lodash/isEqual'; import cloneDeep from 'lodash/cloneDeep'; import range from 'lodash/range'; import includes from 'lodash/includes'; diff --git a/client/lib/reader-lists/actions.js b/client/lib/reader-lists/actions.js index e7bedc02803564..bb581716c4ce69 100644 --- a/client/lib/reader-lists/actions.js +++ b/client/lib/reader-lists/actions.js @@ -1,15 +1,12 @@ // External dependencies import Dispatcher from 'dispatcher'; import wpcom from 'lib/wp'; -import debugModule from 'debug'; // Internal dependencies import ReaderListsStore from 'lib/reader-lists/lists'; import ReaderListsSubscriptionsStore from 'lib/reader-lists/subscriptions'; import { action as actionTypes } from './constants'; -const debug = debugModule( 'calypso:reader:list-management' ); - var fetchingLists = {}; const ReaderListActions = { diff --git a/client/lib/service-worker/service-worker.js b/client/lib/service-worker/service-worker.js index 94b0cd8129fa8b..448168d2a412b9 100644 --- a/client/lib/service-worker/service-worker.js +++ b/client/lib/service-worker/service-worker.js @@ -37,9 +37,9 @@ self.addEventListener( 'push', function( event ) { icon: notification.icon, timestamp: notification.note_timestamp, data: notification - } ).then( function () { + } ).then( function() { if ( notification.note_opened_pixel ) { - fetch( notification.note_opened_pixel, { mode: 'no-cors' } ).catch( function( err ) { + fetch( notification.note_opened_pixel, { mode: 'no-cors' } ).catch( function( err ) { // eslint-disable-line no-unused-vars console.log( 'Could not load the pixel %s', notification.note_opened_pixel ); } ); } @@ -55,7 +55,7 @@ self.addEventListener( 'notificationclick', function( event ) { self.clients.matchAll().then( function( clientList ) { if ( clientList.length > 0 ) { clientList[ 0 ].postMessage( { action: 'openPanel' } ); - clientList[ 0 ].postMessage( { action: 'trackClick', notification: notification.data } ); + clientList[ 0 ].postMessage( { action: 'trackClick', notification: notification.data } ); try { clientList[ 0 ].focus(); } catch ( err ) { diff --git a/client/lib/sites-list/list.js b/client/lib/sites-list/list.js index 7557afb4c951e5..b2e0f76216d01a 100644 --- a/client/lib/sites-list/list.js +++ b/client/lib/sites-list/list.js @@ -110,7 +110,7 @@ SitesList.prototype.sync = function( data ) { } } store.set( 'SitesList', sites ); -} +}; /** * Initialize data with Site objects @@ -189,8 +189,7 @@ SitesList.prototype.parse = function( data ) { **/ SitesList.prototype.update = function( sites ) { var sitesMap = {}, - changed = false, - oldSelected = this.getSelectedSite(); + changed = false; // Create ID -> site map from existing data this.data.forEach( function( site ) { @@ -291,7 +290,6 @@ SitesList.prototype.propagateChange = function() { */ SitesList.prototype.getNetworkSites = function( multisite ) { return this.get().filter( function( site ) { - return site.jetpack && site.visible && ( this.isConnectedSecondaryNetworkSite( site ) || site.isMainNetworkSite() ) && @@ -426,7 +424,7 @@ SitesList.prototype.getRecentlySelected = function() { this.recentlySelected.forEach( function( id, index ) { sites[ index ] = this.get().filter( function( site ) { return id === site.ID; - }, this )[0]; + }, this )[ 0 ]; }, this ); // remove undefined sites @@ -557,7 +555,7 @@ SitesList.prototype.getSelectedOrAllWithPlugins = function() { return site.capabilities && site.capabilities.manage_options && site.jetpack && - ( site.visible || this.selected ) + ( site.visible || this.selected ); } ); }; diff --git a/client/lib/states-list/index.js b/client/lib/states-list/index.js index 9a5dd34003583c..7387c19be349ba 100644 --- a/client/lib/states-list/index.js +++ b/client/lib/states-list/index.js @@ -4,7 +4,6 @@ var debug = require( 'debug' )( 'calypso:StatesList' ), inherits = require( 'inherits' ), isEmpty = require( 'lodash/isEmpty' ), - reject = require( 'lodash/reject' ), store = require( 'store' ); /** @@ -98,7 +97,7 @@ StatesList.prototype.getByCountry = function( countryCode ) { } this.fetchForCountry( countryCode ); - } else if ( ! (countryCode in this.data) ) { + } else if ( ! ( countryCode in this.data ) ) { this.fetchForCountry( countryCode ); } diff --git a/client/lib/stats/stats-list/stats-parser.js b/client/lib/stats/stats-list/stats-parser.js index 4afdbaff9b01ea..404ea984fc1d6d 100644 --- a/client/lib/stats/stats-list/stats-parser.js +++ b/client/lib/stats/stats-list/stats-parser.js @@ -635,7 +635,6 @@ StatsParser.prototype.statsTopPosts = function( payload ) { response.data = payload.days[ startDate ].postviews.map( function( item ) { var detailPage = '/stats/post/' + item.id + '/' + this.options.domain, postDate, - children, inPeriod = false; if ( item.date ) { @@ -649,17 +648,6 @@ StatsParser.prototype.statsTopPosts = function( payload ) { } } - if ( item.children ) { - children = item.children.map( function( child ) { - return { - label: child.title, - value: child.views, - link: child.link, - labelIcon: 'attachment' - }; - } ); - } - return { label: item.title, value: item.views, diff --git a/client/lib/wp/localization/test/index.js b/client/lib/wp/localization/test/index.js index 15ae190421ea72..188d62f7a1765f 100644 --- a/client/lib/wp/localization/test/index.js +++ b/client/lib/wp/localization/test/index.js @@ -11,7 +11,7 @@ import sinon from 'sinon'; import useMockery from 'test/helpers/use-mockery'; describe( 'index', () => { - let getCurrentUserLocaleMock, localization, addLocaleQueryParam, + let getCurrentUserLocaleMock, addLocaleQueryParam, injectLocalization, bindState, setLocale, getLocale; useMockery(); diff --git a/client/lib/wpcom-undocumented/lib/site.js b/client/lib/wpcom-undocumented/lib/site.js index bc61062972a9ea..5ad1519e7247e5 100644 --- a/client/lib/wpcom-undocumented/lib/site.js +++ b/client/lib/wpcom-undocumented/lib/site.js @@ -6,8 +6,7 @@ var debug = require( 'debug' )( 'calypso:wpcom-undocumented:site' ); /** * Internal dependencies. */ -var Export = require( './export' ), - i18n = require( 'lib/i18n-utils' ); +var Export = require( './export' ); /** * Resources array diff --git a/client/me/billing-history/receipt.jsx b/client/me/billing-history/receipt.jsx index 9004f0ddbab08e..8603f5d0672be7 100644 --- a/client/me/billing-history/receipt.jsx +++ b/client/me/billing-history/receipt.jsx @@ -1,9 +1,7 @@ /** * External dependencies */ -var React = require( 'react' ), - defer = require( 'lodash/defer' ), - titleCase = require( 'to-title-case' ); +var React = require( 'react' ); /** * Internal dependencies diff --git a/client/me/purchases/manage-purchase/index.jsx b/client/me/purchases/manage-purchase/index.jsx index d1588903e92d2e..94c25ae709e639 100644 --- a/client/me/purchases/manage-purchase/index.jsx +++ b/client/me/purchases/manage-purchase/index.jsx @@ -198,7 +198,7 @@ const ManagePurchase = React.createClass( { renderCreditCardExpiringNotice() { const purchase = getPurchase( this.props ), - { id, payment: { creditCard } } = purchase; + { payment: { creditCard } } = purchase; if ( isExpired( purchase ) || isOneTimePurchase( purchase ) || isIncludedWithPlan( purchase ) || ! getSelectedSite( this.props ) ) { return null; diff --git a/client/me/purchases/payment/edit-card-details/index.jsx b/client/me/purchases/payment/edit-card-details/index.jsx index 5a4392cd172da0..b3c46be94a0edb 100644 --- a/client/me/purchases/payment/edit-card-details/index.jsx +++ b/client/me/purchases/payment/edit-card-details/index.jsx @@ -1,7 +1,6 @@ /** * External Dependencies */ -import assign from 'lodash/assign'; import { connect } from 'react-redux'; import page from 'page'; import React from 'react'; diff --git a/client/my-sites/customize/actions.js b/client/my-sites/customize/actions.js index 3967efddbedae8..988c777e2014b4 100644 --- a/client/my-sites/customize/actions.js +++ b/client/my-sites/customize/actions.js @@ -8,7 +8,6 @@ import defer from 'lodash/defer'; */ import Dispatcher from 'dispatcher'; import page from 'page'; -import wpcom from 'lib/wp'; import { addItem } from 'lib/upgrades/actions/cart'; import { trackClick } from '../themes/helpers'; import { themeItem } from 'lib/cart-values/cart-items'; diff --git a/client/my-sites/customize/main.jsx b/client/my-sites/customize/main.jsx index 847c3c88f993e5..4173839be0d2a3 100644 --- a/client/my-sites/customize/main.jsx +++ b/client/my-sites/customize/main.jsx @@ -14,7 +14,6 @@ var React = require( 'react' ), */ var notices = require( 'notices' ), page = require( 'page' ), - config = require( 'config' ), CustomizerLoadingPanel = require( 'my-sites/customize/loading-panel' ), EmptyContent = require( 'components/empty-content' ), SidebarNavigation = require( 'my-sites/sidebar-navigation' ), @@ -156,7 +155,7 @@ var Customize = React.createClass( { query.calypso = true; query.calypsoOrigin = protocol + '//' + host; if ( site.options && site.options.frame_nonce ) { - query['frame-nonce'] = site.options.frame_nonce; + query[ 'frame-nonce' ] = site.options.frame_nonce; } // autofocus panels @@ -195,7 +194,7 @@ var Customize = React.createClass( { return; } // Ensure we have a string that's JSON.parse-able - if ( typeof event.data !== 'string' || event.data[0] !== '{' ) { + if ( typeof event.data !== 'string' || event.data[ 0 ] !== '{' ) { debug( 'ignoring message received from iframe with bad data', event.data ); return; } @@ -229,11 +228,11 @@ var Customize = React.createClass( { this.setState( { iframeLoaded: true } ); break; case 'activated': - themeSlug = message.theme.stylesheet.split( '/' )[1]; + themeSlug = message.theme.stylesheet.split( '/' )[ 1 ]; Actions.activated( themeSlug, site, this.props.themeActivated ); break; case 'purchased': - themeSlug = message.theme.stylesheet.split( '/' )[1]; + themeSlug = message.theme.stylesheet.split( '/' )[ 1 ]; Actions.purchase( themeSlug, site ); break; } @@ -256,7 +255,7 @@ var Customize = React.createClass( { }, render: function() { - var iframeUrl ; + var iframeUrl; if ( this.state.timeoutError ) { this.cancelWaitingTimer(); diff --git a/client/my-sites/exporter/guided-transfer-card/index.jsx b/client/my-sites/exporter/guided-transfer-card/index.jsx index 682a5ba83517eb..641b28104fb8b1 100644 --- a/client/my-sites/exporter/guided-transfer-card/index.jsx +++ b/client/my-sites/exporter/guided-transfer-card/index.jsx @@ -4,7 +4,6 @@ import React, { Component } from 'react'; import { localize } from 'i18n-calypso'; import { connect } from 'react-redux'; -import page from 'page'; /** * Internal dependencies @@ -88,4 +87,3 @@ const mapStateToProps = state => ( { } ); export default connect( mapStateToProps )( localize( GuidedTransferCard ) ); - diff --git a/client/my-sites/menus/menu.jsx b/client/my-sites/menus/menu.jsx index e19682db8aef32..2f2a2d9b48363e 100644 --- a/client/my-sites/menus/menu.jsx +++ b/client/my-sites/menus/menu.jsx @@ -8,7 +8,6 @@ var React = require( 'react' ), * Internal dependencies */ var protectForm = require( 'lib/mixins/protect-form' ), - observe = require( 'lib/mixins/data-observe' ), assign = require( 'lodash/assign' ), classNames = require( 'classnames' ), MenuName = require( './menu-name' ), diff --git a/client/my-sites/pages/controller.js b/client/my-sites/pages/controller.js index 7088b57508394b..afcc8b8c009e13 100644 --- a/client/my-sites/pages/controller.js +++ b/client/my-sites/pages/controller.js @@ -1,8 +1,7 @@ /** * External Dependencies */ -var ReactDom = require( 'react-dom' ), - React = require( 'react' ), +var React = require( 'react' ), i18n = require( 'i18n-calypso' ); /** diff --git a/client/my-sites/pages/page-list.jsx b/client/my-sites/pages/page-list.jsx index 5ca4aebb2aaff9..29c7cb9778f58e 100644 --- a/client/my-sites/pages/page-list.jsx +++ b/client/my-sites/pages/page-list.jsx @@ -49,7 +49,7 @@ var PageList = React.createClass( { } } ); -var Pages = React.createClass({ +var Pages = React.createClass( { displayName: 'Pages', @@ -121,8 +121,7 @@ var Pages = React.createClass({ }, getNoContentMessage: function() { - var selectedSite = this.props.sites.getSelectedSite(), - attributes, newPageLink; + var attributes, newPageLink; if ( this.props.search ) { return { this.props.search } } - } ) } + } ) } />; } else { - newPageLink = this.props.siteID ? '/page/' + this.props.siteID : '/page'; if ( this.props.hasRecentError ) { @@ -195,10 +193,10 @@ var Pages = React.createClass({ addLoadingRows: function( rows, count ) { var i; for ( i = 0; i < count; i++ ) { - if ( i % 4 === 0) { - rows.push ( ); + if ( i % 4 === 0 ) { + rows.push( ); } - rows.push ( ); + rows.push( ); } }, @@ -227,14 +225,14 @@ var Pages = React.createClass({ pages = this._insertTimeMarkers( pages ); } rows = pages.map( function( page ) { - if ( ! ( 'site_ID' in page ) ) { - return page; - } + if ( ! ( 'site_ID' in page ) ) { + return page; + } // Get the site the page belongs to - var site = this.props.sites.getSite( page.site_ID ); + var site = this.props.sites.getSite( page.site_ID ); // Render each page - return ( + return ( ); }, this ); @@ -249,7 +247,6 @@ var Pages = React.createClass({ if ( status === 'published' && get( site, 'options.show_on_front' ) === 'posts' ) { rows.push( this.blogPostsPage() ); } - } else if ( ( ! this.props.loading ) && this.props.sites.initialized ) { rows.push(
{ this.getNoContentMessage() }
); } else { @@ -263,6 +260,6 @@ var Pages = React.createClass({ ); } -}); +} ); module.exports = PageList; diff --git a/client/my-sites/plugins-wpcom/index.jsx b/client/my-sites/plugins-wpcom/index.jsx index dd96268a93f4cd..664506db90bd20 100644 --- a/client/my-sites/plugins-wpcom/index.jsx +++ b/client/my-sites/plugins-wpcom/index.jsx @@ -1,4 +1,4 @@ -import React, { PropTypes } from 'react'; +import React from 'react'; import PluginPanel from 'my-sites/plugins-wpcom/plugin-panel'; diff --git a/client/my-sites/plugins-wpcom/standard-plugins-panel.jsx b/client/my-sites/plugins-wpcom/standard-plugins-panel.jsx index d53e10afc42d70..25913d07084552 100644 --- a/client/my-sites/plugins-wpcom/standard-plugins-panel.jsx +++ b/client/my-sites/plugins-wpcom/standard-plugins-panel.jsx @@ -25,7 +25,6 @@ export const StandardPluginsPanel = React.createClass( { plugins = [] } = this.props; - const selectPlugin = name => () => onClick( name ); const shownPlugins = plugins.slice( 0, displayCount ); return ( diff --git a/client/my-sites/plugins/plugins-list/index.jsx b/client/my-sites/plugins/plugins-list/index.jsx index d359a3e56f7614..ad4e56af390e98 100644 --- a/client/my-sites/plugins/plugins-list/index.jsx +++ b/client/my-sites/plugins/plugins-list/index.jsx @@ -9,7 +9,6 @@ import includes from 'lodash/includes'; import negate from 'lodash/negate'; import range from 'lodash/range'; import isEqual from 'lodash/isEqual'; -import map from 'lodash/map'; /** * Internal dependencies @@ -76,7 +75,7 @@ export default React.createClass( { if ( ! isEqual( this.state.selectedPlugins, nextState.selectedPlugins ) ) { return true; } - if ( this.shouldComponentUpdateNotices( this.state.notices, nextState.notices) ) { + if ( this.shouldComponentUpdateNotices( this.state.notices, nextState.notices ) ) { return true; } @@ -113,7 +112,7 @@ export default React.createClass( { setBulkSelectionState( plugins, selectionState ) { let slugsToBeUpdated = {}; - plugins.forEach( plugin => slugsToBeUpdated[ plugin.slug] = this.hasNoSitesThatCanManage( plugin ) ? false : selectionState ); + plugins.forEach( plugin => slugsToBeUpdated[ plugin.slug ] = this.hasNoSitesThatCanManage( plugin ) ? false : selectionState ); this.setState( { selectedPlugins: Object.assign( {}, this.state.selectedPlugins, slugsToBeUpdated ) } ); }, @@ -373,7 +372,7 @@ export default React.createClass( {
{ this.renderPlaceholders() }
- ) + ); } if ( isEmpty( this.props.plugins ) ) { diff --git a/client/my-sites/posts/post-list.jsx b/client/my-sites/posts/post-list.jsx index c1d5eed2eb6204..eb08fc41cb5356 100644 --- a/client/my-sites/posts/post-list.jsx +++ b/client/my-sites/posts/post-list.jsx @@ -56,7 +56,6 @@ var PostList = React.createClass( { } } ); - var Posts = React.createClass( { propTypes: { @@ -145,8 +144,7 @@ var Posts = React.createClass( { }, getNoContentMessage: function() { - var selectedSite = this.props.sites.getSelectedSite(), - attributes, newPostLink; + var attributes, newPostLink; if ( this.props.search ) { return ); - } else { if ( this.props.loading || ! this.props.sites.fetched ) { for ( i = 0; i < placeholderCount; i++ ) { diff --git a/client/my-sites/sharing/connections/service-action.jsx b/client/my-sites/sharing/connections/service-action.jsx index 70f2b214d39840..416811f185260d 100644 --- a/client/my-sites/sharing/connections/service-action.jsx +++ b/client/my-sites/sharing/connections/service-action.jsx @@ -8,8 +8,6 @@ import React from 'react'; */ import serviceConnections from './service-connections'; import Button from 'components/button'; -import Gridicon from 'components/gridicon'; -import classNames from 'classnames'; module.exports = React.createClass( { displayName: 'SharingServiceAction', diff --git a/client/my-sites/sharing/controller.js b/client/my-sites/sharing/controller.js index f3eb658bb0c83d..11e83bba7c2ba8 100644 --- a/client/my-sites/sharing/controller.js +++ b/client/my-sites/sharing/controller.js @@ -2,7 +2,6 @@ * External Dependencies */ var page = require( 'page' ), - ReactDom = require( 'react-dom' ), React = require( 'react' ), i18n = require( 'i18n-calypso' ); diff --git a/client/my-sites/site-settings/section-discussion.jsx b/client/my-sites/site-settings/section-discussion.jsx index 0ed8b6042950cd..0448f738119637 100644 --- a/client/my-sites/site-settings/section-discussion.jsx +++ b/client/my-sites/site-settings/section-discussion.jsx @@ -7,10 +7,9 @@ var React = require( 'react' ), /** * Internal dependencies */ -var Card = require( 'components/card' ), - DiscussionForm = require( 'my-sites/site-settings/form-discussion' ); +var DiscussionForm = require( 'my-sites/site-settings/form-discussion' ); -module.exports = React.createClass({ +module.exports = React.createClass( { displayName: 'SiteSettingsDiscussion', componentWillMount: function() { @@ -18,10 +17,8 @@ module.exports = React.createClass({ }, render: function() { - return ( ); - } -}); +} ); diff --git a/client/my-sites/site-settings/start-over/index.jsx b/client/my-sites/site-settings/start-over/index.jsx index d85b733fe83f02..eccf0506fc6da2 100644 --- a/client/my-sites/site-settings/start-over/index.jsx +++ b/client/my-sites/site-settings/start-over/index.jsx @@ -14,9 +14,8 @@ var HeaderCake = require( 'components/header-cake' ), ActionPanelBody = require( 'my-sites/site-settings/action-panel/body' ), ActionPanelFigure = require( 'my-sites/site-settings/action-panel/figure' ), ActionPanelFooter = require( 'my-sites/site-settings/action-panel/footer' ), - Button = require ( 'components/button' ), - Gridicon = require ( 'components/gridicon' ), - support = require('lib/url/support'); + Button = require( 'components/button' ), + support = require( 'lib/url/support' ); module.exports = React.createClass( { @@ -62,11 +61,11 @@ module.exports = React.createClass( { }

{ this.translate( 'Alternatively, you can delete all content from your site by following {{link}}the steps here{{/link}}.', - { - components: { - link: + { + components: { + link: + } } - } ) }

diff --git a/client/my-sites/sites/sites.jsx b/client/my-sites/sites/sites.jsx index 7557a42fa3b9d0..95ccfc8a12ba1c 100644 --- a/client/my-sites/sites/sites.jsx +++ b/client/my-sites/sites/sites.jsx @@ -12,7 +12,6 @@ import Main from 'components/main'; import observe from 'lib/mixins/data-observe'; import SiteSelector from 'components/site-selector'; import { addSiteFragment } from 'lib/route'; -import { preventWidows } from 'lib/formatting'; export default React.createClass( { displayName: 'Sites', diff --git a/client/my-sites/stats/stats-download-csv/index.jsx b/client/my-sites/stats/stats-download-csv/index.jsx index 80e42f869fa121..b870ccfa05f049 100644 --- a/client/my-sites/stats/stats-download-csv/index.jsx +++ b/client/my-sites/stats/stats-download-csv/index.jsx @@ -48,7 +48,7 @@ module.exports = React.createClass( { render() { try { - const isFileSaverSupported = !! new Blob(); + const isFileSaverSupported = !! new Blob(); // eslint-disable-line no-unused-vars } catch ( e ) { return null; } diff --git a/client/my-sites/upgrades/controller.jsx b/client/my-sites/upgrades/controller.jsx index 40e25ca61d29f1..6dadb0786a5d43 100644 --- a/client/my-sites/upgrades/controller.jsx +++ b/client/my-sites/upgrades/controller.jsx @@ -17,7 +17,6 @@ var analytics = require( 'lib/analytics' ), titleActions = require( 'lib/screen-title/actions' ), setSection = require( 'state/ui/actions' ).setSection, productsList = require( 'lib/products-list' )(), - abtest = require( 'lib/abtest' ).abtest, renderWithReduxStore = require( 'lib/react-helpers' ).renderWithReduxStore; module.exports = { diff --git a/client/my-sites/upgrades/domain-management/dns/delete-email-forwards-dialog.jsx b/client/my-sites/upgrades/domain-management/dns/delete-email-forwards-dialog.jsx index d8d76c0979f1e6..3e0e815f6e1de5 100644 --- a/client/my-sites/upgrades/domain-management/dns/delete-email-forwards-dialog.jsx +++ b/client/my-sites/upgrades/domain-management/dns/delete-email-forwards-dialog.jsx @@ -2,7 +2,6 @@ * External dependencies */ import React from 'react'; -import page from 'page'; /** * Internal dependencies @@ -31,17 +30,17 @@ const DeleteEmailForwardsDialog = React.createClass( { render() { const buttons = [ - { - action: 'delete', - label: this.translate( 'Deactivate Email Forwards and Remove Records' ), - isPrimary: true, - onClick: () => this.close( { shouldDeleteEmailForwards: true } ) - }, - { - action: 'keep', - label: this.translate( 'Keep Records and Email Forwards' ) - } - ]; + { + action: 'delete', + label: this.translate( 'Deactivate Email Forwards and Remove Records' ), + isPrimary: true, + onClick: () => this.close( { shouldDeleteEmailForwards: true } ) + }, + { + action: 'keep', + label: this.translate( 'Keep Records and Email Forwards' ) + } + ]; return ( { + /* eslint-enable no-unused-vars, no-shadow */ return includes( types, type ); } ); diff --git a/client/my-sites/upgrades/domain-management/email-forwarding/email-forwarding-details.jsx b/client/my-sites/upgrades/domain-management/email-forwarding/email-forwarding-details.jsx index 4e3a4e2381fc13..7e7ee9fd3b4bcc 100644 --- a/client/my-sites/upgrades/domain-management/email-forwarding/email-forwarding-details.jsx +++ b/client/my-sites/upgrades/domain-management/email-forwarding/email-forwarding-details.jsx @@ -1,8 +1,7 @@ /** * External dependencies */ -var i18n = require( 'i18n-calypso' ), - React = require( 'react' ); +var React = require( 'react' ); /** * Internal dependencies @@ -33,4 +32,3 @@ var EmailForwardingDetails = React.createClass( { } ); module.exports = EmailForwardingDetails; - diff --git a/client/my-sites/upgrades/domain-search/domain-search.jsx b/client/my-sites/upgrades/domain-search/domain-search.jsx index d704ba09f443e5..920b0e4043b238 100644 --- a/client/my-sites/upgrades/domain-search/domain-search.jsx +++ b/client/my-sites/upgrades/domain-search/domain-search.jsx @@ -23,7 +23,6 @@ var observe = require( 'lib/mixins/data-observe' ), upgradesActions = require( 'lib/upgrades/actions' ), cartItems = require( 'lib/cart-values/cart-items' ), analyticsMixin = require( 'lib/mixins/analytics' ), - { abtest } = require( 'lib/abtest' ), shouldFetchSitePlans = require( 'lib/plans' ).shouldFetchSitePlans; var DomainSearch = React.createClass( { @@ -112,7 +111,6 @@ var DomainSearch = React.createClass( { removeDomain( suggestion ) { this.recordEvent( 'removeDomainButtonClick', suggestion.domain_name ); upgradesActions.removeDomainFromCart( suggestion ); - }, render: function() { diff --git a/client/notifications/index.jsx b/client/notifications/index.jsx index 23aa009769b558..c96c04e19fc508 100644 --- a/client/notifications/index.jsx +++ b/client/notifications/index.jsx @@ -19,13 +19,13 @@ var analytics = require( 'lib/analytics' ), */ var widgetDomain = 'https://widgets.wp.com'; -var Notifications = React.createClass({ +var Notifications = React.createClass( { getInitialState: function() { return { - 'loaded' : true, - 'iframeLoaded' : false, - 'shownOnce' : false, - 'widescreen' : false + 'loaded': true, + 'iframeLoaded': false, + 'shownOnce': false, + 'widescreen': false }; }, @@ -42,18 +42,18 @@ var Notifications = React.createClass({ }, componentWillReceiveProps: function( nextProps ) { - if ( nextProps.visible && !this.state.loaded ) { - this.setState( { 'loaded' : true } ); - } else if ( !nextProps.visible && !this.state.iframeLoaded && this.state.shownOnce ) { + if ( nextProps.visible && ! this.state.loaded ) { + this.setState( { 'loaded': true } ); + } else if ( ! nextProps.visible && ! this.state.iframeLoaded && this.state.shownOnce ) { // for cases where iframe is stuck loading, this will remove it from // the DOM so we can try reloading it next time - this.setState( { 'loaded' : false } ); + this.setState( { 'loaded': false } ); } // tell the iframe if we're changing visible status if ( nextProps.visible !== this.props.visible ) { this.postMessage( { 'action': 'togglePanel', 'showing': nextProps.visible } ); - this.setState( { 'shownOnce' : true, 'widescreen': false } ); + this.setState( { 'shownOnce': true, 'widescreen': false } ); } if ( document.documentElement.classList.contains( 'touch' ) ) { @@ -128,8 +128,8 @@ var Notifications = React.createClass({ handleVisibilityChange: function() { this.postMessage( { - 'action' : 'toggleVisibility', - 'hidden' : document.hidden ? true : false + 'action': 'toggleVisibility', + 'hidden': document.hidden ? true : false } ); }, @@ -146,7 +146,7 @@ var Notifications = React.createClass({ } }, - receiveMessage: function(event) { + receiveMessage: function( event ) { // Receives messages from the notifications widget if ( event.origin !== widgetDomain ) { return; @@ -165,10 +165,9 @@ var Notifications = React.createClass({ this.props.checkToggle(); } else if ( data.action === 'render' ) { this.props.setIndicator( data.num_new ); - } else if ( data.action === 'iFrameReady' ) { // the iframe is loaded, send any pending messages - this.setState( { 'iframeLoaded' : true } ); + this.setState( { 'iframeLoaded': true } ); debug( 'notifications iframe loaded' ); // We always want this to happen, in addition to whatever may be queued @@ -178,11 +177,10 @@ var Notifications = React.createClass({ this.postMessage( this.queuedMessage ); this.queuedMessage = null; } - } else if ( data.action === 'renderAllSeen' ) { // user has seen the notes, no longer new this.props.setIndicator( 0 ); - } else if ( data.action === 'widescreen') { + } else if ( data.action === 'widescreen' ) { this.setState( { widescreen: data.widescreen } ); } else { debug( 'unknown message from iframe: %s', event.data ); @@ -196,7 +194,7 @@ var Notifications = React.createClass({ return; } - if ( !( 'action' in event.data ) ) { + if ( ! ( 'action' in event.data ) ) { return; } @@ -245,7 +243,6 @@ var Notifications = React.createClass({ var userData = user.get(), localeSlug = userData.localeSlug || config( 'i18n_default_locale_slug' ), widgetURL = widgetDomain, - divStyle = {}, frameClasses = [ 'wide' ], panelClasses = [ 'wide' ], now = new Date(); @@ -283,6 +280,6 @@ var Notifications = React.createClass({ ); } -}); +} ); module.exports = Notifications; diff --git a/client/post-editor/editor-ground-control/test/index.jsx b/client/post-editor/editor-ground-control/test/index.jsx index 80e1681d56aefd..ff326d71f1d21c 100644 --- a/client/post-editor/editor-ground-control/test/index.jsx +++ b/client/post-editor/editor-ground-control/test/index.jsx @@ -29,7 +29,9 @@ const MOCK_USER = { }; const MOCK_USER_UTILS = { - needsVerificationForSite: function ( site ) { return !MOCK_USER.email_verified; } + needsVerificationForSite: function( site ) { // eslint-disable-line no-unused-vars + return ! MOCK_USER.email_verified; + } }; describe( 'EditorGroundControl', function() { @@ -50,7 +52,7 @@ describe( 'EditorGroundControl', function() { mockery.registerMock( 'components/sticky-panel', EmptyComponent ); mockery.registerMock( 'components/post-schedule', EmptyComponent ); mockery.registerMock( 'lib/user/utils', { - needsVerificationForSite: () => !MOCK_USER.email_verified, + needsVerificationForSite: () => ! MOCK_USER.email_verified, } ); EditorGroundControl = require( '../' ); diff --git a/client/reader/comments/post-comment-content.jsx b/client/reader/comments/post-comment-content.jsx index 76c64678d8a0aa..280695980176a0 100644 --- a/client/reader/comments/post-comment-content.jsx +++ b/client/reader/comments/post-comment-content.jsx @@ -2,7 +2,6 @@ * External dependencies */ import React, { PropTypes } from 'react'; -import PureRenderMixin from 'react-pure-render/mixin'; export default class PostCommentContent extends React.Component { render() { diff --git a/client/reader/daily-post/test/index.jsx b/client/reader/daily-post/test/index.jsx index 6e9f673a0ae055..6c4b5e271b56c3 100644 --- a/client/reader/daily-post/test/index.jsx +++ b/client/reader/daily-post/test/index.jsx @@ -13,7 +13,6 @@ import noop from 'lodash/noop'; */ import useMockery from 'test/helpers/use-mockery'; import { sites, dailyPromptPost } from './fixtures'; -import Button from 'components/button'; describe( 'DailyPostButton', () => { const SitesPopover = props => ; diff --git a/client/reader/following-edit/sort-controls.jsx b/client/reader/following-edit/sort-controls.jsx index 19c3742f9ead5f..addee6fe4f3337 100644 --- a/client/reader/following-edit/sort-controls.jsx +++ b/client/reader/following-edit/sort-controls.jsx @@ -2,13 +2,11 @@ * External dependencies */ import React from 'react'; -import debugModule from 'debug'; import noop from 'lodash/noop'; /** * Module variables */ -//const debug = debugModule( 'calypso:reader:following-edit:sort' ); const FollowingEditSortControls = React.createClass( { diff --git a/client/reader/full-post/main.jsx b/client/reader/full-post/main.jsx index 21357370949bef..41a1d02428d273 100644 --- a/client/reader/full-post/main.jsx +++ b/client/reader/full-post/main.jsx @@ -17,8 +17,7 @@ var ReactDom = require( 'react-dom' ), /** * Internal Dependencies */ -var abtest = require( 'lib/abtest' ).abtest, - config = require( 'config' ), +var config = require( 'config' ), CommentButton = require( 'blocks/comment-button' ), Dialog = require( 'components/dialog' ), DISPLAY_TYPES = require( 'lib/feed-post-store/display-types' ), diff --git a/client/reader/list-management/description-edit/index.jsx b/client/reader/list-management/description-edit/index.jsx index e56d3000842f66..1f7bbd1958db59 100644 --- a/client/reader/list-management/description-edit/index.jsx +++ b/client/reader/list-management/description-edit/index.jsx @@ -2,7 +2,6 @@ import React from 'react'; import { connect } from 'react-redux'; import { bindActionCreators } from 'redux'; -import debugModule from 'debug'; // Internal dependencies import Card from 'components/card'; @@ -18,8 +17,6 @@ import { updateListDetails, dismissListNotice, updateTitle, updateDescription } import { isUpdatedList, hasError } from 'state/reader/lists/selectors'; import protectForm from 'lib/mixins/protect-form'; -const debug = debugModule( 'calypso:reader:list-management' ); - const ListManagementDescriptionEdit = React.createClass( { mixins: [ protectForm.mixin ], diff --git a/client/reader/post-byline/test/index.jsx b/client/reader/post-byline/test/index.jsx index 1865f640f0270a..c18bb9b3390972 100644 --- a/client/reader/post-byline/test/index.jsx +++ b/client/reader/post-byline/test/index.jsx @@ -5,7 +5,7 @@ import React from 'react'; import { shallow } from 'enzyme'; import { assert } from 'chai'; import { spy } from 'sinon'; -import { each, partial, omit } from 'lodash'; +import { each, omit } from 'lodash'; /** * Internal dependencies diff --git a/client/state/analytics/test/middleware.js b/client/state/analytics/test/middleware.js index ced163c251da61..6bb8d29aa17f51 100644 --- a/client/state/analytics/test/middleware.js +++ b/client/state/analytics/test/middleware.js @@ -1,4 +1,3 @@ -import React from 'react'; import { expect } from 'chai'; import { spy } from 'sinon'; @@ -64,7 +63,7 @@ describe( 'middleware', () => { } ); it( 'should call analytics events with wrapped actions', () => { - dispatch( withAnalytics( bumpStat( 'name', 'value' ), { type: 'TEST_ACTION'} ) ); + dispatch( withAnalytics( bumpStat( 'name', 'value' ), { type: 'TEST_ACTION' } ) ); expect( mock ).to.have.been.calledWith( 'mc.bumpStat' ); } ); diff --git a/client/state/comments/test/utils.js b/client/state/comments/test/utils.js index 576f760b4cbe01..f45db3c009122c 100644 --- a/client/state/comments/test/utils.js +++ b/client/state/comments/test/utils.js @@ -1,7 +1,7 @@ /** * External dependencies */ -import Chai, { expect } from 'chai' +import { expect } from 'chai'; import Immutable from 'immutable'; /** @@ -49,7 +49,7 @@ describe( 'utils', () => { expect( Immutable.Map.isMap( parent ) ).to.equal( true ); expect( Immutable.List.isList( parent.get( 'children' ) ) ).to.equal( true ); expect( firstChildOfParentId ).to.be.a.number; - expect( actualFirstChildOfParent.getIn( ['data', 'ID'] ) ).to.equal( 9 ); + expect( actualFirstChildOfParent.getIn( [ 'data', 'ID' ] ) ).to.equal( 9 ); expect( commentsTreeForPost.getIn( [ 9, 'children' ] ).size ).to.equal( 2 ); expect( commentsTreeForPost.getIn( [ 9, 'children', 0 ] ) ).to.equal( 11 ); @@ -70,7 +70,7 @@ describe( 'utils', () => { { ID: 8, parent: false, text: 'eight', date: '2016-01-28T10:17:18-08:00' }, { ID: 7, parent: false, text: 'seven', date: '2016-01-28T10:08:18-08:00' }, { ID: 6, parent: false, text: 'six', date: '2016-01-28T10:07:18-08:00' } - ] ) + ] ) ); // traverse the comments tree recursively and validate all the dates are in correct order diff --git a/client/state/jetpack-connect/reducer.js b/client/state/jetpack-connect/reducer.js index aba16d20019f83..09cea1186e86cd 100644 --- a/client/state/jetpack-connect/reducer.js +++ b/client/state/jetpack-connect/reducer.js @@ -4,7 +4,6 @@ import isEmpty from 'lodash/isEmpty'; import omit from 'lodash/omit'; import { combineReducers } from 'redux'; -import urlModule from 'url'; /** * Internal dependencies diff --git a/client/state/notices/test/reducer.js b/client/state/notices/test/reducer.js index 3cbbda6ccfb5e1..d09c4fe7774bdb 100644 --- a/client/state/notices/test/reducer.js +++ b/client/state/notices/test/reducer.js @@ -10,7 +10,6 @@ import deepFreeze from 'deep-freeze'; import { NOTICE_CREATE, NOTICE_REMOVE, - POST_SAVE_SUCCESS, ROUTE_SET } from 'state/action-types'; import { items } from '../reducer'; diff --git a/client/state/plans/test/fixture.js b/client/state/plans/test/fixture.js index a6c30e04850e21..1ce508349222cb 100644 --- a/client/state/plans/test/fixture.js +++ b/client/state/plans/test/fixture.js @@ -8,8 +8,6 @@ import { PLANS_REQUEST_FAILURE } from 'state/action-types'; -import { getValidDataFromResponse } from '../actions'; - // WP REST-API error response export const ERROR_MESSAGE_RESPONSE = 'There was a problem fetching plans. Please try again later or contact support.'; diff --git a/client/state/posts/selectors.js b/client/state/posts/selectors.js index aeff946f4ffdad..145777cd659890 100644 --- a/client/state/posts/selectors.js +++ b/client/state/posts/selectors.js @@ -3,7 +3,6 @@ */ import get from 'lodash/get'; import createSelector from 'lib/create-selector'; -import find from 'lodash/find'; import includes from 'lodash/includes'; import some from 'lodash/some'; import omit from 'lodash/omit'; diff --git a/client/state/reader/posts/reducer.js b/client/state/reader/posts/reducer.js index 2e75ebfe238625..db0809fdcdd7ae 100644 --- a/client/state/reader/posts/reducer.js +++ b/client/state/reader/posts/reducer.js @@ -3,8 +3,6 @@ */ import { combineReducers } from 'redux'; import keyBy from 'lodash/keyBy'; -import omitBy from 'lodash/omitBy'; -import isUndefined from 'lodash/isUndefined'; /** * Internal dependencies diff --git a/client/state/ui/editor/contact-form/test/reducer.js b/client/state/ui/editor/contact-form/test/reducer.js index 72ba01ab46d218..5fccba62e5fe68 100644 --- a/client/state/ui/editor/contact-form/test/reducer.js +++ b/client/state/ui/editor/contact-form/test/reducer.js @@ -3,12 +3,10 @@ */ import { assert } from 'chai'; import deepFreeze from 'deep-freeze'; -import mockery from 'mockery'; /** * Internal dependencies */ -import useMockery from 'test/helpers/use-mockery'; import { CONTACT_FORM_DEFAULT, CONTACT_FORM_FIELD_TYPES } from '../constants'; import { EDITOR_CONTACT_FORM_CLEAR, @@ -22,8 +20,6 @@ import { describe( 'editor\'s contact form state reducer', () => { let reducer; - useMockery(); - before( () => { reducer = require( '../reducer' ); } ); diff --git a/client/vip/controller.js b/client/vip/controller.js index 9d641af01d958f..36ed9e55eef2c6 100644 --- a/client/vip/controller.js +++ b/client/vip/controller.js @@ -1,8 +1,7 @@ /** * External Dependencies */ -var ReactDom = require( 'react-dom' ), - React = require( 'react' ), +var React = require( 'react' ), i18n = require( 'i18n-calypso' ), page = require( 'page' ); diff --git a/server/bundler/utils.js b/server/bundler/utils.js index 0c00a244eaf9a3..c7536b2e3259e1 100644 --- a/server/bundler/utils.js +++ b/server/bundler/utils.js @@ -1,12 +1,10 @@ -var path = require( 'path' ); - function getAssets( stats ) { var chunks = stats.chunks; return chunks.map( function( chunk ) { - var filename = chunk.files[0]; + var filename = chunk.files[ 0 ]; return { - name: chunk.names[0], + name: chunk.names[ 0 ], hash: chunk.hash, file: filename, url: stats.publicPath + filename,