Skip to content

Commit 8c16592

Browse files
fix(eslint-plugin-reactotron): Fix ESLint Plugin CommonJS Export Compatibility (#1578)
## Please verify the following: - [x] `yarn build-and-test:local` passes - [ ] I have added tests for any new features, if relevant - [ ] `README.md` (or relevant documentation) has been updated with your changes ## Describe your PR Fixes: [infinitered/ignite#2997](infinitered/ignite#2997) ### Problem The eslint-plugin-reactotron v0.1.8 fails with "Definition for rule 'reactotron/no-tron-in-production' was not found". This affects all new Ignite CLI projects and any project using the ESLint plugin. ### Root Cause Migration from Rollup to react-native-builder-bob changed the CommonJS export format. Builder Bob outputs exports.default = plugin (standard Babel behavior), but ESLint expects the plugin to be available directly as the module export, not nested under .default. ### Solution Modified the source code export structure to improve CommonJS compatibility: ```ts // Before const eslintPluginReactotron: Linter.Plugin = { rules: { "no-tron-in-production": noTronInProduction, }, } satisfies Linter.Plugin export default eslintPluginReactotron // After export const rules: Record<string, any> = { "no-tron-in-production": noTronInProduction, } const plugin: Linter.Plugin = { rules } export default plugin ```
1 parent a94e313 commit 8c16592

File tree

1 file changed

+6
-6
lines changed
  • lib/eslint-plugin-reactotron/src

1 file changed

+6
-6
lines changed

lib/eslint-plugin-reactotron/src/index.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,10 @@ import { noTronInProduction } from "./rules/no-tron-in-production"
1616
}
1717
```
1818
*/
19-
const eslintPluginReactotron: Linter.Plugin = {
20-
rules: {
21-
"no-tron-in-production": noTronInProduction,
22-
},
23-
} satisfies Linter.Plugin
19+
export const rules: Record<string, any> = {
20+
"no-tron-in-production": noTronInProduction,
21+
}
2422

25-
export default eslintPluginReactotron
23+
// Export the plugin object directly
24+
const plugin: Linter.Plugin = { rules }
25+
export default plugin

0 commit comments

Comments
 (0)