Skip to content

fix(scanner): detect "use server" after leading comments#31

Open
7etsuo wants to merge 1 commit into
vercel-labs:mainfrom
7etsuo:fix/use-server-directive-with-leading-comments
Open

fix(scanner): detect "use server" after leading comments#31
7etsuo wants to merge 1 commit into
vercel-labs:mainfrom
7etsuo:fix/use-server-directive-with-leading-comments

Conversation

@7etsuo
Copy link
Copy Markdown

@7etsuo 7etsuo commented May 5, 2026

Three "use server" matchers were silently skipping every export in any file with a leading copyright/license banner. Fixed by routing the file-level directive check through a shared helper that handles shebangs and comment prologues.

  • Adds hasFileDirective helper in matchers/utils.ts that strips a leading shebang and any line/block comments before testing for the directive
  • Routes server-action, server-action-no-auth, and all-server-actions through it for file-level detection
  • Adds 12 unit tests; on a banner-prefixed sample, candidate counts go from 0/0/0 to 3/2/3 across the three matchers

@vercel
Copy link
Copy Markdown

vercel Bot commented May 5, 2026

@7etsuo is attempting to deploy a commit to the Vercel Labs Team on Vercel.

A member of the Team first needs to authorize it.

@cramforce
Copy link
Copy Markdown
Contributor

Looks good. Please re-push with a signed commit!

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