Skip to content

Commit 3b6204f

Browse files
committed
feat: add languageOptions configuration property
1 parent 629221e commit 3b6204f

File tree

3 files changed

+31
-9
lines changed

3 files changed

+31
-9
lines changed

src/config/LanguageOptions.d.ts

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
export interface LanguageOptions {
2+
syntax?: {
3+
atRules?: Record<
4+
string,
5+
{
6+
comment?: string
7+
prelude?: string
8+
descriptors?: Record<string, string>
9+
}
10+
>
11+
cssWideKeywords?: string[]
12+
properties?: Record<string, string>
13+
types?: Record<string, string>
14+
}
15+
}

src/config/index.d.ts

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,15 @@
1-
import type { ConfigRuleSettings, CustomSyntax, DisableOptions, Formatter, FormatterType, Rule, Severity } from 'stylelint'
1+
import type { ConfigRuleSettings, CustomSyntax, DisableOptions, Formatter, FormatterType, Severity } from 'stylelint'
22
import type { Rules } from '../rules'
33
import type { LiteralUnion } from '../utils'
44
import type { KnownCustomSyntax } from './customSyntax'
55
import type { KnownExtends } from './extends'
6-
import type { Plugins } from './plugins'
7-
8-
export interface PluginFunctions {
9-
[pluginName: string]: Rule
10-
}
6+
import type { LanguageOptions } from './LanguageOptions'
7+
import type { PluginFunctions, Plugins } from './plugins'
118

129
export type Extends = KnownExtends | StylelintConfig
1310

11+
export type DisableSettings = ConfigRuleSettings<boolean, DisableOptions>
12+
1413
/**
1514
* specify what subset of files to apply a configuration to.
1615
*/
@@ -24,8 +23,6 @@ export interface Override extends Omit<StylelintConfig, 'overrides'> {
2423
name?: string
2524
}
2625

27-
export type DisableSettings = ConfigRuleSettings<boolean, DisableOptions>
28-
2926
/**
3027
* Stylelint configuration
3128
* @see [Stylelint configuration](https://stylelint.io/user-guide/configure)
@@ -239,6 +236,12 @@ export interface StylelintConfig {
239236
* @see [computeEditInfo](https://stylelint.io/user-guide/configure#computeeditinfo)
240237
*/
241238
computeEditInfo?: boolean
239+
240+
/**
241+
* You can customize the syntax to define or extend the syntax for at-rules, properties, types, and CSS-wide keywords.
242+
* @see [languageOptions](https://stylelint.io/user-guide/configure#languageoptions)
243+
*/
244+
languageOptions?: LanguageOptions
242245
}
243246

244247
export { Severity }

src/config/plugins.d.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import type { Plugin } from 'stylelint'
1+
import type { Plugin, Rule } from 'stylelint'
22
import type { LiteralUnion } from '../utils'
33

44
/**
@@ -23,3 +23,7 @@ type KnownPlugins = LiteralUnion<
2323
>
2424

2525
export type Plugins = KnownPlugins | Plugin | (KnownPlugins | Plugin)[]
26+
27+
export interface PluginFunctions {
28+
[pluginName: string]: Rule
29+
}

0 commit comments

Comments
 (0)