From 3f448e5597b533ad4497ea421fe92336242a6a32 Mon Sep 17 00:00:00 2001 From: Renegade334 Date: Wed, 1 Jul 2026 15:58:58 +0200 Subject: [PATCH 1/2] tools: add lint rule for `[await] using` in core Signed-off-by: Renegade334 --- lib/eslint.config_partial.mjs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lib/eslint.config_partial.mjs b/lib/eslint.config_partial.mjs index 335692e2cf4a18..e199d9d9e45bc9 100644 --- a/lib/eslint.config_partial.mjs +++ b/lib/eslint.config_partial.mjs @@ -46,6 +46,11 @@ const noRestrictedSyntax = [ selector: "CallExpression:matches([callee.type='Identifier'][callee.name='FunctionPrototypeApply'], [callee.type='MemberExpression'][callee.property.type='Identifier'][callee.property.name='apply'][arguments.length=2])", message: 'Use `ReflectApply` instead of %Function.prototype.apply%', }, + // TODO: remove once js_explicit_resource_management is unflagged in V8 + { + selector: "VariableDeclaration:matches([kind='using'], [kind='await using'])", + message: '`[await] using` statements cannot yet be used in /lib, call the disposer in a `try ... finally` block instead.', + }, ]; export default [ From c5b942695870d2631440bb793e9f247e1fb0b1c3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9?= Date: Wed, 1 Jul 2026 21:49:52 +0100 Subject: [PATCH 2/2] fixup! tools: add lint rule for `[await] using` in core Co-authored-by: Antoine du Hamel --- lib/eslint.config_partial.mjs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/eslint.config_partial.mjs b/lib/eslint.config_partial.mjs index e199d9d9e45bc9..a1f9c885a6875b 100644 --- a/lib/eslint.config_partial.mjs +++ b/lib/eslint.config_partial.mjs @@ -48,7 +48,7 @@ const noRestrictedSyntax = [ }, // TODO: remove once js_explicit_resource_management is unflagged in V8 { - selector: "VariableDeclaration:matches([kind='using'], [kind='await using'])", + selector: 'VariableDeclaration[kind=/^(await )?using$/]', message: '`[await] using` statements cannot yet be used in /lib, call the disposer in a `try ... finally` block instead.', }, ];