Permalink
Browse files

JSHint reinstated and warnings cleared up

  • Loading branch information...
1 parent bff5e85 commit e8f02755d140152b0e2cbc38bd830c6f72bdc1bc @adskjohn adskjohn committed Oct 20, 2016
View
@@ -0,0 +1 @@
+test/coverage/**
View
@@ -0,0 +1,92 @@
+{
+ "maxerr" : 50, // {int} Maximum error before stopping
+
+ // Enforcing
+ "bitwise" : true, // true: Prohibit bitwise operators (&, |, ^, etc.)
+ "camelcase" : false, // true: Identifiers must be in camelCase
+ "curly" : false, // true: Require {} for every new block or scope
+ "eqeqeq" : true, // true: Require triple equals (===) for comparison
+ "forin" : false, // true: Require filtering for..in loops with obj.hasOwnProperty()
+ "immed" : true, // true: Require immediate invocations to be wrapped in parens e.g. `(function () { } ());`
+ "indent" : 2, // {int} Number of spaces to use for indentation
+ "latedef" : false, // false: Allows function hoisting
+ "newcap" : true, // true: Require capitalization of all constructor functions e.g. `new F()`
+ "noarg" : true, // true: Prohibit use of `arguments.caller` and `arguments.callee`
+ "noempty" : true, // true: Prohibit use of empty blocks
+ "nonew" : true, // true: Prohibit use of constructors for side-effects (without assignment)
+ "plusplus" : false, // true: Prohibit use of `++` & `--`
+ "quotmark" : "single", // Quotation mark consistency:
+ // false : do nothing (default)
+ // true : ensure whatever is used is consistent
+ // "single" : require single quotes
+ // "double" : require double quotes
+ "undef" : true, // true: Require all non-global variables to be declared (prevents global leaks)
+ "unused" : "vars", // true: Require all defined variables be used
+ "strict" : true, // true: Requires all functions run in ES5 Strict Mode
+ "maxparams" : false, // {int} Max number of formal params allowed per function
+ "maxdepth" : false, // {int} Max depth of nested blocks (within functions)
+ "maxstatements" : false, // {int} Max number statements per function
+ "maxcomplexity" : false, // {int} Max cyclomatic complexity per function
+ "maxlen" : false, // {int} Max number of characters per line
+
+ // Relaxing
+ "asi" : true, // true: Tolerate Automatic Semicolon Insertion (no semicolons)
+ "boss" : false, // true: Tolerate assignments where comparisons would be expected
+ "debug" : false, // true: Allow debugger statements e.g. browser breakpoints.
+ "eqnull" : false, // true: Tolerate use of `== null`
+ "es5" : false, // true: Allow ES5 syntax (ex: getters and setters)
+ "esnext" : true, // true: Allow ES.next (ES6) syntax (ex: `const`)
+ "moz" : false, // true: Allow Mozilla specific syntax (extends and overrides esnext features)
+ // (ex: `for each`, multiple try/catch, function expression…)
+ "evil" : false, // true: Tolerate use of `eval` and `new Function()`
+ "expr" : false, // true: Tolerate `ExpressionStatement` as Programs
+ "funcscope" : false, // true: Tolerate defining variables inside control statements
+ "globalstrict" : false, // true: Allow global "use strict" (also enables 'strict')
+ "iterator" : false, // true: Tolerate using the `__iterator__` property
+ "lastsemic" : false, // true: Tolerate omitting a semicolon for the last statement of a 1-line block
+ "laxbreak" : false, // true: Tolerate possibly unsafe line breakings
+ "laxcomma" : false, // true: Tolerate comma-first style coding
+ "loopfunc" : false, // true: Tolerate functions being defined in loops
+ "multistr" : false, // true: Tolerate multi-line strings
+ "proto" : false, // true: Tolerate using the `__proto__` property
+ "scripturl" : false, // true: Tolerate script-targeted URLs
+ "shadow" : false, // true: Allows re-define variables later in code e.g. `var x=1; x=2;`
+ "sub" : false, // true: Tolerate using `[]` notation when it can still be expressed in dot notation
+ "supernew" : false, // true: Tolerate `new function () { ... };` and `new Object;`
+ "validthis" : false, // true: Tolerate using this in a non-constructor function
+
+ // Environments
+ "browser" : true, // Web Browser (window, document, etc)
+ "couch" : false, // CouchDB
+ "devel" : true, // Development/debugging (alert, confirm, etc)
+ "dojo" : false, // Dojo Toolkit
+ "jquery" : false, // jQuery
+ "mootools" : false, // MooTools
+ "node" : true, // Node.js
+ "nonstandard" : false, // Widely adopted globals (escape, unescape, etc)
+ "prototypejs" : false, // Prototype and Scriptaculous
+ "rhino" : false, // Rhino
+ "worker" : false, // Web Workers
+ "wsh" : false, // Windows Scripting Host
+ "yui" : false, // Yahoo User Interface
+
+ // Custom Globals
+ "globals": {
+ "$" : true,
+ "angular" : true,
+ "define" : false,
+ "jasmine" : false,
+ "require" : false,
+ "exports" : false,
+ "module" : false,
+ "describe" : false,
+ "before" : false,
+ "beforeEach" : false,
+ "after" : false,
+ "afterEach" : false,
+ "it" : false,
+ "inject" : false,
+ "expect" : false,
+ "spyOn" : false
+ }
+}
View
@@ -1,52 +1,54 @@
-'use strict'
-
-import 'angular/angular-csp.css'
-import 'angular-ui-select/select.min.css'
-import 'angular-material/angular-material.min.css'
-
-import jQuery from 'jquery'
-import 'angular'
-import 'angular-ui-select/select'
-import 'angular-mocks'
-import 'angular-cookies'
-import 'angular-resource'
-import 'angular-sanitize'
-import 'angular-ui-router'
-import 'angular-jwt'
-import 'angular-aria'
-import 'angular-animate'
-import 'angular-material'
-
-window.$ = jQuery
+'use strict';
+
+import 'angular/angular-csp.css';
+import 'angular-ui-select/select.min.css';
+import 'angular-material/angular-material.min.css';
+
+import jQuery from 'jquery';
+import 'angular';
+import 'angular-ui-select/select';
+import 'angular-mocks';
+import 'angular-cookies';
+import 'angular-resource';
+import 'angular-sanitize';
+import 'angular-ui-router';
+import 'angular-jwt';
+import 'angular-aria';
+import 'angular-animate';
+import 'angular-material';
+
+window.$ = jQuery;
angular.element(document).ready(function () {
// Fixing facebook bug with redirect
- if (window.location.hash === '#_=_') window.location.hash = '#!'
+ if (window.location.hash === '#_=_') {
+ window.location.hash = '#!';
+ }
// Then init the app
- angular.bootstrap(document, ['mean'])
-})
+ angular.bootstrap(document, ['mean']);
+});
function processModules (modules) {
- var packageModules = ['ngCookies', 'ngResource', 'ui.router', 'ui.select', 'ngSanitize', 'ngMaterial']
- var m
- var mn
+ var packageModules = ['ngCookies', 'ngResource', 'ui.router', 'ui.select', 'ngSanitize', 'ngMaterial'];
+ var m;
+ var mn;
for (var index in modules) {
- m = modules[index]
- mn = 'mean.' + m.name
- angular.module(mn, m.angularDependencies || [])
- packageModules.push(mn)
+ m = modules[index];
+ mn = 'mean.' + m.name;
+ angular.module(mn, m.angularDependencies || []);
+ packageModules.push(mn);
}
- var req = require.context('./packages', true, /\/public\/(?!tests|assets|views)(.*)\.js$/)
- req.keys().map(req)
- req = require.context('./node_modules', true, /\/meanio-(.*)\/public\/(?!tests|assets|views)(.*)\.js$/)
- req.keys().map(req)
- angular.module('mean', packageModules)
+ var req = require.context('./packages', true, /\/public\/(?!tests|assets|views)(.*)\.js$/);
+ req.keys().map(req);
+ req = require.context('./node_modules', true, /\/meanio-(.*)\/public\/(?!tests|assets|views)(.*)\.js$/);
+ req.keys().map(req);
+ angular.module('mean', packageModules);
}
jQuery.ajax('/_getModules', {
dataType: 'json',
async: false,
success: processModules
-})
+});
View
@@ -1,57 +1,61 @@
-'use strict'
-
-var gulp = require('gulp')
-var gulpLoadPlugins = require('gulp-load-plugins')
-var through = require('through')
-var gutil = require('gulp-util')
-var plugins = gulpLoadPlugins()
-var path = require('path')
+'use strict';
+
+/* jshint -W040 */
+
+var gulp = require('gulp');
+var gulpLoadPlugins = require('gulp-load-plugins');
+var through = require('through');
+var gutil = require('gulp-util');
+var plugins = gulpLoadPlugins();
+var path = require('path');
var paths = {
js: ['./*.js', 'config/**/*.js', 'gulp/**/*.js', 'tools/**/*.js', 'packages/**/*.js', '!packages/**/node_modules/**', '!packages/**/assets/**/lib/**', '!packages/**/assets/**/js/**'],
html: ['packages/**/*.html', '!packages/**/node_modules/**', '!packages/**/assets/**/lib/**'],
css: ['packages/**/*.css', '!packages/**/node_modules/**', '!packages/**/assets/**/lib/**'],
less: ['packages/**/*.less', '!packages/**/_*.less', '!packages/**/node_modules/**', '!packages/**/assets/**/lib/**'],
sass: ['packages/**/*.scss', '!packages/**/node_modules/**', '!packages/**/assets/**/lib/**']
-}
-var webpack = require('webpack')
-var webpackConfig = require('../webpack.config.js')
+};
+var webpack = require('webpack');
+var webpackConfig = require('../webpack.config.js');
/** General watch/restart flow **/
// .less / .scss files are watched by less/sass and produce .css files
// .js / .css files are watched by nodemon, invoke webpack,csslint, and jshint as needed before restarting and invoking livereload after
// .html files are watched by livereload explicitly
-var startupTasks = ['devServe']
+var startupTasks = ['devServe'];
-gulp.task('development', startupTasks)
-gulp.task('devServe', ['env:development', 'webpack:build-dev', 'jshint', 'csslint', 'watch'], devServeTask)
-gulp.task('env:development', envDevelopmentTask)
-gulp.task('webpack:build-dev', ['sass', 'less'], webpackBuild)
-gulp.task('sass', sassTask)
-gulp.task('less', lessTask)
-gulp.task('jshint', jshintTask)
-gulp.task('csslint', csslintTask)
+gulp.task('development', startupTasks);
+gulp.task('devServe', ['env:development', 'webpack:build-dev', 'jshint', 'csslint', 'watch'], devServeTask);
+gulp.task('env:development', envDevelopmentTask);
+gulp.task('webpack:build-dev', ['sass', 'less'], webpackBuild);
+gulp.task('sass', sassTask);
+gulp.task('less', lessTask);
+gulp.task('jshint', jshintTask);
+gulp.task('csslint', csslintTask);
-gulp.task('webpack:rebuild-dev', webpackBuild)
-gulp.task('watch', watchTask)
-gulp.task('livereload', livereloadTask)
+gulp.task('webpack:rebuild-dev', webpackBuild);
+gulp.task('watch', watchTask);
+gulp.task('livereload', livereloadTask);
////////////////////////////////////////////////////////////////////
// modify some webpack config options
-var devConfig = Object.create(webpackConfig)
-devConfig.devtool = 'sourcemap'
-devConfig.debug = true
+var devConfig = Object.create(webpackConfig);
+devConfig.devtool = 'sourcemap';
+devConfig.debug = true;
// create a single instance of the compiler to allow caching
-var devCompiler = webpack(devConfig)
+var devCompiler = webpack(devConfig);
function webpackBuild (callback) {
// run webpack
devCompiler.run(function (err, stats) {
- if (err) throw new gutil.PluginError('webpackBuild', err)
+ if (err) {
+ throw new gutil.PluginError('webpackBuild', err);
+ }
gutil.log('webpackBuild', stats.toString({
colors: true
- }))
+ }));
callback()
})
}
@@ -60,32 +64,32 @@ function jshintTask (callback) {
gulp.src(paths.js)
.pipe(plugins.jshint())
.pipe(plugins.jshint.reporter('jshint-stylish'))
- .pipe(count('jshint', 'files lint free'))
- callback()
+ .pipe(count('jshint', 'files lint free'));
+ callback();
}
function envDevelopmentTask (callback) {
- process.env.NODE_ENV = 'development'
- callback()
+ process.env.NODE_ENV = 'development';
+ callback();
}
function csslintTask () {
return gulp.src(paths.css)
.pipe(plugins.csslint('.csslintrc'))
.pipe(plugins.csslint.formatter())
- .pipe(count('csslint', 'files lint free'))
+ .pipe(count('csslint', 'files lint free'));
}
function lessTask () {
return gulp.src(paths.less)
.pipe(plugins.less())
- .pipe(gulp.dest('./packages'))
+ .pipe(gulp.dest('./packages'));
}
function sassTask () {
return gulp.src(paths.sass)
.pipe(plugins.sass().on('error', plugins.sass.logError))
- .pipe(gulp.dest('./packages'))
+ .pipe(gulp.dest('./packages'));
}
function devServeTask () {
@@ -112,10 +116,16 @@ function devServeTask () {
tasks: function (changedFiles) {
var tasks = [];
changedFiles.forEach(function (file) {
- if (path.extname(file) === '.css' && !~tasks.indexOf('csslint')) tasks.push('csslint')
- if (path.extname(file) === '.js' && !~tasks.indexOf('jshint')) tasks.push('jshint')
- if (path.extname(file) === '.js' || path.extname(file) === '.css' && !~tasks.indexOf('webpack:rebuild-dev')) tasks.push('webpack:rebuild-dev')
- })
+ if (path.extname(file) === '.css' && tasks.indexOf('csslint') === -1) {
+ tasks.push('csslint');
+ }
+ if (path.extname(file) === '.js' && tasks.indexOf('jshint') === -1) {
+ tasks.push('jshint');
+ }
+ if (path.extname(file) === '.js' || path.extname(file) === '.css' && tasks.indexOf('webpack:rebuild-dev') === -1) {
+ tasks.push('webpack:rebuild-dev');
+ }
+ });
return tasks;
},
nodeArgs: ['--debug'],
@@ -125,45 +135,45 @@ function devServeTask () {
this.stdout.on('data', function (chunk) {
if (/Mean app started/.test(chunk)) {
setTimeout(function () {
- plugins.livereload.reload()
+ plugins.livereload.reload();
}, 500)
}
process.stdout.write(chunk)
- })
+ });
this.stderr.pipe(process.stderr)
})
.on('restart', function () {
- plugins.livereload.reload()
- })
+ plugins.livereload.reload();
+ });
}
function watchTask (callback) {
plugins.livereload.listen({
interval: 500
- })
+ });
- gulp.watch(paths.html, ['livereload'])
- gulp.watch(paths.less, ['less'])
- gulp.watch(paths.sass, ['sass'])
- callback()
+ gulp.watch(paths.html, ['livereload']);
+ gulp.watch(paths.less, ['less']);
+ gulp.watch(paths.sass, ['sass']);
+ callback();
}
function livereloadTask (callback) {
- plugins.livereload.reload()
- callback()
+ plugins.livereload.reload();
+ callback();
}
function count (taskName, message) {
- var fileCount = 0
+ var fileCount = 0;
function countFiles (file) {
- fileCount++
+ fileCount++;
}
function endStream () {
- gutil.log(gutil.colors.cyan(taskName + ': ') + fileCount + ' ' + message || 'files processed.')
- this.emit('end')
+ gutil.log(gutil.colors.cyan(taskName + ': ') + fileCount + ' ' + message || 'files processed.');
+ this.emit('end');
}
- return through(countFiles, endStream)
+ return through(countFiles, endStream);
}
Oops, something went wrong.

0 comments on commit e8f0275

Please sign in to comment.