Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix no-unused-vars issues #7315

Merged
merged 2 commits into from
Aug 17, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -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: {
Expand Down
2 changes: 1 addition & 1 deletion client/blocks/reader-full-post/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ export class FullPostFluxContainer extends React.Component {
}

export default connect(
state => {
state => { // eslint-disable-line no-unused-vars
return { };
},
dispatch => {
Expand Down
17 changes: 4 additions & 13 deletions client/blocks/reader-related-card/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -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 = (
<span className="reader-related-card__author">
<a href={ `/read/blogs/${post.site_ID}` } onClick={ partial( onSiteClick, site, post ) }>{ displayName }</a>
</span>
);

const sitename = ( <span className="reader-related-card__site-title">
<a href={ `/read/blogs/${post.site_ID}` } onClick={ partial( onSiteClick, site, post ) }>{ siteName }</a>
</span> );

const thumbnailUrl = post.canonical_image && resizeImageUrl( safeImageUrl( post.canonical_image.uri ), { resize: '96,72' } );

Expand Down
3 changes: 0 additions & 3 deletions client/blocks/site/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -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',

Expand Down
1 change: 0 additions & 1 deletion client/boot/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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' ),
Expand Down
13 changes: 5 additions & 8 deletions client/components/chart/bar.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -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( {
Expand Down Expand Up @@ -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 };

Expand All @@ -155,10 +152,10 @@ module.exports = React.createClass( {
};

return (
<div onClick={ this.clickHandler }
<div onClick={ this.clickHandler }
onMouseEnter={ this.mouseEnter }
onMouseLeave={ this.mouseLeave }
className={ classNames( barClass ) }
className={ classNames( barClass ) }
style={ barStyle }>
{ this.buildSections() }
<div className="chart__bar-marker is-hundred"></div>
Expand All @@ -168,4 +165,4 @@ module.exports = React.createClass( {
</div>
);
}
} );
} );
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
1 change: 0 additions & 1 deletion client/components/search/test/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
8 changes: 3 additions & 5 deletions client/components/seo-preview-pane/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -207,10 +207,8 @@ export class SeoPreviewPane extends PureComponent {
</h1>
<p className="seo-preview-pane__description">
{ 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."
) }
</p>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ export default React.createClass( {
return (
<div className="editor-contact-form-modal-fields">
{ this.props.fields.map( ( field, index ) => {
const { label, type, options, required } = field;
return (
<Field
key={ index }
Expand All @@ -42,6 +41,6 @@ export default React.createClass( {
line={ this.translate( 'An empty form is no fun! Go ahead and add some fields!' ) }
action={ this.translate( 'Add New Field' ) }
actionCallback={ this.props.onFieldAdd }
isCompact={ true } />
isCompact={ true } />;
}
} );
8 changes: 0 additions & 8 deletions client/components/tinymce/plugins/insert-menu/menu-items.jsx
Original file line number Diff line number Diff line change
@@ -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 } ) => (
Expand All @@ -11,13 +10,6 @@ const GridiconButton = ( { icon, label } ) => (
</div>
);

const SocialLogoButton = ( { icon, label } ) => (
<div>
<SocialLogo className="wpcom-insert-menu__menu-icon" icon={ icon } />
<span className="wpcom-insert-menu__menu-label">{ label }</span>
</div>
);

export default [
{
name: 'insert_media_item',
Expand Down
3 changes: 1 addition & 2 deletions client/components/tinymce/plugins/wpcom-view/plugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 ) {
Expand Down
2 changes: 1 addition & 1 deletion client/components/token-field/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ var TokenField = React.createClass( {
}
},

_onBlur: function( event ) {
_onBlur: function( event ) { // eslint-disable-line no-unused-vars
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need the exception here? Is removing the argument a problem?

Copy link
Author

@ghost ghost Aug 12, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, it is not a problem. Removing the argument was another possibility. See #7315 (comment)

if ( this._inputHasValidValue() ) {
debug( '_onBlur adding current token' );
this.setState( { isActive: false }, this._addCurrentToken );
Expand Down
8 changes: 3 additions & 5 deletions client/components/token-field/test/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand All @@ -323,8 +323,7 @@ describe( 'TokenField', function() {
't', // initialText
false, // selectSuggestion
null, // expectedSuggestion
[ 'foo', 'bar', 't' ], // expectedTokens
this.clock
[ 'foo', 'bar', 't' ] // expectedTokens
);
} ) );

Expand All @@ -333,8 +332,7 @@ describe( 'TokenField', function() {
't', // initialText
true, // selectSuggestion
[ 't', 'o' ], // expectedSuggestion
[ 'foo', 'bar', 'to' ], // expectedTokens
this.clock
[ 'foo', 'bar', 'to' ] // expectedTokens
);
} ) );

Expand Down
6 changes: 3 additions & 3 deletions client/devdocs/controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -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' )
);
Expand Down Expand Up @@ -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';

Expand All @@ -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' )
Expand Down
3 changes: 1 addition & 2 deletions client/devdocs/main.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@
* External dependencies
*/
var React = require( 'react' ),
isFunction = require( 'lodash/isFunction' ),
classNames = require( 'classnames' );
isFunction = require( 'lodash/isFunction' );

/**
* Internal dependencies
Expand Down
1 change: 0 additions & 1 deletion client/lib/accept/test/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
*/
import { expect } from 'chai';
import mockery from 'mockery';
import noop from 'lodash/noop';

/**
* Internal dependencies
Expand Down
5 changes: 4 additions & 1 deletion client/lib/analytics/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion client/lib/design-preview/index.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
export function updatePreviewWithChanges( previewDocument, customizations ) {
export function updatePreviewWithChanges( previewDocument, customizations ) { // eslint-disable-line no-unused-vars
// Update the preview here
}
1 change: 0 additions & 1 deletion client/lib/domains/nameservers/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 = [
Expand Down
1 change: 0 additions & 1 deletion client/lib/human-date/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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' );
}

Expand Down
1 change: 0 additions & 1 deletion client/lib/menu-data/menu-data.js
Original file line number Diff line number Diff line change
Expand Up @@ -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';

/**
Expand Down
27 changes: 13 additions & 14 deletions client/lib/perfmon/index.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/**
/**
* Internal dependencies
*/
import analytics from 'lib/analytics';
Expand Down Expand Up @@ -47,17 +47,16 @@ 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 );

// remove any nodes from activePlaceholders that are no longer placeholders
// 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' );
Expand All @@ -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
Expand All @@ -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);
} );
}

Expand All @@ -135,7 +134,7 @@ function isElementVisibleInViewport( node ) {
);
}

function recordPlaceholders( mutation ) {
function recordPlaceholders( mutation ) {
var nodes = [];

if ( mutation.attributeName === 'class' ) { // mutation.type === 'attributes' is redundant
Expand Down
Loading