Software zum Installieren eines Smart-Mirror Frameworks , zum Nutzen von hochschulrelevanten Informationen, auf einem Raspberry-Pi.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

README.md 4.6KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152
  1. # `pretty-quick`
  2. [![Travis](https://img.shields.io/travis/azz/pretty-quick.svg?style=flat-square)](https://travis-ci.org/azz/pretty-quick)
  3. [![Prettier](https://img.shields.io/badge/code_style-prettier-ff69b4.svg?style=flat-square)](https://github.com/prettier/prettier)
  4. [![npm](https://img.shields.io/npm/v/pretty-quick.svg?style=flat-square)](https://npmjs.org/pretty-quick)
  5. [![semantic-release](https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg?style=flat-square)](https://github.com/semantic-release/semantic-release)
  6. [![License](https://img.shields.io/badge/license-MIT-blue.svg?style=flat-square)](LICENSE)
  7. > Get Pretty Quick
  8. Runs [Prettier](https://prettier.io) on your changed files.
  9. ![demo](./img/demo.gif)
  10. Supported source control managers:
  11. - Git
  12. - Mercurial
  13. ## Install
  14. With `yarn`:
  15. ```shellsession
  16. yarn add --dev prettier pretty-quick
  17. ```
  18. With `npm`:
  19. ```shellsession
  20. npm install --save-dev prettier pretty-quick
  21. ```
  22. ## Usage
  23. With `yarn`:
  24. ```shellsession
  25. yarn pretty-quick
  26. ```
  27. With [`npx`](https://npm.im/npx):
  28. ```shellsession
  29. npx -p prettier@latest -p pretty-quick pretty-quick
  30. ```
  31. > Note: You can (_should_) change `latest` to a specific version of Prettier.
  32. With `npm`:
  33. 1. Add `"pretty-quick": "pretty-quick"` to the `"scripts"` section of `package.json`.
  34. 2. `npm run pretty-quick`
  35. ## Pre-Commit Hook
  36. You can run `pretty-quick` as a pre-commit hook using [`husky`](https://github.com/typicode/husky).
  37. > For Mercurial have a look at [`husky-hg`](https://github.com/TobiasTimm/husky-hg)
  38. ```shellstream
  39. yarn add --dev husky
  40. ```
  41. In `package.json`, add:
  42. ```json
  43. "husky": {
  44. "hooks": {
  45. "pre-commit": "pretty-quick --staged"
  46. }
  47. }
  48. ```
  49. ![demo](./img/precommit.gif)
  50. ## CLI Flags
  51. ### `--staged` (only git)
  52. Pre-commit mode. Under this flag only staged files will be formatted, and they will be re-staged after formatting.
  53. Partially staged files will not be re-staged after formatting and pretty-quick will exit with a non-zero exit code. The intent is to abort the git commit and allow the user to amend their selective staging to include formatting fixes.
  54. ### `--no-restage` (only git)
  55. Use with the `--staged` flag to skip re-staging files after formatting.
  56. ### `--branch`
  57. When not in `staged` pre-commit mode, use this flag to compare changes with the specified branch. Defaults to `master` (git) / `default` (hg) branch.
  58. ### `--pattern`
  59. Filters the files for the given [minimatch](https://github.com/isaacs/minimatch) pattern.
  60. For example `pretty-quick --pattern "**/*.*(js|jsx)"` or `pretty-quick --pattern "**/*.js" --pattern "**/*.jsx"`
  61. ### `--verbose`
  62. Outputs the name of each file right before it is proccessed. This can be useful if Prettier throws an error and you can't identify which file is causing the problem.
  63. ### `--bail`
  64. Prevent `git commit` if any files are fixed.
  65. ### `--check`
  66. Check that files are correctly formatted, but don't format them. This is useful on CI to verify that all changed files in the current branch were correctly formatted.
  67. ### `--no-resolve-config`
  68. Do not resolve prettier config when determining which files to format, just use standard set of supported file types & extensions prettier supports. This may be useful if you do not need any customization and see performance issues.
  69. By default, pretty-quick will check your prettier configuration file for any overrides you define to support formatting of additional file extensions.
  70. Example `.prettierrc` file to support formatting files with `.cmp` or `.page` extensions as html.
  71. ```
  72. {
  73. "printWidth": 120,
  74. "bracketSpacing": false,
  75. "overrides": [
  76. {
  77. "files": "*.{cmp,page}",
  78. "options": {"parser": "html"}
  79. }
  80. ],
  81. }
  82. ```
  83. <!-- Undocumented = Unsupported :D
  84. ### `--config`
  85. Path to a `.prettierrc` file.
  86. ### `--since`
  87. A SCM revision such as a git commit hash or ref.
  88. For example `pretty-quick --since HEAD` will format only staged files.
  89. -->
  90. ### `--ignore-path`
  91. Check an alternative file for ignoring files with the same format as [`.prettierignore`](https://prettier.io/docs/en/ignore#ignoring-files).
  92. For example `pretty-quick --ignore-path .gitignore`
  93. ## Configuration and Ignore Files
  94. `pretty-quick` will respect your [`.prettierrc`](https://prettier.io/docs/en/configuration), [`.prettierignore`](https://prettier.io/docs/en/ignore#ignoring-files), and [`.editorconfig`](http://editorconfig.org/) files if you don't use `--ignore-path` . Configuration files will be found by searching up the file system. `.prettierignore` files are only found from the repository root and the working directory that the command was executed from.