@inlang/core/lint #319
Replies: 3 comments 17 replies
-
ProposalDevelop a dedicated @inlang/core/lint module that takes the AST and extends it with an additional node const resources = config.readResources()
const resourcesWithLints = lint(resources)
// @inlang/core/query still works
// with linted resources provides additional information
const message = query(resourcesWithLints)
if (message.lint.error){
console.log(message.lint.error.message)
console.log(message.lint.error.type)
} Pros
Cons
|
Beta Was this translation helpful? Give feedback.
-
Adding the lint information to the existing nodes in the AST makes sense to me. export type Resource = Node<"Resource"> & {
languageTag: LanguageTag
- body: Array<Message>
+ body: Array<Message & LintInformation>
}
+export type LintInformation = {
+ errors: LintMessage[]
+ warnings: LintMessage[]
+}
+export type LintMessage = {
+ type: LintType
+ // ... additional type specific properties
+}
+export type LintType = 'missing_key' // ... and others I'm imagine an additional function is needed to be able to easily iterate over all lint errors without traversing the tree manually. Things that could be detected by the linter:
The inlang config will probably also need a lint configuration option where a user can specify lint-specific settings e.g. disable certain lint rules, use a |
Beta Was this translation helpful? Give feedback.
-
Is Lint might be known among developers but what about non-technical users like translators? |
Beta Was this translation helpful? Give feedback.
-
Problem
The CLI, Editor, and IDE extension require lints and filters based.
Beta Was this translation helpful? Give feedback.
All reactions