Adds .editorconfig#23
Conversation
falkenhawk
left a comment
There was a problem hiding this comment.
The indent_style and indent_size settings are fine as documentation of the existing style.
However, trim_trailing_whitespace = true and insert_final_newline = true should not be enabled on a legacy codebase like this - every file touched by an editor would get reformatted on save, creating unnecessary whitespace-only diffs and messing up git blame.
Ideally we'd only trim whitespace on edited lines, but editorconfig doesn't support that - it's all-or-nothing. Both PhpStorm and VS Code have this as an IDE-level setting:
- PhpStorm: Settings → Editor → General → On Save → Remove trailing spaces on: "Modified lines"
- VS Code:
files.trimTrailingWhitespaceInRegionsOnly: true
Neither IDE exposes this through editorconfig - no ij_ or vscode_ prefixed property exists for it. And trim_trailing_whitespace = true in editorconfig actually overrides the IDE's "Modified lines" preference, forcing trimming on ALL lines (IJPL-40113).
I'd suggest removing trim_trailing_whitespace and insert_final_newline, or setting them to false to explicitly prevent editors from applying whole-file reformatting.
falkenhawk
left a comment
There was a problem hiding this comment.
Also relevant: there's a long-standing open issue on the editorconfig spec itself about this exact problem - whether trim_trailing_whitespace should apply to all lines or only modified lines, with a proposal for a three-value option (modified/all/none): editorconfig/editorconfig#208
| insert_final_newline = true | ||
| trim_trailing_whitespace = true | ||
|
|
||
| [*.md] | ||
| trim_trailing_whitespace = false |
There was a problem hiding this comment.
| insert_final_newline = true | |
| trim_trailing_whitespace = true | |
| [*.md] | |
| trim_trailing_whitespace = false |
for more info see #23 (review)
To make the maintenance easier and avoid addicental tabs.