Skip to content

invalidCodeLines

Reports cases for invalid code that isn't formatted across lines.

✅ This rule is included in the flint logical presets.

When writing invalid test cases for lint rules, code and snapshot blocks should be formatted across multiple lines using template literals. This allows snapshot ~ characters to appear visually underneath the flagged code, making test reports more readable.

const ruleTester: any
ruleTester
.
any
describe
(
const rule: any
rule
, {
valid: string[]
valid
: ['a', 'a'],
invalid: any[]
invalid
: [
{
Error ts(2796) ― It is likely that you are missing a comma to separate these two template expressions. They form a tagged template expression which cannot be invoked.
code: string
code
: "",
snapshot: any
snapshot
: \`
Error ts(1127) ― Invalid character.
Error ts(1136) ― Property assignment expected.
~
Rule report message.
\`,
}
],
});
const ruleTester: any
ruleTester
.
any
describe
(
const rule: any
rule
, {
valid: string[]
valid
: ['a', 'a'],
invalid: any[]
invalid
: [
{
Error ts(2796) ― It is likely that you are missing a comma to separate these two template expressions. They form a tagged template expression which cannot be invoked.
code: any
code
: \`console.log(
Error ts(1127) ― Invalid character.
Error ts(1136) ― Property assignment expected.
);\`,
snapshot: \`console.log(
);
~
Rule report message.
\`,
}
],
});
const ruleTester: any
ruleTester
.
any
describe
(
const rule: any
rule
, {
valid: string[]
valid
: ['a', 'a'],
invalid: any[]
invalid
: [
{
Error ts(2796) ― It is likely that you are missing a comma to separate these two template expressions. They form a tagged template expression which cannot be invoked.
code: any
code
: \`
Error ts(1127) ― Invalid character.
Error ts(1136) ― Property assignment expected.
console.log();\`,
snapshot: \`
console.log();
~
Rule report message.\`,
}
],
});
const ruleTester: any
ruleTester
.
any
describe
(
const rule: any
rule
, {
valid: string[]
valid
: ['a', 'a'],
invalid: any[]
invalid
: [
{
Error ts(2796) ― It is likely that you are missing a comma to separate these two template expressions. They form a tagged template expression which cannot be invoked.
code: any
code
: \`console.log();\`,
Error ts(1127) ― Invalid character.
Error ts(1136) ― Property assignment expected.
snapshot: \`console.log();
~~~~~~~~~~~~~
Rule report message.
\`,
}
],
});

This rule is not configurable.

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