[1.x] Add indent and line-ending options #230
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.
Laravel Pint, as an opinionated formatter, closely follows Laravel's internal formatting rules. However, the essence of Laravel is its configurability, a feature that should ideally extend to Pint. This update proposes the addition of customizable indentation and line-ending options, designed to integrate seamlessly and require minimal maintenance.
Key reasons for introducing these options include:
Accessibility: Adjustable indentation improves readability for developers with visual impairments or those using screen readers, making Pint more inclusive.
Focus on Development, Not Formatting Debates: Issues like ->setIndent("\t") #24 and Add Ability to Set Indentation Level #90 show how formatting can become a point of contention. Configurable options can minimize these distractions for the Laravel maintainers.
Integration with Legacy Code: For projects transitioning to Laravel, pre-existing code standards can be maintained without extensive reformatting, easing the integration process.
Adherence to Regional or Organizational Standards: Flexibility in formatting helps developers meet specific coding standards required in different regions or by various organizations.
Laravel Pint is already heavily configurable by allowing you to adjust rules, which is appreciated by many. But these last two options would make it a lot easier for teams to integrate the tool with existing workflows. Developers could of course create their own workflows with PhpCsFixer manually, but most of them probably also want the rules specified by this project to stay in line with most of the Laravel maintainer's opinions. Allowing more configurability will allow more Laravel projects to adopt this tool, keeping Laravel projects between organizations mostly in sync with the Laravel style guidelines with some organizations making some custom changes here and there.
I hope you will consider merging this PR and let me know if there are any additional changes you would like me to make. I can also update the Laravel documentation with these options if you would like in another PR.