Skip to content

Commit 65e7bf7

Browse files
committed
squash: add hack to load tap formatter
1 parent c400d0d commit 65e7bf7

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

eslint.config.mjs

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import Module from 'node:module';
12
import { fileURLToPath, URL } from 'node:url';
23

34
import 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

1517
const js = requireEslintTool('@eslint/js');
@@ -22,6 +24,19 @@ const stylisticJs = requireEslintTool('@stylistic/eslint-plugin-js');
2224
const nodeCore = requireEslintTool('eslint-plugin-node-core');
2325
nodeCore.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+
2540
export default [
2641
// #region ignores
2742
{

0 commit comments

Comments
 (0)