test(linter): add test case for no_unused_vars in 3b87ac4

This commit is contained in:
Boshen 2024-09-07 20:45:40 +08:00
parent 3b87ac48ce
commit 3835189785
No known key found for this signature in database
GPG key ID: 67715A371E534061

View file

@ -110,6 +110,7 @@ fn test_vars_simple() {
// type annotations do not get clobbered
("let x: number = 1; x = 2;", "let _x: number = 1; _x = 2;", None, FixKind::DangerousFix),
("const { a } = obj;", "", None, FixKind::DangerousSuggestion),
("let [f,\u{a0}a]=p", "let [,a]=p", None, FixKind::DangerousSuggestion),
];
Tester::new(NoUnusedVars::NAME, pass, fail)
@ -469,7 +470,7 @@ fn test_functions() {
"
function foo(a: number): number;
function foo(a: number | string): number {
return Number(a)
return Number(a)
}
foo();
",
@ -952,9 +953,9 @@ fn test_type_references() {
type PermissionValues<T> = {
[K in keyof T]: T[K] extends object ? PermissionValues<T[K]> : T[K];
}[keyof T];
export type ApiPermission = PermissionValues<typeof API_PERMISSIONS>;
export const API_PERMISSIONS = {} as const;
",
"