linter: ergonomics and new rules (#10197)

* linter: allow a trailing field

* linter: dont fail if no matches are found

* lint: only import 'bun' once

* lint: ban std.mem.indexOfAny

* linter: ignore commented out code and ignore benchmarks

* this was testing nothing

* lint: ban std.debug.print

* this wasnt testing anything either
This commit is contained in:
Meghan Denny
2024-04-11 22:26:23 -07:00
committed by GitHub
parent 19da72fe34
commit 70023bc4ed
20 changed files with 92 additions and 127 deletions

View File

@@ -225,6 +225,15 @@ pub inline fn indexAnyComptime(target: string, comptime chars: string) ?usize {
return null;
}
pub inline fn indexAnyComptimeT(comptime T: type, target: []const T, comptime chars: []const T) ?usize {
for (target, 0..) |parent, i| {
inline for (chars) |char| {
if (char == parent) return i;
}
}
return null;
}
pub inline fn indexEqualAny(in: anytype, target: string) ?usize {
for (in, 0..) |str, i| if (eqlLong(str, target, true)) return i;
return null;