Skip to main content

wxml_parser_rs/parser/
eslint.rs

1use serde_json::Value;
2
3use super::{
4  parse_program_with_mode,
5  serialize::{serialize_eslint, serialize_eslint_to_string},
6};
7
8pub fn parse_for_eslint_json(code: &str) -> Value {
9  serialize_eslint(parse_program_with_mode(code, true))
10}
11
12/// Parse WXML for ESLint and return the result as a JSON string directly,
13/// avoiding the expensive `serde_json::from_str` → Value step.
14pub fn parse_for_eslint_json_string(code: &str) -> String {
15  serialize_eslint_to_string(&parse_program_with_mode(code, true))
16}