ony3000 / prettier-plugin-merge

A Prettier plugin that sequentially merges the formatting results of other Prettier plugins.
MIT License
24 stars 1 forks source link

In most cases, programmatic formatting does not work #17

Closed ony3000 closed 8 months ago

ony3000 commented 8 months ago

Dependency information

Steps to reproduce

  1. Prepare an empty prettier config.
  2. Try to run this test.
test('tailwindcss', async () => {
  expect(
    await format(`export function Counter() {\n  return <span classes="font-bold px-1">{count}</span>;\n}`, {
      ...defaultOptions,
      filepath: 'Counter.jsx',
      plugins: [
        'prettier-plugin-tailwindcss',
        'prettier-plugin-merge',
      ],
      tailwindAttributes: ['classes'],
    }),
  ).toBe(`export function Counter() {\n  return <span classes="px-1 font-bold">{count}</span>;\n}\n`);
});

The current behavior

The test will only pass if the options passed to the format function and the prettier config are identical.

The expected behavior

Should be able to pass the test with just the options passed to the format function.