<p dir="auto">I understand that this has been brought up(as formatter options, but i think it would include this) before, but please read what I have to say as I believe I have newer and more solid reasoning for this change.</p>
<p dir="auto">Since a meta/config file(<a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="510351149" data-permission-text="Title is private" data-url="https://github.com/denoland/deno/issues/3179" data-hovercard-type="issue" data-hovercard-url="/denoland/deno/issues/3179/hovercard" href="https://github.com/denoland/deno/issues/3179">#3179</a>) is on the Q3 2021 Roadmap and Q3 is coming soon, I'd like to bring up adding space amount customizations:</p>
<p dir="auto">I've decided to bring this up as an issue instead of in <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="510351149" data-permission-text="Title is private" data-url="https://github.com/denoland/deno/issues/3179" data-hovercard-type="issue" data-hovercard-url="/denoland/deno/issues/3179/hovercard" href="https://github.com/denoland/deno/issues/3179">#3179</a> itself because <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="510351149" data-permission-text="Title is private" data-url="https://github.com/denoland/deno/issues/3179" data-hovercard-type="issue" data-hovercard-url="/denoland/deno/issues/3179/hovercard" href="https://github.com/denoland/deno/issues/3179">#3179</a> in particular seems to be targeted at putting current configuration options into a file, and the discussion in that issue seems to have mostly went to a config file format.</p>
<p dir="auto">The reason I am bringing this up in the first place is that I don't use <code class="notranslate">deno fmt</code>  because I am unable to make it format my code with 4 spaces, I will be focusing on that:</p>
<h2 dir="auto">Reasoning</h2>
<ul dir="auto">
<li>
<p dir="auto">It doesn't make any sense to not allow customizations for such a simple option that has no reason for being as they are in the current settings, the defaults can still be whatever it is now, but it wouldn't hurt anyone to have an option for 4 spaces that, in my experience. doesn't even impact readability.</p>
</li>
<li>
<p dir="auto">It is not some obscure formatting option that is only used by a few people(like having semicolons after a functions closing bracket), it is a formatting option that a lot of people want, like, and want to be able to use with <code class="notranslate">deno fmt</code></p>
</li>
<li>
<p dir="auto">This wouldn't really change a lot(if anything) in terms of consistency, most people will still use the default, if someone wants to use 4 spaces they will either: 1. Adapt to 2 spaces because they don't have the option; or 2. Use 4 spaces anyway with some other formatter(I've seen projects like this) or manually(me); Not having this option makes people's lives harder(having to adapt to 2 spaces or use a different tool) at no real benefit since there's always going to be projects with 2 spaces and 4 spaces.</p>
</li>
<li>
<p dir="auto">A few people have brought up the option of using Prettier, dprint by itself, or writing my own formatter, I do not want to do that personally and I wouldn't really expect someone if they were working on a project of mine to install prettier or dprint or my own formatter. I understand that the "adapt or go" philosophy(which is whats happening here) is not wanted in the Deno community, and as such, it should not be wanted in the toolchain either, especially as it is a simple change that is wanted by many.</p>
</li>
<li>
<p dir="auto">Some have brought up the argument that it wastes company time and money to decide on formatting options, I do not think this holds up, because it is 1 simple option and as such would not take very long to decide on.</p>
</li>
<li>
<p dir="auto">I do not believe that making this change would force the core team to include small things as an option in <code class="notranslate">deno fmt</code>, because most things in <code class="notranslate">deno fmt</code> are reasonable and have a good reason for them being as they are. If this is wanted and eventually merged, it will be up to core and others to decide if similar options shall get in. Although I do not believe making these kind of decisions will be necessary because there are not many other things that have no reason to be as they are.</p>
</li>
<li>
<p dir="auto">Deno is supposed to be a one-stop shop for all JavaScript needs this, alienizing people like this is not a good way to achieve that goal and make people use Deno as the one-stop shop for their JS needs, this also feeds into my earlier reasoning regarding using prettier or dprint.</p>
</li>
</ul>
<h2 dir="auto">Prior Art</h2>
<ul dir="auto">
<li>I understand that Deno likes following other projects such as Rust or Go in it's decisions, so I will be listing a few formatters that allow this option, or has other changes that fixes this problem:
<ul dir="auto">
<li><code class="notranslate">gofmt</code>: Formats using tabs, this fixes this problem and also allows for better accesibility</li>
<li><code class="notranslate">rustfmt</code>: Has 4 spaces by default, allows changing this amount in <code class="notranslate">rustfmt.toml</code> file</li>
<li>Prettier: Allows changing spaces in a <code class="notranslate">.prettierc</code> file</li>
</ul>
</li>
</ul>
<h2 dir="auto">Development/Meeting Time</h2>
<p dir="auto">A few people on discord have brought up the topic of (core's) wasting development and/or meeting time on such simple and opinionated things:</p>
<ul dir="auto">
<li>I am willing to implement this myself, if that is what is needed, and if a PR implementing that will get accepted.</li>
<li>A meta/config file is already going to be discussed due to <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="510351149" data-permission-text="Title is private" data-url="https://github.com/denoland/deno/issues/3179" data-hovercard-type="issue" data-hovercard-url="/denoland/deno/issues/3179/hovercard" href="https://github.com/denoland/deno/issues/3179">#3179</a> being on the Q3 Roadmap, and it is a simple addition to that, so I do not think it will take long to discuss.</li>
</ul>
<h2 dir="auto">Discord</h2>
<p dir="auto">I have created a thread on discord in the <code class="notranslate">#dev-fmt</code> channel where there was some discussion related to this:</p>
<p dir="auto"><a href="https://discord.com/channels/684898665143206084/870438916136771614/870438917860651028" rel="nofollow">https://discord.com/channels/684898665143206084/870438916136771614/870438917860651028</a></p>
<p dir="auto">I really like the idea of "one formatting style". People spend too much time on these matters. I also currently use two spaces for JavaScript files as it is the Prettier default.</p>
<p dir="auto">But thinking more about the accessibility issues with defaulting to a small indent size, deno should reconsider.</p>
<p dir="auto">Ref: <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="489059120" data-permission-text="Title is private" data-url="https://github.com/stylelint/stylelint/issues/4246" data-hovercard-type="issue" data-hovercard-url="/stylelint/stylelint/issues/4246/hovercard" href="https://github.com/stylelint/stylelint/issues/4246">stylelint/stylelint#4246</a><br>
<a href="https://www.reddit.com/r/javascript/comments/c8drjo/nobody_talks_about_the_real_reason_to_use_tabs/" rel="nofollow">https://www.reddit.com/r/javascript/comments/c8drjo/nobody_talks_about_the_real_reason_to_use_tabs/</a></p>
<p dir="auto">It is hard to read code when it is scrunched to one side. We have less of a need for a small indent size given the move from callbacks to async/await.</p>
<p dir="auto">Given the above, I'd like to see <code class="notranslate">deno fmt</code> consider defaulting to use tabs before 1.0. When editing a file with tabs, the user can choose whether an indent should visually be displayed as 2, 4, or even 8 spaces. Tabs would also be more consistent with <code class="notranslate">go fmt</code> which the tool is clearly inspired from. I'm not interested in starting a holy war on this though.</p>
<p dir="auto">I'd also like to see the ability to set the <code class="notranslate">deno fmt</code> CLI arguments as environment variables so users could use <code class="notranslate">deno fmt</code> if they strongly disagree with the defaults.</p>