Skip to content

ntnyq/no-duplicate-exports ​

Disallow duplicate exports statement.

  • 🔧 The --fix option on the command line can automatically fix some of the problems reported by this rule.

📖 Rule Details ​

This rule reports multiple same export all statement.

ts
export * from './foobar'

export * as foobar from './foobar'

export { bar, foo } from './foobar'

export type * from './foobar'

export type * as Foobar from './foobar'
correct
ts
export * from './foobar'
export * from './foobar'
export { foo } from './foobar'
export { bar } from './foobar'
export * as foobar from './foobar'
export * as foobar from './foobar'
export type * from './foobar'
export type * from './foobar'
export type * as Foobar from './foobar'
export type * as Foobar from './foobar'
incorrect

🔧 Options ​

ts
export type Options = [
  {
    style?: 'inline' | 'separate'
  },
]

Default to separate.

With inline, type specifiers can be merged into a value export from the same source. A group containing only export type declarations stays type-only, so fixing cannot introduce a runtime dependency. Mixed groups are merged at the first value export to preserve module evaluation order.

Declarations with different import attributes or namespace export names remain separate. Fixes preserve comments; a declaration containing an internal comment may be reported without an automatic fix.

🚀 Version ​

This rule was introduced in eslint-plugin-ntnyq v0.8.1

🔍 Implementation ​