Skip to content

Commit 571914d

Browse files
committed
eslint & related fixes
The project previously had jshint.. but it was misconfigured so that it didn't actually check any of the source. So.. enabling it reported 200+ errors. I installed eslint partially for the --fix option because it autofixes half of the issues (try npm run autofix ;) After that, I fixed the remaining issues, and swapped jshint out for eslint.
1 parent 6eb6144 commit 571914d

22 files changed

+501
-263
lines changed

.eslintignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# http://eslint.org/docs/user-guide/configuring#ignoring-files-and-directories
2+
jsdoc/
3+
doc/
4+
coverage/

.eslintrc.js

Lines changed: 216 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,216 @@
1+
module.exports = {
2+
"env": {
3+
"node": true
4+
},
5+
"extends": "eslint:recommended",
6+
"rules": {
7+
"accessor-pairs": 2,
8+
"array-bracket-spacing": 0,
9+
"array-callback-return": 2,
10+
"arrow-body-style": 2,
11+
"arrow-parens": 2,
12+
"arrow-spacing": 2,
13+
"block-scoped-var": 2,
14+
"block-spacing": 0,
15+
"brace-style": 0,
16+
"callback-return": 0,
17+
"camelcase": 0,
18+
"comma-dangle": [
19+
2,
20+
"only-multiline"
21+
],
22+
"comma-spacing": 0,
23+
"comma-style": [
24+
2,
25+
"last"
26+
],
27+
"complexity": 2,
28+
"computed-property-spacing": [
29+
2,
30+
"never"
31+
],
32+
"consistent-return": 0,
33+
"consistent-this": 0,
34+
"curly": 0,
35+
"default-case": 2,
36+
"dot-location": [
37+
2,
38+
"property"
39+
],
40+
"dot-notation": 0,
41+
"eol-last": 0,
42+
"eqeqeq": 0,
43+
"func-names": 0,
44+
"func-style": 0,
45+
"generator-star-spacing": 2,
46+
"global-require": 0,
47+
"guard-for-in": 2,
48+
"handle-callback-err": 0,
49+
"id-blacklist": 2,
50+
"id-length": 0,
51+
"id-match": 2,
52+
"indent": 0,
53+
"init-declarations": 0,
54+
"jsx-quotes": 2,
55+
"key-spacing": 0,
56+
"keyword-spacing": 0,
57+
"linebreak-style": [
58+
2,
59+
"unix"
60+
],
61+
"lines-around-comment": 0,
62+
"max-depth": 2,
63+
"max-len": 0,
64+
"max-nested-callbacks": 2,
65+
"max-params": 0,
66+
"new-cap": 2,
67+
"new-parens": 2,
68+
"newline-after-var": 0,
69+
"newline-per-chained-call": 0,
70+
"no-alert": 2,
71+
"no-array-constructor": 2,
72+
"no-bitwise": 2,
73+
"no-caller": 2,
74+
"no-catch-shadow": 2,
75+
"no-confusing-arrow": 2,
76+
"no-continue": 2,
77+
"no-div-regex": 2,
78+
"no-else-return": 0,
79+
"no-empty-function": 0,
80+
"no-eq-null": 2,
81+
"no-eval": 2,
82+
"no-extend-native": 2,
83+
"no-extra-bind": 2,
84+
"no-extra-label": 2,
85+
"no-extra-parens": 0,
86+
"no-floating-decimal": 2,
87+
"no-implicit-coercion": 2,
88+
"no-implicit-globals": 2,
89+
"no-implied-eval": 2,
90+
"no-inline-comments": 0,
91+
"no-inner-declarations": [
92+
2,
93+
"functions"
94+
],
95+
"no-invalid-this": 0,
96+
"no-iterator": 2,
97+
"no-label-var": 2,
98+
"no-labels": 2,
99+
"no-lone-blocks": 2,
100+
"no-lonely-if": 0,
101+
"no-loop-func": 2,
102+
"no-magic-numbers": 0,
103+
"no-mixed-requires": 2,
104+
"no-multi-spaces": 0,
105+
"no-multi-str": 2,
106+
"no-multiple-empty-lines": 0,
107+
"no-native-reassign": 2,
108+
"no-negated-condition": 0,
109+
"no-nested-ternary": 2,
110+
"no-new": 2,
111+
"no-new-func": 2,
112+
"no-new-object": 2,
113+
"no-new-require": 2,
114+
"no-new-wrappers": 2,
115+
"no-octal-escape": 2,
116+
"no-param-reassign": 0,
117+
"no-path-concat": 0,
118+
"no-plusplus": [
119+
2,
120+
{
121+
"allowForLoopAfterthoughts": true
122+
}
123+
],
124+
"no-process-env": 0,
125+
"no-process-exit": 2,
126+
"no-proto": 2,
127+
"no-restricted-imports": 2,
128+
"no-restricted-modules": 2,
129+
"no-restricted-syntax": 2,
130+
"no-return-assign": 2,
131+
"no-script-url": 2,
132+
"no-self-compare": 2,
133+
"no-sequences": 2,
134+
"no-shadow": 0,
135+
"no-shadow-restricted-names": 2,
136+
"no-spaced-func": 0,
137+
"no-sync": 0,
138+
"no-ternary": 0,
139+
"no-throw-literal": 2,
140+
"no-trailing-spaces": [
141+
2,
142+
{
143+
"skipBlankLines": true
144+
}
145+
],
146+
"no-undef-init": 2,
147+
"no-undefined": 0,
148+
"no-underscore-dangle": 0,
149+
"no-unmodified-loop-condition": 2,
150+
"no-unneeded-ternary": 2,
151+
"no-unused-expressions": 0,
152+
"no-use-before-define": 0,
153+
"no-useless-call": 2,
154+
"no-useless-concat": 2,
155+
"no-useless-constructor": 2,
156+
"no-var": 0,
157+
"no-void": 2,
158+
"no-warning-comments": 0,
159+
"no-whitespace-before-property": 2,
160+
"no-with": 2,
161+
"object-curly-spacing": 0,
162+
"object-shorthand": 0,
163+
"one-var": 0,
164+
"one-var-declaration-per-line": 2,
165+
"operator-assignment": [
166+
2,
167+
"always"
168+
],
169+
"operator-linebreak": 2,
170+
"padded-blocks": 0,
171+
"prefer-arrow-callback": 0,
172+
"prefer-const": 2,
173+
"prefer-reflect": 0,
174+
"prefer-rest-params": 0,
175+
"prefer-spread": 2,
176+
"prefer-template": 0,
177+
"quote-props": 0,
178+
"quotes": 0,
179+
"radix": 2,
180+
"require-jsdoc": 0,
181+
"require-yield": 2,
182+
"semi": 0,
183+
"semi-spacing": [
184+
2,
185+
{
186+
"after": true,
187+
"before": false
188+
}
189+
],
190+
"sort-imports": 2,
191+
"sort-vars": 0,
192+
"space-before-blocks": 0,
193+
"space-before-function-paren": 0,
194+
"space-in-parens": 0,
195+
"space-infix-ops": 0,
196+
"space-unary-ops": [
197+
2,
198+
{
199+
"nonwords": false,
200+
"words": false
201+
}
202+
],
203+
"spaced-comment": 0,
204+
"strict": 0,
205+
"template-curly-spacing": 2,
206+
"valid-jsdoc": 0,
207+
"vars-on-top": 0,
208+
"wrap-iife": 2,
209+
"wrap-regex": 0,
210+
"yield-star-spacing": 2,
211+
"yoda": [
212+
2,
213+
"never"
214+
]
215+
}
216+
};

