This project showcases how Grit, simple web app with Firebolt, can automate tasks like code migrations with Grit CLI or Github action.
bun install
bun run dev
bun run build
grit list
grit check
grit patterns describe <pattern>
For example, to describe the no_console_log
pattern, you can run the following command:
grit patterns describe no_console_log
# Remove console.log
Remove `console.log` statements.
- Name: no_console_log
- Language: TSX
- Tags: logging
# Body
engine marzano(0.1)
language js
`console.log($arg)` => . where {
$arg <: not within catch_clause()
}
# Samples
## Removes a simple `console.log` statement
Input | Output
--------------------- | ---------------------
// Do not remove this | // Do not remove this
console.error('foo'); | console.error('foo');
console.log('foo'); |
--------------------- | ---------------------
## Removes the statement in a function
Input | Output
--------------------- | ---------------
function f() { | function f() {}
console.log('foo'); |
} |
--------------------- | ---------------
## Works in a list as well
Input | Output
------------------------------------------------------------------- | --------------------
server.listen(PORT, console.log(`Server started on port ${PORT}`)); | server.listen(PORT);
------------------------------------------------------------------- | --------------------
## Doesn't remove `console.log` in a catch clause
Input | Output
--------------------- | ---------------------
try { | try {
} catch (e) { | } catch (e) {
console.log('foo'); | console.log('foo');
} | }
--------------------- | ---------------------
## Works on multiple console logs in the same file
Input | Output
--------------------- | ---------------------
// Do not remove this | // Do not remove this
console.error('foo'); | console.error('foo');
console.log('foo'); |
console.log('bar'); |
--------------------- | ---------------------
grit apply <pattern>
grit pattern edit <pattern>
For example, to edit the no_alert_js
pattern, you can run the following command:
grit patterns edit .grit/patterns/no_alert_js.md
Open in Grit studio: https://app.grit.io/studio?pattern_file=eJyFkLFuAjEMhl%2FFCpWOk7ijrIfo0qVTp25NdbHASg%2FlnDYxrVrEu2MCQmxsyW9%2Fn2zvzTqyEIvpTNM0lmWQQB28RsBASTRAnzt4r9ZxQ833DsMgf9UMqhC9H9hXH5YD%2FVDo4BcTWy4Wy5MbhWXnnE%2BDPokVIhgx%2FSPH6WO7qJVH9jv0BNtcmgs2fehrB6sncO5iKNoJvFEWeMZMsLgURDFdQ%2BMxe1iBNS8UQrRmafns0rxeXiV3kNJlZuYL5VPP0p4mn%2BtHKHGec%2ByLs9%2FmdtyYwxHclHC9
docker-compose up
fly launch
pre-commit install
- Available Patterns | Grit
- Firebolt
- Panda CLI - Panda CSS
- Biome, toolchain of the web
- GritQL Tutorial
👤 Huynh Duc Dung
- Website: https://productsway.com/
- Twitter: @jellydn
- Github: @jellydn
Give a ⭐️ if this project helped you!