Allow the ability to format a DSL file
Nobody has claimed this yet.
- Dominant language
- Go
- Stars
- 35
- Forks
- 17
- Avg merge
- 48m
- Merged PRs (30d)
- 10
Description
We would like to expose a new method: formatter.Format(dslFile, options).
Given a DSL file contents, it would return a formatted DSL file.
Options may not be much at the start, but can grow to include:
- using spaces instead of tabs
- tab width
- having a space between types
- grouping assignable relations at the top
- grouping non-assignable relations prefixed with
is_orcan_at the bottom
For modular models, we should allow passing a map containing the fga.mod and the contents of each file, but that should be a separate ticket.
In later tickets:
- this should be integrated into the VS Code ext, IntelliJ plugin and CLI
- We should allow formatting the store file
Also potentially later combined with a linter used in a github action
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 reviewing the requested formatter.Format(dslFile, options) API and the proposed formatting options. The issue scopes initial work to formatting a single DSL file; modular models, editor and CLI integrations, store-file formatting, and linting are explicitly later work. Done means the agreed initial API formats DSL input according to its supported options.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go
- Domain
- tooling
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 30/100