Krinkle has uploaded a new change for review.

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

Change subject: build: Upgrade jscs and jshint
......................................................................

build: Upgrade jscs and jshint

See also If46b94ce18a7084cf in oojs/core.

jshint:
* Update to grunt-contrib-jshint v0.10.0 (jshint v2.5.0).
* Remove coding style option "noempty" (already covered by jscs).
* Remove option "regexp".
* Enable new option "freeze" (prohibits changing native prototypes).
  http://www.jshint.com/blog/new-in-jshint-oct-2013/#option-freeze
* Re-order to match http://www.jshint.com/docs/options/

jscs:
* Update to grunt-contrib-jshint v0.4.2 (jscs v1.4.0).
* Format .jscsrc file in a more spaceious way and order the
  properties less arbitrarily (using the jscs's readme order).
* Enforce more details of our coding style:
  - requireCurlyBraces: Add more keywords that should have their
    code block wrapped in curly braces.
  - requireSpaceAfterKeywords: Add more keywords that should have
    a space after them.
  - requireMultipleVarDecl: Enable the new "onevar" checker
    (like jshint's "onevar"). Introduced in jscs v1.4.0.
  - disallowTrailingComma: Enable.
  - disallowKeywordsOnNewLine: Enable for "else".
  - requireSpaceBeforeBlockStatements: Enable.
  - requireBlocksOnNewline: Enable, but only when more than 1
    statement (this still will validate shorthand like the
    following, which we make use of at the moment):

    var noop = function () { return true; };

  - requireSpacesInFunctionExpression: Remove, this is already
    covered by requireSpaceAfterKeywords and requireSpaceBeforeBlockStatements,
    which enforce:

    x.noop = function () {};
    x.Foo = function Foo() {};

  - disallowSpacesInNamedFunctionExpression: Enable for the parenthesis.
    Disallows:

    x.Foo = function Foo () {};

  - disallowSpacesInFunctionDeclaration: Enable for parenthesis.
    Disallows:

    function noop () {}

  - disallowDanglingUnderscores: Enable (like jshint's "nomen").
  - disallowSpaceAfterPrefixUnaryOperators: Add "!" back, now that the
    bug where it conflicts with requireRightStickedOperators is fixed.
    https://github.com/mdevils/node-jscs/issues/87
  - disallowMixedSpacesAndTabs: Enable.
  - disallowYodaConditions: Enable.
  - disallowRightStickedOperators: Remove, this is obsolete with
    requireSpace{Before,After}BinaryOperators and fixes a bug
    where the following would be considered invalid when it shouldn't:

    +!!constructor.static.matchFunction
    // Operator + should not stick to following expression

    This is a false positive due to the tricky nature of
    disallowRightStickedOperators and for that reason this rule
    has been deprecated and scheduled for removal in jscs 2.0.0

Change-Id: Iccf3b461b8d01023dd698771183b0ad5816993b1
---
M .jscsrc
M .jshintrc
M Gruntfile.js
M modules/ve/dm/nodes/ve.dm.ImageNode.js
M modules/ve/dm/ve.dm.Model.js
M modules/ve/init/ve.init.DebugBar.js
M modules/ve/test/ce/ve.ce.Surface.test.js
M modules/ve/test/dm/lineardata/ve.dm.FlatLinearData.test.js
M modules/ve/test/dm/ve.dm.Document.test.js
M modules/ve/test/dm/ve.dm.example.js
M modules/ve/ui/widgets/ve.ui.LanguageInputWidget.js
M package.json
12 files changed, 88 insertions(+), 47 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/VisualEditor/VisualEditor 
refs/changes/70/133270/1

diff --git a/.jscsrc b/.jscsrc
index 5ddc1a5..5411724 100644
--- a/.jscsrc
+++ b/.jscsrc
@@ -1,33 +1,94 @@
 {
-       "requireCurlyBraces": ["if", "else", "for", "while", "do"],
-       "requireSpaceAfterKeywords": ["if", "else", "for", "while", "do", 
"switch", "return", "function"],
+       "requireCurlyBraces": [
+               "if",
+               "else",
+               "for",
+               "while",
+               "do",
+               "try",
+               "catch"
+       ],
+       "requireSpaceAfterKeywords": [
+               "if",
+               "else",
+               "for",
+               "while",
+               "do",
+               "switch",
+               "return",
+               "try",
+               "catch",
+               "function"
+       ],
+       "requireSpaceBeforeBlockStatements": true,
        "requireParenthesesAroundIIFE": true,
-       "requireSpacesInFunctionExpression": {
-               "beforeOpeningCurlyBrace": true
+       "disallowSpacesInNamedFunctionExpression": {
+               "beforeOpeningRoundBrace": true
        },
-       "requireMultipleVarDecl": true,
+       "disallowSpacesInFunctionDeclaration": {
+               "beforeOpeningRoundBrace": true
+       },
+       "requireMultipleVarDecl": "onevar",
+       "requireBlocksOnNewline": 1,
        "disallowEmptyBlocks": true,
        "requireSpacesInsideObjectBrackets": "all",
        "disallowDanglingUnderscores": true,
        "disallowSpaceAfterObjectKeys": true,
        "requireCommaBeforeLineBreak": true,
-       "disallowLeftStickedOperators": ["?", "+", "/", "*", "-", "=", "==", 
"===", "!=", "!==", ">", ">=", "<", "<="],
-       "disallowRightStickedOperators": ["?", "/", "*", ":", "=", "==", "===", 
"!=", "!==", ">", ">=", "<", "<="],
+       "disallowLeftStickedOperators": [
+               "?",
+               ">",
+               ">=",
+               "<",
+               "<="
+       ],
        "requireRightStickedOperators": ["!"],
        "requireLeftStickedOperators": [","],
-       "disallowSpaceAfterPrefixUnaryOperators": ["++", "--", "+", "-", "~"],
-       "disallowSpaceBeforePostfixUnaryOperators": ["++", "--"],
-       "requireSpaceBeforeBinaryOperators": ["+", "-", "/", "*", "=", "==", 
"===", "!=", "!=="],
-       "requireSpaceAfterBinaryOperators": ["+", "-", "/", "*", "=", "==", 
"===", "!=", "!=="],
+       "disallowSpaceAfterPrefixUnaryOperators": [
+               "++",
+               "--",
+               "+",
+               "-",
+               "~",
+               "!"
+       ],
+       "disallowSpaceBeforePostfixUnaryOperators": [
+               "++",
+               "--"
+       ],
+       "requireSpaceBeforeBinaryOperators": [
+               "+",
+               "-",
+               "/",
+               "*",
+               "=",
+               "==",
+               "===",
+               "!=",
+               "!=="
+    ],
+       "requireSpaceAfterBinaryOperators": [
+               "+",
+               "-",
+               "/",
+               "*",
+               "=",
+               "==",
+               "===",
+               "!=",
+               "!=="
+       ],
        "requireCamelCaseOrUpperCaseIdentifiers": true,
        "disallowKeywords": [ "with" ],
-       "disallowMultipleLineStrings": true,
        "disallowMultipleLineBreaks": true,
        "validateLineBreaks": "LF",
        "validateQuoteMarks": "'",
-       "disallowMixedSpacesAndTabs": "smart",
+       "disallowMixedSpacesAndTabs": true,
        "disallowTrailingWhitespace": true,
+       "disallowTrailingComma": true,
+       "disallowKeywordsOnNewLine": ["else"],
        "requireLineFeedAtFileEnd": true,
        "requireCapitalizedConstructors": true,
-       "requireDotNotation": true
+       "requireDotNotation": true,
+       "disallowYodaConditions": true
 }
diff --git a/.jshintrc b/.jshintrc
index 1c46fef..3134d28 100644
--- a/.jshintrc
+++ b/.jshintrc
@@ -3,6 +3,7 @@
 
        // Enforcing
        "eqeqeq": true,
+       "freeze": true,
        "latedef": true,
        "noarg": true,
        "nonew": true,
@@ -11,29 +12,8 @@
 
        /* Local */
 
-       // Disabled style checks deprecated in JSHint 3,
-       // done by node-jscs instead
-       // - Enforcing
-       "camelcase": false,
-       "curly": false,
-       "immed": false,
-       "newcap": false,
-       "noempty": false,
-       "quotmark": false,
-       "trailing": false,
-       // - Relaxing
-       "multistr": true,
-       "sub": true,
-       "smarttabs": true,
-       // - Legacy
-       "nomen": false,
-       "onevar": false,
-
        // Enforcing
        "bitwise": true,
-       "forin": false,
-       "plusplus": false,
-       "regexp": true,
        "strict": false,
        // Relaxing
        "es5": false,
diff --git a/Gruntfile.js b/Gruntfile.js
index db39156..ea88291 100644
--- a/Gruntfile.js
+++ b/Gruntfile.js
@@ -83,7 +83,7 @@
                        },
                        all: [
                                '{.docs,build,demos,modules}/**/*.css'
-                       ],
+                       ]
                },
                banana: {
                        all: 'modules/ve/i18n/'
diff --git a/modules/ve/dm/nodes/ve.dm.ImageNode.js 
b/modules/ve/dm/nodes/ve.dm.ImageNode.js
index a3c38b9..f23bc12 100644
--- a/modules/ve/dm/nodes/ve.dm.ImageNode.js
+++ b/modules/ve/dm/nodes/ve.dm.ImageNode.js
@@ -71,7 +71,7 @@
                },
                'minDimensions': {
                        'width': 1,
-                       'height': 1,
+                       'height': 1
                }
        } );
 };
