Hashar has uploaded a new change for review.

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

Change subject: Bring in tests via npm/grunt
......................................................................

Bring in tests via npm/grunt

Get rid of csslint, the sole css file being a third party file under
/lib
Drop jscs-jsdoc config
Ignore a bunch of jscs errors
Declare 'L' as being a global variable to please jshint (should be
fixed in code imho)
Fixup a trivial jshint by adding curly braces
Introduce a Gruntfile.js

Change-Id: I5337da4f5184825bed45ef7ede1d8cdc4d0f77ce
---
D .csslintrc
M .jscsrc
M .jshintrc
A Gruntfile.js
M modules/kartographer.js
M package.json
6 files changed, 67 insertions(+), 33 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Kartographer 
refs/changes/56/262456/1

diff --git a/.csslintrc b/.csslintrc
deleted file mode 100644
index 68d60d2..0000000
--- a/.csslintrc
+++ /dev/null
@@ -1,13 +0,0 @@
-{
-       "adjoining-classes": false,
-       "box-model": false,
-       "box-sizing": false,
-       "fallback-colors": false,
-       "important": false,
-       "outline-none": false,
-       "qualified-headings": false,
-       "unique-headings": false,
-       "universal-selector": false,
-       "unqualified-attributes": false,
-       "gradients": false
-}
diff --git a/.jscsrc b/.jscsrc
index 1959eea..3a9078f 100644
--- a/.jscsrc
+++ b/.jscsrc
@@ -1,21 +1,10 @@
 {
        "preset": "wikimedia",
-
-       "jsDoc": {
-               "checkAnnotations": {
-                       "preset": "jsduck5",
-                       "extra": {
-                               "this": true,
-                               "source": true,
-                               "see": true
-                       }
-               },
-               "checkTypes": "strictNativeCase",
-               "checkParamNames": true,
-               "checkRedundantAccess": true,
-               "checkRedundantReturns": true,
-               "requireNewlineAfterDescription": true,
-               "requireParamTypes": true,
-               "requireReturnTypes": true
-       }
+       "disallowTrailingComma": false,
+       "requireMultipleVarDecl": false,
+       "requireSpaceAfterKeywords": false,
+       "requireSpaceBeforeKeywords": false,
+       "requireSpacesInsideBrackets": false,
+       "requireSpacesInsideParentheses": false,
+       "requireVarDeclFirst": false
 }
diff --git a/.jshintrc b/.jshintrc
index d11f205..7995c8a 100644
--- a/.jshintrc
+++ b/.jshintrc
@@ -18,6 +18,7 @@
        "jquery": true,
 
        "globals": {
+               "L": false,
                "mediaWiki": false,
                "OO": false,
                "ve": false,
diff --git a/Gruntfile.js b/Gruntfile.js
new file mode 100644
index 0000000..bfc7124
--- /dev/null
+++ b/Gruntfile.js
@@ -0,0 +1,56 @@
+/*jshint node:true */
+module.exports = function ( grunt ) {
+       grunt.loadNpmTasks( 'grunt-banana-checker' );
+       grunt.loadNpmTasks( 'grunt-contrib-jshint' );
+       grunt.loadNpmTasks( 'grunt-contrib-watch' );
+       grunt.loadNpmTasks( 'grunt-jscs' );
+       grunt.loadNpmTasks( 'grunt-jsonlint' );
+
+       grunt.initConfig( {
+               jshint: {
+                       options: {
+                               jshintrc: true
+                       },
+                       all: [
+                               '*.js',
+                               'modules/**/*.js'
+                       ]
+               },
+               jscs: {
+                       options: {
+                               config: '.jscsrc',
+                               verbose: true
+                       },
+                       fix: {
+                               options: {
+                                       fix: true
+                               },
+                               src: '<%= jshint.all %>'
+                       },
+                       main: {
+                               src: '<%= jshint.all %>'
+                       }
+               },
+               banana: {
+                       all: 'i18n/'
+               },
+               watch: {
+                       files: [
+                               '.{jscsrc,jshintignore,jshintrc}',
+                               '<%= jshint.all %>',
+                       ],
+                       tasks: 'test'
+               },
+               jsonlint: {
+                       all: [
+                               '**/*.json',
+                               '!node_modules/**'
+                       ]
+               }
+       } );
+
+       grunt.registerTask( 'lint', [ 'jshint', 'jscs:main', 'jsonlint', 
'banana' ] );
+       grunt.registerTask( 'fix', 'jscs:fix' );
+       grunt.registerTask( 'test', 'lint' );
+       grunt.registerTask( 'default', 'test' );
+};
diff --git a/modules/kartographer.js b/modules/kartographer.js
index 73b7967..1f97be1 100644
--- a/modules/kartographer.js
+++ b/modules/kartographer.js
@@ -14,7 +14,9 @@
        function bracketDevicePixelRatio() {
                var brackets = mw.config.get( 'wgKartographerSrcsetScales' ),
                        baseRatio = window.devicePixelRatio || 1;
-               if (!brackets) return 1;
+               if (!brackets) {
+                       return 1;
+               }
                brackets.unshift(1);
                for (var i = 0; i < brackets.length; i++) {
                        var scale = brackets[i];
diff --git a/package.json b/package.json
index 5710a02..76a1ada 100644
--- a/package.json
+++ b/package.json
@@ -12,7 +12,6 @@
     "browserify": "^12.0.1",
     "grunt": "0.4.5",
     "grunt-cli": "0.1.13",
-    "grunt-contrib-csslint": "0.5.0",
     "grunt-contrib-jshint": "0.11.3",
     "grunt-contrib-watch": "0.6.1",
     "grunt-jscs": "2.1.0",

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I5337da4f5184825bed45ef7ede1d8cdc4d0f77ce
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Kartographer
Gerrit-Branch: master
Gerrit-Owner: Hashar <[email protected]>

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

Reply via email to