diff --git a/packages/eslint-plugin-react-hooks/index.js b/packages/eslint-plugin-react-hooks/index.js index ce26a10c31518..4c18af7c001f7 100644 --- a/packages/eslint-plugin-react-hooks/index.js +++ b/packages/eslint-plugin-react-hooks/index.js @@ -1 +1,11 @@ module.exports = require('./src/index.ts'); + +// Hint to Node’s cjs-module-lexer to make named imports work +// https://github.com/facebook/react/issues/34801#issuecomment-3433478810 +// eslint-disable-next-line ft-flow/no-unused-expressions +0 && + (module.exports = { + meta: true, + rules: true, + configs: true, + }); diff --git a/packages/eslint-plugin-react-hooks/npm/index.d.ts b/packages/eslint-plugin-react-hooks/npm/index.d.ts index c883d6f8adf6c..7516dc1e846e2 100644 --- a/packages/eslint-plugin-react-hooks/npm/index.d.ts +++ b/packages/eslint-plugin-react-hooks/npm/index.d.ts @@ -5,4 +5,6 @@ * LICENSE file in the root directory of this source tree. */ -export {default} from './cjs/eslint-plugin-react-hooks'; +import reactHooks from './cjs/eslint-plugin-react-hooks'; + +export = reactHooks; diff --git a/packages/eslint-plugin-react-hooks/src/index.ts b/packages/eslint-plugin-react-hooks/src/index.ts index 6d72c1daa57a9..924299d898948 100644 --- a/packages/eslint-plugin-react-hooks/src/index.ts +++ b/packages/eslint-plugin-react-hooks/src/index.ts @@ -71,7 +71,10 @@ const configs = { plugins, rules: recommendedLatestRuleConfigs, }, - flat: {} as Record, + flat: {} as { + recommended: ReactHooksFlatConfig; + 'recommended-latest': ReactHooksFlatConfig; + }, }; const plugin = {