Skip to content

Commit 2ff553f

Browse files
committed
feat: add rule-config
1 parent 87212c4 commit 2ff553f

File tree

2 files changed

+43
-0
lines changed

2 files changed

+43
-0
lines changed

src/rules/rule-config.d.ts

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
import type { Severity } from 'stylelint'
2+
3+
export interface SecondaryOptions {
4+
/**
5+
* You can set the `disableFix` secondary option to disable autofix on a per-rule basis.
6+
* @see [configure disable fix](https://stylelint.io/user-guide/configure#disablefix)
7+
*/
8+
disableFix?: boolean
9+
/**
10+
* You can set the reportDisables secondary option to report any stylelint-disable comments
11+
* for this rule, effectively disallowing authors to opt-out of it.
12+
* @see [configure report disables](https://stylelint.io/user-guide/configure#reportdisables)
13+
*/
14+
reportDisables?: boolean
15+
/**
16+
* You can use the severity secondary option to adjust any specific rule's severity.
17+
*
18+
* The available values for severity are:
19+
* - "warning"
20+
* - "error" (default)
21+
* @see [configure severity](https://stylelint.io/user-guide/configure#severity)
22+
*/
23+
severity?: Severity
24+
/**
25+
* You can use the message secondary option to deliver a custom message when a rule is violated.
26+
* @see [configure message](https://stylelint.io/user-guide/configure#message)
27+
*/
28+
message?: string | ((...args: any[]) => string)
29+
}
30+
31+
export type RuleConfig<T, S extends object = object>
32+
= null
33+
| undefined
34+
| NonNullable<T>
35+
| [NonNullable<T>]
36+
| [NonNullable<T>, Omit<SecondaryOptions, keyof S> & S]

src/types.d.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
import type * as CSS from 'csstype'
2+
3+
export type CSSPropertiesMap = keyof CSS.Properties
4+
5+
export type StandardPropertiesMap = keyof CSS.StandardProperties
6+
7+
export type AtRules = CSS.AtRules extends `@${infer T}` ? T : never

0 commit comments

Comments
 (0)