generated from ryanwelcher/wordpress-project-template
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit eb2237a
Showing
11 changed files
with
146 additions
and
0 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,14 @@ | ||
# This file is for unifying the coding style for different editors and IDEs | ||
# editorconfig.org | ||
|
||
# WordPress Coding Standards | ||
# https://make.wordpress.org/core/handbook/coding-standards/ | ||
|
||
root = true | ||
|
||
[*] | ||
charset = utf-8 | ||
end_of_line = lf | ||
insert_final_newline = true | ||
trim_trailing_whitespace = true | ||
indent_style = tab |
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,3 @@ | ||
build | ||
node_modules | ||
vendor |
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,3 @@ | ||
{ | ||
"extends": [ "plugin:@wordpress/eslint-plugin/recommended" ] | ||
} |
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,46 @@ | ||
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 | ||
|
||
strategy: | ||
matrix: | ||
node-version: [14.x, 16.x] | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Use Node.js ${{ matrix.node-version }} | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: ${{ matrix.node-version }} | ||
- name: Install dependencies | ||
run: npm ci | ||
- 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,5 @@ | ||
node_modules | ||
vendor | ||
build | ||
.DS_Store | ||
.vscode |
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 @@ | ||
lts/* |
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,21 @@ | ||
# WordPress Code Examples Starter | ||
|
||
This template repository is pre-configured to provide all of the tools to format code to match the WordPress coding standards. | ||
|
||
|
||
## What does it provide? | ||
|
||
1. Linting and formatting tools for PHP, JavaScript, CSS and package.json files. | ||
2. A GitHub action to that runs linting on PRs and merged to trunk. | ||
3. Build process provided by `@wordpress/scripts` | ||
|
||
## How do I use it? | ||
1. Start by clicking the `Use this template` to use this as a starting point for your project. | ||
2. Run `npm run setup` to install everything. | ||
3. If using VSCode add the following to your settings.json | ||
```json | ||
"editor.codeActionsOnSave": { | ||
"source.fixAll.eslint": true | ||
}, | ||
``` | ||
|
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": "ryanwelcher/wordpress-project-template", | ||
"require-dev": { | ||
"dealerdirect/phpcodesniffer-composer-installer": "^0.7.1", | ||
"squizlabs/php_codesniffer": "^3.6", | ||
"wp-coding-standards/wpcs": "^2.3" | ||
}, | ||
"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 | ||
} | ||
} | ||
} |
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,26 @@ | ||
{ | ||
"name": "wordpress-project-template", | ||
"version": "0.1.0", | ||
"description": "A starting point for WordPress projects", | ||
"author": "Ryan Welcher", | ||
"license": "GPL-2.0-or-later", | ||
"main": "build/index.js", | ||
"scripts": { | ||
"setup": "npm install --force && composer install", | ||
"build": "wp-scripts build", | ||
"format": "wp-scripts format", | ||
"lint:css": "wp-scripts lint-style", | ||
"lint:js": "wp-scripts lint-js", | ||
"lint:pkg-json": "wp-scripts lint-pkg-json", | ||
"format:js": "wp-scripts format", | ||
"packages-update": "wp-scripts packages-update", | ||
"plugin-zip": "wp-scripts plugin-zip", | ||
"start": "wp-scripts start" | ||
}, | ||
"prettier": "@wordpress/prettier-config", | ||
"devDependencies": { | ||
"@wordpress/scripts": "^23.1.0", | ||
"eslint-plugin-prettier": "^4.0.0", | ||
"prettier": "npm:[email protected]" | ||
} | ||
} |
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,9 @@ | ||
<?xml version="1.0"?> | ||
<ruleset name="WordPress Coding Standards for my twitch streams"> | ||
<rule ref="WordPress"/> | ||
<arg name="extensions" value="php"/> | ||
<file>.</file> | ||
<!-- Exclude Vendor directory --> | ||
<exclude-pattern>*/vendor/*</exclude-pattern> | ||
<exclude-pattern>*/build/*</exclude-pattern> | ||
</ruleset> |
Empty file.