From d939cc4bd483850c791c74d99b1b4962fa7f4275 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Arnaud=20Barr=C3=A9?= Date: Mon, 2 Dec 2024 12:39:04 +0100 Subject: [PATCH] Fix exports [publish] --- CHANGELOG.md | 4 ++++ package.json | 2 +- src/index.ts | 37 ++++++++++++++++++------------------- 3 files changed, 23 insertions(+), 20 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5657660..61e8f6b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # Changelog +## 0.4.16 + +Fix CJS/ESM interop issue. Sorry everyone for the trouble. + ## 0.4.15 ### Add support for custom HOCs (#60) diff --git a/package.json b/package.json index fc5ab10..4cd1b7c 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "eslint-plugin-react-refresh", - "version": "0.4.15", + "version": "0.4.16", "type": "module", "license": "MIT", "scripts": { diff --git a/src/index.ts b/src/index.ts index ef12772..e6a56d8 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1,26 +1,25 @@ import { onlyExportComponents } from "./only-export-components.ts"; -const plugin = { - rules: { - "only-export-components": onlyExportComponents, - }, +export const rules = { + "only-export-components": onlyExportComponents, }; +const plugin = { rules }; -export default { - rules: plugin.rules, - configs: { - recommended: { - plugins: { "react-refresh": plugin }, - rules: { "react-refresh/only-export-components": "error" }, - }, - vite: { - plugins: { "react-refresh": plugin }, - rules: { - "react-refresh/only-export-components": [ - "error", - { allowConstantExport: true }, - ], - }, +export const configs = { + recommended: { + plugins: { "react-refresh": plugin }, + rules: { "react-refresh/only-export-components": "error" }, + }, + vite: { + plugins: { "react-refresh": plugin }, + rules: { + "react-refresh/only-export-components": [ + "error", + { allowConstantExport: true }, + ], }, }, }; + +// Probably not needed, but keep for backwards compatibility +export default { rules, configs };