WARNING: THIS SITE IS A MIRROR OF GITHUB.COM / IT CANNOT LOGIN OR REGISTER ACCOUNTS / THE CONTENTS ARE PROVIDED AS-IS / THIS SITE ASSUMES NO RESPONSIBILITY FOR ANY DISPLAYED CONTENT OR LINKS / IF YOU FOUND SOMETHING MAY NOT GOOD FOR EVERYONE, CONTACT ADMIN AT ilovescratch@foxmail.com
Skip to content

Commit 17a0c56

Browse files
committed
fixed jshint config, jshint warning, global gulp error handling, fixed CodeClimate config
1 parent d44e7a6 commit 17a0c56

File tree

7 files changed

+122
-2
lines changed

7 files changed

+122
-2
lines changed

.codeclimate.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
languages:
2+
Ruby: false
3+
JavaScript: true
4+
PHP: false
5+
Python: false
6+
exclude_paths:
7+
- "dist/logging-enhancer.js"

.jshintrc

Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
{
2+
// JSHint Default Configuration File (as on JSHint website)
3+
// See http://jshint.com/docs/ for more details
4+
5+
"maxerr" : 50, // {int} Maximum error before stopping
6+
7+
// Enforcing
8+
"bitwise" : true, // true: Prohibit bitwise operators (&, |, ^, etc.)
9+
"camelcase" : false, // true: Identifiers must be in camelCase
10+
"curly" : true, // true: Require {} for every new block or scope
11+
"eqeqeq" : true, // true: Require triple equals (===) for comparison
12+
"forin" : true, // true: Require filtering for..in loops with obj.hasOwnProperty()
13+
"freeze" : true, // true: prohibits overwriting prototypes of native objects such as Array, Date etc.
14+
"immed" : false, // true: Require immediate invocations to be wrapped in parens e.g. `(function () { } ());`
15+
"indent" : 4, // {int} Number of spaces to use for indentation
16+
"latedef" : false, // true: Require variables/functions to be defined before being used
17+
"newcap" : false, // true: Require capitalization of all constructor functions e.g. `new F()`
18+
"noarg" : true, // true: Prohibit use of `arguments.caller` and `arguments.callee`
19+
"noempty" : true, // true: Prohibit use of empty blocks
20+
"nonbsp" : true, // true: Prohibit "non-breaking whitespace" characters.
21+
"nonew" : false, // true: Prohibit use of constructors for side-effects (without assignment)
22+
"plusplus" : false, // true: Prohibit use of `++` & `--`
23+
"quotmark" : false, // Quotation mark consistency:
24+
// false : do nothing (default)
25+
// true : ensure whatever is used is consistent
26+
// "single" : require single quotes
27+
// "double" : require double quotes
28+
"undef" : true, // true: Require all non-global variables to be declared (prevents global leaks)
29+
"unused" : true, // Unused variables:
30+
// true : all variables, last function parameter
31+
// "vars" : all variables only
32+
// "strict" : all variables, all function parameters
33+
"strict" : true, // true: Requires all functions run in ES5 Strict Mode
34+
"maxparams" : false, // {int} Max number of formal params allowed per function
35+
"maxdepth" : false, // {int} Max depth of nested blocks (within functions)
36+
"maxstatements" : false, // {int} Max number statements per function
37+
"maxcomplexity" : false, // {int} Max cyclomatic complexity per function
38+
"maxlen" : false, // {int} Max number of characters per line
39+
40+
// Relaxing
41+
"asi" : false, // true: Tolerate Automatic Semicolon Insertion (no semicolons)
42+
"boss" : false, // true: Tolerate assignments where comparisons would be expected
43+
"debug" : false, // true: Allow debugger statements e.g. browser breakpoints.
44+
"eqnull" : false, // true: Tolerate use of `== null`
45+
"es5" : false, // true: Allow ES5 syntax (ex: getters and setters)
46+
"esnext" : false, // true: Allow ES.next (ES6) syntax (ex: `const`)
47+
"moz" : false, // true: Allow Mozilla specific syntax (extends and overrides esnext features)
48+
// (ex: `for each`, multiple try/catch, function expression…)
49+
"evil" : false, // true: Tolerate use of `eval` and `new Function()`
50+
"expr" : false, // true: Tolerate `ExpressionStatement` as Programs
51+
"funcscope" : false, // true: Tolerate defining variables inside control statements
52+
"globalstrict" : false, // true: Allow global "use strict" (also enables 'strict')
53+
"iterator" : false, // true: Tolerate using the `__iterator__` property
54+
"lastsemic" : false, // true: Tolerate omitting a semicolon for the last statement of a 1-line block
55+
"laxbreak" : false, // true: Tolerate possibly unsafe line breakings
56+
"laxcomma" : false, // true: Tolerate comma-first style coding
57+
"loopfunc" : false, // true: Tolerate functions being defined in loops
58+
"multistr" : false, // true: Tolerate multi-line strings
59+
"noyield" : false, // true: Tolerate generator functions with no yield statement in them.
60+
"notypeof" : false, // true: Tolerate invalid typeof operator values
61+
"proto" : false, // true: Tolerate using the `__proto__` property
62+
"scripturl" : false, // true: Tolerate script-targeted URLs
63+
"shadow" : false, // true: Allows re-define variables later in code e.g. `var x=1; x=2;`
64+
"sub" : false, // true: Tolerate using `[]` notation when it can still be expressed in dot notation
65+
"supernew" : false, // true: Tolerate `new function () { ... };` and `new Object;`
66+
"validthis" : false, // true: Tolerate using this in a non-constructor function
67+
68+
// Environments
69+
"browser" : true, // Web Browser (window, document, etc)
70+
"browserify" : false, // Browserify (node.js code in the browser)
71+
"couch" : false, // CouchDB
72+
"devel" : true, // Development/debugging (alert, confirm, etc)
73+
"dojo" : false, // Dojo Toolkit
74+
"jasmine" : false, // Jasmine
75+
"jquery" : false, // jQuery
76+
"mocha" : true, // Mocha
77+
"mootools" : false, // MooTools
78+
"node" : false, // Node.js
79+
"nonstandard" : false, // Widely adopted globals (escape, unescape, etc)
80+
"phantom" : false, // PhantomJS
81+
"prototypejs" : false, // Prototype and Scriptaculous
82+
"qunit" : false, // QUnit
83+
"rhino" : false, // Rhino
84+
"shelljs" : false, // ShellJS
85+
"typed" : false, // Globals for typed array constructions
86+
"worker" : false, // Web Workers
87+
"wsh" : false, // Windows Scripting Host
88+
"yui" : false, // Yahoo User Interface
89+
90+
// Custom Globals
91+
"globals" : {} // additional predefined global variables
92+
}

