Vigia

Passer de prettier 2.x à 3.x

Comparaison de l’API publique de prettier 2.8.8 et 3.9.9, calculée automatiquement à partir de leurs types TypeScript. Une signature modifiée est un changement incompatible possible, pas une certitude.

Résumé

Chemins d’importation supprimés12
Exports supprimés2
Signatures modifiées14
Membres de classes ou d’interfaces supprimés16
Membres de classes ou d’interfaces modifiés33
Nouvelles dépréciations2
Changements d’exigences (engines, dépendances peer)1
Nouveaux exports1

Chemins d’importation supprimés

Chemins d’importation supprimés
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

Exports supprimés

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

Signatures modifiées

exportAvantAprès
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>

Membres de classes ou d’interfaces supprimés

memberimportAvant
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

Membres de classes ou d’interfaces modifiés

memberAvantAprès
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

Nouvelles dépréciations

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

Changements d’exigences (engines, dépendances peer)

AvantAprès
engines.node>=10.13.0>=14
Nouveaux exports (1)
importexportkind
prettierSupportInfoOptionsinterface

Questions fréquentes

Quels sont les changements incompatibles en passant de prettier 2 à 3 ?

Entre prettier 2.8.8 et 3.9.9, Vigia a trouvé 2 exports supprimés, 14 signatures modifiées et 49 membres de classes ou d’interfaces supprimés ou modifiés.

Qu’est-ce qui a été déprécié dans prettier 3 ?

2 exports ou membres sont désormais marqués comme dépréciés dans prettier 3.9.9.

Pour les agents

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