I am trying to format a js file with prettier but it seems prettier is breaking the code syntax. I want to achieve this
(expectated result) but the red lines appear. On save I get the following result. While running the code I get the following error TypeError: {} is not a function
(error image). I tried the following but none seems to work in my case.
- Why do I keep getting Delete 'cr' [prettier/prettier]?
- Visual Studio Code [eslint] Delete 'CR' [prettier/prettier] on windows
I am using the following .prettierrc.js
module.exports = {
tabWidth: 2,
bracketSpacing: true,
endOfLine: "auto",
jsxBracketSameLine: true,
printWidth: 100,
semi: false,
singleQuote: false,
trailingComma: "none"
}
In my .eslintrc.json file I have the following rules set for prettier
"prettier/prettier": [
"error",
{
"bracketSpacing": true,
"endOfLine": "auto",
"jsxBracketSameLine": true,
"printWidth": 100,
"semi": false,
"singleQuote": false,
"trailingComma": "none"
}
],
I have tried changing LF to CRLF and vice versa that appears in the bottom section of vscode but no success. What else am I missing?