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

Add report invalid scope disables #4181

Merged
8 changes: 8 additions & 0 deletions docs/user-guide/node-api.md
Expand Up @@ -118,6 +118,14 @@ Use this report to clean up your codebase, keeping only the stylelint-disable co

*The recommended way to use this option is through the CLI.* It will output a clean report to the console.

### `reportInvalidScopeDisables`

If `true`, the returned data will contain a `invalidScopeDisables` property, whose value is 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.

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

*The recommended way to use this option is through the CLI.* It will output a clean report to the console.

### `maxWarnings`

Sets a limit to the number of warnings accepted. Will add a `maxWarningsExceeded` property to the returned data if the number of found warnings exceeds the given limit.
Expand Down
7 changes: 5 additions & 2 deletions flow-typed/stylelint.js
Expand Up @@ -36,6 +36,7 @@ export type stylelint$options = {
configOverrides?: Object,
ignoreDisables?: boolean,
ignorePath?: string,
reportInvalidScopeDisables?: boolean,
reportNeedlessDisables?: boolean,
syntax?: stylelint$syntaxes,
customSyntax?: string,
Expand Down Expand Up @@ -107,7 +108,7 @@ export type stylelint$cssSyntaxError = {
source: string
};

export type stylelint$needlessDisablesReport = Array<{
export type stylelint$disableOptionsReport = Array<{
source: string,
ranges: Array<{
unusedRule: string,
Expand All @@ -124,7 +125,8 @@ export type stylelint$standaloneReturnValue = {
maxWarnings: number,
foundWarnings: number
},
needlessDisables?: stylelint$needlessDisablesReport
needlessDisables?: stylelint$disableOptionsReport,
invalidScopeDisables?: stylelint$disableOptionsReport
};

export type stylelint$standaloneOptions = {
Expand All @@ -143,6 +145,7 @@ export type stylelint$standaloneOptions = {
ignorePath?: string,
ignorePattern?: RegExp,
reportNeedlessDisables?: boolean,
reportInvalidScopeDisables?: boolean,
maxWarnings?: number,
syntax?: stylelint$syntaxes,
customSyntax?: string,
Expand Down