function* toRules(rules) {
    for (const rule of rules) {
        yield rule;
        yield* toRules(rule.oneOf || []);
        yield* toRules(rule.rules || []);
    }
}
Check that a matching webpack rule can be found

@param {import("webpack").RuleSetRule[]} rules
@returns {Generator<import("webpack").RuleSetRule>}