-
Notifications
You must be signed in to change notification settings - Fork 35
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #60 from WordPress/feature/add-linting
Add linting tools
- Loading branch information
Showing
7 changed files
with
589 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
name: Static Linting | ||
|
||
on: | ||
pull_request: | ||
push: | ||
branches: | ||
- trunk | ||
|
||
jobs: | ||
php: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Install dependencies | ||
uses: php-actions/composer@v6 | ||
- name: Lint PHP files | ||
run: composer run lint | ||
|
||
name: PHP Files | ||
|
||
other: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Use Node.js | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: 20 | ||
- name: Setup pnpm | ||
uses: pnpm/[email protected] | ||
with: | ||
version: 8 | ||
|
||
- name: Install dependencies | ||
run: pnpm i | ||
- name: Lint JavaScript files | ||
run: npm run lint:js | ||
- name: Lint CSS files | ||
run: npm run lint:css | ||
- name: Lint package.json files | ||
run: npm run lint:pkg-json | ||
env: | ||
CI: true | ||
|
||
name: Javascript, CSS, and package.json |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
#!/usr/bin/env sh | ||
. "$(dirname -- "$0")/_/husky.sh" | ||
|
||
npx lint-staged |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
{ | ||
"name": "wordpress/block-development-examples", | ||
"require-dev": { | ||
"dealerdirect/phpcodesniffer-composer-installer": "^0.7.1", | ||
"squizlabs/php_codesniffer": "^3.6", | ||
"wp-coding-standards/wpcs": "^3.0" | ||
}, | ||
"scripts": { | ||
"lint": "./vendor/bin/phpcs --standard=phpcs.xml" | ||
}, | ||
"config": { | ||
"allow-plugins": { | ||
"squizlabs/php_codesniffer": true, | ||
"dealerdirect/phpcodesniffer-composer-installer": true, | ||
"wp-coding-standards/wpcs": true | ||
} | ||
} | ||
} |
Oops, something went wrong.