Lint Command
The buddy lint command analyzes your codebase for code quality issues, style violations, and potential bugs using the Pickier linter.
Basic Usage
# Run linter
buddy lint
# Run linter and fix issues automatically
buddy lint --fix
Command Syntax
buddy lint [options]
buddy lint:fix [options]
buddy format [options]
buddy format:check [options]
Lint Options
| Option | Description |
|---|---|
-f, --fix | Automatically fix lint errors |
-p, --project [project] | Target a specific project |
--verbose | Enable verbose output |
Format Options
| Option | Description |
|---|---|
-w, --write | Write changes to files |
-c, --check | Check formatting without making changes |
--verbose | Enable verbose output |
Available Commands
Lint
Check for code quality issues:
buddy lint
Lint with Auto-fix
Check and automatically fix issues:
buddy lint --fix
# or
buddy lint:fix
Format
Format code according to style rules:
buddy format
Format Check
Check formatting without modifying files:
buddy format --check
# or
buddy format:check
Examples
Run Linter
buddy lint
Output:
buddy lint
src/components/Button.vue
12:5 error Unexpected console statement no-console
24:1 error Missing return type @typescript-eslint/explicit-function-return-type
2 problems (2 errors, 0 warnings)
Linted your project
Completed in 2.34s
Fix All Issues
buddy lint:fix
Format Code
buddy format
Check Formatting Only
buddy format:check
Configuration
Linting is configured via pickier.config.ts in your project root:
// pickier.config.ts
export default {
rules: {
// TypeScript rules
'@typescript-eslint/no-unused-vars': 'error',
'@typescript-eslint/explicit-function-return-type': 'warn',
// Vue rules
'vue/multi-word-component-names': 'off',
'vue/require-default-prop': 'warn',
// General rules
'no-console': 'warn',
'no-debugger': 'error',
},
ignores: [
'node_modules',
'dist',
'coverage',
],
}
What Gets Linted
By default, the linter checks:
- TypeScript files (
.ts,.tsx) - Vue components (
.vue) - JavaScript files (
.js,.jsx) - Configuration files
Common Rules
TypeScript
| Rule | Description |
|---|---|
no-unused-vars | Disallow unused variables |
explicit-function-return-type | Require return types |
no-explicit-any | Disallow any type |
strict-boolean-expressions | Require strict boolean checks |
Vue
| Rule | Description |
|---|---|
require-default-prop | Require default values for props |
no-v-html | Disallow v-html directive |
component-name-in-template-casing | Enforce component name casing |
General
| Rule | Description |
|---|---|
no-console | Disallow console statements |
no-debugger | Disallow debugger statements |
eqeqeq | Require = and ! |
IDE Integration
Stacks provides excellent IDE integration:
VS Code
Install the ESLint extension for real-time linting feedback.
Settings are pre-configured in .vscode/settings.json:
{
"eslint.validate": [
"javascript",
"typescript",
"vue"
],
"editor.codeActionsOnSave": {
"source.fixAll.eslint": true
}
}
Pre-commit Hooks
Stacks automatically sets up pre-commit hooks to lint staged files:
# When you commit, linting runs automatically
git commit -m "feat: add new feature"
# If linting fails, the commit is blocked
Troubleshooting
Lint Takes Too Long
For large projects:
# Lint specific directory
buddy lint src/
# Or increase timeout
buddy lint --timeout 60000
Rule Conflicts
If you encounter conflicting rules:
- Check
pickier.config.tsfor custom rules - Disable specific rules for a file:
// eslint-disable-next-line no-console
console.log('Debugging')
Can't Auto-fix
Some issues cannot be auto-fixed and require manual intervention:
- Complex type errors
- Unused variable removal (safety check)
- Breaking logic changes
Ignoring Files
Add patterns to ignore in config:
// pickier.config.ts
export default {
ignores: [
'node_modules',
'dist',
'**/*.generated.ts',
'coverage',
],
}
Best Practices
Run Before Committing
buddy lint:fix && buddy commit
CI/CD Integration
Add to your CI pipeline:
# .github/workflows/ci.yml
- name: Lint
run: buddy lint
Fix Issues Progressively
For large codebases:
- Start with
warnlevel for new rules - Fix warnings gradually
- Change to
errorlevel once clean
Related Commands
- buddy test - Run tests
- buddy commit - Commit changes
- buddy build - Build project