-
-
Notifications
You must be signed in to change notification settings - Fork 4.6k
Description
NOTE: This issue is raised due to confusion in #1139.
NOTE: Feel free to use the 👍 and 👎 buttons to indicate your preferences, but please refrain from commenting unless you’ve read every comment and made sure yours says something that has not been said before.
This issue is only about outputting these spaces:
function identity (value) {
// ^ space here
return value;
}
function identity <T>(value: T): T {
// ^ space here
return value;
}
class A {
method () {
// ^ space here
}
}
const obj = {
method () {
// ^ space here
}
}(Prettier currently does not put spaces in those positions.)
🗒 NOTE: This issue is not about anonymous functions:
const identity = function (value) { // ^ space here: SEE #3847! return value; }Anonymous functions are tracked in #3847!
The key arguments is:
Searchability: You can find any function or method declaration my searching for e.g. method ( or identity <, or even just name[space] (mostly).
It also provides a clear and immediate difference between declaration and invocation.
(There are many existing comments in favour of this style, notably: #1139 (comment) and the majority of the discussion from #1139 (comment) onwards.)