Skip to content

Handle @plugin options blocks in Tailwind CSS compiler - #2187

Merged
webpro merged 1 commit into
webpro-nl:mainfrom
mkantautas:fix/tailwind-plugin-block
Oct 22, 2026
Merged

webpro merged 1 commit into
webpro-nl:mainfrom
mkantautas:fix/tailwind-plugin-block

Conversation

@mkantautas

Copy link
Copy Markdown
Contributor

A @plugin options block with no ; before its closing } makes the directive match run on to the next ; in the file, so the directives after it (or the plugin itself) are missed. With @plugin "@tailwindcss/typography" {}, then @plugin "@tailwindcss/forms" { strategy: "class" } and @plugin "daisyui" {}, Knip reports @tailwindcss/forms and daisyui as unused devDependencies. Tailwind accepts both forms and applies the options.

A directive followed by an options block now ends at its {; other directives still end at ;.

Extended the compilers/tailwind fixture with an options block, a block without a trailing ; and an empty block, and added a compiler test that also has braces in an @import parameter and a comment. On main the fixture test fails with files: 2 and devDependencies: 1; both tests pass now. pnpm run ci and the full test suite pass.

@pkg-pr-new

pkg-pr-new Bot commented Oct 22, 2026

Copy link
Copy Markdown

Open in StackBlitz

npm i https://pkg.pr.new/knip@2187
npm i https://pkg.pr.new/@knip/language-server@2187
npm i https://pkg.pr.new/@knip/mcp@2187

commit: 7cdf1a0

@webpro webpro left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, Mantas! Nice catch, and good coverage with the braces in source() and the comment.

@webpro
webpro merged commit 9fae773 into webpro-nl:main Oct 22, 2026
32 checks passed
@webpro

webpro commented Oct 24, 2026

Copy link
Copy Markdown
Member

πŸš€ This pull request is included in v6.43.0. See Release 6.43.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