Skip to content

Warn when supportedFunctions contains an invalid regex#44

Open
Scottcjn wants to merge 3 commits into
beumerr:masterfrom
Scottcjn:fix/warn-invalid-supported-functions-regex
Open

Warn when supportedFunctions contains an invalid regex#44
Scottcjn wants to merge 3 commits into
beumerr:masterfrom
Scottcjn:fix/warn-invalid-supported-functions-regex

Conversation

@Scottcjn

Copy link
Copy Markdown
Contributor

Summary

  • validate regex-style supportedFunctions entries before building the combined detector pattern
  • warn once per invalid pattern instead of silently returning empty utility-function matches
  • keep valid literal and regex function matches working even when one entry is malformed
  • extend the class detector tests to cover the warning path and non-spam behavior

Replaces #40 (branch renamed from warn-invalid-supported-functions-regex to fix/warn-invalid-supported-functions-regex per CI branch naming convention).

Verification

  • npx vitest run test/core/classDetector.test.ts
  • npm run typecheck
  • ./node_modules/.bin/oxfmt --check src/core/classDetector.ts test/core/classDetector.test.ts test/__mocks__/vscode.ts
  • git diff --check

Closes #22

@Scottcjn Scottcjn requested a review from beumerr as a code owner March 18, 2026 02:49
Scottcjn added 2 commits May 18, 2026 10:12
- classDetector.ts: the regex-validation construction tripped no-new;
  add a targeted oxlint-disable since the constructor is intentionally
  invoked only to validate (unicorn/new-for-builtins still requires new).
- vscode.ts mock: reorder window members so showTextDocument precedes
  showWarningMessage, satisfying perfectionist sort-objects.

No behavior change.
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.

Silent failure when user provides invalid regex in supportedFunctions

1 participant