From 031a46aa8e34f2e428c71b9cf9e4c83412c8d438 Mon Sep 17 00:00:00 2001 From: Victor Woeltjen Date: Thu, 12 May 2016 15:32:38 -0700 Subject: [PATCH] [Code Style] Add JSHint rules Add JSHint rules to complement allowing multiple var statements, https://github.com/nasa/openmct/issues/142#issuecomment-212187972 [Code Style] Require one decl per var [Code Style] Don't require separate var decls ...but allow them (for compatibility with existing code style) [Code Style] Allow var decl after start of scope [Code Style] Enforce codestyle during verify task --- .jscsrc | 4 +++- .jshintrc | 3 ++- gulpfile.js | 2 +- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/.jscsrc b/.jscsrc index ac17b5dc9c..7229391def 100644 --- a/.jscsrc +++ b/.jscsrc @@ -1,3 +1,5 @@ { - "preset": "crockford" + "preset": "crockford", + "requireMultipleVarDecl": false, + "requireVarDeclFirst": false } diff --git a/.jshintrc b/.jshintrc index df3f02a1ff..ca549530ff 100644 --- a/.jshintrc +++ b/.jshintrc @@ -5,7 +5,7 @@ "eqeqeq": true, "forin": true, "freeze": true, - "funcscope": true, + "funcscope": false, "futurehostile": true, "latedef": true, "noarg": true, @@ -16,6 +16,7 @@ "define", "Promise" ], + "shadow": "inner", "strict": "implied", "undef": true, "unused": "vars" diff --git a/gulpfile.js b/gulpfile.js index 28d4530b9c..c3e82295d6 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -147,6 +147,6 @@ gulp.task('develop', ['serve', 'stylesheets', 'watch']); gulp.task('install', [ 'static', 'scripts' ]); -gulp.task('verify', [ 'lint', 'test' ]); +gulp.task('verify', [ 'lint', 'test', 'checkstyle' ]); gulp.task('build', [ 'verify', 'install' ]);