While working on Bolt apps I am normally reaching for the console to log any info/warn/errors. To keep things consistent I created this custom Biome plugin using Grit. I think this would be a great addition to Bolt's developer experience!
// Biome GritQL plugin to warn against console usage and suggest app.logger
or {
`console.log($args)` as $node where {
register_diagnostic(
span = $node,
message = "Use app.logger.info() instead of console.log()",
severity = "warn"
)
},
`console.error($args)` as $node where {
register_diagnostic(
span = $node,
message = "Use app.logger.error() instead of console.error()",
severity = "warn"
)
},
`console.warn($args)` as $node where {
register_diagnostic(
span = $node,
message = "Use app.logger.warn() instead of console.warn()",
severity = "warn"
)
},
`console.info($args)` as $node where {
register_diagnostic(
span = $node,
message = "Use app.logger.info() instead of console.info()",
severity = "warn"
)
},
`console.debug($args)` as $node where {
register_diagnostic(
span = $node,
message = "Use app.logger.debug() instead of console.debug()",
severity = "warn"
)
}
}
While working on Bolt apps I am normally reaching for the console to log any info/warn/errors. To keep things consistent I created this custom Biome plugin using Grit. I think this would be a great addition to Bolt's developer experience!
Requirements
Here's an example of the .grit plugin:
and here's an example of the warning: