Skip to content

Instantly share code, notes, and snippets.

@pablocattaneo
Last active June 7, 2025 00:49
Show Gist options
  • Save pablocattaneo/636f21a07eaa6e69cb654de3920266e5 to your computer and use it in GitHub Desktop.
Save pablocattaneo/636f21a07eaa6e69cb654de3920266e5 to your computer and use it in GitHub Desktop.
If you're using **[Trunk](https://trunk.io)** (a dev tool that includes linting, formatting, etc.), and it detects auto-fixable lint issues, you can run the auto-fix with:
```bash
trunk check --fix
```
### Explanation:
* `trunk check`: runs the Trunk pipeline (linters, formatters, etc.)
* `--fix`: automatically applies any fixes that the linters support (like ESLint or Prettier).
---
If you only want to fix issues for a specific linter (e.g., ESLint), you can run:
```bash
trunk check --fix --filter=eslint
```
Yes, it's possible to run `trunk check --fix` on a **specific file**.
Here’s how you can do it:
```bash
trunk check --fix path/to/your/file.ext
```
### Example
```bash
trunk check --fix src/components/Button.tsx
```
This will run all the enabled linters/formatters that apply to that file and fix any issues if possible.
### Notes
* `trunk` automatically determines which tools to run based on the file type and configuration.
* You can also pass multiple files if needed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment