🐛 A custom stylelint plugin causes knip crash
Prerequisites
- [x] I'm using the latest version
- [x] I've read the relevant documentation
- [x] I've searched for existing issues
- [x] I've checked the list of known issues
- [x] I've read the issue reproduction guide
Reproduction url
https://github.com/Ronny-zzl/knip-stylelint-plugin
Reproduction access
- [x] I've made sure the reproduction is publicly accessible
Description of the issue
- clone the repo and
pnpm i - run
pnpm knipand the error below will occurTypeError: filePath.includes is not a function
I believe that knip interprets the plugin's path as a string, but in fact the directly imported plugin is not a string, which causes an error.
Thanks for the report, Zhang! The repro url returns a 404, though.
@webpro I'm sorry for that. It's public now.
Hello, I may facing same issue. If there is workaround, I want to know it.🙏
Looks like we need to check whether the value is a string before using it: https://github.com/webpro-nl/knip/blob/main/packages/knip/src/plugins/stylelint/index.ts#L19
Someone up for a PR maybe? :)
I found same we should fix, too. I'm trying to add test now...
@webpro I created PR! https://github.com/webpro-nl/knip/pull/1004