Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
20ef187
feat: some sort of Astro support
Princesseuh Feb 4, 2026
855b48e
Merge branch 'main' into feat/astro
Princesseuh Feb 4, 2026
c8a0664
feat: linting is kinda fun
Princesseuh Feb 4, 2026
6ae8410
chore: cleanup
Princesseuh Feb 4, 2026
0611c9b
fix: some cleanujp
Princesseuh Feb 4, 2026
36da861
fix: move Astro things out of the way
Princesseuh Feb 4, 2026
d964abf
fix: more cleanup
Princesseuh Feb 4, 2026
adf029f
fix: tests and fixes
Princesseuh Feb 4, 2026
9a401c1
Merge branch 'main' into feat/astro
Princesseuh Feb 4, 2026
847bf92
fix: lint and napi tests
Princesseuh Feb 5, 2026
3da9016
fix: doc lint
Princesseuh Feb 5, 2026
149bf64
feat: a working Astro -> JS transformer
Princesseuh Feb 6, 2026
3bc863e
fix: cleanup
Princesseuh Feb 6, 2026
f00e8d1
refactor: scanner
Princesseuh Feb 6, 2026
f13398b
fix: rework snapshots
Princesseuh Feb 6, 2026
25c9334
Merge pull request #3 from Princesseuh/feat/astro-transform
Princesseuh Feb 6, 2026
3bc29f2
Merge branch 'main' into feat/astro
Princesseuh Feb 6, 2026
e039fcb
feat: remove printer from this repo
Princesseuh Feb 7, 2026
05584fc
fix: regexes in frontmatter
Princesseuh Feb 8, 2026
f549ff8
fix: isolate Astro even more
Princesseuh Feb 8, 2026
de77d5a
fix: lint
Princesseuh Feb 8, 2026
f93188d
fix: empty expressions
Princesseuh Feb 9, 2026
d9cacd9
fix: lint
Princesseuh Feb 10, 2026
e67e08b
Merge branch 'main' into feat/astro
Princesseuh Feb 17, 2026
24dd4ab
fix: update for Astro changes
Princesseuh Feb 17, 2026
d68b530
fix: lint
Princesseuh Feb 17, 2026
7c3714f
chore: remove some outdated files
Princesseuh Feb 17, 2026
d65d74e
test: add tests for comments inside attributes
Princesseuh Feb 28, 2026
f6d3ab6
Merge branch 'main' into feat/astro
Princesseuh Feb 28, 2026
83d9c2f
fix: update from upstream
Princesseuh Feb 28, 2026
a26aa1e
fix: remove HTML comment trivia
Princesseuh Feb 28, 2026
a04d72d
fix: html and comments parsing
Princesseuh Feb 28, 2026
404c114
fix: lint
Princesseuh Feb 28, 2026
5d87fe3
fix(lint): Map diagnostics code actions to their sections
Princesseuh Feb 28, 2026
95b6ac9
fix: properly exit scripts
Princesseuh Mar 13, 2026
424f914
fix: trim expressions edging whitespace in the parser directly
Princesseuh Mar 13, 2026
b3f058b
fix: parse frontmatter boundaries like the Go compiler
Princesseuh Mar 17, 2026
982bf1e
fix: avoid infinite loops in attributes parsing
Princesseuh Mar 17, 2026
3c2349b
fix: parse unquoted attributes correctly
Princesseuh May 5, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions apps/oxlint/fixtures/astro/debugger.astro
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
---
// eslint-disable-next-line no-debugger
debugger
---

Expand All @@ -16,5 +17,18 @@ debugger
</script>

<script>
// eslint-disable-next-line no-debugger
debugger
</script>

{
/* eslint-disable-next-line no-console */
console.log("suppressed in expression container")
}

