Vigia

Upgrading prettier from 2.x to 3.x

Comparison of the public API of prettier 2.8.8 and 3.9.9, computed automatically from their TypeScript types. A changed signature is a candidate for a breaking change, not a certainty.

Summary

Removed import paths12
Removed exports2
Changed signatures14
Removed class or interface members16
Changed class or interface members33
Newly deprecated2
Requirement changes (engines, peer dependencies)1
New exports1

Removed import paths

Removed import paths
prettier/parser-flow
prettier/parser-html
prettier/parser-yaml
prettier/parser-babel
prettier/parser-espree
prettier/parser-angular
prettier/parser-glimmer
prettier/parser-graphql
prettier/parser-meriyah
prettier/parser-postcss
prettier/parser-markdown
prettier/parser-typescript

Removed exports

importexportkindBefore
prettierCustomParsertype(text: string, parsers: BuiltInParsers, options: Options) => any
prettier/docdebugnamespacenamespace

Changed signatures

exportBeforeAfter
prettier · check(source: string, options?: Options | undefined): boolean(source: string, options?: Options | undefined): Promise<boolean>
prettier · format(source: string, options?: Options | undefined): string(source: string, options?: Options | undefined): Promise<string>
prettier · getFileInfo(filePath: string, options?: FileInfoOptions | undefined): Promise<FileInfoResult>(file: string | URL, options?: FileInfoOptions | undefined): Promise<FileInfoResult>
prettier · resolveConfig(filePath: string, options?: ResolveConfigOptions | undefined): Promise<Options | null>(fileUrlOrPath: string | URL, options?: ResolveConfigOptions | undefined): Promise<Options | null>
prettier · BuiltInParsers{ angular: BuiltInParser; "babel-flow": BuiltInParser; "babel-ts": BuiltInParser; babel: BuiltInParser; css: BuiltInParser; espree: BuiltInParser; flow: BuiltInParser; glimmer: BuiltInParser; graphql: BuiltInParser; html: BuiltInParser; "json-stringify": BuiltInParser; json: BuiltInParser; json5: BuiltInParser; less: BuiltInParser; lwc: BuiltInParser; markdown: BuiltInParser; mdx: BuiltInParser; meriyah: BuiltInParser; scss: BuiltInParser; typescript: BuiltInParser; vue: BuiltInParser; yaml: BuiltInParser; }{ acorn: BuiltInParser; angular: BuiltInParser; "babel-flow": BuiltInParser; "babel-ts": BuiltInParser; babel: BuiltInParser; css: BuiltInParser; espree: BuiltInParser; flow: BuiltInParser; glimmer: BuiltInParser; graphql: BuiltInParser; html: BuiltInParser; "json-stringify": BuiltInParser; json: BuiltInParser; json5: BuiltInParser; jsonc: BuiltInParser; less: BuiltInParser; lwc: BuiltInParser; markdown: BuiltInParser; mdx: BuiltInParser; meriyah: BuiltInParser; mjml: BuiltInParser; scss: BuiltInParser; typescript: BuiltInParser; vue: BuiltInParser; yaml: BuiltInParser; }
prettier · getSupportInfo(): SupportInfo(options?: SupportInfoOptions | undefined): Promise<SupportInfo>
prettier · clearConfigCache(): void(): Promise<void>
prettier · formatWithCursor(source: string, options: CursorOptions): CursorResult(source: string, options: CursorOptions): Promise<CursorResult>
prettier · BuiltInParserName"angular" | "babel-flow" | "babel-ts" | "babel" | "css" | "espree" | "flow" | "glimmer" | "graphql" | "html" | "json-stringify" | "json" | "json5" | "less" | "lwc" | "markdown" | "mdx" | "meriyah" | "scss" | "typescript" | "vue" | "yaml""acorn" | "angular" | "babel-flow" | "babel-ts" | "babel" | "css" | "espree" | "flow" | "glimmer" | "graphql" | "html" | "json-stringify" | "json" | "json5" | "jsonc" | "less" | "lwc" | "markdown" | "mdx" | "meriyah" | "mjml" | "scss" | "typescript" | "vue" | "yaml"
prettier · resolveConfigFile(filePath?: string | undefined): Promise<string | null>(fileUrlOrPath?: string | URL | undefined): Promise<string | null>
prettier/standalone · check(source: string, options?: Options | undefined): boolean(source: string, options?: Options | undefined): Promise<boolean>
prettier/standalone · format(source: string, options?: Options | undefined): string(source: string, options?: Options | undefined): Promise<string>
prettier/standalone · getSupportInfo(): SupportInfo(): Promise<SupportInfo>
prettier/standalone · formatWithCursor(source: string, options: CursorOptions): CursorResult(source: string, options: CursorOptions): Promise<CursorResult>

Removed class or interface members

memberimportBefore
Config.pluginSearchDirsprettierfalse | string[] | undefined
Options.pluginSearchDirsprettierfalse | string[] | undefined
CursorOptions.pluginSearchDirsprettierfalse | string[] | undefined
ParserOptions.pluginSearchDirsprettierfalse | string[]
RequiredOptions.pluginSearchDirsprettierfalse | string[]
SupportLanguage.sinceprettierstring | undefined
IntSupportOption.sinceprettierstring
BaseSupportOption.sinceprettierstring
PathSupportOption.sinceprettierstring
ChoiceSupportOption.sinceprettierstring
StringSupportOption.sinceprettierstring
BooleanSupportOption.sinceprettierstring
IntArraySupportOption.sinceprettierstring
PathArraySupportOption.sinceprettierstring
StringArraySupportOption.sinceprettierstring
BooleanArraySupportOption.sinceprettierstring

