Skip to content

Commit f949929

Browse files
authored
fix(types): exported importX should also have flatConfigs as property (#348)
1 parent c7dacbd commit f949929

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

.changeset/soft-fishes-cover.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"eslint-plugin-import-x": patch
3+
---
4+
5+
fix(types): exported `importX` should also have `flatConfigs` as property

src/index.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ const configs = {
148148
} satisfies Record<string, PluginConfig>
149149

150150
// Base Plugin Object
151-
const plugin = {
151+
const plugin_ = {
152152
meta,
153153
configs,
154154
rules,
@@ -157,6 +157,8 @@ const plugin = {
157157
createNodeResolver,
158158
}
159159

160+
const plugin = plugin_ as typeof plugin_ & { flatConfigs: typeof flatConfigs }
161+
160162
// Create flat configs (Only ones that declare plugins and parser options need to be different from the legacy config)
161163
const createFlatConfig = (
162164
baseConfig: PluginFlatBaseConfig,
@@ -183,7 +185,9 @@ const flatConfigs = {
183185
typescript: createFlatConfig(typescriptFlat, 'typescript'),
184186
} satisfies Record<string, PluginFlatConfig>
185187

186-
export default Object.assign(plugin, { flatConfigs })
188+
plugin.flatConfigs = flatConfigs
189+
190+
export default plugin
187191

188192
export {
189193
meta,

0 commit comments

Comments
 (0)