There is a mixture of tabs/spaces in the repo. It would be better if there is only one unified standard for all of the codebase/documentation. In addition, it is a good practice to introduce some CI/pre-commit checks considering this convention.
The issue was revealed in this PR: https://github.com/iterative/dvc.org/pull/1305
@mvshmakov what bothers me here is that we already have useTabs set to false:
"tabWidth": 2,
"useTabs": false,
in the https://github.com/iterative/dvc.org/blob/master/.prettierrc
and we do run it on a pre-commit hook that is installed when you run yarn.
I think the only place we allow spaces are code blocks. And probably prettier ignores them (and rightfully so). It feels there is some overlap between your editor settings and our .prettierrc. What editor do you use? Could you share the settings for it?
@shcheklein I guess I have found the issue. I use Visual Studio Code with custom config, which you can see here: https://pastebin.com/qEjpgKsV. It has a section "prettier.useTabs": true which I totally have forgotten of. I suppose you are right about settings overlapping and it was totally my bad.
We also can force this rule this way if it is necessary: https://github.com/prettier/prettier/issues/5019#issuecomment-416043210.
I think both VSC and Prettier let tabs in code blocks alone. There's 53 instances of this in content/docs right now.
If there's a way to enforce tab->space with Prettier then I would support the no-tab policy. Otherwise I vote actually to use tabs in sample output. Maybe I'm not getting why that is a problem?
@jorgeorpinel I think it's already enforced in our settings? (useTabs: false) prettier probably just ignores code blocks
OK, so my point is if Prettier and IDEs ignore tabs in code blocks (which makes sense) trying to enforce this will be difficult and for starters I don't see why it's desirable. If anything having tabs in sample output is in a way more realistic, as that's what dvc/other commands print to stdout.
I generally prefer to create an .editorconfig file. Since Prettier also uses this file, that allows .editorconfig to be a central location to configure both your editor/IDE and Prettier.
Thanks @noahbrenner but I think still Prettier and IDEs will ignore tabls in Markdown code blocks, regardless of how the policy is configured.
@jorgeorpinel That makes sense. It wouldn't fix existing codeblocks, but I'd expect that an .editorconfig file would at least help avoid creating more instances of this issue in the future (assuming that all contributors have Editor Config plugins for their IDEs, which might not be a good assumption). That doesn't eliminate the need for other automated checks and fixes, it's just another potential tool to help the process along.