| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -83,6 +83,12 @@ rules: | |||
| 83 | 83 | message: Use `const { atob } = require('buffer');` instead of the global. | |
| 84 | 84 | - name: btoa | |
| 85 | 85 | message: Use `const { btoa } = require('buffer');` instead of the global. | |
| 86 | + - name: clearImmediate | ||
| 87 | + message: Use `const { clearImmediate } = require('timers');` instead of the global. | ||
| 88 | + - name: clearInterval | ||
| 89 | + message: Use `const { clearInterval } = require('timers');` instead of the global. | ||
| 90 | + - name: clearTimeout | ||
| 91 | + message: Use `const { clearTimeout } = require('timers');` instead of the global. | ||
| 86 | 92 | - name: crypto | |
| 87 | 93 | message: Use `const { crypto } = require('internal/crypto/webcrypto');` instead of the global. | |
| 88 | 94 | - name: Crypto | |
@@ -99,6 +105,12 @@ rules: | |||
| 99 | 105 | message: Use `const { performance } = require('perf_hooks');` instead of the global. | |
| 100 | 106 | - name: queueMicrotask | |
| 101 | 107 | message: Use `const { queueMicrotask } = require('internal/process/task_queues');` instead of the global. | |
| 108 | + - name: setImmediate | ||
| 109 | + message: Use `const { setImmediate } = require('timers');` instead of the global. | ||
| 110 | + - name: setInterval | ||
| 111 | + message: Use `const { setInterval } = require('timers');` instead of the global. | ||
| 112 | + - name: setTimeout | ||
| 113 | + message: Use `const { setTimeout } = require('timers');` instead of the global. | ||
| 102 | 114 | - name: SubtleCrypto | |
| 103 | 115 | message: Use `const { SubtleCrypto } = require('internal/crypto/webcrypto');` instead of the global. | |
| 104 | 116 | # Custom rules in tools/eslint-rules | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -14,6 +14,11 @@ const { | |||
| 14 | 14 | Immediate, | |
| 15 | 15 | insert | |
| 16 | 16 | } = require('internal/timers'); | |
| 17 | + const { | ||
| 18 | + clearImmediate, | ||
| 19 | + clearInterval, | ||
| 20 | + clearTimeout, | ||
| 21 | + } = require('timers'); | ||
| 17 | 22 | ||
| 18 | 23 | const { | |
| 19 | 24 | AbortError, | |
@@ -73,7 +78,6 @@ function setTimeout(after, value, options = {}) { | |||
| 73 | 78 | insert(timeout, timeout._idleTimeout); | |
| 74 | 79 | if (signal) { | |
| 75 | 80 | oncancel = FunctionPrototypeBind(cancelListenerHandler, | |
| 76 | - // eslint-disable-next-line no-undef | ||
| 77 | 81 | timeout, clearTimeout, reject); | |
| 78 | 82 | signal.addEventListener('abort', oncancel); | |
| 79 | 83 | } | |
@@ -117,7 +121,6 @@ function setImmediate(value, options = {}) { | |||
| 117 | 121 | if (!ref) immediate.unref(); | |
| 118 | 122 | if (signal) { | |
| 119 | 123 | oncancel = FunctionPrototypeBind(cancelListenerHandler, | |
| 120 | - // eslint-disable-next-line no-undef | ||
| 121 | 124 | immediate, clearImmediate, reject); | |
| 122 | 125 | signal.addEventListener('abort', oncancel); | |
| 123 | 126 | } | |
@@ -152,7 +155,6 @@ async function* setInterval(after, value, options = {}) { | |||
| 152 | 155 | insert(interval, interval._idleTimeout); | |
| 153 | 156 | if (signal) { | |
| 154 | 157 | onCancel = () => { | |
| 155 | - // eslint-disable-next-line no-undef | ||
| 156 | 158 | clearInterval(interval); | |
| 157 | 159 | if (callback) { | |
| 158 | 160 | callback(PromiseReject(new AbortError())); | |
@@ -172,7 +174,6 @@ async function* setInterval(after, value, options = {}) { | |||
| 172 | 174 | } | |
| 173 | 175 | throw new AbortError(); | |
| 174 | 176 | } finally { | |
| 175 | - // eslint-disable-next-line no-undef | ||
| 176 | 177 | clearInterval(interval); | |
| 177 | 178 | signal?.removeEventListener('abort', onCancel); | |
| 178 | 179 | } | |
| Back | FazBrowse Home | New Git URL |
0 commit comments