1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#[cfg(feature = "json")]
use serde::Serialize;
#[derive(Debug, Clone, PartialEq)]
#[cfg_attr(feature = "json", derive(Serialize))]
pub struct Position {
pub line: usize,
pub col: usize,
}
impl Into<Position> for swc_common::Loc {
fn into(self) -> Position {
Position {
line: self.line,
col: self.col.0,
}
}
}
#[derive(Debug, Clone, PartialEq)]
#[cfg_attr(feature = "json", derive(Serialize))]
pub struct Range {
pub start: Position,
pub end: Position,
}
#[derive(Clone, Debug)]
#[cfg_attr(feature = "json", derive(Serialize))]
pub struct LintDiagnostic {
pub range: Range,
pub filename: String,
pub message: String,
pub code: String,
}