From 583b7d8cc35d9e10718546eaa0366d740ef23296 Mon Sep 17 00:00:00 2001 From: Willem Date: Sat, 23 Apr 2016 03:58:27 +0200 Subject: [PATCH] made pass jshint and strict --- .jshintignore | 2 -- .jshintrc | 38 -------------------------------------- es5-ff-spa-loader.js | 2 ++ test/jshint.spec.js.bak | 3 --- test/karma.conf.js | 22 ++++++---------------- test/spec-runner.js | 2 ++ test/spec/test-boot.js | 3 ++- test/spec/test-exports.js | 4 ++-- test/spec/test-factory.js | 3 ++- 9 files changed, 16 insertions(+), 63 deletions(-) delete mode 100644 .jshintignore delete mode 100644 .jshintrc delete mode 100644 test/jshint.spec.js.bak diff --git a/.jshintignore b/.jshintignore deleted file mode 100644 index d959f0c..0000000 --- a/.jshintignore +++ /dev/null @@ -1,2 +0,0 @@ -node_modules -example \ No newline at end of file diff --git a/.jshintrc b/.jshintrc deleted file mode 100644 index 72cc948..0000000 --- a/.jshintrc +++ /dev/null @@ -1,38 +0,0 @@ -{ - "predef": [ - "before", - "after", - "it", - "describe", - "beforeEach", - "afterEach" - ], - "asi" : false, - "bitwise" : true, - "boss" : false, - "curly" : true, - "debug": false, - "devel": false, - "eqeqeq": true, - "evil": false, - "expr": true, - "forin": false, - "immed": true, - "latedef" : false, - "laxbreak": false, - "multistr": true, - "newcap": true, - "noarg": true, - "node" : true, - "noempty": false, - "nonew": true, - "onevar": false, - "plusplus": false, - "proto": true, - "regexp": false, - "strict": false, - "sub": false, - "trailing" : true, - "undef": true, - "unused": true -} diff --git a/es5-ff-spa-loader.js b/es5-ff-spa-loader.js index 9632ef3..b6846de 100644 --- a/es5-ff-spa-loader.js +++ b/es5-ff-spa-loader.js @@ -31,6 +31,8 @@ * @module FFSpaLoader */ (function (root, factory) { + 'use strict'; + if ( typeof define === 'function' && define.amd ) { define(factory(root)); } else if ( typeof exports === 'object' ) { diff --git a/test/jshint.spec.js.bak b/test/jshint.spec.js.bak deleted file mode 100644 index 1cb92f9..0000000 --- a/test/jshint.spec.js.bak +++ /dev/null @@ -1,3 +0,0 @@ -'use strict'; - -//require('mocha-jshint')(['es5-ff-spa-loader.js','example']); diff --git a/test/karma.conf.js b/test/karma.conf.js index cbabc47..fc105dd 100644 --- a/test/karma.conf.js +++ b/test/karma.conf.js @@ -12,7 +12,9 @@ module.exports = function(config) { 'test/spec-runner.js'], preprocessors: { - 'es5-ff-spa-loader.js': ['jshint','coverage'] + 'es5-ff-spa-loader.js': ['jshint','coverage'], + 'example/**/*.js': ['jshint'], + 'test/**/*.js': ['jshint'] }, reporters: ['coverage', 'mocha', 'junit'], @@ -29,22 +31,10 @@ module.exports = function(config) { jshint: { options: { - curly: true, - eqeqeq: true, - immed: true, - latedef: true, - newcap: true, - noarg: true, - sub: true, - undef: true, - boss: true, - devel: true, - eqnull: true, + strict: true, browser: true, - globals: { - cordova: true, - jQuery: true - } + jasmine: true, + predef: ['define'] }, summary: true }, diff --git a/test/spec-runner.js b/test/spec-runner.js index 77a9923..77d679a 100644 --- a/test/spec-runner.js +++ b/test/spec-runner.js @@ -2,12 +2,14 @@ var testModules = []; var TEST_REGEXP = /^\/base\/test\/spec\/\S*.js$/i; var pathToModule = function(path) { + 'use strict'; return path.replace(/^\/base\//, '').replace(/\.js$/, ''); }; testModules.push('es5-ff-spa-loader'); Object.keys(window.__karma__.files).forEach(function(file) { + 'use strict'; //console.log('file: '+file); if (TEST_REGEXP.test(file)) { var fileNew = pathToModule(file); diff --git a/test/spec/test-boot.js b/test/spec/test-boot.js index 6845223..1b9b0d5 100644 --- a/test/spec/test-boot.js +++ b/test/spec/test-boot.js @@ -1,6 +1,7 @@ -'use strict'; define(['es5-ff-spa-loader'], function(FFSpaLoader) { + 'use strict'; + describe('Start loader', function() { it('FFSpaLoader start with error', function(done) { FFSpaLoader.options.server.url = 'http://localhost:9999'; diff --git a/test/spec/test-exports.js b/test/spec/test-exports.js index 12cda77..002b94b 100644 --- a/test/spec/test-exports.js +++ b/test/spec/test-exports.js @@ -1,6 +1,7 @@ -'use strict'; define(['es5-ff-spa-loader'], function(FFSpaLoader) { + 'use strict'; + describe('Check module exports', function() { describe('Check undefined', function() { it('FFSpaLoader.options should be defined', function() { @@ -34,4 +35,3 @@ define(['es5-ff-spa-loader'], function(FFSpaLoader) { }); - diff --git a/test/spec/test-factory.js b/test/spec/test-factory.js index a3b4845..5595553 100644 --- a/test/spec/test-factory.js +++ b/test/spec/test-factory.js @@ -1,6 +1,7 @@ -'use strict'; define(['es5-ff-spa-loader'], function(FFSpaLoader) { + 'use strict'; + describe('Check factory detect', function() { it('FFSpaLoader.factory.detect.localStorage', function() { expect(FFSpaLoader.factory.detect.localStorage()).toEqual(true);