Skip to content

Commit 3a61b5a

Browse files
committed
No more jshint; now using eslint which is cool with ES6 stuff and kills the gulp process on syntax error
1 parent 02fa568 commit 3a61b5a

File tree

4 files changed

+235
-36
lines changed

4 files changed

+235
-36
lines changed

generated/.eslintrc

Lines changed: 218 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,218 @@
1+
{
2+
// http://eslint.org/docs/rules/
3+
4+
"ecmaFeatures": {
5+
"binaryLiterals": 1, // enable binary literals
6+
"blockBindings": 1, // enable let and const (aka block bindings)
7+
"defaultParams": 1, // enable default function parameters
8+
"forOf": 1, // enable for-of loops
9+
"generators": 1, // enable generators
10+
"objectLiteralComputedProperties": 1, // enable computed object literal property names
11+
"objectLiteralDuplicateProperties": 1, // enable duplicate object literal properties in strict mode
12+
"objectLiteralShorthandMethods": 1, // enable object literal shorthand methods
13+
"objectLiteralShorthandProperties": 1, // enable object literal shorthand properties
14+
"octalLiterals": 1, // enable octal literals
15+
"regexUFlag": 1, // enable the regular expression u flag
16+
"regexYFlag": 1, // enable the regular expression y flag
17+
"templateStrings": 1, // enable template strings
18+
"unicodeCodePointEscapes": 1, // enable code point escapes
19+
"jsx": 0 // disable JSX
20+
},
21+
22+
"env": {
23+
"browser": 1, // browser global variables.
24+
"node": 1, // Node.js global variables and Node.js-specific rules.
25+
"amd": 0, // defines require() and define() as global variables as per the amd spec.
26+
"mocha": 1, // adds all of the Mocha testing global variables.
27+
"jasmine": 0, // adds all of the Jasmine testing global variables for version 1.3 and 2.0.
28+
"phantomjs": 0, // phantomjs global variables.
29+
"jquery": 0, // jquery global variables.
30+
"prototypejs": 0, // prototypejs global variables.
31+
"shelljs": 0 // shelljs global variables.
32+
},
33+
34+
"globals": {
35+
"angular" : 1,
36+
"app": 1,
37+
"io": 1,
38+
"_": 1,
39+
"inject": 1,
40+
"expect": 1,
41+
"sinon": 1
42+
},
43+
44+
"rules": {
45+
////////// Possible Errors //////////
46+
"comma-dangle": 0, // disallow trailing commas in object literals
47+
"no-cond-assign": 0, // disallow assignment in conditional expressions
48+
"no-console": 0, // disallow use of console (off by default in the node environment)
49+
"no-constant-condition": 0, // disallow use of constant expressions in conditions
50+
"no-control-regex": 0, // disallow control characters in regular expressions
51+
"no-debugger": 1, // disallow use of debugger
52+
"no-dupe-keys": 1, // disallow duplicate keys when creating object literals
53+
"no-empty": 1, // disallow empty statements
54+
"no-empty-class": 0, // disallow the use of empty character classes in regular expressions
55+
"no-ex-assign": 1, // disallow assigning to the exception in a catch block
56+
"no-extra-boolean-cast": 0, // disallow double-negation boolean casts in a boolean context
57+
"no-extra-parens": 0, // disallow unnecessary parentheses (off by default)
58+
"no-extra-semi": 0, // disallow unnecessary semicolons
59+
"no-func-assign": 1, // disallow overwriting functions written as function declarations
60+
"no-inner-declarations": 0, // disallow function or variable declarations in nested blocks
61+
"no-invalid-regexp": 1, // disallow invalid regular expression strings in the RegExp constructor
62+
"no-irregular-whitespace": 1, // disallow irregular whitespace outside of strings and comments
63+
"no-negated-in-lhs": 0, // disallow negation of the left operand of an in expression
64+
"no-obj-calls": 1, // disallow the use of object properties of the global object (Math and JSON) as functions
65+
"no-regex-spaces": 1, // disallow multiple spaces in a regular expression literal
66+
"no-reserved-keys": 0, // disallow reserved words being used as object literal keys (off by default)
67+
"no-sparse-arrays": 0, // disallow sparse arrays
68+
"no-unreachable": 1, // disallow unreachable statements after a return, throw, continue, or break statement
69+
"use-isnan": 1, // disallow comparisons with the value NaN
70+
"valid-jsdoc": 0, // Ensure JSDoc comments are valid (off by default)
71+
"valid-typeof": 1, // Ensure that the results of typeof are compared against a valid string
72+
73+
74+
////////// Best Practices //////////
75+
76+
"block-scoped-var": 0, // treat var statements as if they were block scoped (off by default)
77+
"complexity": 0, // specify the maximum cyclomatic complexity allowed in a program (off by default)
78+
"consistent-return": 0, // require return statements to either always or never specify values
79+
"curly": 0, // specify curly brace conventions for all control statements
80+
"default-case": 0, // require default case in switch statements (off by default)
81+
"dot-notation": 1, // encourages use of dot notation whenever possible
82+
"eqeqeq": 1, // require the use of === and !==
83+
"guard-for-in": 0, // make sure for-in loops have an if statement (off by default)
84+
"no-alert": 0, // disallow the use of alert, confirm, and prompt
85+
"no-caller": 0, // disallow use of arguments.caller or arguments.callee
86+
"no-div-regex": 0, // disallow division operators explicitly at beginning of regular expression (off by default)
87+
"no-else-return": 0, // disallow else after a return in an if (off by default)
88+
"no-empty-label": 1, // disallow use of labels for anything other then loops and switches
89+
"no-eq-null": 0, // disallow comparisons to null without a type-checking operator (off by default)
90+
"no-eval": 0, // disallow use of eval()
91+
"no-extend-native": 0, // disallow adding to native types
92+
"no-extra-bind": 0, // disallow unnecessary function binding
93+
"no-fallthrough": 0, // disallow fallthrough of case statements
94+
"no-floating-decimal": 0, // disallow the use of leading or trailing decimal points in numeric literals (off by default)
95+
"no-implied-eval": 0, // disallow use of eval()-like methods
96+
"no-iterator": 0, // disallow usage of __iterator__ property
97+
"no-labels": 1, // disallow use of labeled statements
98+
"no-lone-blocks": 1, // disallow unnecessary nested blocks
99+
"no-loop-func": 1, // disallow creation of functions within loops
100+
"no-multi-spaces": 1, // disallow use of multiple spaces
101+
"no-multi-str": 0, // disallow use of multiline strings
102+
"no-native-reassign": 1, // disallow reassignments of native objects
103+
"no-new": 1, // disallow use of new operator when not part of the assignment or comparison
104+
"no-new-func": 0, // disallow use of new operator for Function object
105+
"no-new-wrappers": 0, // disallows creating new instances of String, Number, and Boolean
106+
"no-octal": 0, // disallow use of octal literals
107+
"no-octal-escape": 0, // disallow use of octal escape sequences in string literals, such as var foo = "Copyright \251";
108+
"no-process-env": 0, // disallow use of process.env (off by default)
109+
"no-proto": 1, // disallow usage of __proto__ property
110+
"no-redeclare": 1, // disallow declaring the same variable more then once
111+
"no-return-assign": 1, // disallow use of assignment in return statement
112+
"no-script-url": 1, // disallow use of javascript: urls.
113+
"no-self-compare": 0, // disallow comparisons where both sides are exactly the same (off by default)
114+
"no-sequences": 0, // disallow use of comma operator
115+
"no-unused-expressions": 0, // disallow usage of expressions in statement position
116+
"no-void": 0, // disallow use of void operator (off by default)
117+
"no-warning-comments": 0, // disallow usage of configurable warning terms in comments, e.g. TODO or FIXME (off by default)
118+
"no-with": 1, // disallow use of the with statement
119+
"radix": 0, // require use of the second argument for parseInt() (off by default)
120+
"vars-on-top": 0, // requires to declare all vars on top of their containing scope (off by default)
121+
"wrap-iife": 0, // require immediate function invocation to be wrapped in parentheses (off by default)
122+
"yoda": 0, // require or disallow Yoda conditions
123+
124+
125+
////////// Strict Mode //////////
126+
127+
"global-strict": 0, // (deprecated) require or disallow the "use strict" pragma in the global scope (off by default in the node environment)
128+
"no-extra-strict": 0, // (deprecated) disallow unnecessary use of "use strict"; when already in strict mode
129+
"strict": 0, // controls location of Use Strict Directives
130+
131+
132+
////////// Variables //////////
133+
134+
"no-catch-shadow": 1, // disallow the catch clause parameter name being the same as a variable in the outer scope (off by default in the node environment)
135+
"no-delete-var": 1, // disallow deletion of variables
136+
"no-label-var": 1, // disallow labels that share a name with a variable
137+
"no-shadow": 1, // disallow declaration of variables already declared in the outer scope
138+
"no-shadow-restricted-names": 0, // disallow shadowing of names such as arguments
139+
"no-undef": 1, // disallow use of undeclared variables unless mentioned in a /*global */ block
140+
"no-undef-init": 0, // disallow use of undefined when initializing variables
141+
"no-undefined": 0, // disallow use of undefined variable (off by default)
142+
"no-unused-vars": 1, // disallow declaration of variables that are not used in the code
143+
"no-use-before-define": 1, // disallow use of variables before they are defined
144+
145+
146+
////////// Node.js //////////
147+
148+
"handle-callback-err": 1, // enforces error handling in callbacks (off by default) (on by default in the node environment)
149+
"no-mixed-requires": 1, // disallow mixing regular variable and require declarations (off by default) (on by default in the node environment)
150+
"no-new-require": 0, // disallow use of new operator with the require function (off by default) (on by default in the node environment)
151+
"no-path-concat": 0, // disallow string concatenation with __dirname and __filename (off by default) (on by default in the node environment)
152+
"no-process-exit": 0, // disallow process.exit() (on by default in the node environment)
153+
"no-restricted-modules": 0, // restrict usage of specified node modules (off by default)
154+
"no-sync": 1, // disallow use of synchronous methods (off by default)
155+
156+
157+
////////// Stylistic Issues //////////
158+
159+
"brace-style": 0, // enforce one 1 brace style (off by default)
160+
"camelcase": 0, // require camel case names
161+
"comma-spacing": 0, // enforce spacing before and after comma
162+
"comma-style": 0, // enforce one 1 comma style (off by default)
163+
"consistent-this": 0, // enforces consistent naming when capturing the current execution context (off by default)
164+
"eol-last": 0, // enforce newline at the end of file, with no multiple empty lines
165+
"func-names": 0, // require function expressions to have a name (off by default)
166+
"func-style": 0, // enforces use of function declarations or expressions (off by default)
167+
"key-spacing": 0, // enforces spacing between keys and values in object literal properties
168+
"max-nested-callbacks": 0, // specify the maximum depth callbacks can be nested (off by default)
169+
"new-cap": 0, // require a capital letter for constructors
170+
"new-parens": 0, // disallow the omission of parentheses when invoking a constructor with no arguments
171+
"no-array-constructor": 0, // disallow use of the Array constructor
172+
"no-inline-comments": 0, // disallow comments inline after code (off by default)
173+
"no-lonely-if": 0, // disallow if as the only statement in an else block (off by default)
174+
"no-mixed-spaces-and-tabs": 0, // disallow mixed spaces and tabs for indentation
175+
"no-multiple-empty-lines": 0, // disallow multiple empty lines (off by default)
176+
"no-nested-ternary": 0, // disallow nested ternary expressions (off by default)
177+
"no-new-object": 0, // disallow use of the Object constructor
178+
"no-space-before-semi": 0, // disallow space before semicolon
179+
"no-spaced-func": 0, // disallow space between function identifier and application
180+
"no-ternary": 0, // disallow the use of ternary operators (off by default)
181+
"no-trailing-spaces": 0, // disallow trailing whitespace at the end of lines
182+
"no-underscore-dangle": 0, // disallow dangling underscores in identifiers
183+
"no-wrap-func": 0, // disallow wrapping of non-IIFE statements in parens
184+
"one-var": 0, // allow just one var statement per function (off by default)
185+
"operator-assignment": 0, // require assignment operator shorthand where possible or prohibit it entirely (off by default)
186+
"padded-blocks": 0, // enforce padding within blocks (off by default)
187+
"quote-props": 0, // require quotes around object literal property names (off by default)
188+
"quotes": 0, // specify whether double or single quotes should be used
189+
"semi": 0, // require or disallow use of semicolons instead of ASI
190+
"sort-vars": 0, // sort variables within the same declaration block (off by default)
191+
"space-after-function-name": 0, // require a space after function names (off by default)
192+
"space-after-keywords": 0, // require a space after certain keywords (off by default)
193+
"space-before-blocks": 0, // require or disallow space before blocks (off by default)
194+
"space-in-brackets": 0, // require or disallow spaces inside brackets (off by default)
195+
"space-in-parens": 0, // require or disallow spaces inside parentheses (off by default)
196+
"space-infix-ops": 0, // require spaces around operators
197+
"space-return-throw-case": 0, // require a space after return, throw, and case
198+
"space-unary-ops": 0, // Require or disallow spaces before/after unary operators (words on by default, nonwords off by default)
199+
"spaced-line-comment": 0, // require or disallow a space immediately following the // in a line comment (off by default)
200+
"wrap-regex": 0, // require regex literals to be wrapped in parentheses (off by default)
201+
202+
203+
////////// ECMAScript 6 //////////
204+
205+
"no-var": 0, // require let or const instead of var (off by default)
206+
"generator-star": 0, // enforce the position of the * in generator functions (off by default)
207+
208+
209+
////////// Legacy //////////
210+
211+
"max-depth": 0, // specify the maximum depth that blocks can be nested (off by default)
212+
"max-len": 0, // specify the maximum length of a line in your program (off by default)
213+
"max-params": 0, // limits the number of parameters that can be used in the function declaration. (off by default)
214+
"max-statements": 0, // specify the maximum number of statement allowed in a function (off by default)
215+
"no-bitwise": 0, // disallow use of bitwise operators (off by default)
216+
"no-plusplus": 0 // disallow use of unary operators, ++ and -- (off by default)
217+
}
218+
}

