Skip to content

fix: add Astro framework detection - #1518

Draft
skoshx wants to merge 2 commits into
mainfrom
cursor/triage-1517-7be2
Draft

fix: add Astro framework detection#1518
skoshx wants to merge 2 commits into
mainfrom
cursor/triage-1517-7be2

Conversation

@skoshx

@skoshx skoshx commented Jul 30, 2026

Copy link
Copy Markdown
Contributor

Summary

Fixes #1517 (partial) — adds Astro framework detection so Astro projects report framework: "astro" instead of "unknown".

Changes

✅ Framework Detection (Complete)

  • Added astro to FRAMEWORK_PACKAGES mapping (before vite for correct precedence)
  • Added astro to FRAMEWORK_TOKENS union type
  • Added display name "Astro" to FRAMEWORK_DISPLAY_NAMES
  • Added .astro extension to SOURCE_FILE_PATTERN
  • Added tests for framework detection and formatting

Verified working: Astro projects now correctly report framework: "astro" and .astro files appear in analyzedFiles.

⚠️ Lint Coverage (Incomplete)

While .astro files are now included in the source file pattern and appear in analyzed files, lint rules are not yet firing on Astro template content. This is a deeper parser integration issue that requires additional work.

Current behavior:

  • .astro files are discovered and included in analyzedFiles
  • ✅ Framework detected correctly
  • ❌ Lint rules don't fire on template content (frontmatter may work, but HTML-like template sections are not being checked)

Root cause: Astro templates use HTML attribute syntax (class, for) rather than JSX (className, htmlFor), and the current rule visitors expect JSX nodes. Additional transformation or parser configuration is needed to make rules work with Astro's template syntax.

🚧 Remaining Work

  1. Investigate why rules don't fire on .astro content — The oxlint Astro frontend should be parsing these files, but rules aren't receiving/recognizing the AST nodes
  2. Handle HTML vs JSX attribute differences — May need transformation similar to how HTML files are currently processed (see prepare-html-lint-sources.ts)
  3. Add sharp to framework-implicit dependencies — Once Astro is a recognized framework, add it to the allowlist to prevent false unused-dependency warnings

Testing

Manual Testing ✅

Confirmed framework detection works correctly:

$ react-doctor --json | jq '.projects[0].framework'
"astro"

$ react-doctor --json | jq '.projects[0].analyzedFiles'
["src/pages/index.astro", "src/pages/about.astro", ...]

Unit Tests ✅

Added tests in discover-project.test.ts:

  • Framework detection: Astro takes precedence over Vite
  • Format framework name: "astro""Astro"
  • Updated VALID_FRAMEWORKS array to include "astro"

Build & Type Checks ✅

  • pnpm typecheck — passed
  • pnpm lint — passed
  • All core and CLI packages build successfully

Parity Checks

Not run (rde environment not available). Changes are low-risk additions that don't modify existing rule behavior:

  • Framework detection is purely additive (adds one entry to a lookup map)
  • File pattern change includes more files but doesn't change how existing files are processed

Closes

Partial fix for #1517. Framework detection is complete, but full .astro file linting requires additional parser integration work.

Open in Web Open in Cursor 

cursoragent and others added 2 commits July 30, 2026 04:36
- Add 'astro' to FRAMEWORK_PACKAGES mapping (before 'vite' for precedence)
- Add 'astro' to FRAMEWORK_TOKENS and display names
- Add .astro extension to SOURCE_FILE_PATTERN for lint pipeline inclusion
- Add tests for Astro framework detection and formatting

Astro projects use Vite internally, so 'astro' must be checked before 'vite'
in the framework detection order (similar to Next.js and Gatsby).

The .astro file extension is now recognized by the lint pipeline. Oxlint's
Astro frontend (already used for HTML files) can parse Astro templates.

Refs: #1517

Co-authored-by: Skosh <skoshx@users.noreply.github.com>
Co-authored-by: Skosh <skoshx@users.noreply.github.com>
@pkg-pr-new

pkg-pr-new Bot commented Jul 30, 2026

Copy link
Copy Markdown

Open in StackBlitz

npm i https://pkg.pr.new/eslint-plugin-react-doctor@1518
npm i https://pkg.pr.new/oxlint-plugin-react-doctor@1518
npm i https://pkg.pr.new/react-doctor@1518

commit: 21e022b

@github-actions

Copy link
Copy Markdown
Contributor

Interactive terminal E2E

React Doctor interactive terminal recording

Recorded from the built CLI at 21e022b in a real terminal. The fixture holds Git busy for three seconds, so Scanning... must appear immediately after project selection, then exercises the compact interactive report.

Download the GIF and MP4 artifact

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.

Astro: .astro files are never linted, and Astro is missing from framework detection

2 participants