Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Lint Pack Laravel Package

jakub-szajna/lint-pack

Laravel package that adds a linter command to the Artisan CLI, helping you run code style and lint checks from the command line during development and CI. Designed to integrate into typical Laravel workflows for quick, repeatable quality checks.

View on GitHub
Deep Wiki
Context7

Getting Started

Minimal Setup

  1. Installation Add the package via Composer:

    composer require jakub-szajna/lint-pack
    

    Publish the configuration (if needed):

    php artisan vendor:publish --provider="JakubSzajna\LintPack\LintPackServiceProvider"
    
  2. First Use Case Run the linter directly on Artisan commands:

    php artisan lint
    

    This will analyze your CLI commands for syntax errors, typos, or inconsistencies.

Where to Look First

  • Configuration: Check config/lint-pack.php for customization options (e.g., ignored commands, error thresholds).
  • Service Provider: Review JakubSzajna\LintPack\LintPackServiceProvider for bootstrapping logic.
  • Artisan Hooks: The package likely extends Illuminate\Foundation\Console\Kernel—inspect how it integrates with Artisan’s event system.

Implementation Patterns

Core Workflow

  1. Pre-Command Validation Use the linter as a pre-flight check before running critical Artisan commands:

    // In a custom command or middleware
    if (!LintPack::validateCommand('migrate')) {
        throw new \Exception('Command failed linting. Fix errors first.');
    }
    
  2. Integration with CI/CD Add the linter to your GitHub Actions/GitLab CI pipeline:

    - name: Run Lint Pack
      run: php artisan lint --fail-on-error
    
  3. Custom Rules Extend the linter by creating a custom rule (if the package supports it). Example:

    namespace App\Rules;
    
    use JakubSzajna\LintPack\Rules\BaseRule;
    
    class NoDeprecatedCommands extends BaseRule {
        protected $pattern = '/artisan\s+make:controller\s+--deprecated/';
        protected $message = 'Deprecated commands are not allowed.';
    }
    

    Register the rule in config/lint-pack.php under rules.

Common Use Cases

  • Team Onboarding: Enforce CLI command consistency across developers.
  • Pre-Merge Checks: Block PRs with linting failures via Git hooks or CI.
  • Legacy Codebase Cleanup: Identify outdated or unsafe Artisan commands.

Gotchas and Tips

Pitfalls

  1. Outdated Package

    • Last release was in 2015. Test thoroughly in your Laravel version (may require polyfills or patches).
    • Check for compatibility with Laravel 5.8+ (if applicable). Example polyfill for Artisan::command():
      if (!method_exists(\Illuminate\Foundation\Application::class, 'command')) {
          // Add fallback logic
      }
      
  2. False Positives

    • The linter may flag dynamic commands (e.g., php artisan {command}). Exclude these in config:
      'ignored_commands' => [
          'php artisan {command}',
      ],
      
  3. Performance Overhead

    • Running the linter on every artisan call may slow down development. Use selectively:
      # Run only before critical commands
      php artisan lint --commands=migrate,seed
      

Debugging Tips

  • Verbose Output: Enable debug mode in config:
    'debug' => true,
    
  • Log Rules: Check storage/logs/lint-pack.log for rule execution details.
  • Bypass Linting: Temporarily disable via:
    php artisan lint --skip
    

Extension Points

  1. Custom Rules Override or extend rules by publishing the package’s assets and modifying:

    // config/lint-pack.php
    'rules' => [
        \App\Rules\NoDeprecatedCommands::class,
    ],
    
  2. Event Listeners Hook into the linter’s events (if documented). Example:

    LintPack::listen('lint.failed', function ($errors) {
        // Send Slack notification
    });
    
  3. Command Whitelisting Whitelist commands that should bypass linting:

    'whitelisted_commands' => [
        'queue:work',
        'tinker',
    ],
    
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
jayeshmepani/jpl-moshier-ephemeris-php
elnasnato/laraliveui
labrodev/rest-sdk
sampaui/sampaui
babelqueue/php-sdk
facebook/capi-param-builder-php
babelqueue/symfony
hamzi/corewatch
minionfactory/raw-hydrator
hexters/coinpayment
rjcodes/rjcms
act-training/laravel-permissions-manager
alimarchal/laravel-chart-of-accounts
babenkoivan/elastic-scout-driver
mkwebdesign/filament-watchdog-v5
renatomarinho/laravel-page-speed
zedmagdy/filament-business-hours
renatovdemoura/blade-elements-ui
devgeek/beacon-admin
benjamin-rqt/data-watcher-bundle