Skip to content

Upgrading stylelint 14 to 15

Breaking14.16.1 → 15.11.0Breaking5Security1Platform1Deprecated1New27Changed1Fixed96

BreakingUpgrade verdict

5 breaking changes and a platform requirement change and a security fix.

  • The processor feature is gone, so configs that rely on processors must be reworked.
  • The syntax option is no longer accepted; use custom syntax configuration instead.
  • Some TypeScript type names changed, so code referencing the old names must be updated.
  • Overrides that extend configs now merge rather than replace, matching how plugins behave.
Top 5 of 8 that need code or config changes

stylelint publishes an official migration guide for version 15. It covers more than the release notes do.

Migrating to `15.0.0` guide ↗

Node.js requirement changed in 15.0.0: ^12.20.0 || ^14.13.1 || >=16.0.0 → ^14.13.1 || >=16.0.0.

Adds @csstools/css-parser-algorithms ^2.3.1, @csstools/css-tokenizer ^2.2.0, @csstools/media-query-list-parser ^2.1.4, css-tree ^2.3.1.

Drops postcss-media-query-parser, v8-compile-cache.

Installs 159 packages in all (was 165).

Also installs argparse, js-yaml, mdn-data, yocto-queue.

No longer installs @types/parse-json, es-errors, min-indent, p-try, path-parse, resolve, supports-preserve-symlinks-flag, yaml.

Moves @csstools/selector-specificity 2.2.0 → 3.1.1, camelcase 5.3.1 → 6.3.0, camelcase-keys 6.2.2 → 7.0.2, cosmiconfig 7.1.0 → 8.3.6, decamelize 1.2.0 → 1.2.0, 5.0.1, file-entry-cache 6.0.1 → 7.0.2, find-up 4.1.0 → 5.0.0, hosted-git-info 2.8.9, 4.1.0 → 4.1.0, indent-string 4.0.0 → 5.0.0, known-css-properties 0.26.0 → 0.29.0, locate-path 5.0.0 → 6.0.0, meow 9.0.0 → 10.1.5, normalize-package-data 2.5.0, 3.0.3 → 3.0.3, p-limit 2.3.0 → 3.1.0, p-locate 4.1.0 → 5.0.0 and 11 more. Your build may pick other versions.

Breaking5
Removes support for processors.
Removes the syntax option.
syntax
Renames types to be more consistent.
Changes extends in overrides to merge, consistent with plugins behaviour.
extendsoverridesplugins
Reorganizes type definitions.
Security1
Fixes a security vulnerability in the semver dependency.
semver
Platform1
Removes Node.js 12 support.
Deprecated1
Deprecates stylistic rules handled by Prettier.

Generated by DepDelta from published .d.ts files. Not mixed with prose notes.

  • removed: const stylelint: stylelint.PublicApi
  • removed: export = stylelint
  • removed: namespace stylelint
  • removed: type stylelint.CodeProcessor = (code: string, file: string | undefined) => string
  • removed: type stylelint.Config = { extends?: ConfigExtends; plugins?: ConfigPlugins; pluginFunctions?: { [pluginName: string]: Rule }; processors?: ConfigProcessors; processorFunctions?: Funct…
  • removed: type stylelint.ConfigExtends = string | string[]
  • removed: type stylelint.ConfigIgnoreFiles = string | string[]
  • removed: type stylelint.ConfigOverride = Omit<Config, 'overrides'> & { files: string | string[] }
  • removed: type stylelint.ConfigPlugins = string | PluginType | (string | PluginType)[]
  • removed: type stylelint.ConfigProcessor = string | [string, Object]
  • removed: type stylelint.ConfigProcessors = string | ConfigProcessor[]
  • removed: type stylelint.ConfigRuleSettings<T, O extends Object> = null | undefined | NonNullable<T> | [NonNullable<T>] | [NonNullable<T>, O]
  • removed: type stylelint.ConfigRules = { [ruleName: string]: ConfigRuleSettings<any, Object> }
  • removed: type stylelint.ConfigurationError = Error & { code: 78 }
  • removed: type stylelint.CosmiconfigResult = { config: Config; filepath: string; isEmpty?: boolean } | null
  • removed: type stylelint.CssSyntaxError = { file?: string; input: { column: number; file?: string; line: number; source: string }; line: number; column: number; endLine?: number; endColumn?: number; me…
  • removed: type stylelint.CustomSyntax = string | PostCSS.Syntax
  • removed: type stylelint.DisableOptions = { except?: (string | RegExp)[]; severity?: Severity }
  • removed: type stylelint.DisableOptionsReport = DisableReportEntry[]
  • removed: type stylelint.DisablePropertyName = PropertyNamesOfType<Config, DisableSettings>
  • removed: type stylelint.DisableReportEntry = { source?: string; ranges: DisableReportRange[] }
  • removed: type stylelint.DisableReportRange = { rule: string; start: number; end?: number }
  • removed: type stylelint.DisableSettings = ConfigRuleSettings<boolean, DisableOptions>
  • removed: type stylelint.DisabledRange = { comment: PostCSS.Comment; start: number; strictStart: boolean; end?: number; strictEnd?: boolean; rules?: string[]; description?: string }
  • removed: type stylelint.DisabledRangeObject = { [ruleName: string]: DisabledRange[] }
  • removed: type stylelint.DisabledWarning = { line: number; rule: string }
  • removed: type stylelint.EmptyResult = { root: { nodes?: undefined; source: { lang?: undefined; input: { file?: string } } }; messages: PostCSS.Message[]; opts: undefined }
  • removed: type stylelint.FileCache = { calcHashOfConfig: (config: Config) => void; hasFileChanged: (absoluteFilepath: string) => boolean; reconcile: () => void; destroy: () => void; removeEntry: (…
  • removed: type stylelint.Formatter = (results: LintResult[], returnValue: LinterResult) => string
  • removed: type stylelint.FormatterType = 'compact' | 'github' | 'json' | 'string' | 'tap' | 'unix' | 'verbose'
  • removed: type stylelint.GetLintSourceOptions = GetPostcssOptions & { existingPostcssResult?: PostCSS.Result; cache?: boolean }
  • removed: type stylelint.GetPostcssOptions = { code?: string; codeFilename?: string; filePath?: string; codeProcessors?: CodeProcessor[]; syntax?: string; customSyntax?: CustomSyntax }
  • removed: type stylelint.InternalApi = { _options: LinterOptions & { cwd: string }; _extendExplorer: ReturnType<typeof cosmiconfig>; _specifiedConfigCache: Map<Config, Promise<CosmiconfigResult>>; _…
  • removed: type stylelint.LintResult = { source?: string; deprecations: { text: string; reference: string }[]; invalidOptionWarnings: { text: string }[]; parseErrors: (PostCSS.Warning & { stylelintT…
  • removed: type stylelint.LinterOptions = { files?: string | string[]; globbyOptions?: GlobbyOptions; cache?: boolean; cacheLocation?: string; cacheStrategy?: string; code?: string; codeFilename?: stri…
  • removed: type stylelint.LinterResult = { cwd: string; results: LintResult[]; errored: boolean; output: any; maxWarningsExceeded?: { maxWarnings: number; foundWarnings: number }; reportedDisables: Di…
  • removed: type stylelint.LonghandSubPropertiesOfShorthandProperties = ReadonlyMap<| 'animation' | 'background' | 'border' | 'border-block-end' | 'border-block-start' | 'border-bottom' | 'border-color' | 'border-image' | 'border-i…
  • removed: type stylelint.Plugin = RuleBase
  • removed: type stylelint.PluginContext = RuleContext
  • removed: type stylelint.PluginType = { default?: { ruleName: string; rule: Rule } } | { ruleName: string; rule: Rule }
  • removed: type stylelint.PostcssPluginOptions = Omit<LinterOptions, 'syntax' | 'customSyntax'> | Config
  • removed: type stylelint.PostcssResult = (PostCSS.Result | EmptyResult) & { stylelint: StylelintPostcssResult; warn(message: string, options?: WarningOptions): void }
  • removed: type stylelint.Problem = { ruleName: string; result: PostcssResult; message: RuleMessage; messageArgs?: Parameters<RuleMessageFunc> | undefined; node: PostCSS.Node; index?: number; end…
  • removed: type stylelint.PropertyNamesOfType<T, U> = { [K in keyof T]-?: T[K] extends U ? K : never }[keyof T]
  • removed: type stylelint.PublicApi = PostCSS.PluginCreator<PostcssPluginOptions> & { lint: (options: LinterOptions) => Promise<LinterResult>; rules: { [k: string]: Rule }; formatters: { [k: string…
  • removed: type stylelint.RangeType = DisabledRange & { used?: boolean }
  • removed: type stylelint.ResultProcessor = (result: LintResult, file: string | undefined) => LintResult
  • removed: type stylelint.Rule<P = any, S = any> = RuleBase<P, S> & { ruleName: string; messages: RuleMessages; primaryOptionArray?: boolean; meta?: RuleMeta }
  • removed: type stylelint.RuleBase<P = any, S = any> = (primaryOption: P, secondaryOptions: Record<string, S>, context: RuleContext) => (root: PostCSS.Root, result: PostcssResult) => Promise<void> | void
  • removed: type stylelint.RuleContext = { fix?: boolean | undefined; newline?: string | undefined }
  • removed: type stylelint.RuleMessage = string | RuleMessageFunc
  • removed: type stylelint.RuleMessageFunc = { bivariance(...args: (string | number | boolean | RegExp)[]): string }['bivariance']
  • removed: type stylelint.RuleMessages = { [message: string]: RuleMessage }
  • removed: type stylelint.RuleMeta = { url: string; deprecated?: boolean; fixable?: boolean }
  • removed: type stylelint.RuleOptions = { actual: unknown; possible?: | RuleOptionsPossibleFunc | RuleOptionsPossible[] | Record<string, RuleOptionsPossible[]>; optional?: boolean }
  • removed: type stylelint.RuleOptionsPossible = boolean | number | string | RuleOptionsPossibleFunc
  • removed: type stylelint.RuleOptionsPossibleFunc = (value: unknown) => boolean
  • removed: type stylelint.Severity = 'warning' | 'error'
  • removed: type stylelint.StylelintPostcssResult = { ruleSeverities: { [ruleName: string]: Severity }; customMessages: { [ruleName: string]: RuleMessage }; ruleMetadata: { [ruleName: string]: Partial<RuleMeta>…
  • removed: type stylelint.Warning = { line: number; column: number; endLine?: number; endColumn?: number; rule: string; severity: Severity; text: string; stylelintType?: string }
  • removed: type stylelint.WarningOptions = PostCSS.WarningOptions & { stylelintType?: string; severity?: Severity; rule?: string }
  • removed: declare module 'stylelint'
  • added: const stylelint: PublicApi
  • added: export = stylelint
  • added: namespace stylelint
  • added: type stylelint.Config = { extends?: ConfigExtends; plugins?: ConfigPlugins; pluginFunctions?: { [pluginName: string]: Rule }; ignoreFiles?: ConfigIgnoreFiles; ignorePatterns?: string;…
  • added: type stylelint.ConfigRuleSettings<T, O extends Object> = null | undefined | NonNullable<T> | [NonNullable<T>] | [NonNullable<T>, O]
  • added: type stylelint.CosmiconfigResult = (ReturnType<CosmiconfigTransformSync> & { config: Config }) | null
  • added: type stylelint.CssSyntaxError = { file?: string; input: { column: number; file?: string; line: number; source: string }; line: number; column: number; endLine?: number; endColumn?: number; me…
  • added: type stylelint.CustomSyntax = string | PostCSS.Syntax
  • added: type stylelint.DisableOptions = { except?: (string | RegExp)[]; severity?: Severity }
  • added: type stylelint.DisableOptionsReport = DisableReportEntry[]
  • added: type stylelint.DisablePropertyName = PropertyNamesOfType<Config, DisableSettings>
  • added: type stylelint.DisableReportRange = { rule: string; start: number; end?: number }
  • added: type stylelint.DisabledRange = { comment: PostCSS.Comment; start: number; strictStart: boolean; end?: number; strictEnd?: boolean; rules?: string[]; description?: string }
  • added: type stylelint.DisabledRangeObject = { [ruleName: string]: DisabledRange[] }
  • added: type stylelint.DisabledWarning = { line: number; rule: string }
  • added: type stylelint.Formatter = (results: LintResult[], returnValue: LinterResult) => string
  • added: type stylelint.FormatterType = 'compact' | 'github' | 'json' | 'string' | 'tap' | 'unix' | 'verbose'
  • added: type stylelint.GetLintSourceOptions = GetPostcssOptions & { existingPostcssResult?: PostCSS.Result; cache?: boolean }
  • added: type stylelint.GetPostcssOptions = { code?: string; codeFilename?: string; filePath?: string; customSyntax?: CustomSyntax }
  • added: type stylelint.InternalApi = { _options: LinterOptions & { cwd: string }; _extendExplorer: ReturnType<typeof cosmiconfig>; _specifiedConfigCache: Map<Config, Promise<CosmiconfigResult>>; _…
  • added: type stylelint.LintResult = { source?: string; deprecations: { text: string; reference?: string }[]; invalidOptionWarnings: { text: string }[]; parseErrors: (PostCSS.Warning & { stylelint…
  • added: type stylelint.LinterOptions = { files?: string | string[]; globbyOptions?: GlobbyOptions; cache?: boolean; cacheLocation?: string; cacheStrategy?: string; code?: string; codeFilename?: stri…
  • added: type stylelint.LinterResult = { cwd: string; results: LintResult[]; errored: boolean; output: any; maxWarningsExceeded?: { maxWarnings: number; foundWarnings: number }; reportedDisables: Di…
  • added: type stylelint.LonghandSubPropertiesOfShorthandProperties = ReadonlyMap<ShorthandProperties, ReadonlySet<string>>
  • added: type stylelint.Plugin = { default?: { ruleName: string; rule: Rule } } | { ruleName: string; rule: Rule }
  • added: type stylelint.PostcssPluginOptions = Omit<LinterOptions, 'customSyntax'> | Config
  • added: type stylelint.PostcssResult = (PostCSS.Result | EmptyResult) & { stylelint: StylelintPostcssResult; warn(message: string, options?: WarningOptions): void }
  • added: type stylelint.Problem = { ruleName: string; result: PostcssResult; message: RuleMessage; messageArgs?: Parameters<RuleMessageFunc> | undefined; node: PostCSS.Node; index?: number; end…
  • added: type stylelint.Rule<P = any, S = any> = RuleBase<P, S> & { ruleName: string; messages: RuleMessages; primaryOptionArray?: boolean; meta?: RuleMeta }
  • added: type stylelint.RuleBase<P = any, S = any> = (primaryOption: P, secondaryOptions: Record<string, S>, context: RuleContext) => (root: PostCSS.Root, result: PostcssResult) => Promise<void> | void
  • added: type stylelint.RuleContext = { configurationComment?: string | undefined; fix?: boolean | undefined; newline?: string | undefined }
  • added: type stylelint.RuleMessage = string | RuleMessageFunc
  • added: type stylelint.RuleMessages = { [message: string]: RuleMessage }
  • added: type stylelint.RuleMeta = { url: string; deprecated?: boolean; fixable?: boolean }
  • added: type stylelint.RuleOptions = { actual: unknown; possible?: | RuleOptionsPossibleFunc | RuleOptionsPossible[] | Record<string, RuleOptionsPossible[]>; optional?: boolean }
  • added: type stylelint.RuleOptionsPossible = boolean | number | string | RuleOptionsPossibleFunc
  • added: type stylelint.Severity = 'warning' | 'error'
  • added: type stylelint.ShorthandProperties = 'animation' | 'background' | 'border' | 'border-block' | 'border-block-end' | 'border-block-start' | 'border-inline' | 'border-inline-end' | 'border-inline-sta…
  • added: type stylelint.StylelintPostcssResult = { ruleSeverities: { [ruleName: string]: Severity }; customMessages: { [ruleName: string]: RuleMessage }; ruleMetadata: { [ruleName: string]: Partial<RuleMeta>…
  • added: type stylelint.Utils = { report: (problem: Problem) => void; ruleMessages: <T extends RuleMessages, R extends { [K in keyof T]: T[K] }>(ruleName: string, messages: T) => R; validateO…
  • added: type stylelint.Warning = { line: number; column: number; endLine?: number; endColumn?: number; rule: string; severity: Severity; text: string; stylelintType?: string }
  • added: type stylelint.WarningOptions = PostCSS.WarningOptions & { stylelintType?: string; severity?: Severity; rule?: string }