dist/logging-enhancer.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,12 @@
1+
/* global module, exports, window */
2+
13
/*
24
LoggingEnhancer can be used to enhance any logging function and can be tested without angular
35
*/
46
(function() {
7+
8+
'use strict';
9+
510
var LoggingEnhancer = function(sprintf, moment) {
611
var self = this;
712

dist/logging-enhancer.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

gulpfile.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,15 @@ var lazypipe = require('lazypipe');
33
var gulp = require('gulp');
44
var $ = require('gulp-load-plugins')();
55

6+
// globally handle all missed error events
7+
var gulp_src = gulp.src;
8+
gulp.src = function() {
9+
return gulp_src.apply(gulp, arguments).pipe($.plumber(function(error) {
10+
$.util.log($.util.colors.red('Error (' + error.plugin + '): ' + error.message), $.util.colors.red(error.stack));
11+
this.emit('end');
12+
}));
13+
};
14+
615
gulp.task('clean', function() {
716
del(['dist/*', 'reports', 'debug', '.coverdata']);
817
});

package.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,8 @@
3535
"gulp-load-plugins": "0.10.0",
3636
"gulp-jshint": "1.11.0",
3737
"jshint-stylish": "2.0.0",
38-
"lazypipe": "~0.2.3"
38+
"lazypipe": "~0.2.3",
39+
"gulp-plumber": "1.0.1",
40+
"gulp-util": "3.0.5"
3941
}
4042
}

src/logging-enhancer.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,12 @@
1+
/* global module, exports, window */
2+
13
/*
24
LoggingEnhancer can be used to enhance any logging function and can be tested without angular
35
*/
46
(function() {
7+
8+
'use strict';
9+
510
var LoggingEnhancer = function(sprintf, moment) {
611
var self = this;
712

0 commit comments

Comments
 (0)