From 4b3020821a1a29f2f808792c295b13d6c6a459e4 Mon Sep 17 00:00:00 2001 From: Chengzhong Wu Date: Tue, 17 Dec 2024 14:10:02 +0000 Subject: [PATCH] doc: fix eslint check on builtin modules with schemes --- doc/eslint.config_partial.mjs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/doc/eslint.config_partial.mjs b/doc/eslint.config_partial.mjs index edcc72930875b0..c625dbdf46857b 100644 --- a/doc/eslint.config_partial.mjs +++ b/doc/eslint.config_partial.mjs @@ -6,6 +6,7 @@ import { import { builtinModules as builtin } from 'node:module'; const globals = requireEslintTool('globals'); +const noSchemeBuiltins = builtin.filter((id) => !id.startsWith('node:')); export default [ { @@ -18,7 +19,7 @@ export default [ ...noRestrictedSyntaxCommonAll, ...noRestrictedSyntaxCommonLib, { - selector: `CallExpression[callee.name="require"][arguments.0.type="Literal"]:matches(${builtin.map((name) => `[arguments.0.value="${name}"]`).join(',')}),ImportDeclaration:matches(${builtin.map((name) => `[source.value="${name}"]`).join(',')})`, + selector: `CallExpression[callee.name="require"][arguments.0.type="Literal"]:matches(${noSchemeBuiltins.map((name) => `[arguments.0.value="${name}"]`).join(',')}),ImportDeclaration:matches(${noSchemeBuiltins.map((name) => `[source.value="${name}"]`).join(',')})`, message: 'Use `node:` prefix.', }, ],