Skip to content

Commit

Permalink
fix: lint issue
Browse files Browse the repository at this point in the history
  • Loading branch information
magic-akari committed May 29, 2024
1 parent 8349040 commit 0089981
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
4 changes: 3 additions & 1 deletion src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@ if (location.hash.startsWith("#code/")) {
init_code = localStore.code;
}

createRoot(document.getElementById("root")!).render(
declare const root: HTMLElement;

createRoot(root).render(
<StrictMode>
<App code={init_code} />
</StrictMode>,
Expand Down
6 changes: 3 additions & 3 deletions src/swc-ast-parser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@ export function parse_swc_ast(source: string): Section[] {
const span_match = span_regex.exec(text);
if (span_match) {
// span: 7..8#2,
const lo = Number.parseInt(span_match[1]);
const hi = Number.parseInt(span_match[2]);
const lo = Number.parseInt(span_match[1], 10);
const hi = Number.parseInt(span_match[2], 10);
const span: Span = { lo, hi };
span_stack.push({ span, level });
}
Expand All @@ -53,7 +53,7 @@ export function parse_swc_ast(source: string): Section[] {
} else if (text[0] === "}") {
const top = section_stack.pop();
if (!top || top.type !== "start" || level !== top.level) {
throw Error("Invalid section");
throw new Error("Invalid section");
}

if (top.level !== level) {
Expand Down

0 comments on commit 0089981

Please sign in to comment.