Jforrester has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/227885

Change subject: build: Bump grunt-jscs to 2.0.0 and make pass
......................................................................

build: Bump grunt-jscs to 2.0.0 and make pass

Change-Id: Idea268b0b7df9b032a99c0ae94dff75cf2c3ac4d
---
M .jscsrc
M Gruntfile.js
M build/moduleUtils.js
M build/tasks/buildloader.js
M demos/trigger/trigger.js
M package.json
M src/ve.BranchNode.js
7 files changed, 37 insertions(+), 29 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/VisualEditor/VisualEditor 
refs/changes/85/227885/1

diff --git a/.jscsrc b/.jscsrc
index 9d22e3f..e11d3be 100644
--- a/.jscsrc
+++ b/.jscsrc
@@ -1,3 +1,10 @@
 {
-       "preset": "wikimedia"
+       "preset": "wikimedia",
+
+       "checkAnnotations": {
+               "preset": "JSDuck5",
+               "extra": {
+                       "source": true
+               }
+       }
 }
diff --git a/Gruntfile.js b/Gruntfile.js
index 1364179..41ce873 100644
--- a/Gruntfile.js
+++ b/Gruntfile.js
@@ -34,10 +34,10 @@
                                files = grunt.file.expand( 
'demos/ve/pages/*.html' );
                        files.forEach( function ( file ) {
                                var matches = file.match( 
/^.*(pages\/(.+).html)$/ ),
-                                       path = matches[1],
-                                       name = matches[2];
+                                       path = matches[ 1 ],
+                                       name = matches[ 2 ];
 
-                               pages[name] = path;
+                               pages[ name ] = path;
                        } );
                        return pages;
                } )();
@@ -72,11 +72,11 @@
                        // HACK: Ideally these libraries would provide their 
own distribution files (T95667)
                        'jquery.i18n': {
                                dest: 'dist/lib/jquery.i18n.js',
-                               src: modules['jquery.i18n'].scripts
+                               src: modules[ 'jquery.i18n' ].scripts
                        },
                        'jquery.uls.data': {
                                dest: 'dist/lib/jquery.uls.data.js',
-                               src: modules['jquery.uls.data'].scripts
+                               src: modules[ 'jquery.uls.data' ].scripts
                        }
                },
                cssjanus: {
@@ -240,6 +240,7 @@
                        },
                        all: [
                                '*.js',
+                               '{.jsduck,build,demos,src,tests}/*.js',
                                '{.jsduck,build,demos,src,tests}/**/*.js'
                        ]
                },
