In our JS files, we have below structure:
import { html } from 'lit-html';
function when(expression, trueValue, falseValue) {
if (expression) {
return trueValue();
}
if (falseValue) {
return falseValue();
}
return undefined;
}
export class SomeClass extends LitElement {
render = () => html`
<someHtml>
<p>Some text</p>
${when(
someCondition,
() => html`<div>on condition true</div>`
() => html`<div>on condition false</div>`
)}
</someHtml>
`;
}
The when
function creates a conflict between our Prettier and ESLint configuration.
Here is our prettier
configuration:
{
"printWidth": 100,
"singleQuote": true,
"tabWidth": 2,
"trailingComma": "es5",
}
and our eslint/indent
rule:
"indent": [
"error",
2,
{
"SwitchCase": 1,
"CallExpression": { "arguments": 1 }
}
]
Can you tell me why I am getting below errors with the above setup?
ESLint: Expected indentation of 4 spaces but found 8.(indent)
ESLint: Expected indentation of 6 spaces but found 10.(indent)