[Formatting] Record formatting improvements
Open
Nobody has claimed this yet.
Printer
- Dominant language
- OCaml
- Stars
- 10.3k
- Forks
- 438
- PR merge metrics
- No merged PRs in 30d
Description
I think this:
let applyHighlight = (spec: list(ChartSpecT.specItem(string)), ~highlightedKey: option(string)) => {
let defaultItemOpacity = item => ChartSpecT.{
...item,
chart: {
...item.chart,
strokeOpacity: None,
},
};
spec->List.map(defaultItemOpacity);
};
Would be more readable and aesthetically pleasing if formatted like this:
let applyHighlight = (spec: list(ChartSpecT.specItem(string)), ~highlightedKey: option(string)) => {
let defaultItemOpacity = item =>
ChartSpecT.{
...item,
chart: {
...item.chart,
strokeOpacity: None,
},
};
spec->List.map(defaultItemOpacity);
};
Similarly this:
Param.create(
~key="search",
~toString=Params.Search.toString,
~fromString=Params.Search.fromString,
~get=state => state.search,
~set=(value, state) => {
...state,
filter: {
...state.filter,
search: value,
},
},
),
More readable as this (IMO):
Param.create(
~key="search",
~toString=Params.Search.toString,
~fromString=Params.Search.fromString,
~get=state => state.filter.search,
~set=(value, state) => {
...state,
filter: {
...state.filter,
search: value,
},
},
),
Contributor guide
No contributing guide indexed for this repository
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
Review the two Reason formatting examples in the issue and identify the formatter behavior responsible for arrow-function and record-expression indentation. Define the accepted output from those examples, then add coverage for both cases and verify the formatter produces the requested layout.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- ocaml
- Domain
- tooling
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100