rescript-lang / rescript-lang/rescript
formatter aggressively reformats externs into a mess
Dieses Issue hat noch niemand übernommen.
- Vorherrschende Sprache
- OCaml
- Sterne
- 7.5k
- Forks
- 485
- Ø Merge
- 1 T. 2 Std.
- Gemergte PRs (30 T.)
- 55
Beschreibung
background: https://forum.rescript-lang.org/t/my-main-gripes-with-rescript-constructive-criticism/6981/5
right now, the formatter is ruthless in formatting. this is usually appreciated, but for externs, it becomes messy sometimes.
imagine a file such as
@module("moduleX") external f1: someType1 => someType2 = "someFunc"
@module("moduleX") external f2: anotherType1 => thirdType = "someOtherFunc"
@module("moduleX") external f3: interestingType1 => interestingType2 = "someFuncWithALongerName"
@module("moduleX") external f4: t1 => t2 = "anotherFunc"
the formatter reformats it to:
@module("moduleX") external f1: someType1 => someType2 = "someFunc"
@module("moduleX") external f2: anotherType1 => thirdType = "someOtherFunc"
@module("moduleX")
external f3: interestingType1 => interestingType2 = "someFuncWithALongerName"
@module("moduleX") external f4: t1 => t2 = "anotherFunc"
because of the different lengths. this makes the externs really difficult to parse easily by looking at them because there are often repetitions and variants in the functions, so keeping them all on the same format is easier despite some lines being a little longer than what the formatter prefers.
let's discuss potential solutions for this.
Beitragsleitfaden
Erste Schritte
- Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
- Forke das Repository und arbeite in einem Branch.
- Öffne einen Pull Request, der die Issue-Nummer nennt.
Rechercherichtung
Beginnen Sie mit dem Formatter-Verhalten und den extern-Beispielen in diesem Issue und lesen Sie anschließend die verknüpfte Forendiskussion zu den vorgeschlagenen Lösungen und Abwägungen. Done ist noch nicht definiert: Das Issue benötigt eine vereinbarte Formatierungsregel, bevor ein neuer Mitwirkender den Einstiegspunkt der Implementierung oder die Validierungskriterien identifizieren kann.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Bewertung
- Tech-Stack
- ocaml
- Bereich
- tooling
- Issue-Typ
- Feature
- Schwierigkeit
- 5/5
- Geschätzter Aufwand
- Über eine Woche
- Aktivitätsstatus
- Veraltet
- Klarheit
- Muss geklärt werden
- Anfängerfreundlichkeit
- 25/100