Skip to content

Commit 31ec890

Browse files
committed
build(eslint.config.js): determine __dirname as it is not defined in ES module scope; deprecate @rushstack/eslint-patch
1 parent 4422f68 commit 31ec890

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

eslint.config.js

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
import { dirname } from 'node:path';
2+
import { fileURLToPath } from 'node:url';
3+
14
import { defineConfig, globalIgnores } from "eslint/config";
25

36
import globals from "globals";
@@ -9,16 +12,16 @@ import vue from "eslint-plugin-vue";
912
import typescriptEslint from "@typescript-eslint/eslint-plugin";
1013
import js from "@eslint/js";
1114

12-
const {
13-
FlatCompat,
14-
} = require("@eslint/eslintrc");
15+
import { FlatCompat } from "@eslint/eslintrc";
16+
17+
const __filename = fileURLToPath(import.meta.url);
18+
const __dirname = dirname(__filename);
1519

1620
const compat = new FlatCompat({
1721
baseDirectory: __dirname,
1822
recommendedConfig: js.configs.recommended,
1923
allConfig: js.configs.all
2024
});
21-
require("@rushstack/eslint-patch/modern-module-resolution");
2225

2326
const config = defineConfig([{
2427
languageOptions: {

0 commit comments

Comments
 (0)