Search code examples
githubindentation

Problems with indentations on Github


I have some issues with my indentations on GitHub: It shows that I have an indent size of 8 on GitHub even after I changed it to indent size 2 and pushed it.

I have changed the settings on prettier so the code has a indent size 2, and look as it should in my VSCode, but when I commit it is still has a indent size 8.

Attached some photos below and a link to my repo: https://github.com/MT-dotse/project-mongo-api/blob/master/server.js

  • Code on VSCode: Code on VS code
  • Code on GitHub: Code on GitHub

Solution

  • I do see your code on GitHub with the expected tab size of 2, not 8.

    But that is only because I have set my GitHub account setting "Tab Size" to 2.
    Which means any tab is displayed (in my GitHub session on a browser page) as 2 spaces, not 8.


    As the OP Madelene adds in the comments, as an alternative solution:

    I needed to uncheck the "use tabs", and change the tab width to 2 in the prettier extension.