Prerequisites
Reproduction url
https://github.com/dorshinar/knip-css-comment-repro
Reproduction access
Description of the issue
knip's CSS import scanner extracts @import '…'; statements textually without stripping /* … */ comments, so an @import that appears only inside a comment is treated as a real dependency edge. When the specifier resolves back to the same file (e.g. via the package's exports map), the new cycles issue type reports a false self-cycle.
Reproduction
theme.css:
/**
* Usage:
* @import '@your-scope/theme/tailwind-theme.css';
*/
@import 'tailwindcss/theme';
package.json:
{ "exports": { "./tailwind-theme.css": "./src/theme.css" } }
Run: knip --include cycles (with rules: { cycles: 'error' }).
Expected: the commented-out @import is ignored; no cycle.
Actual: Circular dependencies (1): src/theme.css → src/theme.css.
Removing the @import line from the comment eliminates the report.
Environment: knip 6.25.0. The same comment-unaware regex scanning is present in the scss/less compilers.
Prerequisites
Reproduction url
https://github.com/dorshinar/knip-css-comment-repro
Reproduction access
Description of the issue
knip's CSS import scanner extracts @import '…'; statements textually without stripping /* … */ comments, so an @import that appears only inside a comment is treated as a real dependency edge. When the specifier resolves back to the same file (e.g. via the package's exports map), the new cycles issue type reports a false self-cycle.
Reproduction
theme.css:
package.json:
{ "exports": { "./tailwind-theme.css": "./src/theme.css" } }Run:
knip --include cycles(with rules: { cycles: 'error' }).Expected: the commented-out @import is ignored; no cycle.
Actual: Circular dependencies (1): src/theme.css → src/theme.css.
Removing the @import line from the comment eliminates the report.
Environment: knip 6.25.0. The same comment-unaware regex scanning is present in the scss/less compilers.