The sonarjs/no-nested-functions
of eslint-plugin-sonarjs 2.0.4 complains about code like:
import { describe, expect, it } from "vitest";
describe("Foo", () => {
describe("visiting", () => {
describe("accept()", () => {
it("throws an exception", () => {
expect(() => "id".accept("bar")).toThrowError("some error");
});
});
});
});
The error message is:
Refactor this code to not nest functions more than 4 levels deep
In such test suites, functions are a way to group tests and don’t add to the complexity of the file. I would advocate for deactivating this rule in such files or raising the limit.