feat: add rules for playwright (!3)

Reviewed-on: https://codeberg.org/nhcarrigan/eslint-config/pulls/3
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:55:54 +00:00
committed by Naomi the Technomancer
parent 883274a3e4
commit 96935e12b4
6 changed files with 123 additions and 0 deletions

View File

@ -8,6 +8,7 @@ import { describe, expect, it } from "vitest";
import { eslintRules } from "../src/rules/eslint.ts";
import { importRules } from "../src/rules/import.js";
import { jsdocRules } from "../src/rules/jsdoc.js";
import { playwrightRules } from "../src/rules/playwright.ts";
import { stylisticRules } from "../src/rules/stylistic.ts";
import { typescriptEslintRules } from "../src/rules/typescriptEslint.js";
import { unicornRules } from "../src/rules/unicorn.js";
@ -44,6 +45,16 @@ describe("no rules should be turned off in", () => {
}
});
it("playwright rules", () => {
expect.assertions(42);
const rules = Object.entries(playwrightRules);
for (const [ name, rule ] of rules) {
expect(Array.isArray(rule)
? rule.at(0)
: rule, `${name} appears to be turned off - this project does not use any external configs, so all rules should be off by default.`).not.toBe("off");
}
});
it("stylistic rules", () => {
expect.assertions(65);
const rules = Object.entries(stylisticRules);

21
test/playwright.spec.ts Normal file
View File

@ -0,0 +1,21 @@
/**
* @copyright nhcarrigan
* @license Naomi's Public License
* @author Naomi Carrigan
*/
import { describe, expect, it } from "vitest";
import { playwrightRules } from "../src/rules/playwright.ts";
describe("playwright configs", () => {
it("should never be an error", () => {
expect.assertions(42);
const rules = Object.entries(playwrightRules);
for (const [ name, rule ] of rules) {
expect(Array.isArray(rule)
? rule.at(0)
: rule, `${name} appears to be set to an error!`).not.toBe("error");
continue;
}
});
});