diff --git a/.eslintrc.js b/.eslintrc.js index f6de7559cb4fa1..ea69a2893ff188 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -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', diff --git a/benchmark/.eslintrc.yaml b/benchmark/.eslintrc.yaml index 6871299adece7b..aa014eec4e3627 100644 --- a/benchmark/.eslintrc.yaml +++ b/benchmark/.eslintrc.yaml @@ -5,5 +5,4 @@ env: es6: true rules: - no-var: error prefer-arrow-callback: error diff --git a/doc/.eslintrc.yaml b/doc/.eslintrc.yaml index fbc115669a7166..e8d24adb6e00aa 100644 --- a/doc/.eslintrc.yaml +++ b/doc/.eslintrc.yaml @@ -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 diff --git a/lib/internal/async_hooks.js b/lib/internal/async_hooks.js index ebc9254d5c5109..107aab227e4637 100644 --- a/lib/internal/async_hooks.js +++ b/lib/internal/async_hooks.js @@ -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]( @@ -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); diff --git a/lib/internal/js_stream_socket.js b/lib/internal/js_stream_socket.js index faad988e820ffa..f2a0ecaa1d8a65 100644 --- a/lib/internal/js_stream_socket.js +++ b/lib/internal/js_stream_socket.js @@ -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(); diff --git a/test/.eslintrc.yaml b/test/.eslintrc.yaml index 878ea7b975df11..e8295cd3e23621 100644 --- a/test/.eslintrc.yaml +++ b/test/.eslintrc.yaml @@ -6,7 +6,6 @@ env: rules: multiline-comment-style: [error, separate-lines] - no-var: error prefer-const: error symbol-description: off diff --git a/tools/.eslintrc.yaml b/tools/.eslintrc.yaml index de30cf6d123f33..d9a7929836d91f 100644 --- a/tools/.eslintrc.yaml +++ b/tools/.eslintrc.yaml @@ -12,4 +12,3 @@ rules: - error - args: after-used prefer-arrow-callback: error - no-var: error