eslint-plugin-import-x
eslint-plugin-import-x copied to clipboard
Feature: deduplicate exports
ESLint config
// eslint.config.mjs
import { config, configs } from 'typescript-eslint'
import pluginImportX from 'eslint-plugin-import-x'
export default config({
extends: [configs.recommended],
plugins: {
'import-x': pluginImportX
},
rules: {
'import-x/no-duplicates': 'error',
'import-x/export': 'error'
}
})
Code
// foo.ts
export const foo = 'bar'
export const bar = 'foo'
export * from './foo'
export * from './foo'
export { foo } from './foo'
export { bar } from './foo'
Expect behavior
- report user to delete one
export * from './foo' - report user to merge named export from same module. Like
import-x/no-duplicatesdoes for import statement
Current behavior
Nothing.