feat: replace no only tests with vitest (!2)

This gives us a much more robust configuration for our rules. Additionally, it expects tests to be converted to the `expect` API.

Reviewed-on: https://codeberg.org/nhcarrigan/eslint-config/pulls/2
Co-authored-by: Naomi Carrigan <commits@nhcarrigan.com>
Co-committed-by: Naomi Carrigan <commits@nhcarrigan.com>
This commit is contained in:
2024-09-26 00:21:31 +00:00
committed by Naomi the Technomancer
parent 9b128c1bf1
commit 883274a3e4
9 changed files with 172 additions and 213 deletions
+8 -20
View File
@@ -4,30 +4,18 @@
* @author Naomi Carrigan
*/
import { suite, assert, test } from "vitest";
import { describe, expect, it } from "vitest";
import { stylisticRules } from "../src/rules/stylistic.ts";
suite("Stylistic Configs", () => {
test("should never be an error", () => {
describe("stylistic configs", () => {
it("should never be an error", () => {
expect.assertions(65);
const rules = Object.entries(stylisticRules);
for (const [ name, rule ] of rules) {
if (Array.isArray(rule)) {
assert.include(
[ "off", "warn" ],
rule.at(0),
`${name} appears to be set to an error!`,
);
continue;
}
if (typeof rule === "string") {
assert.include(
[ "off", "warn" ],
rule,
`${name} appears to be set to an error!`,
);
continue;
}
assert.fail(`Could not determine rule type for ${name}!`);
expect(Array.isArray(rule)
? rule.at(0)
: rule, `${name} appears to be set to an error!`).not.toBe("error");
continue;
}
});
});