Skip to content

Commit

Permalink
tools: enable no-var ESLint rule for lib
Browse files Browse the repository at this point in the history
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]>
  • Loading branch information
Trott authored and juanarbol committed Apr 6, 2022
1 parent a9dc3a9 commit d64c4fb
Show file tree
Hide file tree
Showing 7 changed files with 4 additions and 4 deletions.
1 change: 1 addition & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -260,6 +260,7 @@ module.exports = {
'no-useless-concat': 'error',
'no-useless-constructor': 'error',
'no-useless-return': 'error',
'no-var': 'error',
'no-void': 'error',
'no-whitespace-before-property': 'error',
'object-curly-newline': 'error',
Expand Down
1 change: 0 additions & 1 deletion benchmark/.eslintrc.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,4 @@ env:
es6: true

rules:
no-var: error
prefer-arrow-callback: error
1 change: 0 additions & 1 deletion doc/.eslintrc.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ rules:
symbol-description: off

# Add new ECMAScript features gradually
no-var: error
prefer-const: error
prefer-rest-params: error
prefer-template: error
Expand Down
2 changes: 2 additions & 0 deletions lib/internal/async_hooks.js
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,7 @@ function emitInitNative(asyncId, type, triggerAsyncId, resource) {
try {
// Using var here instead of let because "for (var ...)" is faster than let.
// Refs: https://github.com/nodejs/node/pull/30380#issuecomment-552948364
// eslint-disable-next-line no-var
for (var i = 0; i < active_hooks.array.length; i++) {
if (typeof active_hooks.array[i][init_symbol] === 'function') {
active_hooks.array[i][init_symbol](
Expand Down Expand Up @@ -228,6 +229,7 @@ function emitHook(symbol, asyncId) {
try {
// Using var here instead of let because "for (var ...)" is faster than let.
// Refs: https://github.com/nodejs/node/pull/30380#issuecomment-552948364
// eslint-disable-next-line no-var
for (var i = 0; i < active_hooks.array.length; i++) {
if (typeof active_hooks.array[i][symbol] === 'function') {
active_hooks.array[i][symbol](asyncId);
Expand Down
1 change: 1 addition & 0 deletions lib/internal/js_stream_socket.js
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,7 @@ class JSStreamSocket extends Socket {

this.stream.cork();
// Use `var` over `let` for performance optimization.
// eslint-disable-next-line no-var
for (var i = 0; i < bufs.length; ++i)
this.stream.write(bufs[i], done);
this.stream.uncork();
Expand Down
1 change: 0 additions & 1 deletion test/.eslintrc.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ env:

rules:
multiline-comment-style: [error, separate-lines]
no-var: error
prefer-const: error
symbol-description: off

Expand Down
1 change: 0 additions & 1 deletion tools/.eslintrc.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,3 @@ rules:
- error
- args: after-used
prefer-arrow-callback: error
no-var: error

0 comments on commit d64c4fb

Please sign in to comment.