Open mesqueeb opened 7 months ago
It appears to not even be importable because it is built in CommonJS. I get No "exports" main defined
errors when trying to import anything from this package into an ESLint v9 flat config.
+1
https://eslint.org/docs/latest/use/configure/migration-guide#using-eslintrc-configs-in-flat-config
Specifically, do this:
import {fileURLToPath} from 'node:url';
import {FlatCompat} from '@eslint/eslintrc';
const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);
const compat = new FlatCompat({
baseDirectory: __dirname,
});
// ESM config export
export default [
...compat.plugins('require-extensions'),
...compat.extends('plugin:require-extensions/recommended'),
// rest of your config
]
The new @eslint/compat
tool that's supposed to help migrate your .eslintrc
incorrectly migrates this plugin, because it can't be import
ed.
You can still use compat.plugins
, but you'll need to remove the import
and fixupPluginRules
call that is generated.
how to use it in the new eslint flat config