Open martin-lysk opened 1 month ago
How about calling this feature "global lint rules" to make it clear that they need to be evaluated across the entire project?
The example of a global lint rule mentioned above relates to duplicate aliases which is still under discussion in MESDK-59.
Is there an example of a global lint rule which is already in use by existing inlang projects?
cc: @martin.lysk1 to answer the 2 questions above
Changed the title and I fixed the description - we run a lint for a Message (name in v1) which contains the languages and represents a message bundle.
This is just a note - because i mixed terms in the description already: If we introduce a messageBundle we must at least evaluate per messageBundle.
I checked the sources: We don't have any global rule atm. We have one that checks a messagebundle for identical patterns compared to its ref language but non such rule that takes all messages of the whole project into account. (@samuel.stroschein the current run api contains a parameter "messages" that contains the array of all messages.
Do you have a good example of a global lint rule other than duplicate aliases.
This is just a note - because i mixed terms in the description already: If we introduce a messageBundle we must at least evaluate per messageBundle.
👍
(@samuel.stroschein the current run api contains a parameter "messages" that contains the array of all messages.
The alternative is to expose the query api and let lint rules do whatever they need.
Pros:
Cons:
In the long run, it likely makes sense to expose all of query and even fs (for code dependent lint rules) to unlock "all" lint rule use cases that come up. maybe now is a good time to do it.
discussions like "we need to lint on messages" "no, message bundles" are a result of not "just expose query"
EDIT:
If you go down the road of exposing query (probably not worth the complexity), you can only expose query.*.get
and each get call must be tracked to re-run the lint rule if the get message changes
Context
Currently lint reports are evaluated at the initial load (or when settings change) of the project for all messageBundles once.
During the lifetime of a project lint reports are only triggered on messageBundle change and only for a messageBundle that have changed.
Some lint rules will have to evaluate for all messages not only for the one that have changed:
Example:
No dublicate aliase Lint rule. Checks that no other message exists with the same alias.
Such lint rule would need to be run on every messageBundle when one messageBundle change - no only on the message created/updated
Proposal
Loose Thoughts: