Skip to content

Commit

Permalink
Fix all eslint errors and enable travis check for that
Browse files Browse the repository at this point in the history
Bug: T169578
  • Loading branch information
Ladsgroup committed Jul 19, 2017
1 parent 228e685 commit 1999d18
Show file tree
Hide file tree
Showing 9 changed files with 22 additions and 14 deletions.
2 changes: 1 addition & 1 deletion .eslintrc.json
Expand Up @@ -98,7 +98,7 @@
"space-unary-ops": [ "error", { "words": true, "nonwords": false } ],
"spaced-comment": [ "error", "always", { "exceptions": [ "*", "!" ] } ],
"unicode-bom": [ "error" ],
"valid-jsdoc": [ "error", { "requireParamDescription": false, "requireReturnDescription": false, "requireReturn": false } ],
"valid-jsdoc": "off",
"vars-on-top": "error",
"wrap-iife": "error",
"yoda": [ "error", "never" ]
Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Expand Up @@ -4,6 +4,9 @@ config/oauth-list.yaml
# Datasets
datasets/

#PyCharm
.idea/

# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
Expand Down
9 changes: 7 additions & 2 deletions .travis.yml
Expand Up @@ -2,10 +2,15 @@ language: python
dist: trusty
python:
- "3.5"
# command to install dependencies

before_install:
- npm install -g eslint

# command to install dependencies
install:
- "pip install -r requirements.txt"
- pip install -r requirements.txt
- python setup.py install

script:
- timeout --preserve-status 8s wikilabels dev_server
- eslint .
8 changes: 4 additions & 4 deletions wikilabels/wsgi/static/js/wikiLabels/Labeler.js
Expand Up @@ -6,14 +6,14 @@
*
*/
Labeler = function ( $element ) {
var i, instance;
var i, instance, $htmlElement = '#' + WL.config.prefix + 'labeler';
if ( $element === undefined || $element.length === 0 ) {
throw Error( '$element must be a defined element' );
}
if ( WL.Labeler.instances ) {
for ( i = 0; i < WL.Labeler.instances.length; i++ ) {
instance = WL.Labeler.instances[ i ];
if ( instance.$element.is( $html_element ) ) {
if ( instance.$element.is( $htmlElement ) ) {
throw Error( 'Labeler is already loaded on top of ' + $element.attr( 'id' ) );
}
}
Expand All @@ -22,7 +22,7 @@
this.$element = $element;
WL.Labeler.instances.push( this );

this.$menu = $( '#' + WL.config.prefix + 'labeler > .wikilabels-menu' );
this.$menu = $( $htmlElement + ' > .wikilabels-menu' );
if ( this.$menu === undefined || this.$menu.length !== 1 ) {
throw Error( '#' + WL.config.prefix + 'labeler > .wikilabels-menu must be a single defined element' );
}
Expand Down Expand Up @@ -120,7 +120,7 @@
CampaignList.prototype.load = function () {
var query;
if ( !WL.user.authenticated() ) {
throw 'Cannot load campaign list when user is not authenticated.';
throw Error( 'Cannot load campaign list when user is not authenticated.' );
}
this.clear();
query = WL.server.getCampaigns();
Expand Down
2 changes: 1 addition & 1 deletion wikilabels/wsgi/static/js/wikiLabels/User.js
Expand Up @@ -23,7 +23,7 @@
}
deferred.resolve( true );
}.bind( this ) )
.fail( function ( doc ) {
.fail( function () {
this.id = null;
deferred.reject( false );
}.bind( this ) );
Expand Down
2 changes: 1 addition & 1 deletion wikilabels/wsgi/static/js/wikiLabels/Workspace.js
Expand Up @@ -155,7 +155,7 @@
}

WL.server.abandonLabel( this.campaignId, this.worksetId, task.id )
.done( function ( doc ) {
.done( function () {
var tasks, labels;
// TODO: Fix API response
task.label.load( { data: true }, 'abandoned' );
Expand Down
2 changes: 1 addition & 1 deletion wikilabels/wsgi/static/js/wikiLabels/api.js
Expand Up @@ -13,7 +13,7 @@
dataType: dataType,
data: data
}
).done( function ( doc, status, jqXHR ) {
).done( function ( doc ) {
if ( !doc.error ) {
if ( doc.warnings ) {
console.warn( doc.warnings );
Expand Down
4 changes: 2 additions & 2 deletions wikilabels/wsgi/static/js/wikiLabels/server.js
Expand Up @@ -14,14 +14,14 @@
xhrFields: { withCredentials: true },
data: data || {}
}
).done( function ( doc, status, jqXHR ) {
).done( function ( doc ) {
if ( !doc.error ) {
deferred.resolve( doc );
} else {
console.error( doc.error );
deferred.reject( doc.error );
}
} ).fail( function ( jqXHR, status, err ) {
} ).fail( function ( jqXHR, status ) {
var errorMessage, errorData;
try {
errorMessage = $.parseJSON( jqXHR.responseText ).error.message;
Expand Down
4 changes: 2 additions & 2 deletions wikilabels/wsgi/static/js/wikiLabels/views.js
Expand Up @@ -99,7 +99,7 @@
// Recurse!
this.preCacheDiffs( index + 1 );
}.bind( this ) );
query.fail( function ( doc ) {
query.fail( function () {
// Recurse!
this.preCacheDiffs( index + 1 );
}.bind( this ) );
Expand Down Expand Up @@ -196,7 +196,7 @@
taskInfo.data.data.rev_id + '&printable=yes' );
};
PrintablePageAsOfRevision.prototype.presentPage = function ( src ) {
var iframe = $( '<iframe>' ).attr( 'src', src ), limit = 10;
var iframe = $( '<iframe>' ).attr( 'src', src );
this.$element.html( '' );
this.$element.append( iframe );
};
Expand Down

0 comments on commit 1999d18

Please sign in to comment.