-
-
Notifications
You must be signed in to change notification settings - Fork 648
Closed
Labels
C-cleanupCategory - technical debt or refactoring. Solution not expected to change behaviorCategory - technical debt or refactoring. Solution not expected to change behavior
Description
Instead of inlining error codes into messages (e.g. eslint(eqeqeq): use '===' instead of '=='
), they should be stored separately.
This will let us
- configure codes automatically for lint rules
- support hyperlinks in the future
Tasks
First, change OxcDiagnosticInner
from
pub struct OxcDiagnosticInner {
pub message: Cow<'static, str>,
pub labels: Option<Vec<LabeledSpan>>,
pub help: Option<Cow<'static, str>>,
pub severity: Severity,
}
To:
pub struct OxcDiagnosticInner {
pub message: Cow<'static, str>,
pub labels: Option<Vec<LabeledSpan>>,
pub help: Option<Cow<'static, str>>,
pub severity: Severity,
pub code_scope: Option<Cow<'static, str>>, // eg `eslint`
pub code_num: Option<Cow<'static, str>>, // eg `eqeqeq`
}
Next, update LintContext
to set code_scope
and code_num
before running a rule.
Finally, update all lint rule diagnostics to remove their inlined error codes.
Metadata
Metadata
Assignees
Labels
C-cleanupCategory - technical debt or refactoring. Solution not expected to change behaviorCategory - technical debt or refactoring. Solution not expected to change behavior