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

OptionDescription
-f, --fixAutomatically fix lint errors
-p, --project [project]Target a specific project
--verboseEnable verbose output

Format Options

OptionDescription
-w, --writeWrite changes to files
-c, --checkCheck formatting without making changes
--verboseEnable 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

RuleDescription
no-unused-varsDisallow unused variables
explicit-function-return-typeRequire return types
no-explicit-anyDisallow any type
strict-boolean-expressionsRequire strict boolean checks

Vue

RuleDescription
require-default-propRequire default values for props
no-v-htmlDisallow v-html directive
component-name-in-template-casingEnforce component name casing

General

RuleDescription
no-consoleDisallow console statements
no-debuggerDisallow debugger statements
eqeqeqRequire = 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:

  1. Check pickier.config.ts for custom rules
  2. 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:

  1. Start with warn level for new rules
  2. Fix warnings gradually
  3. Change to error level once clean