Jforrester has uploaded a new change for review.

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

Change subject: build: Enable jshint and jscs jobs in npm too
......................................................................

build: Enable jshint and jscs jobs in npm too

Change-Id: Ice86c5db0c8f11c632e5fa251d425be9fe9cae9f
---
A .jscsrc
A .jshintignore
A .jshintrc
M Gruntfile.js
M package.json
5 files changed, 55 insertions(+), 1 deletion(-)


  git pull 
ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/PronunciationRecording 
refs/changes/82/233182/1

diff --git a/.jscsrc b/.jscsrc
new file mode 100644
index 0000000..5b6f4bd
--- /dev/null
+++ b/.jscsrc
@@ -0,0 +1,5 @@
+{
+       "preset": "wikimedia",
+
+       "requireSpacesInsideArrayBrackets": null
+}
diff --git a/.jshintignore b/.jshintignore
new file mode 100644
index 0000000..74ae9a1
--- /dev/null
+++ b/.jshintignore
@@ -0,0 +1,3 @@
+docs
+lib
+node_modules
diff --git a/.jshintrc b/.jshintrc
new file mode 100644
index 0000000..a65020c
--- /dev/null
+++ b/.jshintrc
@@ -0,0 +1,27 @@
+{
+       // Enforcing
+       "bitwise": true,
+       "eqeqeq": true,
+       "freeze": true,
+       "latedef": true,
+       "noarg": true,
+       "nonew": true,
+       "undef": true,
+       "unused": true,
+       "strict": false,
+
+       // Relaxing
+       "es5": false,
+
+       // Environment
+       "browser": true,
+       "jquery": true,
+
+       "globals": {
+               "mw": false,
+               "OO": false,
+               "QUnit": false,
+               "unicodeJS": false,
+               "ve": false
+       }
+}
diff --git a/Gruntfile.js b/Gruntfile.js
index d2885f6..456e3ef 100644
--- a/Gruntfile.js
+++ b/Gruntfile.js
@@ -7,10 +7,25 @@
 /*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',
+                               '{.docs,build}/**/*.js',
+                               'resources/*.js'
+                       ]
+               },
+               jscs: {
+                       src: '<%= jshint.all %>'
+               },
                jsonlint: {
                        all: 'i18n/*.json'
                },
@@ -19,12 +34,14 @@
                },
                watch: {
                        files: [
+                               '.{jscsrc,jshintignore,jshintrc}',
+                               '<%= jshint.all %>',
                                '<%= jsonlint.all %>'
                        ],
                        tasks: 'test'
                }
        } );
 
-       grunt.registerTask( 'test', [ 'jsonlint', 'banana' ] );
+       grunt.registerTask( 'test', [ 'jshint', 'jscs', 'jsonlint', 'banana' ] 
);
        grunt.registerTask( 'default', 'test' );
 };
diff --git a/package.json b/package.json
index 4e040f5..f43a534 100644
--- a/package.json
+++ b/package.json
@@ -13,7 +13,9 @@
   "devDependencies": {
     "grunt": "0.4.5",
     "grunt-banana-checker": "0.2.2",
+    "grunt-contrib-jshint": "0.11.2",
     "grunt-contrib-watch": "0.6.1",
+    "grunt-jscs": "2.1.0",
     "grunt-jsonlint": "1.0.4"
   }
 }

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ice86c5db0c8f11c632e5fa251d425be9fe9cae9f
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/PronunciationRecording
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