Skip to content

Commit 2c007d0

Browse files
authored
fix: share same plugin reference for default export (#344)
1 parent a55dcc7 commit 2c007d0

File tree

3 files changed

+13
-11
lines changed

3 files changed

+13
-11
lines changed

.changeset/nasty-dolls-check.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: share same plugin reference for default export

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ In the new system, `.eslintrc*` is no longer used. `eslint.config.*` would be th
9999

100100
```js
101101
import js from '@eslint/js'
102-
import * as importX from 'eslint-plugin-import-x'
102+
import { importX } from 'eslint-plugin-import-x'
103103

104104
export default [js.configs.recommended, importX.flatConfigs.recommended]
105105
```
@@ -114,7 +114,7 @@ npm install eslint-import-resolver-typescript --save-dev
114114

115115
```js
116116
import js from '@eslint/js'
117-
import * as importX from 'eslint-plugin-import-x'
117+
import { importX } from 'eslint-plugin-import-x'
118118
import tsParser from '@typescript-eslint/parser'
119119

120120
export default [

src/index.ts

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,11 @@ const configs = {
150150
// Base Plugin Object
151151
const plugin = {
152152
meta,
153+
configs,
153154
rules,
155+
cjsRequire,
156+
importXResolverCompat,
157+
createNodeResolver,
154158
}
155159

156160
// Create flat configs (Only ones that declare plugins and parser options need to be different from the legacy config)
@@ -179,15 +183,7 @@ const flatConfigs = {
179183
typescript: createFlatConfig(typescriptFlat, 'typescript'),
180184
} satisfies Record<string, PluginFlatConfig>
181185

182-
export default {
183-
meta,
184-
configs,
185-
flatConfigs,
186-
rules,
187-
cjsRequire,
188-
importXResolverCompat,
189-
createNodeResolver,
190-
}
186+
export default Object.assign(plugin, { flatConfigs })
191187

192188
export {
193189
meta,
@@ -197,6 +193,7 @@ export {
197193
cjsRequire,
198194
importXResolverCompat,
199195
createNodeResolver,
196+
plugin as importX,
200197
}
201198

202199
export type * from './types.js'

0 commit comments

Comments
 (0)