Changed class or interface members

memberBeforeAfter
Config.parserCustomParser | LiteralUnion<BuiltInParserName, string> | undefinedLiteralUnion<BuiltInParserName, string> | undefined
Config.plugins(string | Plugin<any>)[] | undefined(string | URL | Plugin<any>)[] | undefined
Config.proseWrap"always" | "never" | "preserve" | undefined"preserve" | "always" | "never" | undefined
Parser.parse(text: string, parsers: { [parserName: string]: Parser<any>; }, options: ParserOptions<T>): T(text: string, options: ParserOptions<T>): T | Promise<T>
Parser.preprocess((text: string, options: ParserOptions<T>) => string) | undefined((text: string, options: ParserOptions<T>) => string | Promise<string>) | undefined
Options.parserCustomParser | LiteralUnion<BuiltInParserName, string> | undefinedLiteralUnion<BuiltInParserName, string> | undefined
Options.plugins(string | Plugin<any>)[] | undefined(string | URL | Plugin<any>)[] | undefined
Options.proseWrap"always" | "never" | "preserve" | undefined"preserve" | "always" | "never" | undefined
Printer.embed((path: AstPath<T>, print: (path: AstPath<T>) => Doc, textToDoc: (text: string, options: Options) => Doc, options: ParserOptions<T>) => Doc | null) | undefined((path: AstPath<any>, options: Options) => Doc | ((textToDoc: (text: string, options: Options) => Promise<Doc>, print: (selector?: string | number | (string | number)[] | AstPath<any> | undefined, args?: unknown) => Doc, path: AstPath<any>, options: Options) => Doc | Promise<Doc | undefined> | undef…
Printer.print(path: AstPath<T>, options: ParserOptions<T>, print: (path: AstPath<T>) => Doc, args?: unknown): Doc(path: AstPath<T>, options: ParserOptions<T>, print: (selector?: string | number | AstPath<T> | (string | number)[] | undefined, args?: unknown) => Doc, args?: unknown): Doc
Printer.preprocess((ast: any, options: ParserOptions<T>) => any) | undefined((ast: T, options: ParserOptions<T>) => T | Promise<T>) | undefined
Printer.massageAstNode((node: any, newNode: any, parent: any) => any) | undefined((original: any, cloned: any, parent: any) => any) | undefined
Printer.canAttachComment((node: T) => boolean) | undefined((node: T, ancestors: T[]) => boolean) | undefined
CursorOptions.parserCustomParser | LiteralUnion<BuiltInParserName, string> | undefinedLiteralUnion<BuiltInParserName, string> | undefined
CursorOptions.plugins(string | Plugin<any>)[] | undefined(string | URL | Plugin<any>)[] | undefined
CursorOptions.rangeEndundefinednumber | undefined
CursorOptions.proseWrap"always" | "never" | "preserve" | undefined"preserve" | "always" | "never" | undefined
CursorOptions.rangeStartundefinednumber | undefined
ParserOptions.parserCustomParser | LiteralUnion<BuiltInParserName, string>LiteralUnion<BuiltInParserName, string>
ParserOptions.plugins(string | Plugin<any>)[](string | URL | Plugin<any>)[]
ParserOptions.useTabsbooleanboolean | undefined
ParserOptions.proseWrap"always" | "never" | "preserve""preserve" | "always" | "never"
ParserOptions.jsxBracketSameLinebooleanboolean | undefined
FileInfoOptions.pluginsstring[] | undefined(string | URL | Plugin<any>)[] | undefined
FileInfoOptions.ignorePathstring | undefinedstring | URL | (string | URL)[] | undefined
RequiredOptions.parserCustomParser | LiteralUnion<BuiltInParserName, string>LiteralUnion<BuiltInParserName, string>
RequiredOptions.plugins(string | Plugin<any>)[](string | URL | Plugin<any>)[]
RequiredOptions.useTabsbooleanboolean | undefined
RequiredOptions.proseWrap"always" | "never" | "preserve""preserve" | "always" | "never"
RequiredOptions.jsxBracketSameLinebooleanboolean | undefined
ChoiceSupportOption.choices{ since?: string | undefined; value: Value; description: string; }[]{ value: Value; description: string; }[]
ChoiceSupportOption.defaultValue | { since: string; value: Value; }[] | undefinedValue | { value: Value; }[] | undefined
ResolveConfigOptions.configstring | undefinedstring | URL | undefined

Newly deprecated

export@deprecated
prettier · AstPath.getNamePlease use `AstPath#key` or `AstPath#index`
prettier · AstPath.getValuePlease use `AstPath#node` or `AstPath#siblings`

Requirement changes (engines, peer dependencies)

BeforeAfter
engines.node>=10.13.0>=14
New exports (1)
importexportkind
prettierSupportInfoOptionsinterface

Frequently asked questions

What are the breaking changes when upgrading prettier from 2 to 3?

Between prettier 2.8.8 and 3.9.9, Vigia found 2 removed exports, 14 changed signatures and 49 removed or changed class or interface members.

What became deprecated in prettier 3?

2 exports or members are newly marked as deprecated in prettier 3.9.9.

For agents

GET https://vigia.coredls.cloud/v1/packages/npm/prettier/upgrade?from=2.8.8&to=3.9.9