UNPKG

stylelint-define-config

Version:

Provide a defineConfig function for stylelint.config.js files

1,158 lines 150 kB
import { ConfigReferenceFiles, ConfigRuleSettings, CustomSyntax as CustomSyntax$1, DisableOptions, Formatter, FormatterType, Plugin, Rule, Severity, Severity as Severity$1 } from "stylelint"; import * as CSS from "csstype"; type Unprefix<T extends Record<string, any>, Pre extends string> = { [K in keyof T as K extends `${Pre}${infer U}` ? U : never]: T[K]; }; type Prefix<T extends Record<string, any>, Pre extends string> = { [K in keyof T as `${Pre}${K}`]: T[K]; }; type RenamePrefix<T extends Record<string, any>, Old extends string, New extends string> = Prefix<Unprefix<T, Old>, New>; type Prettify<T> = { [K in keyof T]: T[K]; } & {}; type Arrayable<T> = T | T[]; /** * A literal type that supports custom further strings but preserves autocompletion in IDEs. * * @see [copied from issue](https://github.com/microsoft/TypeScript/issues/29729#issuecomment-471566609) */ type LiteralUnion<Union extends Base, Base = string> = Union | (Base & { zz_IGNORE_ME?: never; }); type RegExpLike = RegExp | string; type KebabCase<S extends string, B extends boolean = true> = S extends `${infer F}${infer O}` ? F extends Uncapitalize<F> ? `${F}${KebabCase<O, false>}` : B extends true ? `${Uncapitalize<F>}${KebabCase<O, false>}` : `-${Uncapitalize<F>}${KebabCase<O, false>}` : S; interface SecondaryOptions<MessageParams extends readonly any[]> { /** * You can set the `disableFix` secondary option to disable autofix on a per-rule basis. * @see [configure disable fix](https://stylelint.io/user-guide/configure#disablefix) */ disableFix?: boolean; /** * You can set the reportDisables secondary option to report any stylelint-disable comments * for this rule, effectively disallowing authors to opt-out of it. * @see [configure report disables](https://stylelint.io/user-guide/configure#reportdisables) */ reportDisables?: boolean; /** * You can use the severity secondary option to adjust any specific rule's severity. * * The available values for severity are: * - "warning" * - "error" (default) * @see [configure severity](https://stylelint.io/user-guide/configure#severity) */ severity?: Severity$1; /** * You can use the message secondary option to deliver a custom message when a rule is violated. * @see [configure message](https://stylelint.io/user-guide/configure#message) */ message?: string | ((...args: MessageParams) => string); /** * You can use the url secondary option to provide a custom link to external docs. * These urls can then be displayed in custom formatters. * @see [configure url](https://stylelint.io/user-guide/configure#url) */ url?: string; } /** * declaration rule config. * * `RuleConfig<PrimaryOptions, SecondaryOptions>` */ type RuleConfig<Primary, MessageParams extends any[] = [], Secondary extends object = object> = null | undefined | Primary | readonly [Primary] | readonly [Primary, Prettify<Omit<SecondaryOptions<MessageParams>, keyof Secondary> & Secondary>]; type StrictAtRules = CSS.AtRules extends `@${infer T}` ? T : never; type AtRules = LiteralUnion<StrictAtRules>; type CSSFunction = LiteralUnion<'abs' | 'acos' | 'asin' | 'atan' | 'atan2' | 'attr' | 'calc' | 'clamp' | 'cos' | 'counter' | 'counters' | 'cross-fade' | 'env' | 'exp' | 'fix-content' | 'hypot' | 'log' | 'max' | 'min' | 'minmax' | 'pow' | 'rem' | 'repeat' | 'round' | 'sign' | 'sin' | 'sqrt' | 'symbols' | 'tan' | 'url' | 'var'>; type MediaFeature = MediaFeatureNormal | MediaFeaturePrefix; type MediaFeatureNormal = LiteralUnion< // level 3 'width' | 'height' | 'device-width' | 'device-height' | 'orientation' | 'aspect-ratio' | 'device-aspect-ratio' | 'color' | 'color-index' | 'monochrome' | 'resolution' | 'scan' | 'grid' | // level 4 'update' | 'overflow-block' | 'overflow-inline' | 'color-gamut' | 'pointer' | 'hover' | 'any-pointer' | 'any-hover'>; type MediaFeaturePrefix = LiteralUnion<'max-width' | 'max-height' | 'max-device-width' | 'max-device-height' | 'max-aspect-ratio' | 'max-device-aspect-ratio' | 'max-color-index' | 'max-monochrome' | 'max-resolution' | 'max-color' | 'min-width' | 'min-height' | 'min-device-width' | 'min-device-height' | 'min-aspect-ratio' | 'min-device-aspect-ratio' | 'min-color' | 'min-color-index' | 'min-monochrome' | 'min-resolution'>; type MediaFeatureLevel5 = LiteralUnion<'horizontal-viewport-segments' | 'vertical-viewport-segments' | 'display-mode' | 'environment-blending' | 'dynamic-range' | 'inverted-colors' | 'nav-controls' | 'video-color-gamut' | 'video-dynamic-range' | 'scripting' | 'prefers-reduced-motion' | 'prefers-reduced-transparency' | 'prefers-contrast' | 'forced-colors' | 'prefers-color-scheme' | 'prefers-reduced-data'>; type MediaType = LiteralUnion<'all' | 'screen' | 'print'>; type CSSPropertiesMap = keyof CSS.Properties; type StandardPropertiesMap = keyof CSS.StandardProperties; type KebabCaseStandardPropertiesMap = LiteralUnion<KebabCase<StandardPropertiesMap>>; type SelectorAttributeOperator = LiteralUnion<'=' | '~=' | '|=' | '^=' | '$=' | '*='>; type SelectorCombinator = LiteralUnion<' ' | '>' | '+' | '~' | '||' | '|' | ','>; type SelectorPseudoClass = LiteralUnion<'active' | 'any-link' | 'autofill' | 'buffering' | 'blank' | 'checked' | 'current' | 'default' | 'defined' | 'dir' | 'disabled' | 'empty' | 'enabled' | 'first' | 'first-child' | 'first-of-type' | 'focus' | 'focus-visible' | 'focus-within' | 'fullscreen' | 'hover' | 'future' | 'has' | 'host' | 'host-context' | 'hover' | 'indeterminate' | 'in-range' | 'invalid' | 'is' | 'lang' | 'last-child' | 'last-of-type' | 'left' | 'link' | 'local-link' | 'modal' | 'muted' | 'not' | 'nth-child' | 'nth-last-child' | 'nth-last-of-type' | 'not-of-type' | 'only-child' | 'only-of-type' | 'optional' | 'out-of-range' | 'past' | 'paused' | 'picture-in-picture' | 'placeholder-shown' | 'playing' | 'popover-open' | 'ready-only' | 'read-write' | 'required' | 'right' | 'root' | 'scope' | 'seeking' | 'stalled' | 'target' | 'target-within' | 'user-invalid' | 'user-valid' | 'valid' | 'visited' | 'volume-locked' | 'where'>; type SelectorPseudoElement = LiteralUnion<'before' | 'after' | 'backdrop' | 'cue' | 'cue-region' | 'file-selector-button' | 'first-letter' | 'first-line' | 'highlight' | 'marker' | 'part' | 'placeholder' | 'selection' | 'slotted'>; type FontRelativeUnit = 'cap' | 'ch' | 'em' | 'ex' | 'ic' | 'lh' // local font | 'rcap' | 'rch' | 'rem' | 'rex' | 'ric' | 'rlh'; // root font type ViewportUnit = 'dvh' | 'dvw' | 'lvh' | 'lvw' | 'svh' | 'svw' | 'vb' | 'vh' | 'vw' | 'vi' | 'vmax' | 'vmin'; type AbsoluteUnit = 'px' | 'pt' | 'cm' | 'mm' | 'Q' | 'in' | 'pc'; type ContainerUnit = 'cqb' | 'cqh' | 'cqi' | 'cqmax' | 'cqmin' | 'cqw'; type AngleUnit = 'deg' | 'grad' | 'rad' | 'turn'; type PercentUnit = '%'; type TimeUnit = 'ms' | 's'; type FrequencyUnit = 'Hz' | 'kHz'; type FlexUnit = 'fr'; type ResolutionUnit = 'dpi' | 'dpcm' | 'dppx' | 'x'; type CustomUnit = 'rpx'; /* 小程序 */ type StrictUnit = FontRelativeUnit | AbsoluteUnit | ViewportUnit | ContainerUnit | AngleUnit | PercentUnit | TimeUnit | FlexUnit | FrequencyUnit | ResolutionUnit | CustomUnit; type Unit = LiteralUnion<StrictUnit>; type AlphaValueNotationOptions = RuleConfig<'number' | 'percentage', [unfixed: string, fixed: string], { /** * Reverse the primary option for matching properties. * @see [optional secondary options](https://stylelint.io/user-guide/rules/alpha-value-notation#optional-secondary-options) */ exceptProperties?: (CSSPropertiesMap | RegExpLike)[]; }>; type AnnotationNoUnknownOptions = RuleConfig<true, [annotation: string], { /** * Specify which annotations to ignore. */ ignoreAnnotations?: RegExpLike[]; }>; type AtRuleAllowedListOptions = RuleConfig<AtRules[] | string[], [atRule: string]>; type AtRuleDescriptorNoUnknownOptions = RuleConfig<true, [atRule: string, descriptor: string]>; type AtRuleDescriptorValueNoUnknownOptions = RuleConfig<true, [descriptor: string, value: string]>; type AtRuleDisallowedListOptions = RuleConfig<AtRules[] | string[], [atRule: string]>; type AtRuleEmptyLineBeforeOptions = RuleConfig<'always' | 'never', [atRule: string], { except?: LiteralUnion<'after-same-name' | 'inside-block' | 'blockless-after-same-name-blockless' | 'blockless-after-blockless' | 'first-nested'>[]; ignore?: LiteralUnion<'after-comment' | 'first-nested' | 'inside-block' | 'blockless-after-same-name-blockless' | 'blockless-after-blockless'>[]; ignoreAtRules?: (AtRules | RegExp)[]; }>; type AtRuleNoDeprecatedOptions = RuleConfig<true, [atRule: string], { ignoreAtRules?: (RegExp | AtRules)[]; }>; type AtRuleNoUnknownOptions = RuleConfig<true, [atRule: string], { ignoreAtRules?: (string | RegExp)[]; }>; type AtRuleNoVendorPrefixOptions = RuleConfig<true, [atRule: string], { ignoreAtRules?: (AtRules | RegExp)[]; }>; type AtRulePreludeNoInvalidOptions = RuleConfig<true, [atRule: string, prelude: string], { ignoreAtRules?: (RegExp | AtRules)[]; }>; type AtRulePropertyRequiredListOptions = RuleConfig<Record<AtRules, CSSPropertiesMap | CSSPropertiesMap[]>, [atRule: string, property: string]>; type BlockNoEmptyOptions = RuleConfig<true, [block: string], { ignore?: LiteralUnion<'comments'>[]; }>; type BlockNoRedundantNestedStyleRulesOptions = RuleConfig<true>; type ColorFunctionAliasNatationOptions = RuleConfig<'without-alpha' | 'with-alpha', [unfixed: string, fixed: string]>; type ColorFunctionNatationOptions = RuleConfig<'modern' | 'legacy', [primary: string], { ignore?: LiteralUnion<'with-var-inside'>[]; }>; type ColorHexAlphaOptions = RuleConfig<'always' | 'never', [hex: string]>; type ColorHexLengthOptions = RuleConfig<'short' | 'long', [actual: string, expected: string]>; type ColorNamedOptions = RuleConfig<'always-where-possible' | 'never', [named: string], { ignoreProperties?: RegExpLike[]; ignore?: LiteralUnion<'inside-function'>[]; }>; type ColorNoHexOptions = RuleConfig<true, [hex: string, expected: string]>; type ColorNoInvalidHexOptions = RuleConfig<true, [hex: string, expected: string]>; type CommentEmptyLineBeforeOptions = RuleConfig<'always' | 'never', [], { except?: LiteralUnion<'first-nested'>[]; ignore?: LiteralUnion<'stylelint-commands' | 'after-comment'>[]; ignoreComments?: RegExpLike[]; }>; type CommentNoEmptyOptions = RuleConfig<true>; type CommentPatternOptions = RuleConfig<RegExpLike>; type CommentWhitespaceInsideOptions = RuleConfig<'always' | 'never'>; type CommentWordDisallowedListOptions = RuleConfig<Arrayable<RegExpLike>, [pattern: string]>; type ContainerNamePatternOptions = RuleConfig<RegExpLike, [containerName: string, pattern: string]>; type CustomMediaPatternOptions = RuleConfig<RegExpLike, [mediaName: string, pattern: string]>; type CustomPropertyEmptyLineBeforeOptions = RuleConfig<'always' | 'never', [], { except?: LiteralUnion<'after-comment' | 'after-custom-property' | 'after-block' | 'first-nested'>[]; ignore?: LiteralUnion<'after-comment' | 'first-nested' | 'inside-single-line-block' | 'after-custom-property'>[]; }>; type CustomPropertyNoMissingVarFunctionOptions = RuleConfig<true, [customProperty: string]>; type CustomPropertyPatternOptions = RuleConfig<RegExpLike, [propName: string, pattern: string]>; type DeclarationBlockNoDuplicateCustomPropertiesOptions = RuleConfig<true, [property: string]>; type DeclarationBlockNoDuplicatePropertiesOptions = RuleConfig<true, [property: string], { ignore?: LiteralUnion<'consecutive-duplicates' | 'consecutive-duplicates-with-different-values' | 'consecutive-duplicates-with-different-syntaxes' | 'consecutive-duplicates-with-same-prefixless-values'>[]; ignoreProperties?: RegExpLike[]; }>; type DeclarationBlockNoRedundantLonghandPropertiesOptions = RuleConfig<true, [props: string], { ignoreLonghands?: string | string[]; ignoreShorthands?: (string | RegExp)[]; }>; type DeclarationBlockNoShorthandPropertyOverridesOptions = RuleConfig<true, [shorthand: string, original: string]>; type DeclarationBlockSingleLineMaxDeclarationsOptions = RuleConfig<number, [max: number]>; type DeclarationEmptyLineBeforeOptions = RuleConfig<'always' | 'never', [], { except?: LiteralUnion<'after-comment' | 'after-declaration' | 'after-block' | 'first-nested'>[]; ignore?: LiteralUnion<'after-comment' | 'after-declaration' | 'first-nested' | 'inside-single-line-block'>[]; ignoreProperties?: RegExpLike[]; }>; type DeclarationNoImportantOptions = RuleConfig<true>; type DeclarationPropertyMaxValuesOptions = RuleConfig<Partial<Record<KebabCaseStandardPropertiesMap, number>>, [property: string, max: number]>; type DeclarationPropertyUnitAllowedListOptions = RuleConfig<Partial<Record<KebabCaseStandardPropertiesMap, Arrayable<Unit>>>, [property: string, unit: string], { ignore?: LiteralUnion<'inside-function'>[]; }>; type DeclarationPropertyUnitDisallowedListOptions = RuleConfig<Partial<Record<KebabCaseStandardPropertiesMap, Arrayable<Unit>>>, [property: string, unit: string]>; type DeclarationPropertyValueAllowedListOptions = RuleConfig<Partial<Record<KebabCaseStandardPropertiesMap, Arrayable<RegExpLike>>>, [property: string, value: string]>; type DeclarationPropertyValueDisallowedListOptions = RuleConfig<Partial<Record<KebabCaseStandardPropertiesMap, Arrayable<RegExpLike>>>, [property: string, value: string]>; type DeclarationPropertyValueKeywordNoDeprecatedOptions = RuleConfig<true, [property: string, keyword: string], { ignoreKeywords?: Arrayable<RegExpLike>; }>; type DeclarationPropertyValueNoUnknownOptions = RuleConfig<true, [property: string, value: string], { ignoreProperties?: Record<KebabCaseStandardPropertiesMap, Arrayable<RegExpLike>>; /** * Extend or alter the properties syntax dictionary. * {@link https://github.com/csstree/csstree/blob/master/docs/definition-syntax.md CSS Value Definition Syntax} is used to define a value's syntax. * If a definition starts with `|` it is added to the {@link https://csstree.github.io/docs/syntax/ existing definition value} if any. * * @deprecated We've **deprecated** this option and will remove it in the next major release. Use the shared and more performant [languageOptions](https://github.com/stylelint/stylelint/blob/main/docs/user-guide/configure.md#languageoptions) configuration property instead. */ propertiesSyntax?: Record<KebabCaseStandardPropertiesMap, string>; /** * Extend or alter the types syntax dictionary. * {@link https://github.com/csstree/csstree/blob/master/docs/definition-syntax.md CSS Value Definition Syntax} is used to define a value's syntax. * If a definition starts with `|` it is added to the {@link https://csstree.github.io/docs/syntax/ existing definition value} if any. * * @deprecated We've **deprecated** this option and will remove it in the next major release. Use the shared and more performant [languageOptions](https://github.com/stylelint/stylelint/blob/main/docs/user-guide/configure.md#languageoptions) configuration property instead. */ typesSyntax?: Record<string, string>; }>; type DisplayNotationOptions = RuleConfig<'full' | 'short', [normalizedValue: string, replacementValue: string]>; type FontFamilyNameQuotesOptions = RuleConfig<'always-where-required' | 'always-where-recommended' | 'always-unless-keyword', [familyName: string]>; type FontFamilyNoDuplicateNamesOptions = RuleConfig<true, [name: string], { ignoreFontFamilyNames?: RegExpLike[]; }>; type FontFamilyNoMissingGenericFamilyKeywordOptions = RuleConfig<true, [], { ignoreFontFamilies?: RegExpLike[]; }>; type FontWeightNotationOptions = RuleConfig<'numeric' | 'named-where-possible', [type: string], { ignore?: LiteralUnion<'relative'>[]; }>; type FunctionAllowedListOptions = RuleConfig<Arrayable<CSSFunction | RegExpLike>, [name: string], { /** * Disallow the matching functions when they are without a property fallback in the same declaration block. */ exceptWithoutPropertyFallback?: Arrayable<CSSFunction | RegExpLike>; }>; type FunctionCalcNoUnspacedOperatorOptions = RuleConfig<true, [operator: string]>; type FunctionDisallowedListOptions = RuleConfig<Arrayable<CSSFunction | RegExpLike>, [name: string]>; type FunctionLinearGradientNoNonstandardDirectionOptions = RuleConfig<true>; type FunctionNameCaseOptions = RuleConfig<'lower' | 'upper', [actual: string, expected: string], { ignoreFunctions?: RegExpLike[]; }>; type FunctionNoUnknownOptions = RuleConfig<true, [name: string], { ignoreFunctions?: RegExpLike[]; }>; type FunctionUrlNoSchemeRelativeOptions = RuleConfig<true, [], { ignoreFunctions?: RegExpLike[]; }>; type FunctionUrlQuotesOptions = RuleConfig<'always' | 'never', [functionName: string], { except?: LiteralUnion<'empty'>[]; }>; type FunctionUrlSchemeAllowedListOptions = RuleConfig<Arrayable<RegExpLike>, [scheme: string]>; type FunctionUrlSchemeDisallowedListOptions = RuleConfig<Arrayable<RegExpLike>, [scheme: string]>; type HueDegreeNotationOptions = RuleConfig<'angle' | 'number', [unfixed: string, fixed: string]>; type ImportNotationOptions = RuleConfig<'string' | 'url', [unfixed: string, fixed: string]>; type KeyframeBlockNoDuplicateSelectorsOptions = RuleConfig<true, [selector: string]>; type KeyframeDeclarationNoImportantOptions = RuleConfig<true>; type KeyframeSelectorNotationOptions = RuleConfig<'keyword' | 'percentage' | 'percentage-unless-within-keyword-only-block', [selector: string, fixedSelector: string]>; type KeyframesNamePatternOptions = RuleConfig<RegExpLike, [keyframeName: string, pattern: string]>; type LayerNamePatternOptions = RuleConfig<RegExpLike>; type LengthZeroNoUnitOptions = RuleConfig<true, [], { /** * Ignore units for zero length in custom properties. */ ignore?: LiteralUnion<'custom-properties'>[]; ignoreFunctions?: (CSSFunction | RegExpLike)[]; /** * Ignore units for zero lengths within the preludes of the specified at-rules. */ ignorePreludeOfAtRules?: RegExpLike[]; }>; type LightnessNotationOptions = RuleConfig<'percentage' | 'number', [unfixed: string, fixed: string]>; type MaxNestingDepthOptions = RuleConfig<number, [depth: string], { ignore?: LiteralUnion<'blockless-at-rules' | 'pseudo-classes'>[]; ignoreAtRules?: (AtRules | RegExp)[]; }>; type MediaFeatureNameAllowedListOptions = RuleConfig<Arrayable<MediaFeatureNormal | MediaFeatureLevel5 | RegExp>, [name: string]>; type MediaFeatureNameDisallowedListOptions = RuleConfig<Arrayable<MediaFeatureNormal | MediaFeatureLevel5 | RegExp>, [name: string]>; type MediaFeatureNameNoUnknownOptions = RuleConfig<true, [mediaFeatureName: string], { ignoreMediaFeatureNames?: (string | RegExp)[]; }>; type MediaFeatureNameNoVendorPrefixOptions = RuleConfig<true, [], { ignoreMediaFeatureNames?: RegExpLike[]; }>; type MediaFeatureNameUnitAllowedListOptions = RuleConfig<Partial<Record<MediaFeatureNormal | MediaFeatureLevel5, Arrayable<Unit>>>, [unit: string, name: string]>; type MediaFeatureNameValueAllowedListOptions = RuleConfig<Partial<Record<MediaFeatureNormal | MediaFeatureLevel5, Arrayable<RegExpLike>>>, [name: string, value: string]>; type MediaFeatureNameValueNoUnknownOptions = RuleConfig<true, [name: string, value: string], { ignoreMediaFeatureNameValues?: RegExpLike[]; }>; type MediaFeatureRangeNotationOptions = RuleConfig<'context' | 'prefix', [primary: string], { /** * - `'exact-value'`: Reverse the primary option for media features with exact values. */ except?: ('exact-value')[]; }>; type MediaQueryNoInvalidOptions = RuleConfig<true, [query: string, reason: string], { ignoreFunctions?: Arrayable<RegExpLike>; }>; type MediaTypeNoDeprecatedOptions = RuleConfig<true, [], { /** * Ignore the specified media types. */ ignoreMediaTypes?: RegExpLike[]; }>; type NamedGridAreasNoInvalidOptions = RuleConfig<true, [name: string]>; type NestingSelectorNoMissingScopingRootOptions = RuleConfig<true, [], { /** * Ignore nesting selectors within specified at-rules. */ ignoreAtRules?: RegExpLike[]; }>; type NoDescendingSpecificityOptions = RuleConfig<true, [selectorA: string, selectorB: string, line: number], { ignore?: LiteralUnion<'selectors-within-list'>[]; }>; type NoDuplicateAtImportRulesOptions = RuleConfig<true, [atImport: string]>; type NoDuplicateSelectorsOptions = RuleConfig<true, [selector: string, firstDuplicateLine: number | string], { /** * This option will also disallow duplicate selectors within selector lists. * @default false */ disallowInList?: boolean; ignoreSelectors?: RegExpLike[]; }>; type NoEmptySourceOptions = RuleConfig<true>; type NoInvalidDoubleSlashCommentsOptions = RuleConfig<true>; type NoInvalidPositionAtImportRuleOptions = RuleConfig<true, [], { ignoreAtRules?: (AtRules | RegExp)[]; }>; type NoInvalidPositionDeclarationOptions = RuleConfig<true, [], { /** * Ignore nesting at-rules within specified at-rules. */ ignoreAtRules?: RegExpLike[]; }>; type NoIrregularWhitespaceOptions = RuleConfig<true>; type NoUnknownAnimationsOptions = RuleConfig<true>; type NoUnknownCustomMediaOptions = RuleConfig<true>; type NoUnknownCustomPropertiesOptions = RuleConfig<true>; type NumberMaxPrecisionOptions = RuleConfig<number, [actual: string, expected: string], { /** * Ignore the precision of numbers for values with the specified units. */ ignoreUnits?: (Unit | RegExp)[]; /** * Change a primary option value for specified functions. */ insideFunctions?: Record<string, number>; }>; type PropertyAllowedListOptions = RuleConfig<Arrayable<LiteralUnion<CSSPropertiesMap> | RegExp>, [property: string]>; type PropertyDisallowedListOptions = RuleConfig<Arrayable<LiteralUnion<CSSPropertiesMap> | RegExp>, [property: string]>; type PropertyLayoutMappingsOptions = RuleConfig<'flow-relative' | 'physical', [prop: string, expectedProp: string], { ignoreProperties?: (LiteralUnion<CSSPropertiesMap> | RegExp)[]; }>; type PropertyNoDeprecatedOptions = RuleConfig<true, [], { ignoreProperties?: (CSSPropertiesMap | RegExp)[]; }>; type PropertyNoUnknownOptions = RuleConfig<true, [property: string], { ignoreProperties?: RegExpLike[]; /** * Skips checking properties of the given selectors against this rule. */ ignoreSelectors?: RegExpLike[]; /** * Ignores properties nested within specified at-rules. */ ignoreAtRules?: (AtRules | RegExp)[]; /** * If true, this rule will check vendor-prefixed properties. * @default false */ checkPrefixed?: boolean; }>; type PropertyNoVendorPrefixOptions = RuleConfig<true, [property: string], { ignoreProperties?: (LiteralUnion<CSSPropertiesMap> | RegExp)[]; }>; type RelativeSelectorNestingNotationOptions = RuleConfig<'explicit' | 'implicit', [primary: string]>; type RuleEmptyLineBeforeOptions = RuleConfig<'always' | 'never' | 'always-multi-line' | 'never-multi-line', [property: string], { except?: LiteralUnion<'after-rule' | 'after-single-line-comment' | 'inside-block-and-after-rule' | 'inside-block' | 'first-nested'>[]; ignore?: LiteralUnion<'after-comment' | 'first-nested' | 'inside-block'>[]; }>; type RuleNestingAtRuleRequiredListOptions = RuleConfig<RegExpLike[]>; type RuleSelectorPropertyDisallowed = CSSPropertiesMap | RegExpLike; type RuleSelectorPropertyDisallowedListOptions = RuleConfig<Record<string, Arrayable<RuleSelectorPropertyDisallowed>>, [selector: string, property: string], { ignore?: LiteralUnion<'keyframe-selectors'>[]; }>; type SectorAnbNoUnmatchableOptions = RuleConfig<true, [pseudoClass: string]>; type SelectorAttributeNameDisallowedListOptions = RuleConfig<Arrayable<RegExpLike>, [name: string]>; type SelectorAttributeOperatorAllowedListOptions = RuleConfig<Arrayable<SelectorAttributeOperator | RegExp>, [operator: string]>; type SelectorAttributeOperatorDisallowedListOptions = RuleConfig<Arrayable<SelectorAttributeOperator | RegExp>, [operator: string]>; type SelectorAttributeQuotesOptions = RuleConfig<'always' | 'never', [value: string]>; type SelectorClassPatternOptions = RuleConfig<RegExpLike, [selector: string, pattern: string], { /** * This option will resolve nested selectors with `&` interpolation. * @default false */ resolveNestedSelectors?: boolean; }>; type SelectorCombinatorAllowedListOptions = RuleConfig<Arrayable<SelectorCombinator>, [combinator: string]>; type SelectorCombinatorDisallowedListOptions = RuleConfig<Arrayable<SelectorCombinator>, [combinator: string]>; type SelectorDisallowedListIgnore = 'inside-block' | 'keyframe-selectors'; type SelectorDisallowedListOptions = RuleConfig<Arrayable<RegExpLike>, [selector: string], { /** * Split selector lists into individual selectors. * @default false */ splitList?: boolean; /** * Ignore selectors that are inside a block. */ ignore?: [SelectorDisallowedListIgnore]; }>; type SelectorIdPatternOptions = RuleConfig<RegExpLike, [selector: string, pattern: string]>; type SelectorMaxAttributeOptions = RuleConfig<number, [selector: string, max: number | string], { ignoreAttributes?: RegExpLike[]; }>; type SelectorMaxClassOptions = RuleConfig<number, [selector: string, max: number | string]>; type SelectorMaxCombinatorsOptions = RuleConfig<number, [selector: string, max: number | string]>; type SelectorMaxCompoundSelectorsOptions = RuleConfig<number, [selector: string, max: number | string], { ignoreSelectors?: RegExpLike[]; }>; type SelectorMaxIdOptions = RuleConfig<number, [selector: string, max: number | string], { checkContextFunctionalPseudoClasses?: RegExpLike[]; }>; type SelectorMaxPseudoClassOptions = RuleConfig<number, [selector: string, max: number | string]>; type SelectorMaxSpecificityOptions = RuleConfig<`${string},${string},${string}`, [selector: string, max: number | string], { ignoreSelectors?: RegExpLike[]; }>; type SelectorMaxTypeOptions = RuleConfig<number, [selector: string, max: number | string], { /** * Discount child type selectors. */ Ignore?: LiteralUnion<'child' | 'compounded' | 'custom-elements' | 'descendant' | 'next-sibling'>[]; ignoreTypes?: RegExpLike[]; }>; type SelectorMaxUniversalOptions = RuleConfig<number, [selector: string, max: number | string], { /** * Ignore universal selectors that come after one of the specified combinators. */ ignoreAfterCombinators?: SelectorCombinator[]; }>; type SelectorNestedPatternOptions = RuleConfig<RegExpLike, [selector: string], { /** * Split selector lists into individual selectors. * @default false */ splitList?: boolean; }>; type SelectorNoDeprecatedOptions = RuleConfig<true, [unfixed: string, fixed: string], { ignoreSelectors?: RegExpLike[]; }>; type SelectorNoInvalidOptions = RuleConfig<true, [selector: string, season: string]>; type SelectorNoQualifyingTypeOptions = RuleConfig<true, [selector: string], { ignore?: LiteralUnion<'attribute' | 'class' | 'id'>[]; }>; type SelectorNoVendorPrefixOptions = RuleConfig<true, [selector: string], { ignoreSelectors?: RegExpLike[]; }>; type SelectorNotNotationOptions = RuleConfig<'simple' | 'complex', [selector: string]>; type SelectorPseudoClassAllowedListOptions = RuleConfig<Arrayable<SelectorPseudoClass | RegExp>, [selector: string]>; type SelectorPseudoClassDisallowedListOptions = RuleConfig<Arrayable<SelectorPseudoClass | RegExp>, [selector: string]>; type SelectorPseudoClassNoUnknownOptions = RuleConfig<true, [selector: string], { ignorePseudoClasses?: RegExpLike[]; }>; type SelectorPseudoElementAllowedListOptions = RuleConfig<Arrayable<SelectorPseudoElement | RegExp>, [selector: string]>; type SelectorPseudoElementColonNotationOptions = RuleConfig<'single' | 'double', [selector: string]>; type SelectorPseudoElementDisallowed = SelectorPseudoElement | RegExpLike; type SelectorPseudoElementDisallowedListOptions = RuleConfig<Arrayable<SelectorPseudoElementDisallowed>, [selector: string]>; type SelectorPseudoElementNoUnknownOptions = RuleConfig<true, [selector: string], { ignorePseudoElements?: RegExpLike[]; }>; type SelectorTypeCaseOptions = RuleConfig<'lower' | 'upper', [selector: string], { ignoreTypes?: RegExpLike[]; }>; type SelectorTypeNoUnknownIgnore = LiteralUnion<'custom-elements' | 'default-namespace'>; type SelectorTypeNoUnknownOptions = RuleConfig<true, [selector: string], { ignore?: SelectorTypeNoUnknownIgnore[]; ignoreNamespaces?: RegExpLike[]; ignoreTypes?: RegExpLike[]; }>; type ShorthandPropertyNoRedundantValuesOptions = RuleConfig<true, [unexpected: string, expected: string], { /** * Ignore four-value shorthand declarations that could be shortened to three values when applied to edges. */ ignore?: LiteralUnion<'four-into-three-edge-values'>[]; }>; type StringNoNewlineOptions = RuleConfig<true, [], { ignore?: LiteralUnion<'at-rule-preludes' | 'declaration-values'>[]; }>; type SyntaxStringNoInvalidOptions = RuleConfig<true, [syntaxString: string]>; type TimeMinMillisecondsOptions = RuleConfig<number, [time: number], { /** * Ignore time values for an animation or transition delay. */ ignore?: LiteralUnion<'delay'>[]; }>; type UnitAllowedListOptions = RuleConfig<Arrayable<Unit>, [unit: number], { ignoreProperties?: Partial<Record<Unit, Arrayable<CSSPropertiesMap | RegExp>>>; ignoreFunctions?: Arrayable<CSSFunction | RegExp>; }>; type UnitDisallowedListOptions = RuleConfig<Unit | Unit[], [unit: number], { /** * Ignore units in the values of declarations with the specified properties. */ ignoreProperties?: Partial<Record<Unit, Arrayable<CSSPropertiesMap | RegExp>>>; /** * Ignore units for specific feature names. */ ignoreFunctions?: Arrayable<CSSFunction | RegExp>; /** * Ignore units that are inside of the specified functions. */ ignoreMediaFeatureNames?: Partial<Record<Unit, Arrayable<MediaFeature | RegExp>>>; }>; type UnitLayoutMappingsOptions = RuleConfig<'flow-relative' | 'physical', [type: string, unit: string], { ignoreUnits?: (Unit | RegExp)[]; }>; type UnitNoUnknownOptions = RuleConfig<true, [unit: number], { ignoreUnits?: RegExpLike[]; ignoreFunctions?: (MediaFeature | RegExp)[]; }>; type ValueKeywordCaseOptions = RuleConfig<'lower' | 'upper', [actual: number, expected: string], { /** * Ignore case of keywords values. */ ignoreKeywords?: RegExpLike[]; /** * Ignore case of the values of the listed properties. */ ignoreProperties?: (CSSPropertiesMap | RegExp)[]; /** * Ignore case of the values inside the listed functions. */ ignoreFunctions?: (CSSFunction | RegExp)[]; /** * If `true`, this rule expects SVG keywords to be camel case when the primary option is "lower". * @default false */ camelCaseSvgKeywords?: boolean; }>; type ValueKeywordLayoutMappingsOptions = RuleConfig<'flow-relative' | 'physical', [actual: string, expected: string], { /** * Ignore the specified properties. */ ignoreProperties?: (LiteralUnion<StandardPropertiesMap> | RegExp)[]; /** * Ignore the specified keywords. */ ignoreKeywords?: RegExpLike[]; }>; type ValueNoVendorPrefixOptions = RuleConfig<true, [actual: number, expected: string], { ignoreValues: Arrayable<RegExpLike>; }>; /** * Rules determine what the linter looks for and complains about. * There are {@link https://stylelint.io/user-guide/rules over 100 rules} built into Stylelint. No rules are turned on by default. */ interface StyleLintRules { /** * Specify percentage or number notation for alpha-values. * * ```scss * a { color: rgb(0 0 0 / 0.5) } * // ^^^ * // This notation * ``` * * ### Primary Options: * - `"number"`: Alpha-values must always use the number notation. * - `"percentage"`: Alpha-values must always use percentage notation. * * ### Optional Secondary Options: * * - `exceptProperties`: Reverse the primary option for matching properties. * * @see [alpha-value-notation](https://stylelint.io/user-guide/rules/alpha-value-notation) * @example * ```json * { * "alpha-value-notation": ["number", { "exceptProperties": ["opacity"] }] * } * ``` */ 'alpha-value-notation': AlphaValueNotationOptions; /** * Disallow unknown annotations. * * * ```scss * a { color: green !important; } * // ^^^^^^^^^^ * // This annotation * ``` * * This rule considers annotations defined in the CSS Specifications, up to and including Editor's Drafts, to be known. * * ### Primary Options: * * `true` * * ### Optional Secondary Options: * - `ignoreAnnotations` * * @see [annotation-no-unknown](https://stylelint.io/user-guide/rules/annotation-no-unknown) */ 'annotation-no-unknown': AnnotationNoUnknownOptions; /** * Specify a list of allowed at-rules. * * >```scss * >@keyframes name {} * >//^^^^^^^^ * >//At-rules like this * >``` * * ### Primary Options: * - `array | string` * * @see [at-rule-allowed-list](https://stylelint.io/user-guide/rules/at-rule-allowed-list) */ 'at-rule-allowed-list': AtRuleAllowedListOptions; /** * Disallow unknown descriptors for at-rules. * * >```scss * >@counter-style foo { * > unknown-descriptor: cyclic; * >// ^^^^^^^^^^^^^^^^^^ * >// Descriptors like this * >} * >``` * This rule considers descriptors defined in the CSS Specifications, up to and including Editor's Drafts, to be known. * * @see [at-rule-descriptor-no-unknown](https://stylelint.io/user-guide/rules/at-rule-descriptor-no-unknown) */ 'at-rule-descriptor-no-unknown': AtRuleDescriptorNoUnknownOptions; /** * Disallow unknown values for descriptors within at-rules. * * >``` scss * >@counter-style foo { * > system: unknown; * >// ^^^^^^^ * >// Values like this * >} * >``` * * This rule considers descriptors and values defined in the CSS Specifications, up to and including Editor's Drafts, to be known. * * @see [at-rule-descriptor-value-no-unknown](https://stylelint.io/user-guide/rules/at-rule-descriptor-value-no-unknown) */ 'at-rule-descriptor-value-no-unknown': AtRuleDescriptorValueNoUnknownOptions; /** * Specify a list of disallowed at-rules. * * >```scss * >@keyframes name {} * >//^^^^^^^^ * >//At-rules like this * >``` * ### Primary Options: * - `array | string` * * @see [at-rule-disallowed-list](https://stylelint.io/user-guide/rules/at-rule-disallowed-list) */ 'at-rule-disallowed-list': AtRuleDisallowedListOptions; /** * Require or disallow an empty line before at-rules. * * >```scss * >a {} * > // ← This line * >@media {} * >``` * * This rule ignores: * - at-rules that are the very first node in the source * - `@import` in Less. * * ### Primary Options: * - `"always"`: There must always be an empty line before at-rules. * - `"never"`: There must never be an empty line before at-rules. * * ### Optional Secondary Options: * - `except` * - `ignore` * - `ignoreAtRules` * * @see [at-rule-empty-line-before](https://stylelint.io/user-guide/rules/at-rule-empty-line-before) */ 'at-rule-empty-line-before': AtRuleEmptyLineBeforeOptions; /** * Disallow deprecated at-rules. * * >``` scss * >@viewport {} * >//^^^^^^^ * >//At-rules like this * >``` * * This rule flags at-rules that were removed or deprecated after being in the CSS specifications, including editor drafts, and were subsequently either: * * - shipped in a stable version of a browser * - shipped by a developer channel/edition browser * - shipped but behind experimental flags * - polyfilled with some adoption before any browser actually shipped * - had an MDN page at one point in time * * @see [at-rule-no-deprecated](https://stylelint.io/user-guide/rules/at-rule-no-deprecated) */ 'at-rule-no-deprecated': AtRuleNoDeprecatedOptions; /** * Disallow unknown at-rules. * * >```scss * >@unknown (max-width: 960px) {} * >//^^^^^^ * >//At-rules like this * >``` * * This rule considers at-rules defined in the CSS Specifications, * up to and including Editor's Drafts, to be known. * * ### Primary Options: * `true` * * ### Optional Secondary Options: * - `ignoreAtRules` * * @see [at-rule-no-unknown](https://stylelint.io/user-guide/rules/at-rule-no-unknown) */ 'at-rule-no-unknown': AtRuleNoUnknownOptions; /** * Disallow vendor prefixes for at-rules. * * >```scss * >@-webkit-keyframes { 0% { top: 0; } } * >//^^^^^^ * >//This prefix * >``` * * ### Primary Options: * `true` * * This rule ignores non-standard vendor-prefixed at-rules that aren't handled by * {@link https://github.com/postcss/autoprefixer Autoprefixer}. * * @see [at-rule-no-vendor-prefix](https://stylelint.io/user-guide/rules/at-rule-no-vendor-prefix) */ 'at-rule-no-vendor-prefix': AtRuleNoVendorPrefixOptions; /** * Disallow invalid preludes for at-rules. * * >```scss * >@property --foo {} * >// ^^^^^ * >// Preludes like this * >``` * * This rule considers preludes for at-rules defined within the CSS specifications, up to and including Editor's Drafts, to be valid. * * @see [at-rule-prelude-no-invalid](https://stylelint.io/user-guide/rules/at-rule-prelude-no-invalid) */ 'at-rule-prelude-no-invalid': AtRulePreludeNoInvalidOptions; /** * Specify a list of required properties for an at-rule. * * ### Primary Options * `object`: `{ "at-rule-name": ["array", "of", "properties"] |"property" }` * * @see [at-rule-property-required-list](https://stylelint.io/user-guide/rules/at-rule-property-required-list) */ 'at-rule-property-required-list': AtRulePropertyRequiredListOptions; /** * Disallow empty blocks. * * ```scss * a { } * // ^^ * // Blocks like this * ``` * * ### Primary Options: * `true` * * @see [block-no-empty](https://stylelint.io/user-guide/rules/block-no-empty) */ 'block-no-empty': BlockNoEmptyOptions; /** * Disallow redundant nested style rules within blocks. * * ```scss * a { & { color: red; } } * // ^ * // This nested style rule * ``` * * @see [block-no-redundant-nested-style-rules](https://stylelint.io/user-guide/rules/block-no-redundant-nested-style-rules) */ 'block-no-redundant-nested-style-rules': BlockNoRedundantNestedStyleRulesOptions; /** * Specify alias notation for color-functions * * ```scss * a { color: rgb(0 0 0 / 0.2) } * // ^^^ * // This notation * ``` * * Color functions `rgb()` and `hsl()` have aliases `rgba()` and `hsla()`. Those are exactly equivalent, and [it's preferable](https://developer.mozilla.org/en-US/docs/Web/CSS/color_value/rgb) to use the first variant without `a`. * * ### Primary Options * - `'without-alpha'`: Applicable color-functions must always use the without alpha notation. * - `'with-alpha'`: Applicable color-functions must always use with alpha notation. * * @see [color-function-alias-notation](https://stylelint.io/user-guide/rules/color-function-alias-notation) */ 'color-function-alias-notation': ColorFunctionAliasNatationOptions; /** * Specify modern or legacy notation for color-functions. * * ```scss * a { color: rgb(0 0 0 / 0.2) } * // ^^^ * // This notation * ``` * * Modern color-functions use a comma-free syntax because functions in CSS are used to group/name a syntax chunk. * They should work by the same rules that CSS grammar does in general: * values are optional and re-orderable when possible, space-separated, and commas are used to separate repetitions only. * * For legacy reasons, `rgb()` and `hsl()` also supports an alternate syntax that separates all of its arguments with commas. * Also for legacy reasons, the `rgba()` and `hsla()` functions exist using the same comma-based syntax. * * ### Primary Options * - `"modern"`: Applicable color-functions must always use modern notation. * - `"legacy"`: Applicable color-functions must always use the legacy notation. * * ### Optional Secondary Options * - `ignore` * * @see [color-function-notation](https://stylelint.io/user-guide/rules/color-function-notation) */ 'color-function-notation': ColorFunctionNatationOptions; /** * Require or disallow alpha channel for hex colors. * * ```scss * a { color: #fffa } * // ^ * // This alpha channel * ``` * * ### Primary Options * - `"always"` * - `"never"` * * @see [color-hex-alpha](https://stylelint.io/user-guide/rules/color-hex-alpha) */ 'color-hex-alpha': ColorHexAlphaOptions; /** * Specify short or long notation for hex colors. * * ```scss * a { color: #fff } * // ^^^^ * // This hex color * ``` * * ### Primary Options * - `"short"` * - `"long"` * * @see [color-hex-length](https://stylelint.io/user-guide/rules/color-hex-length) */ 'color-hex-length': ColorHexLengthOptions; /** * Require (where possible) or disallow named colors. * * ```scss * a { color: black } * // ^^^^^ * // This named color * ``` * * This rule ignores `$sass` and `@less` variable syntaxes. * * ### Primary Options * - `"always-where-possible"`: Colors must always, where possible, be named. * This will complain if a hex (3, 4, 6 and 8 digit), `rgb()`, `rgba()`, `hsl()`, * `hsla()`, `hwb()` or `gray()` color can be represented as a named color. * - `"never"`: Colors must never be named. * * ### Optional Secondary Options * - `ignore` * - `ignoreProperties` * * @see [color-named](https://stylelint.io/user-guide/rules/color-named) */ 'color-named': ColorNamedOptions; /** * Disallow hex colors. * * ```scss * a { color: #333 } * // ^^^^ * // This hex color * ``` * * ### Primary Options * `true` * * @see [color-no-hex](https://stylelint.io/user-guide/rules/color-no-hex) */ 'color-no-hex': ColorNoHexOptions; /** * Disallow invalid hex colors. * * ```scss * a { color: #y3 } * // ^^^ * // This hex color * ``` * * ### Primary Options * `true` * * Longhand hex colors can be either 6 or 8 (with alpha channel) hexadecimal characters. * And their shorthand variants are 3 and 4 characters respectively. * * @see [color-no-invalid-hex](https://stylelint.io/user-guide/rules/color-no-invalid-hex) */ 'color-no-invalid-hex': ColorNoInvalidHexOptions; /** * Require or disallow an empty line before comments. * * ```scss * a {} * // ← * \/* comment *\/ // ↑ * // ↑ * // This line * ``` * * This rule ignores: * - comments that are the very first node in the source * - shared-line comments * - single-line comments with `//` (when you're using a custom syntax that supports them) * - comments within selector and value lists * * ### Primary Options * - `"always"`: There must always be an empty line before comments. * - `"never"`: There must never be an empty line before comments. * * ### Optional Secondary Options * * - `except` * - `ignore` * - `ignoreComments` * * @see [comment-empty-line-before](https://stylelint.io/user-guide/rules/comment-empty-line-before) */ 'comment-empty-line-before': CommentEmptyLineBeforeOptions; /** * Disallow empty comments. * * ```scss * \/* *\/ * // ^^^ * // Comments like this * ``` * * This rule ignores SCSS-like comments. * * ### Primary Options * `true` * * @see [comment-no-empty](https://stylelint.io/user-guide/rules/comment-no-empty) */ 'comment-no-empty': CommentNoEmptyOptions; /** * Specify a pattern for comments. * * ```scss * \/* comment *\/ * ^^^^^^^ * The pattern of this * ``` * * ### Primary Options * * `RegExp | string` * * A string will be translated into a RegExp like so `new RegExp(yourString)` — so be sure to escape properly. * * @see [comment-pattern](https://stylelint.io/user-guide/rules/comment-pattern) */ 'comment-pattern': CommentPatternOptions; /** * Require or disallow whitespace on the inside of comment markers. * * ```scss * \/* comment *\/ * ^ ^ * The space inside these two markers * ``` * * Any number of asterisks are allowed at the beginning or end of the comment. * * ### Primary Options * - `"always"`: There must always be whitespace inside the markers. * - `"never"`: There must never be whitespace on the inside the markers. * * @see [comment-whitespace-inside](https://stylelint.io/user-guide/rules/comment-whitespace-inside) */ 'comment-whitespace-inside': CommentWhitespaceInsideOptions; /** * Specify a list of disallowed words within comments. * * ```scss * \/* words within comments *\/ * // ^^^^^ ^^^^^^ ^^^^^^^^ * // These three words * ``` * * ### Primary Option * `(string | RegExp)[]` * * @see [comment-word-disallowed-list](https://stylelint.io/user-guide/rules/comment-word-disallowed-list) */ 'comment-word-disallowed-list': CommentWordDisallowedListOptions; /** * Specify a pattern for container names. * * >```scss * >@container foo (width > 400px) {} * >// ^^^ * >// The pattern of this * >``` * * ### Primary Options * `RegExp | string`: A string will be translated into a `RegExp` like so `new RegExp(yourString)` — so be sure to escape properly. * * @see [container-name-pattern](https://stylelint.io/user-guide/rules/container-name-pattern) */ 'container-name-pattern': ContainerNamePatternOptions; /** * Specify a pattern for custom media query names. * * >```scss * >@custom-media --foo (max-width: 30em); * >// ^^^^^ * >// The pattern of this * >``` * * ### Primary Options * `RegExp | string` * * A string will be translated into a RegExp like so `new RegExp(yourString)` — so be sure to escape properly. * * @see [custom-media-pattern](https://stylelint.io/user-guide/rules/custom-media-pattern) */ 'custom-media-pattern': CustomMediaPatternOptions; /** * Require or disallow an empty line before custom properties. * * ```scss * a { * top: 10px; * // This line * --color: pink; * } * ``` * * ### Primary Options * - `"always"` * - `"never"` * * ## Optional Secondary Options * - `except` * - `ignore` * * @see [custom-property-empty-line-before](https://stylelint.io/user-guide/rules/custom-property-empty-line-before) */ 'custom-property-empty-line-before': CustomPropertyEmptyLineBeforeOptions; /** * Disallow missing var function for custom properties. * * ```scss * :root { --foo: red; } * a { color: --foo; } * // ^^^^^ * // This custom property * ``` * * This rule only reports custom properties that are defined within the same source. * * @see [custom-property-no-missing-var-function](https://stylelint.io/user-guide/rules/custom-property-no-missing-var-function) */ 'custom-property-no-missing-var-function': CustomPropertyNoMissingVarFunctionOptions; /** * Specify a pattern for custom properties. * * ```scss * a { --foo-: 1px; } * // ^^^^^^ * // The pattern of this * ``` * * ### Primary Options: * * `RegExp | string` * * A string will be translated into a RegExp like so `new RegExp(yourString)` — so be sure to escape properly. * * @see [custom-property-pattern](https://stylelint.io/user-guide/rules/custom-property-pattern) */ 'custom-property-pattern': CustomPropertyPatternOptions; /** * Disallow duplicate custom properties within declaration blocks. * * ```scss * a { --custom-property: pink; --custom-property: orange; } * // ^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^ * // These duplicated custom properties * ``` * * This rule is case-sensitive. * * ### Primary Options * `true` * * @see [declaration-block-no-duplicate-custom-properties](https://stylelint.io/user-guide/rules/declaration-block-no-duplicate-custom-properties) */ 'declaration-block-no-duplicate-custom-properties': DeclarationBlockNoDuplicateCustomPropertiesOptions; /** * Disallow duplicate properties within declaration blocks. * * ```scss * a { color: pink; color: orange; } * // ^^^^^ ^^^^^ * // These duplicated properties * ``` * * This rule ignores variables (`$sass`, `@less`, `--custom-property`). * * ### Primary Options * `true` * * ### Optional Secondary Options * - `ignore` * - `ignoreProperties` * * @see [declaration-block-no-duplicate-properties](https://stylelint.io/user-guide/rules/declaration-block-no-duplicate-properties) */ 'declaration-block-no-duplicate-properties': DeclarationBlockNoDuplicatePropertiesOptions; /** * Disallow redundant longhand properties within declaration-block. * * ```scss * a { * padding-top: 1px; // ← * padding-right: 2px; // ← * padding-bottom: 3px; // ← * padding-left: 4px; // ← * // These longhand properties * } * ``` * The longhand properties in the example above can be more concisely written as: * ``` * a { padding: 1px 2px 3px 4px; } * ``` * * This rule will only complain if you've used the longhand equivalent of all the properties * that the shorthand will set and if their values are not {@link https://www.w3.org/TR/css-values/#common-keywords CSS