• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

ota-meshi / svelte-eslint-parser / 4581268530

01 Apr 2023 04:18AM UTC coverage: 90.693%. Remained the same
4581268530

push

github

GitHub
chore: release svelte-eslint-parser (#308)

880 of 1041 branches covered (84.53%)

Branch coverage included in aggregate %.

2053 of 2193 relevant lines covered (93.62%)

27060.16 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

52.94
/src/parser/template.ts
1
import { parse } from "svelte/compiler";
4,958✔
2
import type * as SvAST from "./svelte-ast-types";
3
import type { Context } from "../context";
4
import { convertSvelteRoot } from "./converts/index";
1✔
5
import { sortNodes } from "./sort";
1✔
6
import type { SvelteProgram } from "../ast";
7
import { ParseError } from "..";
1✔
8

9
/**
10
 * Parse for template
11
 */
12
export function parseTemplate(
13
  code: string,
14
  ctx: Context,
15
  parserOptions: any = {}
×
16
): {
17
  ast: SvelteProgram;
18
  svelteAst: SvAST.Ast;
19
} {
20
  try {
4,955✔
21
    const svelteAst = parse(code, {
4,955✔
22
      filename: parserOptions.filePath,
23
    }) as SvAST.Ast;
24
    const ast = convertSvelteRoot(svelteAst, ctx);
4,955✔
25
    sortNodes(ast.body);
4,955✔
26

27
    return {
4,955✔
28
      ast,
29
      svelteAst,
30
    };
31
  } catch (e: any) {
32
    if (typeof e.pos === "number") {
×
33
      const err = new ParseError(e.message, e.pos, ctx);
×
34
      (err as any).svelteCompilerError = e;
×
35
      throw err;
×
36
    }
37
    throw e;
×
38
  }
39
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc