file_types_order option to require extensions to follow what they extend
Nobody has claimed this yet.
- Dominant language
- Swift
- Stars
- 19.7k
- Forks
- 2.3k
- Avg merge
- 1d 1h
- Merged PRs (30d)
- 11
Description
New Issue Checklist
- I've Updated SwiftLint to the latest version.
- I've searched for existing GitHub issues.
Feature or Enhancement Proposal
Please add an option to file_types_order, tentatively named extension_location, that allows:
grouped: all extensions must be grouped together (current behavior)after_type: if a type is defined, all its extensions must consecutively follow it; extensions of types that are defined outside the file must be grouped in the extensions section
This should probably also affect (or have options to affect) each type that has the defined type as its sole generic type. e.g., struct X should be followed by all extension X, then by all extension X?, then by all extension [X], then by all extension Y<X>. I don't think there are any other syntaxes for extensions of X or single generics of X, but any other syntaxes can be added, too.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by locating the file_types_order rule and reading how its current grouped behavior is implemented. Define the ordering cases for the proposed grouped and after_type modes, including extensions of types defined outside the file and the listed generic forms; done means the rule enforces the selected ordering consistently.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- swift
- Domain
- tooling
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100