-
-
Notifications
You must be signed in to change notification settings - Fork 927
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
Document errors and warnings better #6426
Merged
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,26 +4,97 @@ In addition to rule problems, Stylelint surfaces the following errors and warnin | |
|
||
## CSS syntax error | ||
|
||
The chosen [PostCSS syntax](usage/options.md#customsyntax) was unable to parse the source. | ||
The CSS parser built into Stylelint, or the chosen [custom syntax](usage/options.md#customsyntax), could not parse your code. | ||
|
||
### Unclosed block | ||
|
||
You should balance your _curly braces_, typically of _declaration blocks_. | ||
|
||
For example: | ||
|
||
```diff css | ||
- a { color: red; | ||
+ a { color: red; } | ||
``` | ||
|
||
### Unclosed bracket | ||
|
||
You should balance your _square brackets_, typically of _attribute selectors_ and _grid names_. | ||
|
||
For example: | ||
|
||
```diff css | ||
- a[foo { grid: [bar; } | ||
+ a[foo] { grid: [bar]; } | ||
``` | ||
|
||
### Unclosed string | ||
|
||
You should balance your _quotation marks_. | ||
|
||
For example: | ||
|
||
```diff css | ||
- a { content: " } | ||
+ a { content: "" } | ||
``` | ||
|
||
### Unknown word | ||
|
||
You should: | ||
|
||
- hyphenate _properties_ | ||
- separate _property and value pairs_ with _colons_ | ||
- separate _declarations_ with _semicolons_ | ||
- pair _selectors_ with _declaration blocks_ in _rules_ | ||
|
||
For example: | ||
|
||
```diff css | ||
a { | ||
- margin top: 1px | ||
- color red | ||
+ margin-top: 1px; | ||
+ color: red | ||
} | ||
``` | ||
|
||
## Parse error | ||
|
||
The chosen [PostCSS syntax](usage/options.md#customsyntax) successfully parsed, but one of the construct-specific parsers failed to parse either a media query, selector or value within that source. | ||
The CSS parser built into Stylelint (or the chosen [custom syntax](usage/options.md#customsyntax)) successfully parsed your code, but one of the construct-specific parsers failed to parse either a media query, selector or value within that source. | ||
|
||
The construct-specific parsers are: | ||
|
||
- `postcss-media-query-parser` | ||
- `postcss-selector-parser` | ||
- `postcss-value-parser` | ||
|
||
You should check that your constructs are wellformed, e.g. parentheses are balanced. | ||
|
||
## Unknown rule error | ||
|
||
There is an unknown rule in the [configuration object](configure.md). | ||
|
||
You should: | ||
|
||
- install the latest version of Stylelint (`npm i --save-dev stylelint`), as we may have recently added the rule | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [Note] Judging by the historical issues raised, it's usually an outdated version of Stylelint causing this error and the invalid option warning. |
||
- check that the rule exists and is correctly named by searching the [list of rules](rules.md) | ||
|
||
## Deprecation warning | ||
|
||
There is a deprecated rule in the [configuration object](configure.md). | ||
|
||
You should: | ||
|
||
- identify in the [CHANGELOG](../../CHANGELOG.md) which release deprecated the rule | ||
- take the action suggested there | ||
|
||
## Invalid option warning | ||
|
||
There is a misconfigured rule in the [configuration object](configure.md). | ||
|
||
You should: | ||
|
||
- install the latest version of Stylelint (`npm i --save-dev stylelint`), as we may have recently added the option | ||
- check that the option exists and is correctly named by reading the rule's README | ||
- correctly configure the [`rules`](configure.md#rules) property in the configuration object |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[Note] The
CSSSyntaxError
includes a message, e.g. this demo. I've used those messages as heading within this section so that: