Skip to content

Add semantic-based WorkflowStep detection - #1

Open
Caio-Nogueira wants to merge 1 commit into
sidharthachatterjee:mainfrom
Caio-Nogueira:push-ssxxysokvqqx
Open

Add semantic-based WorkflowStep detection#1
Caio-Nogueira wants to merge 1 commit into
sidharthachatterjee:mainfrom
Caio-Nogueira:push-ssxxysokvqqx

Conversation

@Caio-Nogueira

Copy link
Copy Markdown

Add semantic-based WorkflowStep detection for accurate linting

Replaces the previous name-based heuristic detection with proper semantic analysis to accurately identify WorkflowStep parameters, eliminating false positives and false negatives.

TypeScript Detection:

  • Detects parameters with type annotation WorkflowStep (from @cloudflare/workers-types ambient declarations)
  • No import required - works with any function/method that has a WorkflowStep typed parameter

JavaScript Detection (Heuristic):

  • For JS files without type annotations, infers the 2nd parameter of run() methods in classes extending WorkflowEntrypoint (imported from "cloudflare:workers") as a WorkflowStep
    False Positive Prevention:
  • Objects named "step" that are NOT typed as WorkflowStep are no longer flagged
  • Parameters with different type names (e.g., WS, Step) are not flagged

Technical Details

  • Added oxc_semantic for symbol resolution
  • Created WorkflowStepSymbols to track known WorkflowStep symbol IDs
  • Uses semantic reference resolution to verify step method calls

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.

1 participant