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.

ruleTester.describe(rule, {
valid: ["a", { code: "a" }],
invalid: [],
});

This rule is not configurable.

Made with ❤️‍🔥 in Boston by Josh Goldberg and contributors.