Skip to content

Commit a04cc3b

Browse files
committed
Remove esquery hack
1 parent e57e912 commit a04cc3b

File tree

2 files changed

+3
-7
lines changed

2 files changed

+3
-7
lines changed

next.config.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,9 @@ const nextConfig = {
3636
// Don't bundle the shim unnecessarily.
3737
config.resolve.alias['use-sync-external-store/shim'] = 'react';
3838

39+
// TODO comment
40+
config.resolve.alias['esquery'] = 'esquery/dist/esquery.min.js';
41+
3942
const {IgnorePlugin, NormalModuleReplacementPlugin} = require('webpack');
4043
config.plugins.push(
4144
new NormalModuleReplacementPlugin(

src/components/MDX/Sandpack/runESLint.tsx

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,6 @@ const getCodeMirrorPosition = (
2121

2222
const linter = new Linter();
2323

24-
// HACK! Eslint requires 'esquery' using `require`, but there's no commonjs interop.
25-
// because of this it tries to run `esquery.parse()`, while there's only `esquery.default.parse()`.
26-
// This hack places the functions in the right place.
27-
const esquery = require('esquery');
28-
esquery.parse = esquery.default?.parse;
29-
esquery.matches = esquery.default?.matches;
30-
3124
const reactRules = require('eslint-plugin-react-hooks').rules;
3225
linter.defineRules({
3326
'react-hooks/rules-of-hooks': reactRules['rules-of-hooks'],

0 commit comments

Comments
 (0)