examples/.eslintrc.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
module.exports = {
2+
"env": {
3+
"node": true
4+
},
5+
"extends": "../.eslintrc.js",
6+
"rules": {
7+
"no-console": 0
8+
}
9+
};

examples/alchemy_language.v1.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,4 @@ alchemy_language.sentiment(params, function (err, response) {
1515
console.log('error:', err);
1616
else
1717
console.log(JSON.stringify(response, null, 2));
18-
});
18+
});

examples/alchemy_vision.v1.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
'use strict';
2+
/*eslint no-redeclare: 0*/
23

34
var watson = require('watson-developer-cloud');
45
var fs = require('fs');
@@ -9,7 +10,7 @@ var alchemy_vision = watson.alchemy_vision({
910

1011
// Image keywords
1112
var params = {
12-
image: fs.createReadStream('resources/car.png')
13+
image: fs.createReadStream('resources/car.png'),
1314
forceShowAll: 1 // Includes lower confidence tags
1415
};
1516

@@ -33,7 +34,7 @@ alchemy_vision.getImageKeywords(params, function (err, keywords) {
3334

3435
// Face recognize
3536
var params = {
36-
knowledgeGraph: 1 // Include knowledge graph information in the the results.
37+
knowledgeGraph: 1, // Include knowledge graph information in the the results.
3738
url: 'https://upload.wikimedia.org/wikipedia/commons/0/00/Scarlett_Johansson_-_Captain_America_2_press_conference_%28retouched%29_2.jpg'
3839
};
3940

jsdoc/template/static/scripts/prettify/lang-css.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.

0 commit comments

Comments
 (0)