build(linting): add Husky hooks, Markdown linting, lint all MD files
This commit is contained in:
parent
c9aa7dcc5f
commit
2279bbef38
9 changed files with 6584 additions and 427 deletions
1044
CHANGELOG.md
1044
CHANGELOG.md
File diff suppressed because it is too large
Load diff
|
@ -116,7 +116,7 @@ the community.
|
|||
|
||||
This Code of Conduct is adapted from the [Contributor Covenant][homepage],
|
||||
version 2.0, available at
|
||||
https://www.contributor-covenant.org/version/2/0/code_of_conduct.html.
|
||||
<https://www.contributor-covenant.org/version/2/0/code_of_conduct.html>.
|
||||
|
||||
Community Impact Guidelines were inspired by [Mozilla's code of conduct
|
||||
enforcement ladder](https://github.com/mozilla/diversity).
|
||||
|
@ -124,5 +124,5 @@ enforcement ladder](https://github.com/mozilla/diversity).
|
|||
[homepage]: https://www.contributor-covenant.org
|
||||
|
||||
For answers to common questions about this code of conduct, see the FAQ at
|
||||
https://www.contributor-covenant.org/faq. Translations are available at
|
||||
https://www.contributor-covenant.org/translations.
|
||||
<https://www.contributor-covenant.org/faq>. Translations are available at
|
||||
<https://www.contributor-covenant.org/translations>.
|
||||
|
|
|
@ -4,44 +4,47 @@
|
|||
|
||||
## Code of Conduct
|
||||
|
||||
Please read and adhere to the project [Code of Conduct][coc].
|
||||
Please read and ensure that you adhere to the project's [Code of Conduct][coc].
|
||||
|
||||
## Requesting Features/Reporting Bugs
|
||||
|
||||
- To request a new feature or to report a bug, create an [Issue][new-issue] and
|
||||
choose the correct template
|
||||
To request a new feature or to report a bug, create an [Issue][new-issue] and
|
||||
choose the correct template.
|
||||
|
||||
## Contributing Code
|
||||
|
||||
- **footnotes** uses [GitHub Flow][github-flow]
|
||||
- branch off of `main` to start developing (`git checkout -b <your branch>`)
|
||||
- ensure that your new branch has a descriptive name
|
||||
- create a remote copy of your new branch (`git push`)
|
||||
- **footnotes** uses [GitHub Flow][github-flow];
|
||||
- branch off of `main` to start developing (`git checkout -b <your branch>`);
|
||||
- ensure that your new branch has a descriptive name;
|
||||
- create a remote copy of your new branch (`git push`);
|
||||
- create a draft [pull request][pull-request] to merge your branch with `main` —
|
||||
tag any related Issues, and if they are assigned to a Project board, this will
|
||||
automatically move them into the ‘In Progress’ bucket
|
||||
automatically move them into the ‘In Progress’ bucket; and
|
||||
- when you think you're finished, un-draft your pull request — if the PR is
|
||||
assigned to a Project board, this will automatically move it and any related
|
||||
Issues into the ‘Review in progress’ bucket
|
||||
Issues into the ‘Review in progress’ bucket.
|
||||
|
||||
## Commits
|
||||
|
||||
- **footnotes** uses [Conventional Commits][conventional-commits]
|
||||
- we use [PHP Commitizen][php-commitizen] to automate this - use `composer commit`
|
||||
- keep individual commits as small as possible
|
||||
- **footnotes** uses the [Conventional Commits][conventional-commits] for
|
||||
commit message formatting;
|
||||
- we recommend using [Commitizen][commitizen] to automate this:
|
||||
- install it globally using `npm install -g commitizen`;
|
||||
- use `git cz` instead of `git commit`.
|
||||
- keep individual commits as small as possible.
|
||||
|
||||
## Versioning
|
||||
|
||||
- **footnotes** uses [Semantic Versioning][semver]
|
||||
**footnotes** uses [WordPress Versioning][wpver].
|
||||
|
||||
## Translating
|
||||
|
||||
- Translations are welcome!
|
||||
Translations are welcome!
|
||||
|
||||
[coc]: https://github.com/markcheret/footnotes/blob/main/CODE_OF_CONDUCT.md
|
||||
[new-issue]: https://github.com/markcheret/footnotes/issues/new/choose
|
||||
[github-flow]: https://githubflow.github.io/
|
||||
[pull-request]: https://github.com/markcheret/footnotes/compare
|
||||
[conventional-commits]: https://www.conventionalcommits.org
|
||||
[php-commitizen]: https://github.com/conventional-commits/php-commitizen
|
||||
[semver]: https://semver.org/
|
||||
[commitizen]: https://www.npmjs.com/package/commitizen
|
||||
[wpver]: https://make.wordpress.org/core/handbook/about/release-cycle/version-numbering/
|
||||
|
|
55
README.md
55
README.md
|
@ -1,11 +1,15 @@
|
|||
# footnotes
|
||||
|
||||
<!-- markdownlint-disable MD013 -->
|
||||
    
|
||||
|
||||
    
|
||||
|
||||
[](https://www.gnu.org/licenses/gpl-3.0)  [](https://github.com/markcheret/footnotes/actions/workflows/ossar-analysis.yml) [](https://github.com/markcheret/footnotes/actions/workflows/php.yml)
|
||||
|
||||
[](http://commitizen.github.io/cz-cli/)
|
||||
<!-- markdownlint-enable MD013 -->
|
||||
|
||||

|
||||
|
||||
**footnotes** aims to be the all-in-one solution for displaying an
|
||||
|
@ -34,23 +38,23 @@ Featured on [wpmudev][wpmudev] — cheers for the review, folks!
|
|||
|
||||
This Plugin provides:
|
||||
|
||||
- fully customizable footnote start and end shortcodes;
|
||||
- stylable tooltips supporting hyperlinks and dedicated text;
|
||||
- a responsive 'reference container', with customisable positioning;
|
||||
- a wide choice of different numbering styles;
|
||||
- a freely-configurable and optional backlink symbol;
|
||||
- footnote appearance customisation via dashboard settings and custom CSS style
|
||||
* fully customizable footnote start and end shortcodes;
|
||||
* stylable tooltips supporting hyperlinks and dedicated text;
|
||||
* a responsive 'reference container', with customisable positioning;
|
||||
* a wide choice of different numbering styles;
|
||||
* a freely-configurable and optional backlink symbol;
|
||||
* footnote appearance customisation via dashboard settings and custom CSS style
|
||||
rules; and
|
||||
- editor buttons for easily adding shortcode tags.
|
||||
* editor buttons for easily adding shortcode tags.
|
||||
|
||||
## Getting Started
|
||||
|
||||
1. Read the [contributing guidelines][contributing];
|
||||
1. clone this repository (`git clone git@github.com:markcheret/footnotes.git`):
|
||||
- we recommend that you use [VVV][vvv] for your local testing environment.
|
||||
* we recommend that you use [VVV][vvv] for your local testing environment.
|
||||
1. install [Composer][composer] and [NPM][npm]; and
|
||||
1. install all dependencies (`composer install`):
|
||||
- you will have to install `php-mbstring` manually if you do not already
|
||||
* you will have to install `php-mbstring` manually if you do not already
|
||||
have it.
|
||||
|
||||
## Deploying
|
||||
|
@ -61,14 +65,14 @@ Automated release deployments will be introduced soon.
|
|||
|
||||
1. Run `_tools/build-stylesheets.sh -c` to concatenate stylesheets;
|
||||
1. manually minify the output files in `css/tmp/`, saving them as `.min.css` files:
|
||||
- the intention is to replace this with automated minification, meaning that
|
||||
* the intention is to replace this with automated minification, meaning that
|
||||
all of these steps can be rolled into a single `build` command.
|
||||
1. run `_tools/build-stylesheets.sh -d` to deploy the minified files to `dist/`:
|
||||
- **this will delete any existing `dist/` folder!**
|
||||
* **this will delete any existing `dist/` folder!**
|
||||
1. run `composer run build` to move over the remaining files to `dist/`:
|
||||
- currently, the files to include in a distribution are hard-coded in
|
||||
* currently, the files to include in a distribution are hard-coded in
|
||||
`_tools/build.sh`; but
|
||||
- the intention is to replace this with a proper parsing of the `.distignore`
|
||||
* the intention is to replace this with a proper parsing of the `.distignore`
|
||||
file
|
||||
|
||||
### Releasing
|
||||
|
@ -88,13 +92,13 @@ This ensures that only style-conformant code can be committed.
|
|||
|
||||
The individual commands can also be called manually:
|
||||
|
||||
- Run `composer run format` to run all format commands.
|
||||
- Run `composer run format:fix` to attempt to automatically fix all formatter warnings
|
||||
* Run `composer run format` to run all format commands.
|
||||
* Run `composer run format:fix` to attempt to automatically fix all formatter warnings
|
||||
and errors.
|
||||
|
||||
- Run `composer run lint` to run all linting commands.
|
||||
- Run `composer run lint:fix` to attempt to automatically fix all linter warnings and
|
||||
errors.
|
||||
* Run `composer run lint` to run all linting commands.
|
||||
* Run `composer run lint:fix` to attempt to automatically fix all linter warnings
|
||||
and errors.
|
||||
|
||||
### PHP Code
|
||||
|
||||
|
@ -108,11 +112,11 @@ PHP code must follow the [WordPress PHP Coding Standards][wpcs-php].
|
|||
|
||||
JavaScript code must follow the [WordPress JavaScript Coding Standards][wpcs-js].
|
||||
|
||||
- Run `composer run format:js` to format all JS files with [Prettier][prettier].
|
||||
- Run `composer run format:js:fix` to attempt to automatically fix warnings and errors.
|
||||
* Run `composer run format:js` to format all JS files with [Prettier][prettier].
|
||||
* Run `composer run format:js:fix` to attempt to automatically fix warnings and errors.
|
||||
|
||||
- Run `composer run lint:js` to lint all JS files with [ESLint][eslint].
|
||||
- Run `composer run lint:js:fix` to attempt to automatically fix warnings and errors.
|
||||
* Run `composer run lint:js` to lint all JS files with [ESLint][eslint].
|
||||
* Run `composer run lint:js:fix` to attempt to automatically fix warnings and errors.
|
||||
|
||||
Prettier configuration settings are found in `.prettierrc`.
|
||||
|
||||
|
@ -123,8 +127,9 @@ found in `.eslintignore`.
|
|||
|
||||
JavaScript code must follow the [WordPress CSS Coding Standards][wpcs-css].
|
||||
|
||||
- Run `composer run lint:css` to format all CSS files with [stylelint][stylelint].
|
||||
- Run `npcomposerm run lint:css:fix` to attempt to automatically fix warnings and errors.
|
||||
* Run `composer run lint:css` to format all CSS files with [stylelint][stylelint].
|
||||
* Run `npcomposerm run lint:css:fix` to attempt to automatically fix warnings and
|
||||
errors.
|
||||
|
||||
stylelint configuration settings are found in `.stylelint.json`.
|
||||
|
||||
|
@ -148,7 +153,7 @@ This project is licensed under the [GNU GPL v3][gpl-v3].
|
|||
|
||||
| Name | Link(s) |
|
||||
|---------------|-----------------------|
|
||||
|Mark Cheret | [Email][mcheret] |
|
||||
|Mark Cheret | [Email][mcheret] |
|
||||
|
||||
[wpmudev]: http://premium.wpmudev.org/blog/12-surprisingly-useful-wordpress-plugins-you-dont-know-about/
|
||||
[php]: https://www.php.net/
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
"description": "footnotes lets you easily add highly-customisable footnotes on your WordPress Pages and Posts.",
|
||||
"license": "GPL-3.0-only",
|
||||
"scripts": {
|
||||
"cm": "npm run cz",
|
||||
"release": "./_tools/release.sh",
|
||||
"release:commit": "composer run release -- -c",
|
||||
"build": "./_tools/build.sh",
|
||||
|
@ -18,16 +19,16 @@
|
|||
"lint:js:fix": "npm run lint:js:fix",
|
||||
"format:js": "npm run format:js",
|
||||
"format:js:fix": "npm run format:js:fix",
|
||||
"lint:md": "npm run lint:md",
|
||||
"lint:md:fix": "npm run lint:md:fix",
|
||||
"docs": "./vendor/bin/phpdoc",
|
||||
"commit": "./vendor/bin/php-commitizen commit -- ./.php-commitizen.php",
|
||||
"post-install-cmd": "npm install && ./_tools/setup.sh"
|
||||
"post-install-cmd": "npm install"
|
||||
},
|
||||
"require-dev": {
|
||||
"dealerdirect/phpcodesniffer-composer-installer": "^0.7.1",
|
||||
"phpcompatibility/php-compatibility": "*",
|
||||
"wp-coding-standards/wpcs": "^2.3",
|
||||
"phpdocumentor/phpdocumentor": "^3.0",
|
||||
"damianopetrungaro/php-commitizen": "^0.2.0",
|
||||
"marcocesarato/php-conventional-changelog": "^1.9",
|
||||
"phpcompatibility/phpcompatibility-wp": "*"
|
||||
},
|
||||
|
|
57
composer.lock
generated
57
composer.lock
generated
|
@ -4,7 +4,7 @@
|
|||
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
|
||||
"This file is @generated automatically"
|
||||
],
|
||||
"content-hash": "635644be9174c16cb944ef5f2bf46e80",
|
||||
"content-hash": "1b1e75ba247201e270b06cd85706a3bd",
|
||||
"packages": [],
|
||||
"packages-dev": [
|
||||
{
|
||||
|
@ -80,61 +80,6 @@
|
|||
],
|
||||
"time": "2020-11-11T10:22:58+00:00"
|
||||
},
|
||||
{
|
||||
"name": "damianopetrungaro/php-commitizen",
|
||||
"version": "v0.2.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/conventional-commits/php-commitizen.git",
|
||||
"reference": "985283538f013c37146b2ec83812eeef2ff9d73c"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/conventional-commits/php-commitizen/zipball/985283538f013c37146b2ec83812eeef2ff9d73c",
|
||||
"reference": "985283538f013c37146b2ec83812eeef2ff9d73c",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"symfony/console": "^4 || ^5"
|
||||
},
|
||||
"require-dev": {
|
||||
"phpspec/prophecy-phpunit": "^2.0",
|
||||
"phpunit/phpunit": "^9"
|
||||
},
|
||||
"bin": [
|
||||
"php-commitizen"
|
||||
],
|
||||
"type": "library",
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Damianopetrungaro\\PHPCommitizen\\": "src/"
|
||||
}
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Damiano Petrungaro",
|
||||
"email": "damianopetrungaro@gmail.com"
|
||||
}
|
||||
],
|
||||
"description": "Help writing Git commit following conventional commit specs",
|
||||
"keywords": [
|
||||
"atomic",
|
||||
"atomic commit",
|
||||
"commit",
|
||||
"conventional commit",
|
||||
"conventionalcommit",
|
||||
"git"
|
||||
],
|
||||
"support": {
|
||||
"issues": "https://github.com/conventional-commits/php-commitizen/issues",
|
||||
"source": "https://github.com/conventional-commits/php-commitizen/tree/v0.2.0"
|
||||
},
|
||||
"time": "2020-07-15T23:51:42+00:00"
|
||||
},
|
||||
{
|
||||
"name": "dealerdirect/phpcodesniffer-composer-installer",
|
||||
"version": "v0.7.1",
|
||||
|
|
5732
package-lock.json
generated
5732
package-lock.json
generated
File diff suppressed because it is too large
Load diff
43
package.json
43
package.json
|
@ -1,24 +1,59 @@
|
|||
{
|
||||
"scripts": {
|
||||
"cm": "cz",
|
||||
"format": "npm run format:js",
|
||||
"format:fix": "npm run format:js:fix",
|
||||
"format:js": "prettier --config .prettierrc './src/**/*.js'",
|
||||
"format:js:fix": "npm run format:js -- --write",
|
||||
"lint": "npm run lint:js && npm run lint:css",
|
||||
"lint:fix": "npm run lint:js:fix && npm run lint:css:fix",
|
||||
"lint": "npm run lint:js && npm run lint:css && npm run lint:md",
|
||||
"lint:fix": "npm run lint:js:fix && npm run lint:css:fix && npm run lint:md:fix",
|
||||
"lint:php": "composer run lint:php",
|
||||
"lint:php:fix": "composer run lint:php:fix",
|
||||
"lint:js": "eslint \"./src/**/*.js\"",
|
||||
"lint:js:fix": "npm run lint:js -- --fix",
|
||||
"lint:css": "stylelint \"./src/**/*.css\"",
|
||||
"lint:css:fix": "npm run lint:css -- --fix"
|
||||
"lint:css:fix": "npm run lint:css -- --fix",
|
||||
"lint:md": "markdownlint '*.md'",
|
||||
"lint:md:fix": "npm run lint:md -- --fix"
|
||||
},
|
||||
"husky": {
|
||||
"hooks": {
|
||||
"pre-commit": "lint-staged",
|
||||
"pre-push": "npm run test:coverage && npm run docs && git add coverage public && git commit -m \"docs: update documentation and coverage output\" --no-verify"
|
||||
}
|
||||
},
|
||||
"lint-staged": {
|
||||
"*.php": [
|
||||
"composer run lint:php"
|
||||
],
|
||||
"*.js": [
|
||||
"npm run format:js:fix",
|
||||
"npm run lint:js"
|
||||
],
|
||||
"*.(sa|sc|c)ss": [
|
||||
"npm run lint:css"
|
||||
],
|
||||
"*.md": [
|
||||
"npm run lint:md"
|
||||
]
|
||||
},
|
||||
"devDependencies": {
|
||||
"cz-conventional-changelog": "^3.3.0",
|
||||
"eslint": "^7.24.0",
|
||||
"eslint-config-prettier": "^8.2.0",
|
||||
"eslint-config-wordpress": "^2.0.0",
|
||||
"eslint-plugin-prettier": "^3.4.0",
|
||||
"husky": "^4.3.8",
|
||||
"lint-staged": "^10.5.4",
|
||||
"markdownlint-cli": "^0.27.1",
|
||||
"prettier": "^2.2.1",
|
||||
"stylelint": "^13.12.0",
|
||||
"stylelint-config-wordpress": "^17.0.0"
|
||||
},
|
||||
"license": "GPL-3.0"
|
||||
"license": "GPL-3.0",
|
||||
"config": {
|
||||
"commitizen": {
|
||||
"path": "./node_modules/cz-conventional-changelog"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Reference in a new issue