In VScode when I accidentally leave off a semi colon at the end of a javascript line and save the file, vscode (prettier or eslint or both) fixes this by adding 2 semi colons to the end of the line. Example
Original line
const x = 1
Fixed line
const x = 1;;
I want it to add only 1 ;
Where would I look to fix this? facepalm
In VScode when I accidentally leave off a semi colon at the end of a javascript line and save the file, vscode (prettier or eslint or both) fixes this by adding 2 semi colons to the end of the line. Example
Original line
const x = 1
Fixed line
const x = 1;;
I want it to add only 1 ;
Where would I look to fix this? facepalm
Share Improve this question asked Apr 12, 2019 at 0:42 graburygrabury 5,61917 gold badges81 silver badges136 bronze badges 1- Did you manage to find what was causing this? I am hitting the same issue. – Lee Commented Apr 26, 2019 at 22:37
1 Answer
Reset to default 4TL;DR: Check your ESLint rules, make sure you don't have a redundant one that is already being taken care of by your plugins.
I was having this issue. I solved it in my .eslintrc.json
file, which I had mis-configured.
I have both the plugin installed for prettier
"plugins": ["babel", "react", "prettier"],
as well a rule set for eslint to add semi colons
"rules": {
"semi": ["error", "always"],
When I take either that rule out or the prettier plugin out, it would go to only adding one semicolon.
However, when I would take out the prettier plugin, it would also give the error:
Definition for rule 'prettier/prettier' was not foundeslint(prettier/prettier)
So the rule setting seemed to be redundant with the plugin, and removing the rule fixed this issue.
发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745147405a4613707.html
评论列表(0条)