Skip to content

Exports assignments not being picked up by no-unused-modules #1984

@paleite

Description

@paleite

First of all, thanks for a great plugin! This has aided our team and saved us HOURS of debugging and it makes our imports and exports really consistent 🙂
I'm using export assignments (export = , see https://www.typescriptlang.org/docs/handbook/modules.html#export--and-import--require ) in some of my TypeScript modules and no-unused-modules claims the modules aren't exporting anything.

Background, I'm writing my ESLint config in TypeScript, and want the compiled TypeScript code to say module.exports = eslintConfig

My ESLint config for the rule looks like this:
"import/no-unused-modules": ["error", { missingExports: true }]

And the module looks like this:

index.ts:

const eslintConfig = {
  rules: {
    "import/no-unused-modules": ["error", { missingExports: true }],
  },
};

export = eslintConfig;

no-unused-modules with missingExports set to true will claim index.ts does not export a module.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions