Skip to content

Add .editorconfig #7

@DevanshSrajput

Description

@DevanshSrajput

Context
No .editorconfig in the repo. A contributor's editor picks
its own defaults for indent, EOL, and final newline — and the
next git diff looks like a noise storm because every line
moves. Two contributors on Windows recently committed CRLF
into requirements.txt and Readme.md; a single config file
would have prevented it.

What to change
Create .editorconfig at the repo root:

root = true

[*]
charset = utf-8
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true
indent_style = space
indent_size = 4

[*.{md,yaml,yml,json,toml}]
indent_size = 2

[Makefile]
indent_style = tab

How to verify

  • git config --get core.autocrlf is whatever the user set
    (we don't override git config), but git diff after editing
    a file shows zero \\ No newline at end of file warnings.
  • Most editors (VS Code, PyCharm, Sublime) auto-detect the
    file and apply the rules without further config.
  • The file is ≤ 20 lines and has a short comment explaining
    the [*] defaults.

Skill: cross-platform hygiene.
Estimated effort: S.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions