Skip to content

Commit fcc881d

Browse files
LiviaMedeirostargos
authored andcommitted
tools: support DisposableStack and AsyncDisposableStack in linter
PR-URL: #58454 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Chengzhong Wu <legendecas@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
1 parent 767e88c commit fcc881d

File tree

2 files changed

+14
-1
lines changed

2 files changed

+14
-1
lines changed

eslint.config.mjs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,7 @@ export default [
120120
{
121121
languageOptions: {
122122
globals: {
123+
AsyncDisposableStack: 'readonly',
123124
ByteLengthQueuingStrategy: 'readonly',
124125
CompressionStream: 'readonly',
125126
CountQueuingStrategy: 'readonly',
@@ -128,6 +129,7 @@ export default [
128129
Crypto: 'readonly',
129130
CryptoKey: 'readonly',
130131
DecompressionStream: 'readonly',
132+
DisposableStack: 'readonly',
131133
EventSource: 'readable',
132134
fetch: 'readonly',
133135
Float16Array: 'readonly',

lib/eslint.config_partial.mjs

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -356,11 +356,22 @@ export default [
356356
name: 'SubtleCrypto',
357357
message: "Use `const { SubtleCrypto } = require('internal/crypto/webcrypto');` instead of the global.",
358358
},
359-
// Float16Array is not available in primordials because it's only available with --js-float16array CLI flag.
359+
// Float16Array is not available in primordials because it can be
360+
// disabled with --no-js-float16array CLI flag.
360361
{
361362
name: 'Float16Array',
362363
message: 'Use `const { Float16Array } = globalThis;` instead of the global.',
363364
},
365+
// DisposableStack and AsyncDisposableStack are not available in primordials because they can be
366+
// disabled with --no-js-explicit-resource-management CLI flag.
367+
{
368+
name: 'DisposableStack',
369+
message: 'Use `const { DisposableStack } = globalThis;` instead of the global.',
370+
},
371+
{
372+
name: 'AsyncDisposableStack',
373+
message: 'Use `const { AsyncDisposableStack } = globalThis;` instead of the global.',
374+
},
364375
],
365376
'no-restricted-modules': [
366377
'error',

0 commit comments

Comments
 (0)