summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRich Trott <rtrott@gmail.com>2022-04-01 21:18:40 -0700
committerJuan José Arboleda <soyjuanarbol@gmail.com>2022-04-06 12:25:55 -0500
commitd64c4fb94ddc05c47bf824389eeef23bb5cee5a4 (patch)
tree8f0166508c0005d009bcacf8f5f4fe9b478554e1
parenta9dc3a92d920dbdccc85ea603b3c65abd57dda05 (diff)
downloadnode-new-d64c4fb94ddc05c47bf824389eeef23bb5cee5a4.tar.gz
tools: enable no-var ESLint rule for lib
PR-URL: https://github.com/nodejs/node/pull/42573 Reviewed-By: Darshan Sen <raisinten@gmail.com> Reviewed-By: Mohammed Keyvanzadeh <mohammadkeyvanzade94@gmail.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Akhil Marsonya <akhil.marsonya27@gmail.com> Reviewed-By: Michaël Zasso <targos@protonmail.com>
-rw-r--r--.eslintrc.js1
-rw-r--r--benchmark/.eslintrc.yaml1
-rw-r--r--doc/.eslintrc.yaml1
-rw-r--r--lib/internal/async_hooks.js2
-rw-r--r--lib/internal/js_stream_socket.js1
-rw-r--r--test/.eslintrc.yaml1
-rw-r--r--tools/.eslintrc.yaml1
7 files changed, 4 insertions, 4 deletions
diff --git a/.eslintrc.js b/.eslintrc.js
index d44e3f1414..97affb91c0 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 6871299ade..aa014eec4e 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 fbc115669a..e8d24adb6e 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 ebc9254d5c..107aab227e 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 faad988e82..f2a0ecaa1d 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 878ea7b975..e8295cd3e2 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 de30cf6d12..d9a7929836 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