fix: add Astro framework detection - #1518
Draft
skoshx wants to merge 2 commits into
Draft
Conversation
- 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>
commit: |
Contributor
Interactive terminal E2ERecorded from the built CLI at |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Summary
Fixes #1517 (partial) — adds Astro framework detection so Astro projects report
framework: "astro"instead of"unknown".Changes
✅ Framework Detection (Complete)
astrotoFRAMEWORK_PACKAGESmapping (beforevitefor correct precedence)astrotoFRAMEWORK_TOKENSunion type"Astro"toFRAMEWORK_DISPLAY_NAMES.astroextension toSOURCE_FILE_PATTERNVerified working: Astro projects now correctly report
framework: "astro"and.astrofiles appear inanalyzedFiles.While
.astrofiles 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:
.astrofiles are discovered and included inanalyzedFilesRoot 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
.astrocontent — The oxlint Astro frontend should be parsing these files, but rules aren't receiving/recognizing the AST nodesprepare-html-lint-sources.ts)sharpto framework-implicit dependencies — Once Astro is a recognized framework, add it to the allowlist to prevent falseunused-dependencywarningsTesting
Manual Testing ✅
Confirmed framework detection works correctly:
Unit Tests ✅
Added tests in
discover-project.test.ts:"astro"→"Astro"VALID_FRAMEWORKSarray to include"astro"Build & Type Checks ✅
pnpm typecheck— passedpnpm lint— passedParity Checks
Not run (rde environment not available). Changes are low-risk additions that don't modify existing rule behavior:
Closes
Partial fix for #1517. Framework detection is complete, but full
.astrofile linting requires additional parser integration work.