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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Describe missing reportedDisables and reportDescriptionlessDisables #4939

Merged
merged 4 commits into from Sep 25, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
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
4 changes: 3 additions & 1 deletion docs/user-guide/configure.md
Expand Up @@ -137,7 +137,7 @@ Reporters may use these severity levels to display violations or exit the proces

### `reportDisables`

You can set the `reportDisables` secondary option to report any disable comments for this rule, effectively disallowing authors to opt out of it.
You can set the `reportDisables` secondary option to report any `stylelint-disable` comments for this rule, effectively disallowing authors to opt out of it.

For example:

Expand All @@ -155,6 +155,8 @@ For example:
}
```

The report is included in the [`reportedDisables`](usage/node-api.md#reporteddisables) property to the returned data of Node.js API.

## `defaultSeverity`

You can set the default severity level for all rules that do not have a severity specified in their secondary options. For example, you can set the default severity to `"warning"`:
Expand Down
12 changes: 10 additions & 2 deletions docs/user-guide/usage/node-api.md
Expand Up @@ -66,13 +66,21 @@ An array containing all the stylelint result objects (the objects that formatter

An object containing the maximum number of warnings and the amount found, e.g. `{ maxWarnings: 0, foundWarnings: 12 }`.

### `reportedDisables`

An array of objects, one for each source, with tells you which `stylelint-disable` comments for rules enabled [`reportDisables`](../configure.md#reportdisables).

### `needlessDisables`

An array of objects, one for each source, with tells you which stylelint-disable comments are not blocking a lint violation
An array of objects, one for each source, with tells you which `stylelint-disable` comments are not blocking a lint violation.

### `invalidScopeDisables`

An array of objects, one for each source, with tells you which rule in `stylelint-disable <rule>` comment don't exist within the configuration object.
An array of objects, one for each source, with tells you which rule in a `stylelint-disable <rule>` comment doesn't exist within the configuration object.

### `descriptionlessDisables`

An array of objects, one for each source, with tells you which `stylelint-disable` comments without a description.

## Syntax errors

Expand Down
43 changes: 41 additions & 2 deletions docs/user-guide/usage/options.md
Expand Up @@ -141,7 +141,7 @@ You can use this option to see what your linting results would be like without t

CLI flags: `--report-needless-disables, --rd`

Produce a report to clean up your codebase, keeping only the stylelint-disable comments that serve a purpose.
Produce a report to clean up your codebase, keeping only the `stylelint-disable` comments that serve a purpose.

If needless disables are found, the:

Expand All @@ -152,13 +152,52 @@ If needless disables are found, the:

CLI flags: `--report-invalid-scope-disables, --risd`

Produce a report of the stylelint-disable comments that used for rules that don't exist within the configuration object.
Produce a report of the `stylelint-disable` comments that used for rules that don't exist within the configuration object.

If invalid scope disables are found, the:

- CLI process exits with code `2`
- Node.js API adds a [`invalidScopeDisables`](node-api.md#invalidscopedisables) property to the returned data

## `reportDescriptionlessDisables`

CLI flags: `--report-descriptionless-disables, --rdd`

Produce a report of the `stylelint-disable` comments without a description.

For example, when the configuration `{ block-no-empty: true }` is given, the following patterns are reported:

<!-- prettier-ignore -->
```css
/* stylelint-disable */
a {}
```

<!-- prettier-ignore -->
```css
/* stylelint-disable-next-line block-no-empty */
a {}
```

But, the following patterns (`stylelint-disable -- <description>`) are _not_ reported:

<!-- prettier-ignore -->
```css
/* stylelint-disable -- This violation is ignorable. */
a {}
```

<!-- prettier-ignore -->
```css
/* stylelint-disable-next-line block-no-empty -- This violation is ignorable. */
a {}
```

If descriptionless disables are found, the:

- CLI process exits with code `2`
- Node.js API adds a [`descriptionlessDisables`](node-api.md#descriptionlessdisables) property to the returned data

## `codeFilename`

CLI flag: `--stdin-filename`
Expand Down