Skip to content

Fix undefined when no options or prefix were provided. - #138

Merged
RadValentin merged 1 commit into
masterfrom
135-3o-optional-options-object
Sep 7, 2026
Merged

RadValentin merged 1 commit into
masterfrom
135-3o-optional-options-object

Conversation

@RadValentin

@RadValentin RadValentin commented Sep 7, 2026

Copy link
Copy Markdown
Owner

Fixes #135

prefixPlugin remains typed as PluginCreator<T> and safely returns a no-op plugin when options or prefix is missing.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟡 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.js to no-op when options is missing/invalid or options.prefix is not provided.
  • Add tests asserting the plugin makes no changes when called with no options or with {}.
  • Rename the coverage script from test-cov to test: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.

Comment thread index.js
@RadValentin
RadValentin merged commit 0b1bb89 into master Sep 7, 2026
2 checks passed
@RadValentin
RadValentin deleted the 135-3o-optional-options-object branch September 7, 2026 11:03
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.

Require the options argument in the published signature

2 participants