diff --git a/modules/ve/dm/ve.dm.Model.js b/modules/ve/dm/ve.dm.Model.js
index 987863f..cddb478 100644
--- a/modules/ve/dm/ve.dm.Model.js
+++ b/modules/ve/dm/ve.dm.Model.js
@@ -227,7 +227,7 @@
                        specArray = [ specArray ];
                }
                for ( i = 0, len = specArray.length; i < len; i++ ) {
-                       if  ( matches( specArray[i] ) ) {
+                       if ( matches( specArray[i] ) ) {
                                return true;
                        }
                }
diff --git a/modules/ve/init/ve.init.DebugBar.js 
b/modules/ve/init/ve.init.DebugBar.js
index 9d5ea8c..b962bc8 100644
--- a/modules/ve/init/ve.init.DebugBar.js
+++ b/modules/ve/init/ve.init.DebugBar.js
@@ -149,7 +149,7 @@
                        $label.addClass( 've-init-debugBar-dump-element' );
                        text = element.type;
                        annotations = element.annotations;
-               } else if ( ve.isArray( element ) ){
+               } else if ( ve.isArray( element ) ) {
                        $label.addClass( 've-init-debugBar-dump-achar' );
                        text = element[0];
                        annotations = element[1];
diff --git a/modules/ve/test/ce/ve.ce.Surface.test.js 
b/modules/ve/test/ce/ve.ce.Surface.test.js
index 786f496..32985ea 100644
--- a/modules/ve/test/ce/ve.ce.Surface.test.js
+++ b/modules/ve/test/ce/ve.ce.Surface.test.js
@@ -573,7 +573,7 @@
                                                {
                                                        'type': 'replace',
                                                        'insert': [
-                                                               'F', 'o', 'o',
+                                                               'F', 'o', 'o'
                                                        ],
                                                        'remove': []
                                                },
@@ -754,7 +754,7 @@
                                                                { 'type': 
'/tableRow' },
                                                                { 'type': 
'/tableSection' },
                                                                { 'type': 
'/table' },
-                                                               { 'type': 
'paragraph' },
+                                                               { 'type': 
'paragraph' }
                                                        ],
                                                        'remove': []
                                                },
