Skip to content

Commit

Permalink
Tooling to format and check formatting for PHP files
Browse files Browse the repository at this point in the history
  • Loading branch information
tynanbe committed Nov 10, 2023
1 parent 390fc9a commit 4c4762b
Show file tree
Hide file tree
Showing 5 changed files with 162 additions and 3 deletions.
26 changes: 26 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: CI

on:
push:
branches:
- master
- dev
- "v*.*"
pull_request:

jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- uses: actions/setup-node@v3
with:
node-version: "20"
check-latest: true
cache: npm
cache-dependency-path: package-lock.json

- run: npm ci

- run: npm run format-check
8 changes: 8 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
*.local
*.log
*.swp
.DS_Store
.cache
.env*
.vscode
node_modules
12 changes: 9 additions & 3 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -1,10 +1,16 @@
{
"plugins": [
"@prettier/plugin-php"
],
"arrowParens": "avoid",
"braceStyle": "per-cs",
"endOfLine": "auto",
"tabWidth": 4,
"phpVersion": "5.3",
"printWidth": 180,
"useTabs": true,
"semi": true,
"singleQuote": true,
"tabWidth": 4,
"trailingComma": "all",
"arrowParens": "avoid"
"trailingCommaPHP": false,
"useTabs": true
}
105 changes: 105 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 14 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"name": "litespeed-cache",
"description": "High-performance page caching and site optimization from LiteSpeed",
"license": "GPLv3",
"scripts": {
"format": "npm run prettier -- --write",
"format-check": "npm run prettier -- --check",
"prettier": "prettier *.php cli/*.php cli/**/*.php inc/*.php inc/**/*.php src/*.php src/**/*.php thirdparty/*.php thirdparty/**/*.php tpl/*.php tpl/**/*.php"
},
"devDependencies": {
"@prettier/plugin-php": "^0.21.0",
"prettier": "^3.0.3"
}
}

0 comments on commit 4c4762b

Please sign in to comment.