Skip to content

New rule: no-useless-empty-export #2757

Closed
@remcohaszing

Description

@remcohaszing

In TypeScript, modules are TypeScript files that contain an import or export statement. If a file is not a module, it will be ignored by TypeScript. Sometimes a file doesn’t contain imports or exports for legitimate reasons. In this case, an empty export must be added. I.e. to augment an interface:

export {};

declare module '@appsemble/sdk' {
  interface Parameters {
    interval: number;
  }

  interface EventEmitters {
    interval: never;
  }
}

As soon as the file is modified to contain actual imports or exports, the empty export can be removed.

I’d like to propose a rule that reports empty exports if the file contains other imports / exports. This can be autofixable by removing the empty export. I’m willing to implement this.

Metadata

Metadata

Assignees

No one assigned

    Labels

    accepting prsGo ahead, send a pull request that resolves this issueenhancement: new plugin ruleNew rule request for eslint-pluginpackage: eslint-pluginIssues related to @typescript-eslint/eslint-plugin

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions