Skip to content

testShorthands

Test cases with only a code property can use string shorthand syntax instead of object literal syntax.

✅ This rule is included in the flint logical presets.

When defining test cases for linting rules, if a test case only requires a code property without any additional configuration (like options, errors, etc.), it can be simplified using string shorthand syntax.

const ruleTester: RuleTester
ruleTester
.
any
describe
(
const rule: AnyRule
rule
, {
valid: (string | {
code: string;
})[]
valid
: ["a", {
code: string
code
: "a" }],
invalid: never[]
invalid
: [],
});

This rule is not configurable.

Made with ❤️‍🔥 around the world by the Flint team and contributors.