New Feature: Add .editorconfig Support #234
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The approach I've gone for puts
.editorconfig
settings above those settings in theecs.php
config itself, to prioritize convenience for those people using pre-built sets. As many setttings as I could easily implement have been supported, including one proposed (but not standardized) setting I like to use.As mentioned in the related ticket, I've used a similar approach as Prettier does, only pulling configuration settings from
[*]
and[*.php]
at the root-level.editorconfig
(no recursive traversal toroot
), since we don't have immediate access to a high quality EditorConfig library and don't want to maintain anything that complicated.The changes made here should also be backwards-compatible for a minor version release; opt-in for support is required for the new feature, and all other changes make the checker more permissive. But please do check my work, especially in regard to the changed conflicting / duplicate checker entries.
This commit includes tests, documentation, and dogfooding.
Tests only currently cover the parsing of
.editorconfig
, but do not test how all permutations affect configuration. Doing so would require advanced alias mocks of theEditorConfigFactory
and it'sload
method, which I wasn't able to get working in an initial attempt. That, or a refactor ofECSConfigBuilder
to allow injecting the factory, but I didn't want to mess with any of the exposed public API.Closes #217
Thank you for your time! 😄