Skip to content

Ignore import-x/no-unused-modules on certain files #433

@sofianegargouri

Description

@sofianegargouri

I'm using Next.js.

There are conventions of named exports or default exports in certain file names that are not imported anywhere else.

I would like to use the import-x/no-unused-modules rule to be able to flag unused code on my helper files or libraries. But when I'm using it as follows:

'import-x/no-unused-modules': ['error', { unusedExports: true, missingExports: true }]

I have errors on both my next files and the missing exports in the .d.ts files.

I would like to be able to configure the rule as follows:

'import-x/no-unused-modules': ['error', { unusedExports: {enabled: true, ignorePatterns: '**/{layout,page,middleware}.ts{,x}'}, missingExports: {enabled: true, ignorePatterns: '**/*.d.ts'} }]

I don't know if there is currenly a way to do this, all I understood with the documentation is that I can ignore patterns for all my rules (which I do not really want, I still want those files to be linted by other rules).

If there is currently a way to do that, maybe adding it to the documentation could be nice.

Cheers !

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