diff --git a/modules/ve/test/dm/lineardata/ve.dm.FlatLinearData.test.js 
b/modules/ve/test/dm/lineardata/ve.dm.FlatLinearData.test.js
index 20af409..236883c 100644
--- a/modules/ve/test/dm/lineardata/ve.dm.FlatLinearData.test.js
+++ b/modules/ve/test/dm/lineardata/ve.dm.FlatLinearData.test.js
@@ -14,7 +14,7 @@
                data = new ve.dm.FlatLinearData( new ve.dm.IndexValueStore(), [
                        { 'type': 'paragraph' },
                        'a', ['b',[0]],
-                       { 'type': '/paragraph' },
+                       { 'type': '/paragraph' }
                ] ),
                types = ['paragraph', undefined, undefined, 'paragraph'],
                isOpen = [0],
diff --git a/modules/ve/test/dm/ve.dm.Document.test.js 
b/modules/ve/test/dm/ve.dm.Document.test.js
index b24095c..25e80db 100644
--- a/modules/ve/test/dm/ve.dm.Document.test.js
+++ b/modules/ve/test/dm/ve.dm.Document.test.js
@@ -495,7 +495,7 @@
                range = new ve.Range( 0, cases[i].expected.length );
                expectedData = expectedData.concat( [
                        { 'type': 'internalList' },
-                       { 'type': '/internalList' },
+                       { 'type': '/internalList' }
                ] );
                slice = doc.cloneSliceFromRange( cases[i].range );
                assert.deepEqualWithDomElements(
diff --git a/modules/ve/test/dm/ve.dm.example.js 
b/modules/ve/test/dm/ve.dm.example.js
index 5d349f3..4917078 100644
--- a/modules/ve/test/dm/ve.dm.example.js
+++ b/modules/ve/test/dm/ve.dm.example.js
@@ -3445,5 +3445,5 @@
                        }
                ],
                'msg': 'range covering handlesOwnChildren node doesn\'t descend'
