|
| 1 | +# "Check Prettier Formatting" workflow (Task) |
| 2 | + |
| 3 | +Workflow file: [check-prettier-formatting-task.yml](check-prettier-formatting-task.yml) |
| 4 | + |
| 5 | +Use [Prettier](https://prettier.io/docs/en/index.html) to check formatting. Supported languages include: |
| 6 | + |
| 7 | +- JavaScript |
| 8 | +- TypeScript |
| 9 | +- CSS |
| 10 | +- HTML |
| 11 | +- JSON |
| 12 | +- Markdown |
| 13 | +- YAML |
| 14 | + |
| 15 | +This is the version of the workflow for projects using the [Task](https://taskfile.dev/#/) task runner tool. |
| 16 | + |
| 17 | +## Assets |
| 18 | + |
| 19 | +- [`Taskfile.yml`](assets/check-prettier-formatting-task/Taskfile.yml] - Formatting task. |
| 20 | + - Install to: repository root (or add the `general:format-prettier` task into the existing `Taskfile.yml`) |
| 21 | + |
| 22 | +## Configuration |
| 23 | + |
| 24 | +Prettier should be configured via a `.prettierignore` file to ignore any externally maintained files contained in the repository: |
| 25 | +https://prettier.io/docs/en/ignore.html |
| 26 | + |
| 27 | +Support for additional languages can be added to Prettier via plugins: |
| 28 | +https://prettier.io/docs/en/plugins.html |
| 29 | + |
| 30 | +Prettier automatically determines the language based on file name. In cases where it is not able to recognize a file, the parser can be specified in a `.prettierrc.yml` configuration file: |
| 31 | +https://prettier.io/docs/en/configuration.html#setting-the-parserdocsenoptionshtmlparser-option |
| 32 | + |
| 33 | +The default Prettier code style is the official standardized style to be used in all Arduino tooling projects and should not be modified. |
| 34 | + |
| 35 | +## Readme badge |
| 36 | + |
| 37 | +Markdown badge: |
| 38 | + |
| 39 | +```markdown |
| 40 | +[](https://github.com/REPO_OWNER/REPO_NAME/actions/workflows/check-prettier-formatting-task.yml) |
| 41 | +``` |
| 42 | + |
| 43 | +Replace the `REPO_OWNER` and `REPO_NAME` placeholders in the URLs with the final repository owner and name ([example](https://raw.githubusercontent.com/arduino-libraries/ArduinoIoTCloud/master/README.md)). |
| 44 | + |
| 45 | +--- |
| 46 | + |
| 47 | +Asciidoc badge: |
| 48 | + |
| 49 | +```adoc |
| 50 | +image:https://github.com/{repository-owner}/{repository-name}/actions/workflows/check-prettier-formatting-task.yml/badge.svg["Check Prettier Formatting status", link="https://github.com/{repository-owner}/{repository-name}/actions/workflows/check-prettier-formatting-task.yml"] |
| 51 | +``` |
| 52 | + |
| 53 | +Define the `{repository-owner}` and `{repository-name}` attributes and use them throughout the readme ([example](https://raw.githubusercontent.com/arduino-libraries/WiFiNINA/master/README.adoc)). |
| 54 | + |
| 55 | +## Commit message |
| 56 | + |
| 57 | +``` |
| 58 | +Add CI workflow to check for Prettier formatting compliance |
| 59 | + |
| 60 | +On every push and pull request that affects relevant files, and periodically, check whether the formatting of supported |
| 61 | +files is compliant with the Prettier style. |
| 62 | +``` |
| 63 | +
|
| 64 | +## PR message |
| 65 | +
|
| 66 | +```markdown |
| 67 | +On every push and pull request that affects relevant files, and periodically, check whether the formatting of supported files is compliant with the [Prettier](https://prettier.io/docs/en/index.html) style. |
| 68 | +``` |
0 commit comments