tools: support DisposableStack and AsyncDisposableStack in linter

PR-URL: https://github.com/nodejs/node/pull/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>
This commit is contained in:
LiviaMedeiros 2025-05-26 04:14:06 +08:00
parent a7e4a40298
commit 381d7a4ae0
No known key found for this signature in database
GPG Key ID: 691C0F6AF4A67582
2 changed files with 14 additions and 1 deletions

View File

@ -120,6 +120,7 @@ export default [
{
languageOptions: {
globals: {
AsyncDisposableStack: 'readonly',
ByteLengthQueuingStrategy: 'readonly',
CompressionStream: 'readonly',
CountQueuingStrategy: 'readonly',
@ -128,6 +129,7 @@ export default [
Crypto: 'readonly',
CryptoKey: 'readonly',
DecompressionStream: 'readonly',
DisposableStack: 'readonly',
EventSource: 'readable',
fetch: 'readonly',
Float16Array: 'readonly',

View File

@ -356,11 +356,22 @@ export default [
name: 'SubtleCrypto',
message: "Use `const { SubtleCrypto } = require('internal/crypto/webcrypto');` instead of the global.",
},
// Float16Array is not available in primordials because it's only available with --js-float16array CLI flag.
// Float16Array is not available in primordials because it can be
// disabled with --no-js-float16array CLI flag.
{
name: 'Float16Array',
message: 'Use `const { Float16Array } = globalThis;` instead of the global.',
},
// DisposableStack and AsyncDisposableStack are not available in primordials because they can be
// disabled with --no-js-explicit-resource-management CLI flag.
{
name: 'DisposableStack',
message: 'Use `const { DisposableStack } = globalThis;` instead of the global.',
},
{
name: 'AsyncDisposableStack',
message: 'Use `const { AsyncDisposableStack } = globalThis;` instead of the global.',
},
],
'no-restricted-modules': [
'error',