-       },
+       }
 ];
diff --git a/modules/ve/ui/widgets/ve.ui.LanguageInputWidget.js 
b/modules/ve/ui/widgets/ve.ui.LanguageInputWidget.js
index 93b730e..43f3cfa 100644
--- a/modules/ve/ui/widgets/ve.ui.LanguageInputWidget.js
+++ b/modules/ve/ui/widgets/ve.ui.LanguageInputWidget.js
@@ -33,7 +33,7 @@
 
        this.directionSelect = new OO.ui.ButtonSelectWidget( {
                '$': this.$,
-               'classes': [ 've-ui-languageInputWidget-directionSelect' ],
+               'classes': [ 've-ui-languageInputWidget-directionSelect' ]
        } ).addItems( [
                new OO.ui.ButtonOptionWidget( 'rtl', { '$': this.$, 'icon': 
'text-dir-rtl' } ),
                new OO.ui.ButtonOptionWidget( null, { '$': this.$, 'label': 
ve.msg( 'visualeditor-dialog-language-auto-direction' ) } ),
diff --git a/package.json b/package.json
index 67fefed..b03827d 100644
--- a/package.json
+++ b/package.json
@@ -16,11 +16,11 @@
   ],
   "devDependencies": {
     "grunt": "0.4.2",
-    "grunt-contrib-jshint": "0.8.0",
+    "grunt-contrib-jshint": "0.10.0",
     "grunt-contrib-csslint": "0.2.0",
     "grunt-contrib-qunit": "0.4.0",
     "grunt-contrib-watch": "0.5.3",
     "grunt-banana-checker": "0.1.0",
-    "grunt-jscs-checker": "0.4.1"
+    "grunt-jscs-checker": "0.4.2"
   }
 }

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Iccf3b461b8d01023dd698771183b0ad5816993b1
Gerrit-PatchSet: 1
Gerrit-Project: VisualEditor/VisualEditor
Gerrit-Branch: master
Gerrit-Owner: Krinkle <krinklem...@gmail.com>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to