Skip to content

Commit d64c4fb

Browse files
Trottjuanarbol
authored andcommitted
tools: enable no-var ESLint rule for lib
PR-URL: #42573 Reviewed-By: Darshan Sen <[email protected]> Reviewed-By: Mohammed Keyvanzadeh <[email protected]> Reviewed-By: Matteo Collina <[email protected]> Reviewed-By: Akhil Marsonya <[email protected]> Reviewed-By: Michaël Zasso <[email protected]>
1 parent a9dc3a9 commit d64c4fb

File tree

7 files changed

+4
-4
lines changed

7 files changed

+4
-4
lines changed

.eslintrc.js

+1
Original file line numberDiff line numberDiff line change
@@ -260,6 +260,7 @@ module.exports = {
260260
'no-useless-concat': 'error',
261261
'no-useless-constructor': 'error',
262262
'no-useless-return': 'error',
263+
'no-var': 'error',
263264
'no-void': 'error',
264265
'no-whitespace-before-property': 'error',
265266
'object-curly-newline': 'error',

benchmark/.eslintrc.yaml

-1
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,4 @@ env:
55
es6: true
66

77
rules:
8-
no-var: error
98
prefer-arrow-callback: error

doc/.eslintrc.yaml

-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ rules:
99
symbol-description: off
1010

1111
# Add new ECMAScript features gradually
12-
no-var: error
1312
prefer-const: error
1413
prefer-rest-params: error
1514
prefer-template: error

lib/internal/async_hooks.js

+2
Original file line numberDiff line numberDiff line change
@@ -196,6 +196,7 @@ function emitInitNative(asyncId, type, triggerAsyncId, resource) {
196196
try {
197197
// Using var here instead of let because "for (var ...)" is faster than let.
198198
// Refs: https://github.com/nodejs/node/pull/30380#issuecomment-552948364
199+
// eslint-disable-next-line no-var
199200
for (var i = 0; i < active_hooks.array.length; i++) {
200201
if (typeof active_hooks.array[i][init_symbol] === 'function') {
201202
active_hooks.array[i][init_symbol](
@@ -228,6 +229,7 @@ function emitHook(symbol, asyncId) {
228229
try {
229230
// Using var here instead of let because "for (var ...)" is faster than let.
230231
// Refs: https://github.com/nodejs/node/pull/30380#issuecomment-552948364
232+
// eslint-disable-next-line no-var
231233
for (var i = 0; i < active_hooks.array.length; i++) {
232234
if (typeof active_hooks.array[i][symbol] === 'function') {
233235
active_hooks.array[i][symbol](asyncId);

lib/internal/js_stream_socket.js

+1
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,7 @@ class JSStreamSocket extends Socket {
171171

172172
this.stream.cork();
173173
// Use `var` over `let` for performance optimization.
174+
// eslint-disable-next-line no-var
174175
for (var i = 0; i < bufs.length; ++i)
175176
this.stream.write(bufs[i], done);
176177
this.stream.uncork();

test/.eslintrc.yaml

-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ env:
66

77
rules:
88
multiline-comment-style: [error, separate-lines]
9-
no-var: error
109
prefer-const: error
1110
symbol-description: off
1211

tools/.eslintrc.yaml

-1
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,3 @@ rules:
1212
- error
1313
- args: after-used
1414
prefer-arrow-callback: error
15-
no-var: error

0 commit comments

Comments
 (0)