Skip to content
Advertisement

Tag: visual-studio-code

Prevent Prettier formating arrow functions to multiple lines

When I write arrow functions in Vue.js using vscode i get an unexpected formating. I wish to change the settings for Prettier when auto formating arrow functions in vscode. Expected: Acceptable: Actual: Answer I did some research and found this feature has already been requested: https://github.com/prettier/prettier/issues/4125 Changes to prettier were made (https://github.com/prettier/prettier/pull/6685) and released in prettier 2.0 back in 2020.

Weird Formatting for nextJs (vscode)

I am using prettier as my formater. When I read a simple JSX function it is written as however, when saved the autoformatter turns it into I have turned prettier off and turned most of my other extensions off yet this doesn’t change, I belive it is intrinsic to vscode somehow. Anyone have a fix? Answer On the lower right,

Vscode available properties intellisense using javascript or typescript in a function which’s parameter is a string

Look here. For the first parameter of the addEventListener function, vscode gives me several inbuilt suggestions How should I make this available in my javascript function? It could be using Jsdoc or typescript etc. Answer You can always see what vscode uses for intellisense by hovering on the addEventListener method or ctrl + click to go to the definition in

why i am getting error for this one like Unexpected template string expression no-template-curly-in-string

here i am posting my code i am getting the error while running npm start Unexpected template string expression no-template-curly-in-string Answer You should replace quotes (‘) to a backtick quotes (`) at your href inside <a> tag like this. Before: <a href={‘/product/${product._id}’}> After: <a href={`/product/${product._id}`}> Here is link to eslint doc page for more information.

IntelliSense/JSDoc @param = @return, a.k.a. how do I document wrapper functions?

I have a function which takes in another function as an argument, does something to that function-argument, and then returns that same function-argument (or at least returns a function with the exact same signature to it) However, as you can see from my comments in the following… … IntelliSense will autocomplete when calling arbitraryFn() but not wrappedArbitraryFn(). Is there any

Advertisement