mirror of
https://github.com/oven-sh/bun
synced 2026-02-09 18:38:55 +00:00
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:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user