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.

linting.md 2.0KB

12345678910111213141516171819202122232425262728293031323334
  1. # Linting
  2. A linter is a tool that analyzes source code to flag programming errors, bugs, stylistic errors, and suspicious constructs.
  3. You can use a linter with a pretty printer and a validator. There are, however, usually overlaps between these three types of tools.
  4. ## Pretty printers
  5. There are two approaches to enforcing stylistic conventions:
  6. - a machine algorithmically pretty prints the code (usually based on a maximum line length)
  7. - a human initially formats the code, and a machine fixes-up/warns-about any mistakes
  8. The former is handled by pretty printers, like [prettier](https://github.com/prettier/prettier), whereas the latter is catered for by the built-in [stylistic rules](../user-guide/rules/list.md#stylistic-issues). If you use a pretty printer, you'll want to use [`stylelint-config-recommended`](https://github.com/stylelint/stylelint-config-recommended), which only turns on [possible error](../user-guide/rules/list.md#possible-errors) rules.
  9. Additionally, the built-in stylistic rules and plugins are configurable to support a diverse range of stylistic conventions. For example, ordering properties within declaration blocks is a divisive topic, where there isn't a dominant convention. The [`stylelint-order`](https://www.npmjs.com/package/stylelint-order) plugin can be configured to lint and fix a diverse range of ordering conventions.
  10. Another example is the use of single-line rules for sets of _related_ rules, e.g.
  11. <!-- prettier-ignore -->
  12. ```css
  13. /* Single-line related classes */
  14. .class-1 { top: 0; bottom: 0; }
  15. .class-2 { top: 5px; right: 0; }
  16. .class-3 { top: 8px; left: 0; }
  17. ```
  18. You can configure the built-in stylistic rules to allow both multi-line and single-line rules. The choice of when to use each belongs to the user.
  19. ## Validators
  20. Validators like [csstree](https://github.com/csstree/csstree) identify invalid code such as misformed hex colors and unknown language features.
  21. However, as a stop-gap, while these tools mature stylelint provides rules for the simplest of cases.