Skip to content

Adds .editorconfig#23

Merged
falkenhawk merged 2 commits intomasterfrom
feature/editorconfig
Apr 2, 2026
Merged

Adds .editorconfig#23
falkenhawk merged 2 commits intomasterfrom
feature/editorconfig

Conversation

@marcing
Copy link
Copy Markdown
Collaborator

@marcing marcing commented Apr 15, 2025

To make the maintenance easier and avoid addicental tabs.

@marcing marcing requested a review from falkenhawk April 15, 2025 12:23
Copy link
Copy Markdown
Member

@falkenhawk falkenhawk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown
Member

@falkenhawk falkenhawk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Comment thread .editorconfig Outdated
Comment on lines +11 to +15
insert_final_newline = true
trim_trailing_whitespace = true

[*.md]
trim_trailing_whitespace = false
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
insert_final_newline = true
trim_trailing_whitespace = true
[*.md]
trim_trailing_whitespace = false

@falkenhawk falkenhawk merged commit 3420b0d into master Apr 2, 2026
26 checks passed
@falkenhawk falkenhawk deleted the feature/editorconfig branch April 2, 2026 11:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants