Skip to content

Commit

Permalink
squash: add hack to load tap formatter
Browse files Browse the repository at this point in the history
  • Loading branch information
targos committed May 22, 2024
1 parent c400d0d commit 65e7bf7
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import Module from 'node:module';
import { fileURLToPath, URL } from 'node:url';

import benchmarkConfig from './benchmark/eslint.config_partial.mjs';
Expand All @@ -10,6 +11,7 @@ import {
noRestrictedSyntaxCommonLib,
noRestrictedSyntaxCommonTest,
requireEslintTool,
resolveEslintTool,
} from './tools/eslint.config_utils.mjs';

const js = requireEslintTool('@eslint/js');
Expand All @@ -22,6 +24,19 @@ const stylisticJs = requireEslintTool('@stylistic/eslint-plugin-js');
const nodeCore = requireEslintTool('eslint-plugin-node-core');
nodeCore.RULES_DIR = fileURLToPath(new URL('./tools/eslint-rules', import.meta.url));

// The Module._resolveFilename() monkeypatching is to make it so that ESLint is able to
// dynamically load extra modules that we install with it.
const ModuleResolveFilename = Module._resolveFilename;
const hacks = [
'eslint-formatter-tap',
];
Module._resolveFilename = (request, parent, isMain, options) => {
if (hacks.includes(request) && parent.id.endsWith('__placeholder__.js')) {
return resolveEslintTool(request);
}
return ModuleResolveFilename(request, parent, isMain, options);
};

export default [
// #region ignores
{
Expand Down

0 comments on commit 65e7bf7

Please sign in to comment.