tools: support `DisposableStack` and `AsyncDisposableStack` in linter · nodejs/node@fcc881d

2 files changed

lines changed

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',

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',