-
-
Notifications
You must be signed in to change notification settings - Fork 4.6k
Closed
Labels
area:apiIssues with Prettier's Application Programming InterfaceIssues with Prettier's Application Programming Interfacearea:plugin apilocked-due-to-inactivityPlease open a new issue and fill out the template instead of commenting.Please open a new issue and fill out the template instead of commenting.
Description
Environments:
- Prettier Version: next
- Running Prettier via: API
- Runtime: Node 18
- Operating System: WSL
- Prettier plugins (if any): custom
Steps to reproduce:
import * as prettier from "prettier";
console.log(
await prettier.format(".", {
plugins: [
{ parsers: { baz: { parse: () => ({}), astFormat: "baz-ast" } } },
{ printers: { "baz-ast": { print: () => "1" } } },
],
parser: "baz",
}),
await prettier.format(".", {
plugins: [
{ parsers: { baz: { parse: () => ({}), astFormat: "baz-ast" } } },
{ printers: { "baz-ast": { print: () => "2" } } },
],
parser: "baz",
})
);The problem is here:
prettier/src/common/load-plugins.js
Line 13 in 2c77149
| const memoizedLoad = mem(load, { cacheKey: JSON.stringify }); |
Both plugins are serialized to the same string by JSON.stringify.
Expected output: 1 2
Actual output: 1 1
fisker
Metadata
Metadata
Assignees
Labels
area:apiIssues with Prettier's Application Programming InterfaceIssues with Prettier's Application Programming Interfacearea:plugin apilocked-due-to-inactivityPlease open a new issue and fill out the template instead of commenting.Please open a new issue and fill out the template instead of commenting.