summaryrefslogtreecommitdiff
path: root/cli/tsc/diagnostics.rs
diff options
context:
space:
mode:
Diffstat (limited to 'cli/tsc/diagnostics.rs')
-rw-r--r--cli/tsc/diagnostics.rs13
1 files changed, 10 insertions, 3 deletions
diff --git a/cli/tsc/diagnostics.rs b/cli/tsc/diagnostics.rs
index 362385c07..9525d1855 100644
--- a/cli/tsc/diagnostics.rs
+++ b/cli/tsc/diagnostics.rs
@@ -136,6 +136,13 @@ pub struct Diagnostic {
}
impl Diagnostic {
+ /// If this diagnostic should be included when it comes from a remote module.
+ pub fn include_when_remote(&self) -> bool {
+ /// TS6133: value is declared but its value is never read (noUnusedParameters and noUnusedLocals)
+ const TS6133: u64 = 6133;
+ self.code != TS6133
+ }
+
fn fmt_category_and_code(&self, f: &mut fmt::Formatter) -> fmt::Result {
let category = match self.category {
DiagnosticCategory::Error => "ERROR",
@@ -275,11 +282,11 @@ impl Diagnostics {
/// Return a set of diagnostics where only the values where the predicate
/// returns `true` are included.
- pub fn filter<P>(&self, predicate: P) -> Self
+ pub fn filter<P>(self, predicate: P) -> Self
where
- P: FnMut(&Diagnostic) -> Option<Diagnostic>,
+ P: FnMut(&Diagnostic) -> bool,
{
- let diagnostics = self.0.iter().filter_map(predicate).collect();
+ let diagnostics = self.0.into_iter().filter(predicate).collect();
Self(diagnostics)
}