Skip to content

Commit 982578e

Browse files
committed
Change jshint to eslint, update examples
1 parent e66fe86 commit 982578e

File tree

5 files changed

+44
-13
lines changed

5 files changed

+44
-13
lines changed

.eslintrc.yml

Lines changed: 37 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
1-
parserOptions:
2-
ecmaVersion: 6
31
env:
2+
es6: true
43
node: true
54
extends: 'eslint:recommended'
5+
globals:
6+
api: false
67
rules:
78
indent:
89
- error
@@ -69,7 +70,7 @@ rules:
6970
ignoreUrls: true
7071
max-nested-callbacks:
7172
- error
72-
- max: 5
73+
- max: 7
7374
new-cap:
7475
- error
7576
- newIsCap: true
@@ -137,3 +138,36 @@ rules:
137138
no-use-before-define:
138139
- error
139140
- functions: false
141+
arrow-body-style:
142+
- error
143+
- as-needed
144+
arrow-spacing:
145+
- error
146+
no-confusing-arrow:
147+
- error
148+
- allowParens: true
149+
no-useless-computed-key:
150+
- error
151+
no-useless-rename:
152+
- error
153+
no-var:
154+
- error
155+
object-shorthand:
156+
- error
157+
- always
158+
prefer-arrow-callback:
159+
- error
160+
prefer-const:
161+
- error
162+
prefer-numeric-literals:
163+
- error
164+
prefer-rest-params:
165+
- error
166+
prefer-spread:
167+
- error
168+
rest-spread-spacing:
169+
- error
170+
- never
171+
template-curly-spacing:
172+
- error
173+
- never

.jshintrc

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

JavaScript/4-for-in.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
const arr = [7, 10, 1, 5, 2];
44
arr.field = 'Value';
55

6-
for (let i in arr) {
7-
let value = arr[i];
6+
for (const i in arr) {
7+
const value = arr[i];
88
console.log(i, value);
99
}
1010

JavaScript/5-for-of.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,6 @@
33
const arr = [7, 10, 1, 5, 2];
44
arr.field = 'Value';
55

6-
for (let i of arr) {
6+
for (const i of arr) {
77
console.log(i);
88
}

JavaScript/6-break.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,9 @@ label1: {
66
console.log('Hello');
77
if (flag) break label1;
88
console.log('World');
9+
label2: {
10+
console.log('There');
11+
break label2;
12+
}
913
}
1014

11-
label2: {
12-
console.log('There');
13-
}

0 commit comments

Comments
 (0)