Fix undefined when no options or prefix were provided. - #138
Conversation
There was a problem hiding this comment.
🟡 Changes recommended
It claims to fix #135, but the published TypeScript declaration still exposes PluginCreator<T> (keeping opts optional), so the issue’s required-signature requirement is not actually addressed.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Pull request overview
This PR prevents postcss-prefix-selector from prefixing selectors with the literal string undefined when the plugin is invoked without options or without a prefix, and adds regression coverage for those cases (noting that the linked issue #135 is specifically about TypeScript’s published call signature).
Changes:
- Add a runtime guard in
index.jsto no-op whenoptionsis missing/invalid oroptions.prefixis not provided. - Add tests asserting the plugin makes no changes when called with no options or with
{}. - Rename the coverage script from
test-covtotest:cov.
File summaries
| File | Description |
|---|---|
| index.js | Adds a no-op early return to avoid undefined prefixing when prefix is missing. |
| test/test.js | Adds regression tests for no-options / no-prefix invocations. |
| package.json | Renames the coverage test script to test:cov. |
Review details
- Files reviewed: 3/3 changed files
- Comments generated: 1
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Fixes #135
prefixPluginremains typed asPluginCreator<T>and safely returns a no-op plugin when options or prefix is missing.