Permalink
Browse files

setup jshint

  • Loading branch information...
1 parent 8f57ceb commit 476faced39a1af60bdfd6dc015b321b3ca87167e @timdream committed Apr 13, 2014
Showing with 55 additions and 4 deletions.
  1. +6 −0 .jshintignore
  2. +32 −0 .jshintrc
  3. +2 −2 CONTRIBUTE.md
  4. +13 −1 Gruntfile.js
  5. +2 −1 package.json
View
@@ -0,0 +1,6 @@
+/assets/vars.js
+/assets/wordfreq
+/assets/wordcloud2.js
+/assets/go2
+/assets/canvas-to-blob
+/assets/web-l10n
View
@@ -0,0 +1,32 @@
+{
+ "camelcase": false,
+ "curly": true,
+ "forin": false,
+ "latedef": "nofunc",
+ "newcap": false,
+ "noarg": true,
+ "nonew": true,
+ "quotmark": "single",
+ "undef": true,
+ "unused": "vars",
+ "strict": true,
+ "trailing": true,
+ "maxlen": 80,
+
+ "eqnull": true,
+ "esnext": true,
+ "expr": true,
+ "globalstrict": true,
+
+ "maxerr": 1000,
+ "regexdash": true,
+ "laxcomma": true,
+ "proto": true,
+
+ "browser": true,
+ "devel": true,
+ "nonstandard": true,
+ "worker": true,
+
+ "-W078": true
+}
View
@@ -7,7 +7,7 @@ Thank you for your interests about contributing HTML5 Word Cloud!
You'll need the following skill/tools
* [`git`](http://git-scm.com/)
-* [Closure Linter (`gjslint`)](https://developers.google.com/closure/utilities/)
+* [`jshint`](http://www.jshint.com/) for JavaScript linting
* [Compass](http://compass-style.org/), preferably [Compass.app](http://compass.handlino.com/)
* The ability to run a localhost HTTP server (Compass.app have that built-in, with Livereload)
@@ -46,7 +46,7 @@ Tests require Internet access.
## Coding style
* You must agree to submit your contribution under [MIT License](./MIT-LICENSE.txt).
-* Javascript must pass `gjslint --nojsdoc`.
+* Javascript must pass `jshint`; `grunt test` will verify that.
* Unique function names for each functions is strongly recommended for future profiling/stack tracing.
* Early return is encouraged over indent.
* Please do take care of possible race condition when working with async operations.
View
@@ -21,6 +21,14 @@ module.exports = function(grunt) {
src: 'assets/canvas-to-blob/canvas-to-blob.min.js',
dest: 'production' }
},
+ jshint: {
+ options: {
+ jshintrc: true,
+ },
+ all: [
+ 'assets/*.js', 'test/**.js'
+ ]
+ },
replace: {
dist: {
options: {
@@ -101,6 +109,7 @@ module.exports = function(grunt) {
grunt.loadNpmTasks('grunt-contrib-clean');
grunt.loadNpmTasks('grunt-contrib-concat');
grunt.loadNpmTasks('grunt-contrib-copy');
+ grunt.loadNpmTasks('grunt-contrib-jshint');
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-replace');
grunt.loadNpmTasks('grunt-rev');
@@ -118,8 +127,11 @@ module.exports = function(grunt) {
// Quick shell command to rsync the code to my site
grunt.registerTask('deploy', ['shell:deploy']);
+ // Test
+ grunt.registerTask('test', ['jshint', 'test-phantomjs']);
+
// Run the test suite with QUnit on PhantomJS
- grunt.registerTask('test', ['connect', 'qunit']);
+ grunt.registerTask('test-phantomjs', ['connect', 'qunit']);
// Simple target to check remaining client credit.
grunt.registerTask('check-imgur-credit', function checkImgurCredit() {
View
@@ -18,6 +18,7 @@
"grunt-rev": "~0.1.0",
"grunt-shell": "~0.2.2",
"grunt-contrib-qunit": "~0.2.2",
- "grunt-contrib-connect": "~0.3.0"
+ "grunt-contrib-connect": "~0.3.0",
+ "grunt-contrib-jshint": "~0.10.0"
}
}

0 comments on commit 476face

Please sign in to comment.