1+ import Module from 'node:module' ;
12import { fileURLToPath , URL } from 'node:url' ;
23
34import benchmarkConfig from './benchmark/eslint.config_partial.mjs' ;
@@ -10,6 +11,7 @@ import {
1011 noRestrictedSyntaxCommonLib ,
1112 noRestrictedSyntaxCommonTest ,
1213 requireEslintTool ,
14+ resolveEslintTool ,
1315} from './tools/eslint.config_utils.mjs' ;
1416
1517const js = requireEslintTool ( '@eslint/js' ) ;
@@ -22,6 +24,19 @@ const stylisticJs = requireEslintTool('@stylistic/eslint-plugin-js');
2224const nodeCore = requireEslintTool ( 'eslint-plugin-node-core' ) ;
2325nodeCore . RULES_DIR = fileURLToPath ( new URL ( './tools/eslint-rules' , import . meta. url ) ) ;
2426
27+ // The Module._resolveFilename() monkeypatching is to make it so that ESLint is able to
28+ // dynamically load extra modules that we install with it.
29+ const ModuleResolveFilename = Module . _resolveFilename ;
30+ const hacks = [
31+ 'eslint-formatter-tap' ,
32+ ] ;
33+ Module . _resolveFilename = ( request , parent , isMain , options ) => {
34+ if ( hacks . includes ( request ) && parent . id . endsWith ( '__placeholder__.js' ) ) {
35+ return resolveEslintTool ( request ) ;
36+ }
37+ return ModuleResolveFilename ( request , parent , isMain , options ) ;
38+ } ;
39+
2540export default [
2641 // #region ignores
2742 {
0 commit comments