Upgrading stylelint 16 to 17
Breaking16.26.1 → 17.16.0Breaking13Platform1Deprecated1New22Fixed89Other1
BreakingUpgrade verdict
13 breaking changes and a platform requirement change.
In plain terms
- Code that loads stylelint with require() in Node.js no longer works; the package is now ESM-only.
- Results returned by the Node.js API no longer include the formatted output text.
- The formatter that produced GitHub annotation output is gone.
- The selector-class-pattern rule no longer accepts the resolveNestedSelectors option.
Must act Top 5 of 15 that need code or config changes
stylelint publishes an official migration guide for version 17. It covers more than the release notes do.
Migrating to `17.0.0` guide ↗Node.js requirement changed in 17.0.0: >=18.12.0 → >=20.19.0.
Adds @csstools/css-calc ^3.3.0, @csstools/selector-resolve-nested ^4.0.1, import-meta-resolve ^4.2.0.
Drops @dual-bundle/import-meta-resolve, balanced-match, imurmurhash, is-plain-object, known-css-properties, postcss-resolve-nested-selector, resolve-from.
Installs 115 packages in all (was 116).
What you must change
Breaking13
Removes the CommonJS Node.js API.
Removes the
output property from the resolved object returned by the Node.js API.outputRemoves the GitHub formatter.
Removes the
resolveNestedSelectors option from selector-class-pattern.selector-class-patternresolveNestedSelectorsRemoves the
checkContextFunctionalPseudoClasses option from selector-max-id.selector-max-idcheckContextFunctionalPseudoClassesChanges the default
fix mode to strict.fixChanges
report to handle provided position arguments consistently and predictably.reportChanges
selector-max-* syntax rules for standard CSS nesting and modern functional pseudo-classes.selector-max-*Changes
*-specificity semantic rules for standard CSS nesting.*-specificityChanges
no-duplicate-selectors and selector-no-qualifying-type for standard CSS nesting.no-duplicate-selectorsselector-no-qualifying-typeChanges
*-list rules to behave consistently for vendor prefixes and case.*-listChanges
*-no-vendor-prefix rules to behave consistently for their ignore*: [] secondary options.*-no-vendor-prefixignore*Changes
declaration-property-max-values to behave consistently for vendor prefixes.declaration-property-max-valuesPlatform1
Drops support for Node.js versions below 20.19.0.
Deprecations to plan for
Deprecated1
Deprecates the
*syntax options from declaration-property-value-no-unknown.declaration-property-value-no-unknown*syntaxAPI changes
Generated by DepDelta from published .d.ts files. Not mixed with prose notes.
- removed:
export { Config } from './index' - removed:
export { ConfigRuleSettings } from './index' - removed:
export { CoreRules } from './index' - removed:
export { CosmiconfigResult } from './index' - removed:
export { CssSyntaxError } from './index' - removed:
export { CustomSyntax } from './index' - removed:
export { DisableOptions } from './index' - removed:
export { DisableOptionsReport } from './index' - removed:
export { DisablePropertyName } from './index' - removed:
export { DisableReportRange } from './index' - removed:
export { DisabledRange } from './index' - removed:
export { DisabledRangeObject } from './index' - removed:
export { DisabledWarning } from './index' - removed:
export { FixCallback } from './index' - removed:
export { FixMode } from './index' - removed:
export { FixObject } from './index' - removed:
export { Formatter } from './index' - removed:
export { FormatterType } from './index' - removed:
export { GetLintSourceOptions } from './index' - removed:
export { GetPostcssOptions } from './index' - removed:
export { InternalApi } from './index' - removed:
export { LintResult } from './index' - removed:
export { LinterOptions } from './index' - removed:
export { LinterResult } from './index' - removed:
export { LonghandSubPropertiesOfShorthandProperties } from './index' - removed:
export { Plugin } from './index' - removed:
export { PostcssPluginOptions } from './index' - removed:
export { PostcssResult } from './index' - removed:
export { Problem } from './index' - removed:
export { Processor } from './index' - removed:
export { PublicApi } from './index' - removed:
export { Range } from './index' - removed:
export { Rule } from './index' - removed:
export { RuleBase } from './index' - removed:
export { RuleContext } from './index' - removed:
export { RuleMessage } from './index' - removed:
export { RuleMessages } from './index' - removed:
export { RuleMeta } from './index' - removed:
export { RuleOptions } from './index' - removed:
export { RuleOptionsPossible } from './index' - removed:
export { Severity } from './index' - removed:
export { ShorthandProperties } from './index' - removed:
export { StylelintPostcssResult } from './index' - removed:
export { SuppressedProblems } from './index' - removed:
export { Utils } from './index' - removed:
export { Warning } from './index' - removed:
export { WarningOptions } from './index' - removed:
export { default } from './index' - changed:
const stylelint: stylelint.PublicApi → const stylelint: stylelint.PublicApi & { default: stylelint.PublicApi } - changed:
type stylelint.Config = { extends?: ConfigExtends; plugins?: ConfigPlugins; pluginFunctions?: { [pluginName: string]: Rule }; ignoreFiles?: ConfigIgnoreFiles; ignorePatterns?: string;… → type stylelint.Config = { extends?: ConfigExtends; plugins?: ConfigPlugins; _pluginFunctions?: { [pluginName: string]: Rule }; ignoreFiles?: ConfigIgnoreFiles; rules?: ConfigRules; qu… - changed:
type stylelint.Formatters = { readonly compact: Promise<Formatter>; readonly github: Promise<Formatter>; readonly json: Promise<Formatter>; readonly string: Promise<Formatter>; readonly t… → type stylelint.Formatters = { readonly compact: Promise<Formatter>; readonly json: Promise<Formatter>; readonly string: Promise<Formatter>; readonly tap: Promise<Formatter>; readonly unix… - changed:
type stylelint.GetLintSourceOptions = GetPostcssOptions & { existingPostcssResult?: PostCSS.Result; cache?: boolean } → type stylelint.GetLintSourceOptions = GetPostcssOptions & { existingPostcssResult?: PostCSS.Result; cache?: boolean; abortSignal?: AbortSignal } - changed:
type stylelint.GetPostcssOptions = { code?: string; codeFilename?: string; filePath?: string; customSyntax?: CustomSyntax } → type stylelint.GetPostcssOptions = { code?: string; codeFilename?: string; filePath?: string; customSyntax?: PostCSS.Syntax } - changed:
type stylelint.InternalApi = { _options: LinterOptions & { cwd: string }; _extendExplorer: ReturnType<typeof cosmiconfig>; _specifiedConfigCache: Map<Config, Map<string, CosmiconfigResult>… → type stylelint.InternalApi = { _options: LinterOptions & { cwd: string }; _extendExplorer: ReturnType<typeof cosmiconfig>; _configExplorer: ReturnType<typeof cosmiconfig>; _specifiedConfig… - changed:
type stylelint.LinterOptions = { files?: OneOrMany<string>; globbyOptions?: GlobbyOptions; cache?: boolean; cacheLocation?: string; cacheStrategy?: string; code?: string; codeFilename?: stri… → type stylelint.LinterOptions = { abortSignal?: AbortSignal; files?: OneOrMany<string>; globbyOptions?: GlobbyOptions; cache?: boolean; cacheLocation?: string; cacheStrategy?: string; code?:… - changed:
type stylelint.LinterResult = { cwd: string; results: LintResult[]; errored: boolean; output: string; _output?: string; _outputWarned?: boolean; report: string; code?: string; maxWarningsEx… → type stylelint.LinterResult = { cwd: string; results: LintResult[]; errored: boolean; report: string; code?: string; maxWarningsExceeded?: { maxWarnings: number; foundWarnings: number }; re… - changed:
type stylelint.Problem = { ruleName: string; result: PostcssResult; message: RuleMessage; messageArgs?: Parameters<RuleMessageFunc> | undefined; node: PostCSS.Node; index?: number; end… → type stylelint.Problem = { ruleName: string; result: PostcssResult; message: RuleMessage; messageArgs?: Parameters<RuleMessageFunc> | undefined; node: PostCSS.Node; severity?: RuleSeve… - changed:
type stylelint.RuleContext = { configurationComment?: string | undefined; fix?: boolean | undefined; newline?: string | undefined; lexer?: unknown | undefined } → type stylelint.RuleContext = { configurationComment?: string | undefined; fix?: boolean | undefined; newline?: string | undefined } - changed:
type stylelint.RuleOptions = { actual: unknown; possible?: | RuleOptionsPossibleFunc | RuleOptionsPossible[] | Record<string, RuleOptionsPossible[]>; optional?: boolean } → type stylelint.RuleOptions = { actual: unknown; possible?: RuleOptionsPossibleFunc | RuleOptionsPossible[] | Record<string, RuleOptionsPossible[]>; optional?: boolean } - added:
type stylelint.CompiledOverride = { configOverrides: Omit<ConfigOverride, 'files'>; matches: (filePath: string) => boolean } - added:
type stylelint.ConfigReferenceFiles = string | ConfigReferenceFilesEntry | (string | ConfigReferenceFilesEntry)[] - added:
type stylelint.ConfigReferenceFilesEntry = { files: string | string[]; customSyntax?: CustomSyntax; loader?: Loader } - added:
type stylelint.Directionality = 'top-to-bottom' | 'bottom-to-top' | 'left-to-right' | 'right-to-left' - added:
type stylelint.Loader = string | PostCSS.Plugin | PostCSS.PluginCreator<any> - added:
type stylelint.Maybe<T> = T | null | undefined - added:
type stylelint.ProblemLocation = { start: Position; end: Position } | { index: number; endIndex: number } | { word: string } | object