Skip to content

Commit 9db75db

Browse files
committed
feat: support CustomRuleOptions
1 parent 4835c57 commit 9db75db

File tree

1 file changed

+36
-0
lines changed

1 file changed

+36
-0
lines changed

src/rules/index.d.ts

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
import type { RuleConfig } from './rule-config'
2+
import type { StyleLintRules } from './stylelint'
3+
4+
/**
5+
* This is a special exported interface for other packages to declare
6+
* additional types that should bail out for eslint rules. For example
7+
* `stylelint-scss` can declare it like so in its `d.ts`:
8+
*
9+
* ```ts
10+
* import type { RuleConfig } from 'stylelint-define-config';
11+
* declare module 'stylelint-define-config' {
12+
* export interface CustomRuleOptions {
13+
* 'scss/at-else-closing-brace-newline-after': RuleConfig<
14+
* "always-last-in-chain",
15+
* { disableFix?: boolean }
16+
* >
17+
*
18+
* // ... more Rules
19+
* }
20+
* }
21+
* ```
22+
*/
23+
export interface CustomRuleOptions {}
24+
25+
type CustomRules = {
26+
[TRuleName in keyof CustomRuleOptions]: CustomRuleOptions[TRuleName]
27+
}
28+
29+
/**
30+
* Rules determine what the linter looks for and complains about.
31+
* There are {@link https://stylelint.io/user-guide/rules over 100 rules} built into Stylelint. No rules are turned on by default.
32+
*/
33+
export interface Rules extends
34+
StyleLintRules,
35+
CustomRules,
36+
Record<string, RuleConfig> {}

0 commit comments

Comments
 (0)