I am currently working on development projects with different languages (TS, TSX) with different developers. Moreover we use Prettier/ESLint, but it's a detail.
And some developers are used to develop with 2 indentation, and the use of spaces. And some use 4 indentation, and prefer tabs.
The problem is that when we get the code from github, the indentation may be that of another developer and therefore not the one that corresponds to us. When a developer retrieves this code indented to 2, is working with 4 indentation, the entire files are detected as being modified by git.
Is it possible to perform at the time of a clone/pull/fetch, a formatting of the code to match our preferences? And at the time of the creation of a pull request/push/commit, to format the code so that it corresponds to that present on the repository?
We have tried several things to solve this problem but without success:
We tried using clean and smudge, but it never worked:
Can git automatically switch between spaces and tabs?We tried github actions, the problem is that to find a specific modification, it is not practical at all.