unicorn/template-indent
eslint-plugin-unicorn
Safe autofix
eslint.config.js
import unicorn from "eslint-plugin-unicorn";
export default [
{
plugins: { unicorn },
rules: {
"unicorn/template-indent": "error",
},
},
];function foo() {
const sqlQuery = sql`
select *
from students
where first_name = ${x}
and last_name = ${y}
`;
const gqlQuery = gql`
query user(id: 5) {
firstName
lastName
}
`;
const html = /* HTML */ `
<div>
<span>hello</span>
</div>
`;
}function foo() {
const sqlQuery = sql`
select *
from students
where first_name = ${x}
and last_name = ${y}
`;
const gqlQuery = gql`
query user(id: 5) {
firstName
lastName
}
`;
const html = /* HTML */ `
<div>
<span>hello</span>
</div>
`;
}Examples from the ESLint documentation.
unicorn/template-indent
eslint-plugin-unicorn
import unicorn from "eslint-plugin-unicorn";
export default [
{
plugins: { unicorn },
rules: {
"unicorn/template-indent": "error",
},
},
];Oxlint does not have this rule.
Biome does not have this rule.
Enforce a consistent style for single-line block comments.
Require parentheses around complex spread arguments.
Require type literals to be last in union types.
Prefer .then().catch() over .then(…, …) for error handling.
Prefer declaring variables and type aliases in the smallest possible scope.
Prefer a single object destructuring declaration per local const source.