Skip to content

Commit

Permalink
doc: fix eslint check on builtin modules with schemes
Browse files Browse the repository at this point in the history
  • Loading branch information
legendecas committed Dec 17, 2024
1 parent 5a868b5 commit 4b30208
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion doc/eslint.config_partial.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -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 [
{
Expand All @@ -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.',
},
],
Expand Down

0 comments on commit 4b30208

Please sign in to comment.