From fe1a73ca8afd4ac3f62de1728af2264a9468d946 Mon Sep 17 00:00:00 2001 From: Ed Page Date: Fri, 19 Jan 2024 10:26:22 -0600 Subject: [PATCH] fix(config): Don't treat ts as typoscript Fixes #911 --- crates/typos-cli/src/default_types.rs | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/crates/typos-cli/src/default_types.rs b/crates/typos-cli/src/default_types.rs index 161fd0d..db71bf5 100644 --- a/crates/typos-cli/src/default_types.rs +++ b/crates/typos-cli/src/default_types.rs @@ -261,7 +261,7 @@ pub const DEFAULT_TYPES: &[(&str, &[&str])] = &[ ("ts", &["*.ts", "*.tsx"]), ("twig", &["*.twig"]), ("txt", &["*.txt"]), - ("typoscript", &["*.typoscript", "*.ts"]), + ("typoscript", &["*.typoscript"]), ("vala", &["*.vala"]), ("vb", &["*.vb"]), ("vcl", &["*.vcl"]), @@ -292,3 +292,20 @@ pub const DEFAULT_TYPES: &[(&str, &[&str])] = &[ ]), ("zstd", &["*.zst", "*.zstd"]), ]; + +// See `cargo test --lib -- --nocapture default_types::check_duplicates` +#[test] +fn check_duplicates() { + let mut reverse = std::collections::BTreeMap::new(); + for (name, exts) in DEFAULT_TYPES { + for ext in *exts { + reverse.entry(ext).or_insert(Vec::new()).push(name); + } + } + + for (ext, names) in reverse { + if 1 < names.len() { + println!("{ext} is under multiple names: {names:?}"); + } + } +}