Skip to content

Commit 479fe81

Browse files
lholmquistjoyeecheung
authored andcommitted
src: Replace var with let (#72)
This replaces the usage of var with let to make the code more consistent
1 parent 86b9053 commit 479fe81

File tree

7 files changed

+12
-12
lines changed

7 files changed

+12
-12
lines changed

bin/cmd.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -61,15 +61,15 @@ function load(sha, cb) {
6161
}
6262

6363
function loadPatch(uri, cb) {
64-
var h = http
64+
let h = http
6565
if (~uri.protocol.indexOf('https')) {
6666
h = https
6767
}
6868
uri.headers = {
6969
'user-agent': 'core-validate-commit'
7070
}
7171
h.get(uri, (res) => {
72-
var buf = ''
72+
let buf = ''
7373
res.on('data', (chunk) => {
7474
buf += chunk
7575
})
@@ -109,8 +109,8 @@ if (parsed.tap) {
109109
const tap = new Tap()
110110
tap.pipe(process.stdout)
111111
if (parsed.out) tap.pipe(fs.createWriteStream(parsed.out))
112-
var count = 0
113-
var total = args.length
112+
let count = 0
113+
let total = args.length
114114

115115
v.on('commit', (c) => {
116116
count++

lib/format-pretty.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ function formatLength(msg, opts) {
6262
const str = msg.string
6363
const l = str.length
6464
if (!opts.detailed) return out
65-
var col = msg.column || 0
65+
const col = msg.column || 0
6666
const diff = str.slice(0, col) + chalk.red(str.slice(col, l))
6767
return `${out}
6868
${diff}`

lib/rules/fixes-url.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ module.exports = {
7878
}
7979

8080
function findLineAndColumn(body, str) {
81-
for (var i = 0; i < body.length; i++) {
81+
for (let i = 0; i < body.length; i++) {
8282
const l = body[i]
8383
if (~l.indexOf('Fixes')) {
8484
const idx = l.indexOf(str)

lib/rules/line-length.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ module.exports = {
2828
})
2929
return
3030
}
31-
var failed = false
31+
let failed = false
3232
for (let i = 0; i < parsed.body.length; i++) {
3333
const line = parsed.body[i]
3434
// Skip quoted lines, e.g. for original commit messages of V8 backports.

lib/rules/metadata-end.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ module.exports = {
1717
if (end < body.length) {
1818
const extra = body.slice(end + 1)
1919
let lineNum = end + 1
20-
for (var i = 0; i < extra.length; i++) {
20+
for (let i = 0; i < extra.length; i++) {
2121
if (extra[i]) {
2222
lineNum += i
2323
break

lib/rules/pr-url.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,9 @@ module.exports = {
2323
})
2424
return
2525
}
26-
var line = -1
27-
var column = -1
28-
for (var i = 0; i < context.body.length; i++) {
26+
let line = -1
27+
let column = -1
28+
for (let i = 0; i < context.body.length; i++) {
2929
const l = context.body[i]
3030
if (~l.indexOf('PR-URL') && ~l.indexOf(context.prUrl)) {
3131
line = i

lib/rules/subsystem.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ module.exports = {
108108
})
109109
}
110110
} else {
111-
var failed = false
111+
let failed = false
112112
for (const sub of parsed.subsystems) {
113113
if (!~subs.indexOf(sub)) {
114114
failed = true

0 commit comments

Comments
 (0)