<div
id={
// eslint-disable-next-line no-console
console.log("suppressed in attribute")
}
></div>
62 changes: 62 additions & 0 deletions apps/oxlint/src-js/generated/deserialize.js
Original file line number Diff line number Diff line change
Expand Up @@ -3827,6 +3827,12 @@ function deserializeJSXChild(pos) {
return deserializeBoxJSXExpressionContainer(pos + 8);
case 4:
return deserializeBoxJSXSpreadChild(pos + 8);
case 5:
return deserializeBoxAstroScript(pos + 8);
case 6:
return deserializeBoxAstroDoctype(pos + 8);
case 7:
return deserializeBoxAstroComment(pos + 8);
default:
throw Error(`Unexpected discriminant ${uint8[pos]} for JSXChild`);
}
Expand Down Expand Up @@ -5771,6 +5777,50 @@ function deserializeComment(pos) {
};
}

function deserializeAstroScript(pos) {
let start,
end,
previousParent = parent,
node = (parent = {
__proto__: NodeProto,
type: "AstroScript",
program: null,
start: (start = deserializeU32(pos)),
end: (end = deserializeU32(pos + 4)),
range: [start, end],
parent,
});
node.program = deserializeProgram(pos + 8);
parent = previousParent;
return node;
}

function deserializeAstroDoctype(pos) {
let start, end;
return {
__proto__: NodeProto,
type: "AstroDoctype",
value: deserializeStr(pos + 8),
start: (start = deserializeU32(pos)),
end: (end = deserializeU32(pos + 4)),
range: [start, end],
parent,
};
}

function deserializeAstroComment(pos) {
let start, end;
return {
__proto__: NodeProto,
type: "AstroComment",
value: deserializeStr(pos + 8),
start: (start = deserializeU32(pos)),
end: (end = deserializeU32(pos + 4)),
range: [start, end],
parent,
};
}

