Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prepare 15.0.0 docs #6573

Merged
merged 21 commits into from Jan 25, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
19 changes: 12 additions & 7 deletions docs/developer-guide/rules.md
Expand Up @@ -27,23 +27,28 @@ Unless it applies to the whole source, then there is no first part.

### Write tests
jeddy3 marked this conversation as resolved.
Show resolved Hide resolved

Each rule must have tests that cover all patterns that:
You should add test cases for all patterns that are:

- are considered problems
- should _not_ be considered problems
- considered problems
- _not_ considered problems

You should test errors in multiple positions, not the same place every time and use:
You should use:

- realistic CSS, and avoid the use of ellipses
- the minimum amount of code possible, e.g. if the rule targets selectors then use an empty rule, e.g. `{}`
- separate `testRule`s when testing non-standard syntax and set the `customSyntax` property
- realistic CSS, avoiding the use of ellipses
- the minimum amount of code possible, e.g. use an empty rule if targetting selectors
- `{}` for empty rules, rather than `{ }`
- the `a` type selector by default
- the `@media` at-rules by default
- the `color` property by default
- the `red` value by default
- the `(min-)width` media feature by default
- _foo_, _bar_ and _baz_ for names, e.g. `.foo`, `#bar`, `--baz`

You should test:

- in multiple positions, not the same place every time
jeddy3 marked this conversation as resolved.
Show resolved Hide resolved
- non-standard syntax in the `isStandardSyntax*` utilities, not in the rule itself

#### Commonly overlooked edge-cases

You should ask yourself how does your rule handle:
Expand Down