generated/.jshintrc

Lines changed: 0 additions & 27 deletions
This file was deleted.

generated/gulpfile.js

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ var minifyCSS = require('gulp-minify-css');
1313
var ngAnnotate = require('gulp-ng-annotate');
1414
var uglify = require('gulp-uglify');
1515
var sourcemaps = require('gulp-sourcemaps');
16-
var jshint = require('gulp-jshint');
16+
var eslint = require('gulp-eslint');
1717
var mocha = require('gulp-mocha');
1818
var karma = require('karma').server;
1919

@@ -30,12 +30,15 @@ gulp.task('reloadCSS', function () {
3030
});
3131

3232
gulp.task('lintJS', function () {
33+
3334
return gulp.src(['./browser/js/**/*.js', './server/**/*.js'])
34-
.pipe(jshint())
35-
.pipe(jshint.reporter('jshint-stylish'));
35+
.pipe(eslint())
36+
.pipe(eslint.format())
37+
.pipe(eslint.failOnError());
38+
3639
});
3740

38-
gulp.task('buildJS', function () {
41+
gulp.task('buildJS', ['lintJS'], function () {
3942
return gulp.src(['./browser/js/app.js', './browser/js/**/*.js'])
4043
.pipe(plumber())
4144
.pipe(sourcemaps.init())
@@ -62,7 +65,7 @@ gulp.task('buildCSS', function () {
6265
.pipe(plumber())
6366
.pipe(sass())
6467
.pipe(rename('style.css'))
65-
.pipe(gulp.dest('./public'))
68+
.pipe(gulp.dest('./public'));
6669
});
6770

6871
gulp.task('seedDB', function () {
@@ -119,7 +122,7 @@ gulp.task('build', function () {
119122
if (process.env.NODE_ENV === 'production') {
120123
runSeq(['buildJSProduction', 'buildCSSProduction']);
121124
} else {
122-
runSeq(['lintJS', 'buildJS', 'buildCSS']);
125+
runSeq(['buildJS', 'buildCSS']);
123126
}
124127
});
125128

@@ -129,16 +132,22 @@ gulp.task('default', function () {
129132
gulp.start('build');
130133

131134
gulp.watch('browser/js/**', function () {
132-
runSeq('buildJS', ['testBrowserJS', 'reload']);
135+
runSeq('buildJS', 'reload');
133136
});
134137

135138
gulp.watch('browser/scss/**', function () {
136139
runSeq('buildCSS', 'reloadCSS');
137140
});
138141

139142
gulp.watch('server/**/*.js', ['lintJS']);
143+
144+
// Reload when a template (.html) file changes.
140145
gulp.watch(['browser/**/*.html', 'server/app/views/*.html'], ['reload']);
146+
147+
// Run server tests when a server file or server test file changes.
141148
gulp.watch(['tests/server/**/*.js', 'server/**/*.js'], ['testServerJS']);
149+
150+
// Run browser testing when a browser test file changes.
142151
gulp.watch('tests/browser/**/*', ['testBrowserJS']);
143152

144153
});

generated/package.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
"gulp": "^3.8.11",
2525
"gulp-babel": "^5.1.0",
2626
"gulp-concat": "^2.5.2",
27-
"gulp-jshint": "^1.9.2",
27+
"gulp-eslint": "^0.14.0",
2828
"gulp-livereload": "^3.7.0",
2929
"gulp-minify-css": "^0.4.6",
3030
"gulp-mocha": "^2.0.0",
@@ -34,7 +34,6 @@
3434
"gulp-sass": "^1.3.3",
3535
"gulp-sourcemaps": "^1.3.0",
3636
"gulp-uglify": "^1.1.0",
37-
"jshint-stylish": "^1.0.1",
3837
"karma": "^0.12.31",
3938
"karma-chai": "^0.1.0",
4039
"karma-mocha": "^0.1.10",

0 commit comments

Comments
 (0)