Search by

rgb72 / coding-standards

rgb72

Shared PHP CS Fixer config and EditorConfig for rgb72 Laravel projects

Package info

gitlab.com/rgb72/coding-standards

Issues

pkg:composer/rgb72/coding-standards

Statistics

Installs: 15

Dependents: 0

Suggesters: 0

Stars: 0

v0.1.3 2026-11-21 07:19 UTC

This package is auto-updated.

Last update: 2026-11-21 00:21:35 UTC


README

Shared code style for rgb72 projects — Laravel (PHP CS Fixer) and Vue 3 + Vuetify on Nuxt or Laravel + Vite/Inertia (ESLint, Prettier, Stylelint), plus a common .editorconfig.

ToolPackageImport
Prettier@rgb72/coding-standards (npm)@rgb72/coding-standards/prettier
ESLint@rgb72/coding-standards (npm)@rgb72/coding-standards/eslint
Stylelint@rgb72/coding-standards (npm)@rgb72/coding-standards/stylelint
PHP CS Fixerrgb72/coding-standards (Composer)Rgb72\CodingStandards\PhpCsFixer\Config
EditorConfigbothcopied by rgb72-standards init

Frontend (Nuxt or Laravel + Vite)

# Nuxt (requires @nuxt/eslint)
npm i -D @rgb72/coding-standards eslint prettier stylelint
npx rgb72-standards init --nuxt

# Laravel + Vite / Inertia / Vuexy
npm i -D @rgb72/coding-standards eslint prettier stylelint eslint-plugin-vue typescript-eslint
npx rgb72-standards init --vite

Creates .editorconfig, eslint.config.mjs, prettier.config.mjs, stylelint.config.mjs and .prettierignore. Existing files are skipped (--force to overwrite), and legacy configs (.prettierrc, .eslintrc.cjs, .stylelintrc.json) are reported so you can delete them — Prettier picks .prettierrc over prettier.config.mjs if both exist.

Style at a glance

  • No semicolons, single quotes, trailing commas, printWidth: 120, 2-space indent (4 for PHP)
  • One attribute per line in templates
  • Imports sorted by @ianvs/prettier-plugin-sort-imports: types → built-ins/packages → @/ aliases → @/*.vue components → relative
  • Vuetify components in PascalCase (<VBtn>), <script setup> only, block order script → template → style
  • SCSS: idiomatic property order, logical properties (margin-inline not margin-left)

Vuexy projects

Keep Vuexy-only rules in the project, not here: path-alias importOrder (example in the prettier.config.mjs stub), regex/invalid alias rules, valid-appcardcode-*, and no-restricted-imports for auto-imported packages. Add them to the project block of eslint.config.mjs.

Laravel

PSR-12 base, declare(strict_types=1), short arrays, 'Hello ' . $name concat spacing, sorted/unused imports cleaned, Laravel-style ! $x.

composer require --dev rgb72/coding-standards
vendor/bin/rgb72-standards init
vendor/bin/php-cs-fixer fix
// .php-cs-fixer.dist.php
use Rgb72\CodingStandards\PhpCsFixer\Config;

return Config::make(
    Config::laravelFinder(__DIR__),
    ['final_class' => true], // optional project overrides
);

Suggested composer.json scripts:

"scripts": {
    "lint": "php-cs-fixer fix --dry-run --diff",
    "fix": "php-cs-fixer fix"
}

Developing locally

Link the working copy into a project instead of publishing:

# Nuxt
npm i -D ~/Workspace/Libraries/coding-standards
// Laravel composer.json
"repositories": [
    { "type": "path", "url": "~/Workspace/Libraries/coding-standards", "options": { "symlink": true } }
]

Run tests with npm test.

Releasing

  1. Update version in package.json and CHANGELOG.md
  2. git flow release start 1.2.0, commit, then git flow release finish 1.2.0 -m "release: 🏹1.2.0" (tag v1.2.0)
  3. git push origin main develop --follow-tags
  4. GitLab CI publishes to npm on the v* tag (Trusted Publishing, OIDC — no token); Packagist updates via the GitLab integration

See CHANGELOG.md for the semver policy.