Skip to content
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

feat(plugin-eslint): support eslint.config.ts files #956

Merged
merged 2 commits into from
Feb 25, 2025

Conversation

cylewaitforit
Copy link
Contributor

@cylewaitforit cylewaitforit commented Feb 23, 2025

Adds support for eslint.config.ts files to the eslint plugin's default configuration.

https://eslint.org/docs/latest/use/configure/configuration-files#typescript-configuration-files

#955

@webpro
Copy link
Member

webpro commented Feb 23, 2025

Thanks for the PR, @cylewaitforit. There are some issues around loading such config files, mostly #818

Any chance you could add a test and a fixture with e.g. a eslint.config.ts file? Then we can better find out what works and what doesn't. Otherwise, we might be adding a feature that throws exceptions for many people new to the project which wouldn't improve the first impression.

@cylewaitforit
Copy link
Contributor Author

@webpro I took a try at adding the fixture. Since it doesn't look like the eslint.config.js file has any related tests I am not really certain what to add in the eslint.tests.ts beside updating the total and processed. Please let me know if I am totally off the mark.

@webpro
Copy link
Member

webpro commented Feb 24, 2025

That's great for now, thanks!

Am I right in thinking that if you add something like eslint: ['eslint.config.ts'] to your project(s) that this works well for you already?

Copy link

pkg-pr-new bot commented Feb 24, 2025

Open in Stackblitz

npm i https://pkg.pr.new/knip@956

commit: 8f4d2f4

@cylewaitforit
Copy link
Contributor Author

cylewaitforit commented Feb 25, 2025

Yes, right now in my repo I’m using

 "eslint": {
    "entry": ["eslint.config.ts"]
  }

@webpro webpro merged commit 474dca3 into webpro-nl:main Feb 25, 2025
23 of 24 checks passed
@webpro
Copy link
Member

webpro commented Feb 25, 2025

Thanks! I was thinking ahead a bit as I'm also trying to "promote" the eslint.config.* files to config files (to also fix other issues as I've linked to, including #806), but that requires a bit more work. This is one is complete, so happy to have merged this one. Thanks again.

@webpro
Copy link
Member

webpro commented Feb 25, 2025

🚀 This pull request is included in v5.45.0. See Release 5.45.0 for release notes.

Using Knip in a commercial project? Please consider becoming a sponsor.

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

Successfully merging this pull request may close these issues.

2 participants