From 46b6a3b047024f350cf36e1ef62dc0e54e488720 Mon Sep 17 00:00:00 2001 From: Shaoquan Chen Date: Sun, 8 Feb 2015 12:59:10 -0800 Subject: [PATCH] Improving jshint - Including JS files under horizon/static/angular/ folder. - Adding .jshintrc to allow globals defined by jQuery, Angular, Angular mock, Jasmine, d3 and jsi18n. - Allowing global strict mode in spec files. Change-Id: I07359a4b3044cd5f675eef3b7df99398df909f81 Closes-Bug: #1419625 --- .jshintrc | 33 +++++++++++++++++++ .../angular/help-panel/help-panel.spec.js | 1 + .../static/angular/modal/simple-modal.spec.js | 3 +- horizon/static/angular/wizard/wizard.spec.js | 1 + run_tests.sh | 1 + 5 files changed, 38 insertions(+), 1 deletion(-) create mode 100644 .jshintrc diff --git a/.jshintrc b/.jshintrc new file mode 100644 index 0000000000..e81cb66306 --- /dev/null +++ b/.jshintrc @@ -0,0 +1,33 @@ +{ + "browser": true, + "trailing": true, + "evil": true, + + "globals": { + "jQuery": false, + "$": false, + + "angular": false, + "module": false, + "inject": false, + + "describe": false, + "beforeEach": false, + "afterEach": false, + "beforeAll": false, + "afterAll": false, + "it": false, + "expect": false, + + "d3": false, + + "pluralidx": false, + "gettext": false, + "ngettext": false, + "gettext_noop": false, + "pgettext": false, + "npgettext": false, + "interpolate": false, + "get_format": false + } +} diff --git a/horizon/static/angular/help-panel/help-panel.spec.js b/horizon/static/angular/help-panel/help-panel.spec.js index 3644fc0ec7..b024f1b99c 100644 --- a/horizon/static/angular/help-panel/help-panel.spec.js +++ b/horizon/static/angular/help-panel/help-panel.spec.js @@ -1,3 +1,4 @@ +/* jshint globalstrict: true */ 'use strict'; describe('hz.widget.help-panel module', function() { diff --git a/horizon/static/angular/modal/simple-modal.spec.js b/horizon/static/angular/modal/simple-modal.spec.js index 9fae12b486..1b66a531e0 100644 --- a/horizon/static/angular/modal/simple-modal.spec.js +++ b/horizon/static/angular/modal/simple-modal.spec.js @@ -1,3 +1,4 @@ +/* jshint globalstrict: true */ 'use strict'; describe('hz.widget.modal module', function(){ @@ -52,4 +53,4 @@ describe('modal factory', function(){ expect(modal(data)).toBeDefined(); }); -}); \ No newline at end of file +}); diff --git a/horizon/static/angular/wizard/wizard.spec.js b/horizon/static/angular/wizard/wizard.spec.js index b168a399b5..d45233892b 100644 --- a/horizon/static/angular/wizard/wizard.spec.js +++ b/horizon/static/angular/wizard/wizard.spec.js @@ -1,3 +1,4 @@ +/* jshint globalstrict: true */ 'use strict'; describe('hz.widget.wizard module', function () { diff --git a/run_tests.sh b/run_tests.sh index fa2944a2dd..7393420518 100755 --- a/run_tests.sh +++ b/run_tests.sh @@ -157,6 +157,7 @@ function run_jshint { echo "Running jshint ..." jshint horizon/static/horizon/js jshint horizon/static/horizon/tests + jshint horizon/static/angular/ } function warn_on_flake8_without_venv {