Skip to content

Commit

Permalink
(feat): add husky pre commit composer run format
Browse files Browse the repository at this point in the history
  • Loading branch information
Mike van den Hoek committed Jul 16, 2024
1 parent b1f237f commit fd4f838
Show file tree
Hide file tree
Showing 6 changed files with 809 additions and 37 deletions.
41 changes: 4 additions & 37 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,41 +1,10 @@
# -----------------------------------------------------------------
# .gitignore for WordPress
# Bare Minimum Git
# http://ironco.de/bare-minimum-git/
# ver 20150227
#
# This file is tailored for a WordPress project
# using the default directory structure
#
# This file specifies intentionally untracked files to ignore
# http://git-scm.com/docs/gitignore
#
# NOTES:
# The purpose of gitignore files is to ensure that certain files not
# tracked by Git remain untracked.
#
# To ignore uncommitted changes in a file that is already tracked,
# use `git update-index --assume-unchanged`.
#
# To stop tracking a file that is currently tracked,
# use `git rm --cached`
#
# Change Log:
# 20150227 Ignore hello.php plugin. props @damienfa
# 20150227 Change theme ignore to wildcard twenty*. props @Z33
# 20140606 Add .editorconfig as a tracked file
# 20140404 Ignore database, compiled, and packaged files
# 20140404 Header Information Updated
# 20140402 Initially Published
#
# -----------------------------------------------------------------

# ignore all files starting with .
# Ignore all files starting with .
.*

# track this file .gitignore (i.e. do NOT ignore it)
# Except the following files/folders
!.gitignore
!.github/
!.husky/pre-commit

# Eslint
!.eslintrc
Expand Down Expand Up @@ -94,6 +63,4 @@ bower_components
vendor
releases

tests/coverage

wordpress/
tests/
4 changes: 4 additions & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

npx lint-staged
1 change: 1 addition & 0 deletions .nvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
v18.16.0
58 changes: 58 additions & 0 deletions .php-cs-fixer.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
<?php

$finder = \PhpCsFixer\Finder::create()
->in([
__DIR__ . '/src',
__DIR__ . '/tests',
])
->name('*.php')
->notName('*.blade.php')
->ignoreDotFiles(true)
->ignoreVCS(true);


return (new \PhpCsFixer\Config())->setRules([
'@PSR2' => true,
'array_syntax' => ['syntax' => 'short'],
'ordered_imports' => ['sort_algorithm' => 'alpha'],
'no_unused_imports' => true,
'not_operator_with_successor_space' => true,
'trailing_comma_in_multiline' => true,
'phpdoc_scalar' => true,
'phpdoc_var_without_name' => true,
'phpdoc_single_line_var_spacing' => true,
'unary_operator_spaces' => true,
'phpdoc_trim' => true,
'phpdoc_trim_consecutive_blank_line_separation' => true,
'align_multiline_comment' => true,
'array_indentation' => true,
'no_superfluous_elseif' => true,
'single_blank_line_before_namespace' => true,
'blank_line_after_opening_tag' => true,
'no_blank_lines_after_phpdoc' => true,
'phpdoc_separation' => true,
'binary_operator_spaces' => [
"operators" => [
"=" => "single_space",
"=>" => "single_space",
],
],
'return_type_declaration' => [
'space_before' => 'none',
],
'blank_line_before_statement' => [
'statements' => ['break', 'continue', 'declare', 'return', 'throw', 'try'],
],
'method_argument_space' => [
'on_multiline' => 'ensure_fully_multiline',
'keep_multiple_spaces_after_comma' => true,
],
'yoda_style' => [
'always_move_variable' => true,
'equal' => true,
'identical' => true,
'less_and_greater' => true,
],
'single_quote' => true,
])
->setFinder($finder);
Loading

0 comments on commit fd4f838

Please sign in to comment.