diff --git a/build/moduleUtils.js b/build/moduleUtils.js
index f42701d..4c604a5 100644
--- a/build/moduleUtils.js
+++ b/build/moduleUtils.js
@@ -122,15 +122,15 @@
                list = list || [];
 
                for ( i = 0; i < load.length; i++ ) {
-                       module = load[i];
+                       module = load[ i ];
 
                        if ( !modules.hasOwnProperty( module ) ) {
                                throw new Error( 'Dependency ' + module + ' not 
found' );
                        }
 
                        // Add in any dependencies
-                       if ( modules[module].hasOwnProperty( 'dependencies' ) ) 
{
-                               self.buildDependencyList( modules, 
modules[module].dependencies, list );
+                       if ( modules[ module ].hasOwnProperty( 'dependencies' ) 
) {
+                               self.buildDependencyList( modules, modules[ 
module ].dependencies, list );
                        }
 
                        // Append target load module to the end of the current 
list
diff --git a/build/tasks/buildloader.js b/build/tasks/buildloader.js
index b306801..5ebcb1b 100644
--- a/build/tasks/buildloader.js
+++ b/build/tasks/buildloader.js
@@ -81,22 +81,22 @@
                        var module, moduleStyles, moduleScripts, dependency, 
dependencies;
                        dependencies = moduleUtils.buildDependencyList( 
modules, load );
                        for ( dependency in dependencies ) {
-                               module = dependencies[dependency];
+                               module = dependencies[ dependency ];
                                if ( loadedModules.indexOf( module ) > -1 ) {
                                        continue;
                                }
                                loadedModules.push( module );
-                               if ( modules[module].scripts ) {
-                                       moduleScripts = modules[module].scripts
+                               if ( modules[ module ].scripts ) {
+                                       moduleScripts = modules[ module 
].scripts
                                                .map( expand ).filter( 
filter.bind( this, 'scripts' ) ).map( scriptTag )
                                                .join( '\n' );
                                        if ( moduleScripts ) {
                                                scripts.push( indent + '<!-- ' 
+ module + ' -->\n' + moduleScripts );
                                        }
                                }
-                               if ( modules[module].styles ) {
-                                       moduleStyles = modules[module].styles
-                                               .map( expand ).filter( 
filter.bind( this, 'styles' ) ).map( styleTag.bind( styleTag, 
modules[module].styleGroup ) )
+                               if ( modules[ module ].styles ) {
+                                       moduleStyles = modules[ module ].styles
+                                               .map( expand ).filter( 
filter.bind( this, 'styles' ) ).map( styleTag.bind( styleTag, modules[ module 
].styleGroup ) )
                                                .join( '\n' );
                                        if ( moduleStyles ) {
                                                styles.push( indent + '<!-- ' + 
module + ' -->\n' + moduleStyles );
@@ -145,7 +145,7 @@
                grunt.util.async.forEachSeries(
                        Object.keys( placeholders ),
                        function ( id, next ) {
-                               placeholder( text, id.toUpperCase(), 
placeholders[id], function ( newText ) {
+                               placeholder( text, id.toUpperCase(), 
placeholders[ id ], function ( newText ) {
                                        text = newText;
                                        next();
                                } );
diff --git a/demos/trigger/trigger.js b/demos/trigger/trigger.js
index db562fa..807c0bc 100644
--- a/demos/trigger/trigger.js
+++ b/demos/trigger/trigger.js
@@ -10,7 +10,7 @@
        parts = trigger.split( '+' );
        $( '#trigger' ).text( trigger );
        for ( i = 0, len = parts.length; i < len; i++ ) {
-               key = parts[i].replace( '\\', '\\\\' ).replace( '"', '\\"' );
+               key = parts[ i ].replace( '\\', '\\\\' ).replace( '"', '\\"' );
                $( '.key[rel="' + key + '"]' ).addClass( 'active' );
        }
 }
@@ -29,8 +29,8 @@
        $modifiers.append(
                $( '<li>' ).append(
                        $( '<span class="key"></span>' )
-                               .text( modifierKeys[i] )
-                               .attr( 'rel', modifierKeys[i] )
+                               .text( modifierKeys[ i ] )
+                               .attr( 'rel', modifierKeys[ i ] )
                )
        );
 }
@@ -38,8 +38,8 @@
        $primary.append(
                $( '<li>' ).append(
                        $( '<span class="key"></span>' )
-                               .text( primaryKeys[i] )
-                               .attr( 'rel', primaryKeys[i] )
+                               .text( primaryKeys[ i ] )
+                               .attr( 'rel', primaryKeys[ i ] )
                )
        );
 }
@@ -48,7 +48,7 @@
                $( '<li>' )
                        .append( $( '<span class="key alias"></span>' ).text( 
key ) )
                        .append( '⇢' )
-                       .append( $( '<span class="key"></span>' ).text( 
keyAliases[key] ) )
+                       .append( $( '<span class="key"></span>' ).text( 
keyAliases[ key ] ) )
        );
 }
 
diff --git a/package.json b/package.json
index 3985c50..069448a 100644
--- a/package.json
+++ b/package.json
@@ -31,7 +31,7 @@
     "grunt-contrib-watch": "0.6.1",
     "grunt-css-url-embed": "1.6.1",
     "grunt-cssjanus": "0.2.4",
-    "grunt-jscs": "1.8.0",
+    "grunt-jscs": "2.0.0",
     "grunt-karma": "0.12.0",
     "karma": "0.13.3",
     "karma-chrome-launcher": "0.2.0",
diff --git a/src/ve.BranchNode.js b/src/ve.BranchNode.js
index 9ffbbfb..e4377d8 100644
--- a/src/ve.BranchNode.js
+++ b/src/ve.BranchNode.js
@@ -40,9 +40,9 @@
                children = node.getChildren();
 
        for ( i = 0, len = children.length; i < len; i++ ) {
-               callback.call( this, children[i] );
-               if ( children[i] instanceof ve.ce.BranchNode ) {
-                       this.traverse( children[i], callback );
+               callback.call( this, children[ i ] );
+               if ( children[ i ] instanceof ve.ce.BranchNode ) {
+                       this.traverse( children[ i ], callback );
                }
        }
 };
@@ -94,7 +94,7 @@
        }
        this.root = root;
        for ( var i = 0; i < this.children.length; i++ ) {
-               this.children[i].setRoot( root );
+               this.children[ i ].setRoot( root );
        }
 };
 
@@ -112,7 +112,7 @@
        }
        this.doc = doc;
        for ( var i = 0; i < this.children.length; i++ ) {
-               this.children[i].setDocument( doc );
+               this.children[ i ].setDocument( doc );
        }
 };
 
@@ -138,7 +138,7 @@
                var i, length, nodeLength, childNode,
                        nodeOffset = 0;
                for ( i = 0, length = this.children.length; i < length; i++ ) {
-                       childNode = this.children[i];
+                       childNode = this.children[ i ];
                        if ( offset === nodeOffset ) {
                                // The requested offset is right before 
childNode,
                                // so it's not inside any of this's children, 
but inside this

-- 
To view, visit https://gerrit.wikimedia.org/r/227885
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Idea268b0b7df9b032a99c0ae94dff75cf2c3ac4d
Gerrit-PatchSet: 1
Gerrit-Project: VisualEditor/VisualEditor
Gerrit-Branch: master
Gerrit-Owner: Jforrester <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to