eslint-config/test/eslint.spec.ts
Naomi Carrigan f13bcd87a9 feat: migrate to eslint verison 9 (#1)
This is a pretty sizeable change. It also removes all external configuration sets. Every rule is now defined by us.

Additionally, this version will conflict with other formatters, and should not be used in tandem with Prettier.

Reviewed-on: https://codeberg.org/nhcarrigan/eslint-config/pulls/1
Co-authored-by: Naomi Carrigan <commits@nhcarrigan.com>
Co-committed-by: Naomi Carrigan <commits@nhcarrigan.com>
2024-07-28 21:11:31 +00:00

47 lines
1.3 KiB
TypeScript

/**
* @copyright nhcarrigan
* @license Naomi's Public License
* @author Naomi Carrigan
*/
import { suite, assert, test } from "vitest";
import { disabledEslintRules, eslintRules } from "../src/rules/eslint.ts";
suite("ESLint Configs", () => {
test("should not enable disabled rules", () => {
const disabled = Object.keys(disabledEslintRules);
const enabled = Object.keys(eslintRules);
for (const key of disabled) {
assert.notInclude(
enabled,
key,
`Disabled rule ${key} has been re-enabled!`,
);
}
});
test("all disabled rules should be off", () => {
const rules = Object.entries(disabledEslintRules);
for (const [ name, rule ] of rules) {
if (Array.isArray(rule)) {
assert.strictEqual(
rule.at(0),
"off",
`${name} appears to be turned off - this project does not use any external configs, so all rules should be off by default.`,
);
continue;
}
if (typeof rule === "string") {
assert.strictEqual(
rule,
"off",
`${name} appears to be turned off - this project does not use any external configs, so all rules should be off by default.`,
);
continue;
}
assert.fail(`Could not determine rule type for ${name}!`);
}
});
});