tightenco/duster

Automatic configuration for Laravel apps to apply Tighten's standard linting & code standards.

Installs: 3 482

Dependents: 2

Suggesters: 0

Security: 0

Stars: 39

Watchers: 16

Forks: 3

Open Issues: 5

Language:Shell

v0.3.2 2021-08-20 15:23 UTC

README

Project Banner

Duster

Automatically apply Tighten's default code style for Laravel apps:

  • PHPCS, with PSR-12 + some special preferences
  • Tighten's Tlint
  • Maybe JS and CSS?

To achieve this, this package installs PHPCS (and PHPCBF with it) and Tlint, and automatically configures them. Tlint uses the default Tighten preset. PHPCS uses the Tighten preset which is PSR-12 and a few Tighten-specific rules.

Installation

You can install the package via composer:

composer require tightenco/duster --dev
./vendor/bin/duster init

You must run ./vendor/bin/duster init after installing, or you won't have a local copy of the PHPCS config file, and Duster won't work.

The init command will also optionally add a GitHub action to run Duster's linters.

Usage

To lint everything at once:

./vendor/bin/duster lint

To fix everything at once:

./vendor/bin/duster fix

To run individual lints:

./vendor/bin/duster tlint
./vendor/bin/duster phpcs

To run individual fixes:

./vendor/bin/duster tlint fix
./vendor/bin/duster phpcs fix

Customizing the lints

To override the configuration for PHPCS, you can edit the .phpcs.xml.dist file and add customizations below the <rule ref="Tighten"/> line or even disable the Tighten rule and use your own ruleset. Learn more in this introductory article.

To override the configuration for Tlint, create a tlint.json file in your project root. Learn more in the Tlint documentation.

Contributing

Please see CONTRIBUTING for details.

Security

If you discover any security related issues, please email hello@tighten.co instead of using the issue tracker.

Credits

License

The MIT License (MIT). Please see License File for more information.