realm / realm/SwiftLint

file_types_order option to require extensions to follow what they extend

Open
#6,071 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement
Dominant language
Swift
Stars
19.7k
Forks
2.3k
Avg merge
1d 1h
Merged PRs (30d)
11

Description

New Issue Checklist
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

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.