Skip to content

💡 Rename "ignore" to "ignoreFiles" #965

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
Zamiell opened this issue Mar 2, 2025 · 2 comments
Open

💡 Rename "ignore" to "ignoreFiles" #965

Zamiell opened this issue Mar 2, 2025 · 2 comments
Labels
feature request Feature request

Comments

@Zamiell
Copy link
Contributor

Zamiell commented Mar 2, 2025

Suggest an idea for Knip

Introduction

Currently, Knip has the following config properties:

  • ignore
  • ignoreBinaries
  • ignoreDependencies
  • ignoreExportsUsedInFile
  • ignoreMembers
  • ignoreUnresolved
  • ignoreWorkspaces

Here, "ignore" really means "ignoreFiles", but that is not really clear from the name alone. Even though this seems like a minor quibble with the tool, it is a cognitive hurdle to use the tool properly.

My User Story

I consider myself to be a veteran user of Knip. However, today, I started with the following config:

export default {
  ignoreBinaries: [ "tsx" ],
  ignoreDependencies: [ "complete-lint" ],
};

I needed to change this config to ignore a new file. So, I naturally tried adding a "ignoreFiles" option, forgetting that it actually supposed to be called "ignore", and then Knip failed to work properly, and let to some frustrating time wasted. If I am being frustrated as a veteran user, then surely other people who are not already familiar with Knip will also encounter difficulties with this.

Recommendation

Since this would be a breaking change, we could start by allowing both "ignore" and "ignoreFiles" interchangeably. And then we could provide a "hint" for people to rename it. And then you could finally remove "ignore" in some future major version.

@Zamiell Zamiell added the feature request Feature request label Mar 2, 2025
@webpro
Copy link
Member

webpro commented Mar 2, 2025

While I agree it might be confusing, what ignore really does is exclude any type of issue for matching files. So not only unused files are filtered out by this setting, but also unlisted dependencies or unresolved imports.

So I guess what you might be asking for is a new ignoreFiles option to exclude matching files from the unused files category in the report specifically.

@Zamiell
Copy link
Contributor Author

Zamiell commented Mar 2, 2025

I guess what you might be asking for is a new ignoreFiles option to exclude matching files from the unused files category in the report specifically.

Yes, thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature request Feature request
Projects
None yet
Development

No branches or pull requests

2 participants