You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
There are various reasons why onevar is bad, like always changing unrelated
lines when adding or removing variables. jshint actually remove the onevar
option recently.
Instead of specifying how variables should be declared without onevar, I've
removed the entire Assignments section. We can bring it back in the future
when there is consensus, if its needed at all.
Also removes two unnecessary blank lines in unrelated code example.
Closes#105
@@ -292,50 +289,6 @@ For UMD, the factory is indented to visually differentiate it from the body.
292
289
}));
293
290
```
294
291
295
-
## Assignments
296
-
297
-
Assignments in a declaration must be on their own line. Declarations that don't have an assignment must be listed together at the start of the declaration. Each line after the initial line must be indented once. For example:
298
-
299
-
```js
300
-
// Bad
301
-
var foo =true;
302
-
var bar =false;
303
-
var a;
304
-
var b;
305
-
var c;
306
-
307
-
// Good
308
-
var a, b, c,
309
-
foo =true,
310
-
bar =false,
311
-
obj = {
312
-
a: b,
313
-
c: d,
314
-
},
315
-
arr = [
316
-
a,
317
-
b,
318
-
c
319
-
],
320
-
fn=function() {
321
-
body();
322
-
};
323
-
```
324
-
325
-
Exception: When a declaration has a single multiline assignment, the subsequent lines are not indented.
326
-
327
-
```js
328
-
// Good
329
-
varfn=function() {
330
-
body();
331
-
};
332
-
333
-
// Bad
334
-
varfn=function() {
335
-
body();
336
-
};
337
-
```
338
-
339
292
## Equality
340
293
341
294
Strict equality checks (`===`) must be used in favor of abstract equality checks (`==`). The _only_ exception is when checking for `undefined` and `null` by way of `null`.
0 commit comments