function deserializeAssignmentOperator(pos) {
switch (uint8[pos]) {
case 0:
Expand Down Expand Up @@ -6848,6 +6898,18 @@ function deserializeBoxJSXSpreadChild(pos) {
return deserializeJSXSpreadChild(uint32[pos >> 2]);
}

function deserializeBoxAstroScript(pos) {
return deserializeAstroScript(uint32[pos >> 2]);
}

function deserializeBoxAstroDoctype(pos) {
return deserializeAstroDoctype(uint32[pos >> 2]);
}

function deserializeBoxAstroComment(pos) {
return deserializeAstroComment(uint32[pos >> 2]);
}

function deserializeVecTSEnumMember(pos) {
let arr = [],
pos32 = pos >> 2;
Expand Down
46 changes: 45 additions & 1 deletion apps/oxlint/src-js/generated/types.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1068,7 +1068,15 @@ export interface JSXIdentifier extends Span {
parent: Node;
}

export type JSXChild = JSXText | JSXElement | JSXFragment | JSXExpressionContainer | JSXSpreadChild;
export type JSXChild =
| JSXText
| JSXElement
| JSXFragment
| JSXExpressionContainer
| JSXSpreadChild
| AstroScript
| AstroDoctype
| AstroComment;

export interface JSXSpreadChild extends Span {
type: "JSXSpreadChild";
Expand Down Expand Up @@ -1677,6 +1685,37 @@ export interface JSDocUnknownType extends Span {
parent: Node;
}

export interface AstroRoot extends Span {
type: "AstroRoot";
frontmatter: AstroFrontmatter | null;
body: Array<JSXChild>;
parent: Node;
}

export interface AstroFrontmatter extends Span {
type: "AstroFrontmatter";
program: Program;
parent: Node;
}

export interface AstroScript extends Span {
type: "AstroScript";
program: Program;
parent: Node;
}

export interface AstroDoctype extends Span {
type: "AstroDoctype";
value: string;
parent: Node;
}

export interface AstroComment extends Span {
type: "AstroComment";
value: string;
parent: Node;
}

export type AssignmentOperator =
| "="
| "+="
Expand Down Expand Up @@ -1910,4 +1949,9 @@ export type Node =
| JSDocNullableType
| JSDocNonNullableType
| JSDocUnknownType
| AstroRoot
| AstroFrontmatter
| AstroScript
| AstroDoctype
| AstroComment
| ParamPattern;
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ File URI: file://<variable>/fixtures/lsp/issue_14565/foo-bar.astro
code: "eslint-plugin-unicorn(filename-case)"
code_description.href: "https://oxc.rs/docs/guide/usage/linter/rules/unicorn/filename-case.html"
message: "Filename should be in snake_case, or PascalCase\nhelp: Rename the file to 'foo_bar.astro', or 'FooBar.astro'"
range: Range { start: Position { line: 0, character: 3 }, end: Position { line: 0, character: 3 } }
range: Range { start: Position { line: 0, character: 0 }, end: Position { line: 0, character: 0 } }
Comment thread
Princesseuh marked this conversation as resolved.
related_information[0].message: ""
related_information[0].location.uri: "file://<variable>/fixtures/lsp/issue_14565/foo-bar.astro"
related_information[0].location.range: Range { start: Position { line: 0, character: 3 }, end: Position { line: 0, character: 3 } }
related_information[0].location.range: Range { start: Position { line: 0, character: 0 }, end: Position { line: 0, character: 0 } }
severity: Some(Error)
source: Some("oxc")
tags: None
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,42 +7,24 @@ working directory:
----------

! eslint(no-debugger): `debugger` statement is not allowed
,-[fixtures/astro/debugger.astro:2:1]
1 | ---
2 | debugger
: ^^^^^^^^
3 | ---
`----
help: Remove the debugger statement

! eslint(no-debugger): `debugger` statement is not allowed
,-[fixtures/astro/debugger.astro:11:3]
10 | <script asdf >
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Need to change script handling to match current compiler, we should still parse as JS if there's attributes unless they're type="something" we don't know.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure if this is the same issue or something else now.

11 | debugger
: ^^^^^^^^
12 | </script>
`----
help: Remove the debugger statement

! eslint(no-debugger): `debugger` statement is not allowed
,-[fixtures/astro/debugger.astro:15:3]
14 | <script asdf>
15 | debugger
,-[fixtures/astro/debugger.astro:12:3]
11 | <script asdf >
12 | debugger
: ^^^^^^^^
16 | </script>
13 | </script>
`----
help: Remove the debugger statement

! eslint(no-debugger): `debugger` statement is not allowed
,-[fixtures/astro/debugger.astro:19:3]
18 | <script>
19 | debugger
,-[fixtures/astro/debugger.astro:16:3]
15 | <script asdf>
16 | debugger
: ^^^^^^^^
20 | </script>
17 | </script>
`----
help: Remove the debugger statement

Found 4 warnings and 0 errors.
Found 2 warnings and 0 errors.
Finished in <variable>ms on 1 file with 93 rules using 1 threads.
----------
CLI result: LintSucceeded
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,14 +90,6 @@ working directory: fixtures/report_unused_directives
`----
help: Remove the debugger statement

! Unused eslint-disable directive (no problems were reported).
,-[test.astro:17:3]
16 | <script>
17 | // eslint-disable-next-line no-unused-vars
: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
18 | const unusedVariable2 = 100;
`----

! Unused eslint-disable directive (no problems were reported from no-debugger).
,-[test.astro:28:41]
27 |
Expand Down Expand Up @@ -320,7 +312,7 @@ working directory: fixtures/report_unused_directives
37 | </script>
`----

Found 38 warnings and 0 errors.
Found 37 warnings and 0 errors.
Finished in <variable>ms on 5 files with 94 rules using 1 threads.
----------
CLI result: LintSucceeded
Expand Down
2 changes: 2 additions & 0 deletions crates/oxc/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,8 @@ cfg = ["oxc_cfg", "oxc_semantic/cfg"]
isolated_declarations = ["oxc_isolated_declarations"]
ast_visit = ["oxc_ast_visit"]
regular_expression = ["oxc_regular_expression", "oxc_parser/regular_expression"]
# Support for Astro file parsing (.astro)
astro = ["oxc_parser/astro"]

serialize = [
"oxc_allocator/from_raw_parts",
Expand Down
Loading
Loading