summaryrefslogtreecommitdiff
path: root/tests/util
diff options
context:
space:
mode:
authorDavid Sherret <dsherret@users.noreply.github.com>2024-07-25 09:07:59 -0400
committerGitHub <noreply@github.com>2024-07-25 09:07:59 -0400
commit763f05e74dfd0032b238603f625893a52e363591 (patch)
treec6a71559472755919358afa53eecac206cad80a9 /tests/util
parentef78d317f084ffe633253acd138a48a425113fa7 (diff)
fix(unstable): move sloppy-import warnings to lint rule (#24710)
Adds a new `no-sloppy-imports` lint rule and cleans up the lint code. Closes #22844 Closes https://github.com/denoland/deno_lint/issues/1293
Diffstat (limited to 'tests/util')
-rw-r--r--tests/util/server/src/lsp.rs12
1 files changed, 11 insertions, 1 deletions
diff --git a/tests/util/server/src/lsp.rs b/tests/util/server/src/lsp.rs
index f21035610..b615ed475 100644
--- a/tests/util/server/src/lsp.rs
+++ b/tests/util/server/src/lsp.rs
@@ -1230,6 +1230,16 @@ impl CollectedDiagnostics {
.collect()
}
+ pub fn for_file(&self, specifier: &Url) -> Vec<lsp::Diagnostic> {
+ self
+ .all_messages()
+ .iter()
+ .filter(|p| p.uri == *specifier)
+ .flat_map(|p| p.diagnostics.iter())
+ .cloned()
+ .collect()
+ }
+
/// Gets the messages that the editor will see after all the publishes.
pub fn all_messages(&self) -> Vec<lsp::PublishDiagnosticsParams> {
self.0.clone()
@@ -1245,7 +1255,7 @@ impl CollectedDiagnostics {
.find(|p| {
p.diagnostics
.iter()
- .any(|d| d.source == Some(source.to_string()))
+ .any(|d| d.source.as_deref() == Some(source))
})
.map(ToOwned::to_owned)
.unwrap()