From 1e7717ac8a0cfa42eecc27fea2c18231b2d76ce1 Mon Sep 17 00:00:00 2001 From: dceejay Date: Thu, 16 Apr 2015 10:56:22 +0100 Subject: [PATCH] Add jshintrc and inline lint checking to node-red-nodes --- .jshintrc | 13 +++++++++++++ Gruntfile.js | 6 ++++-- package.json | 1 + 3 files changed, 18 insertions(+), 2 deletions(-) create mode 100644 .jshintrc diff --git a/.jshintrc b/.jshintrc new file mode 100644 index 00000000..69b410b8 --- /dev/null +++ b/.jshintrc @@ -0,0 +1,13 @@ +{ + "asi": true, // allow missing semicolons + "curly": true, // require braces + "eqnull": true, // ignore ==null + "forin": true, // require property filtering in "for in" loops + "immed": true, // require immediate functions to be wrapped in ( ) + "nonbsp": true, // warn on unexpected whitespace breaking chars + //"strict": true, // commented out for now as it causes 100s of warnings, but want to get there eventually + "unused": true, // Check for unused functions and variables + "loopfunc": true, // allow functions to be defined in loops + //"expr": true, // allow ternery operator syntax... + "sub": true // don't warn that foo['bar'] should be written as foo.bar +} diff --git a/Gruntfile.js b/Gruntfile.js index ef8a91ca..1d796d6d 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -39,6 +39,7 @@ module.exports = function(grunt) { //"strict": true, // commented out for now as it causes 100s of warnings, but want to get there eventually "loopfunc": true, // allow functions to be defined in loops "sub": true, // don't warn that foo['bar'] should be written as foo.bar + //"unused": true, // Check for unused functions //"forin":false, // turn off check for "for (x in y...)" "reporter": require('jshint-stylish') }, @@ -55,12 +56,13 @@ module.exports = function(grunt) { }, }, inlinelint: { - html: ['*/*.html'] + html: ['*/*/*.html'] } }); grunt.loadNpmTasks('grunt-simple-mocha'); grunt.loadNpmTasks('grunt-contrib-jshint'); + grunt.loadNpmTasks('grunt-lint-inline'); - grunt.registerTask('default', ['jshint:all', 'simplemocha:all'] ); + grunt.registerTask('default', ['jshint:all', 'inlinelint', 'simplemocha:all'] ); }; diff --git a/package.json b/package.json index b62bf892..3ed87967 100644 --- a/package.json +++ b/package.json @@ -20,6 +20,7 @@ "grunt-cli": "0.1.13", "grunt-simple-mocha": "0.4.0", "grunt-contrib-jshint": "0.11.0", + "grunt-lint-inline": "0.4.3", "jshint-stylish": "1.0.1", "mocha": "2.1.0", "should": "4.6.5",