For my new project, I have set up prettier and eslint to automatically convert the indentation and brace styles to the correct format. However, I am facing an issue with the following code block:
export default class BaseTextMixin
implements BaseTextMixinType
{
readTextFile(this: BaseType, link: string): string {
return (
this.text_mesh.get(link) ?? fs.readFileSync(link, 'utf-8')
)
}
}
When I check it, I see:
https://i.sstatic.net/GXZ01.png
The first error message states:
Expected indentation of 0 spaces but found 2. eslint
indent
The second error message is:
Opening curly brace does not appear on the same line as controlling statement. eslint
brace-style
In my .eslintrc.json
, I have the following configurations:
"rules": {
"curly": 2,
"brace-style": ["error", "1tbs"],
"indent": ["error", 2, { "SwitchCase": 1 }]
// ...
}
And in my .prettierrc.json
, these are the settings:
{
"semi": false,
"trailingComma": "all",
"singleQuote": true,
"printWidth": 64,
"tabWidth": 2,
"useTabs": false,
"arrowParens": "avoid",
"quoteProps": "as-needed",
"bracketSpacing": true,
"proseWrap": "always",
"endOfLine": "lf",
"singleAttributePerLine": true,
"prettierPath": "./node_modules/prettier"
}
How can I make it accept this format, knowing that the line length exceeds the limit (following prettier's rule)? Specifically, how can I allow the indentation like:
export default class BaseTextMixin
implements BaseTextMixinType
{
Should I make changes to prettier or eslint?