From 38e40c7ebabb0c8dff4aeba6b0ad5b0395fec976 Mon Sep 17 00:00:00 2001 From: Leigh Johnson Date: Wed, 9 Nov 2016 09:53:58 -0500 Subject: [PATCH] Hook up npm script target for jshint (#3916) * Hook up npm script target for jshint * Shrinkwrap ui dependencies --- .jshintrc | 41 ------------ Makefile | 4 +- awx/ui/.jshintrc | 4 ++ awx/ui/Gruntfile.js | 1 + awx/ui/grunt-tasks/clean.js | 3 +- awx/ui/grunt-tasks/jshint.js | 11 ++++ awx/ui/npm-shrinkwrap.json | 118 +++++++++++++++++++---------------- awx/ui/package.json | 4 +- 8 files changed, 87 insertions(+), 99 deletions(-) delete mode 100644 .jshintrc create mode 100644 awx/ui/grunt-tasks/jshint.js diff --git a/.jshintrc b/.jshintrc deleted file mode 100644 index e44155d984..0000000000 --- a/.jshintrc +++ /dev/null @@ -1,41 +0,0 @@ -{ - "browser": true, - "jquery": true, - "esnext": true, - "globalstrict": true, - "curly": true, - "immed": true, - "latedef": "nofunc", - "noarg": true, - "nonew": true, - "maxerr": 10000, - "notypeof": true, - "globals": { - "beforeEach": false, - "inject": false, - "module": false, - "angular":false, - "alert":false, - "$AnsibleConfig":true, - "$basePath":true, - "jsyaml":false, - "_":false, - "d3":false, - "Donut3D":false, - "nv":false, - "it": false, - "xit": false, - "expect": false, - "context": false, - "describe": false, - "moment": false - }, - "strict": false, - "quotmark": false, - "trailing": true, - "undef": true, - "unused": true, - "eqeqeq": true, - "indent": 4, - "newcap": false -} diff --git a/Makefile b/Makefile index ae883febcf..e4313c7637 100644 --- a/Makefile +++ b/Makefile @@ -1,11 +1,9 @@ -PATH := awx/ui/node_modules/.bin:$(PATH) PYTHON = python PYTHON_VERSION = $(shell $(PYTHON) -c "from distutils.sysconfig import get_python_version; print get_python_version()") SITELIB=$(shell $(PYTHON) -c "from distutils.sysconfig import get_python_lib; print get_python_lib()") OFFICIAL ?= no PACKER ?= packer PACKER_BUILD_OPTS ?= -var 'official=$(OFFICIAL)' -var 'aw_repo_url=$(AW_REPO_URL)' -GRUNT ?= $(shell [ -t 0 ] && echo "grunt" || echo "grunt --no-color") NODE ?= node NPM_BIN ?= npm DEPS_SCRIPT ?= packaging/bundle/deps.py @@ -597,7 +595,7 @@ testjs_ci: echo "Update UI unittests later" #ui-test-ci jshint: - $(GRUNT) --gruntfile awx/ui/Gruntfile.js jshint #Depends on node 6.x and npm 3.x installed on Jenkins slave + $(NPM_BIN) run --prefix awx/ui jshint ui-test-saucelabs: $(UI_DEPS_FLAG_FILE) $(NPM_BIN) --prefix awx/ui run test:saucelabs diff --git a/awx/ui/.jshintrc b/awx/ui/.jshintrc index e44155d984..dc889c2b16 100644 --- a/awx/ui/.jshintrc +++ b/awx/ui/.jshintrc @@ -1,5 +1,6 @@ { "browser": true, + "node": true, "jquery": true, "esnext": true, "globalstrict": true, @@ -11,6 +12,9 @@ "maxerr": 10000, "notypeof": true, "globals": { + "$ENV": true, + "require": true, + "global": true, "beforeEach": false, "inject": false, "module": false, diff --git a/awx/ui/Gruntfile.js b/awx/ui/Gruntfile.js index a118409568..ce571e3e21 100644 --- a/awx/ui/Gruntfile.js +++ b/awx/ui/Gruntfile.js @@ -44,4 +44,5 @@ module.exports = function(grunt) { 'webpack:prod', 'concurrent:prod', ]); + }; diff --git a/awx/ui/grunt-tasks/clean.js b/awx/ui/grunt-tasks/clean.js index 9e603b833d..ddea762235 100644 --- a/awx/ui/grunt-tasks/clean.js +++ b/awx/ui/grunt-tasks/clean.js @@ -2,5 +2,6 @@ module.exports = { options: { force: true }, static: 'static/*', coverage: 'coverage/*', - tmp: '../../tmp' + tmp: '../../tmp', + jshint: 'coverage/jshint.xml' }; diff --git a/awx/ui/grunt-tasks/jshint.js b/awx/ui/grunt-tasks/jshint.js new file mode 100644 index 0000000000..102cce1bf2 --- /dev/null +++ b/awx/ui/grunt-tasks/jshint.js @@ -0,0 +1,11 @@ +module.exports = { + source: { + src: ['client/src/**/*.js', '*conf.js', '*.config.js', 'Gruntfile.js'], + options: { + reporter: 'jslint', + reporterOutput: 'coverage/jshint.xml', + jshintrc: true + } + }, + +}; diff --git a/awx/ui/npm-shrinkwrap.json b/awx/ui/npm-shrinkwrap.json index f4cce2939f..e5d9164a0e 100644 --- a/awx/ui/npm-shrinkwrap.json +++ b/awx/ui/npm-shrinkwrap.json @@ -50,9 +50,9 @@ "resolved": "https://registry.npmjs.org/almond/-/almond-0.3.3.tgz" }, "amdefine": { - "version": "1.0.0", + "version": "1.0.1", "from": "amdefine@>=0.0.4", - "resolved": "https://registry.npmjs.org/amdefine/-/amdefine-1.0.0.tgz" + "resolved": "https://registry.npmjs.org/amdefine/-/amdefine-1.0.1.tgz" }, "angular": { "version": "1.4.14", @@ -102,9 +102,9 @@ "resolved": "https://registry.npmjs.org/angular-gettext-tools/-/angular-gettext-tools-2.3.0.tgz", "dependencies": { "lodash": { - "version": "4.16.5", + "version": "4.16.6", "from": "lodash@>=4.0.0 <5.0.0", - "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.16.5.tgz" + "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.16.6.tgz" } } }, @@ -207,9 +207,9 @@ "resolved": "https://registry.npmjs.org/archiver/-/archiver-1.1.0.tgz", "dependencies": { "lodash": { - "version": "4.16.5", + "version": "4.16.6", "from": "lodash@>=4.8.0 <5.0.0", - "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.16.5.tgz" + "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.16.6.tgz" } } }, @@ -219,9 +219,9 @@ "resolved": "https://registry.npmjs.org/archiver-utils/-/archiver-utils-1.3.0.tgz", "dependencies": { "lodash": { - "version": "4.16.5", + "version": "4.16.6", "from": "lodash@>=4.8.0 <5.0.0", - "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.16.5.tgz" + "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.16.6.tgz" } } }, @@ -311,9 +311,9 @@ "resolved": "https://registry.npmjs.org/async/-/async-2.1.2.tgz", "dependencies": { "lodash": { - "version": "4.16.5", + "version": "4.16.6", "from": "lodash@>=4.14.0 <5.0.0", - "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.16.5.tgz" + "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.16.6.tgz" } } }, @@ -333,9 +333,9 @@ "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz" }, "autoprefixer": { - "version": "6.5.1", + "version": "6.5.2", "from": "autoprefixer@>=6.0.0 <7.0.0", - "resolved": "https://registry.npmjs.org/autoprefixer/-/autoprefixer-6.5.1.tgz" + "resolved": "https://registry.npmjs.org/autoprefixer/-/autoprefixer-6.5.2.tgz" }, "aws-sign2": { "version": "0.6.0", @@ -353,14 +353,14 @@ "resolved": "https://registry.npmjs.org/babel-code-frame/-/babel-code-frame-6.16.0.tgz" }, "babel-core": { - "version": "6.18.0", + "version": "6.18.2", "from": "babel-core@>=6.11.4 <7.0.0", - "resolved": "https://registry.npmjs.org/babel-core/-/babel-core-6.18.0.tgz", + "resolved": "https://registry.npmjs.org/babel-core/-/babel-core-6.18.2.tgz", "dependencies": { "lodash": { - "version": "4.16.5", + "version": "4.16.6", "from": "lodash@>=4.2.0 <5.0.0", - "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.16.5.tgz" + "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.16.6.tgz" }, "source-map": { "version": "0.5.6", @@ -375,9 +375,9 @@ "resolved": "https://registry.npmjs.org/babel-generator/-/babel-generator-6.18.0.tgz", "dependencies": { "lodash": { - "version": "4.16.5", + "version": "4.16.6", "from": "lodash@>=4.2.0 <5.0.0", - "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.16.5.tgz" + "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.16.6.tgz" }, "source-map": { "version": "0.5.6", @@ -397,9 +397,9 @@ "resolved": "https://registry.npmjs.org/babel-helper-define-map/-/babel-helper-define-map-6.18.0.tgz", "dependencies": { "lodash": { - "version": "4.16.5", + "version": "4.16.6", "from": "lodash@>=4.2.0 <5.0.0", - "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.16.5.tgz" + "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.16.6.tgz" } } }, @@ -429,9 +429,9 @@ "resolved": "https://registry.npmjs.org/babel-helper-regex/-/babel-helper-regex-6.18.0.tgz", "dependencies": { "lodash": { - "version": "4.16.5", + "version": "4.16.6", "from": "lodash@>=4.2.0 <5.0.0", - "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.16.5.tgz" + "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.16.6.tgz" } } }, @@ -471,9 +471,9 @@ "resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-block-scoping/-/babel-plugin-transform-es2015-block-scoping-6.18.0.tgz", "dependencies": { "lodash": { - "version": "4.16.5", + "version": "4.16.6", "from": "lodash@>=4.2.0 <5.0.0", - "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.16.5.tgz" + "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.16.6.tgz" } } }, @@ -588,9 +588,9 @@ "resolved": "https://registry.npmjs.org/babel-register/-/babel-register-6.18.0.tgz", "dependencies": { "lodash": { - "version": "4.16.5", + "version": "4.16.6", "from": "lodash@>=4.2.0 <5.0.0", - "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.16.5.tgz" + "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.16.6.tgz" }, "minimist": { "version": "0.0.8", @@ -615,9 +615,9 @@ "resolved": "https://registry.npmjs.org/babel-template/-/babel-template-6.16.0.tgz", "dependencies": { "lodash": { - "version": "4.16.5", + "version": "4.16.6", "from": "lodash@>=4.2.0 <5.0.0", - "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.16.5.tgz" + "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.16.6.tgz" } } }, @@ -627,9 +627,9 @@ "resolved": "https://registry.npmjs.org/babel-traverse/-/babel-traverse-6.18.0.tgz", "dependencies": { "lodash": { - "version": "4.16.5", + "version": "4.16.6", "from": "lodash@>=4.2.0 <5.0.0", - "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.16.5.tgz" + "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.16.6.tgz" } } }, @@ -639,9 +639,9 @@ "resolved": "https://registry.npmjs.org/babel-types/-/babel-types-6.18.0.tgz", "dependencies": { "lodash": { - "version": "4.16.5", + "version": "4.16.6", "from": "lodash@>=4.2.0 <5.0.0", - "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.16.5.tgz" + "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.16.6.tgz" } } }, @@ -872,9 +872,9 @@ } }, "caniuse-db": { - "version": "1.0.30000572", - "from": "caniuse-db@>=1.0.30000554 <2.0.0", - "resolved": "https://registry.npmjs.org/caniuse-db/-/caniuse-db-1.0.30000572.tgz" + "version": "1.0.30000578", + "from": "caniuse-db@>=1.0.30000576 <2.0.0", + "resolved": "https://registry.npmjs.org/caniuse-db/-/caniuse-db-1.0.30000578.tgz" }, "caseless": { "version": "0.11.0", @@ -922,9 +922,9 @@ "resolved": "https://registry.npmjs.org/clone/-/clone-1.0.2.tgz" }, "code-point-at": { - "version": "1.0.1", + "version": "1.1.0", "from": "code-point-at@>=1.0.0 <2.0.0", - "resolved": "https://registry.npmjs.org/code-point-at/-/code-point-at-1.0.1.tgz" + "resolved": "https://registry.npmjs.org/code-point-at/-/code-point-at-1.1.0.tgz" }, "codemirror": { "version": "5.20.2", @@ -947,9 +947,9 @@ "resolved": "https://registry.npmjs.org/combine-lists/-/combine-lists-1.0.1.tgz", "dependencies": { "lodash": { - "version": "4.16.5", + "version": "4.16.6", "from": "lodash@>=4.5.0 <5.0.0", - "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.16.5.tgz" + "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.16.6.tgz" } } }, @@ -994,9 +994,9 @@ "resolved": "https://registry.npmjs.org/compress-commons/-/compress-commons-1.1.0.tgz" }, "compressible": { - "version": "2.0.8", + "version": "2.0.9", "from": "compressible@>=2.0.8 <2.1.0", - "resolved": "https://registry.npmjs.org/compressible/-/compressible-2.0.8.tgz" + "resolved": "https://registry.npmjs.org/compressible/-/compressible-2.0.9.tgz" }, "compression": { "version": "1.6.2", @@ -1679,9 +1679,9 @@ "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz" }, "fsevents": { - "version": "1.0.14", + "version": "1.0.15", "from": "fsevents@>=1.0.0 <2.0.0", - "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-1.0.14.tgz", + "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-1.0.15.tgz", "dependencies": { "abbrev": { "version": "1.0.9", @@ -2353,16 +2353,16 @@ "resolved": "https://registry.npmjs.org/globule/-/globule-1.1.0.tgz", "dependencies": { "lodash": { - "version": "4.16.5", + "version": "4.16.6", "from": "lodash@>=4.16.4 <4.17.0", - "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.16.5.tgz" + "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.16.6.tgz" } } }, "graceful-fs": { - "version": "4.1.9", + "version": "4.1.10", "from": "graceful-fs@>=4.1.2 <5.0.0", - "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.1.9.tgz" + "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.1.10.tgz" }, "graceful-readlink": { "version": "1.0.1", @@ -2579,9 +2579,9 @@ "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-3.1.0.tgz" }, "lodash": { - "version": "4.16.5", + "version": "4.16.6", "from": "lodash@>=4.16.2 <5.0.0", - "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.16.5.tgz" + "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.16.6.tgz" } } }, @@ -2904,6 +2904,18 @@ "from": "jsesc@>=1.3.0 <2.0.0", "resolved": "https://registry.npmjs.org/jsesc/-/jsesc-1.3.0.tgz" }, + "jshint": { + "version": "2.9.4", + "from": "jshint@>=2.9.4 <3.0.0", + "resolved": "https://registry.npmjs.org/jshint/-/jshint-2.9.4.tgz", + "dependencies": { + "lodash": { + "version": "3.7.0", + "from": "lodash@>=3.7.0 <3.8.0", + "resolved": "https://registry.npmjs.org/lodash/-/lodash-3.7.0.tgz" + } + } + }, "json-schema": { "version": "0.2.3", "from": "json-schema@0.2.3", @@ -3809,9 +3821,9 @@ "resolved": "https://registry.npmjs.org/regenerate/-/regenerate-1.3.1.tgz" }, "regenerator-runtime": { - "version": "0.9.5", + "version": "0.9.6", "from": "regenerator-runtime@>=0.9.5 <0.10.0", - "resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.9.5.tgz" + "resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.9.6.tgz" }, "regex-cache": { "version": "0.4.3", @@ -4772,9 +4784,9 @@ "resolved": "https://registry.npmjs.org/zip-stream/-/zip-stream-1.1.0.tgz", "dependencies": { "lodash": { - "version": "4.16.5", + "version": "4.16.6", "from": "lodash@>=4.8.0 <5.0.0", - "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.16.5.tgz" + "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.16.6.tgz" } } } diff --git a/awx/ui/package.json b/awx/ui/package.json index 2836c5d754..6e78f0e80b 100644 --- a/awx/ui/package.json +++ b/awx/ui/package.json @@ -24,6 +24,7 @@ "build-release": "grunt release", "pretest": "grunt clean:coverage", "test": "karma start karma.conf.js", + "jshint": "grunt clean:jshint jshint:source --no-color", "test:ci": "npm run test -- --single-run --reporter junit,dots --browsers=PhantomJS", "test:saucelabs": "SAUCE_USERNAME=${npm_package_config_sauce_username} SAUCE_ACCESS_KEY=${npm_package_config_sauce_access_key} karma start karma.conf-saucelabs.js" }, @@ -48,13 +49,14 @@ "grunt-contrib-clean": "^1.0.0", "grunt-contrib-concat": "^1.0.1", "grunt-contrib-copy": "^1.0.0", + "grunt-contrib-jshint": "^1.0.0", "grunt-contrib-less": "^1.3.0", "grunt-extract-sourcemap": "^0.1.18", "grunt-newer": "^1.2.0", "grunt-webpack": "^1.0.11", "imports-loader": "^0.6.5", "jasmine-core": "^2.4.1", - "jshint": "^2.9.2", + "jshint": "^2.9.4", "jshint-loader": "^0.8.3", "jshint-stylish": "^2.2.0", "karma": "^1.1.2",