Skip to content

[Prettier Plugin] Handle two more plugins #13708

@un33k

Description

@un33k

Discussed in #13630

Originally posted by un33k May 3, 2024

Description

We are encountering a compatibility issue where certain Prettier plugins must be able to precede the Tailwind CSS plugin without losing functionality or disabling Tailwind. This compatibility is crucial for maintaining our project's code formatting standards and utility functionality.

Affected Plugins

  • @softonus/prettier-plugin-duplicate-remover
  • @softonus/prettier-plugin-whitespace-remover

Desired Outcome

The desired outcome is for these plugins to function correctly when placed before the Tailwind CSS plugin in the Prettier configuration file. This would allow for better flexibility in managing code formatting and style consistency.

Current Behavior

  • When these plugins are placed before the Tailwind plugin: They do not function as expected.
  • When placed after the Tailwind plugin: They lead to the Tailwind plugin being disabled.

Steps to Reproduce

  1. Set up a project with Prettier and Tailwind CSS.
  2. Install and configure the aforementioned plugins in the .prettierrc file.
  3. Arrange the plugins before the Tailwind CSS plugin and attempt to format the files.
  4. Observe the lack of expected functionality from the plugins.

Suggested Solution

Investigate potential changes or enhancements in the plugin architecture or initialization sequence that would allow these plugins to operate effectively when configured before the Tailwind CSS plugin. This might involve modifications to how plugins are loaded or processed by Prettier when working with CSS frameworks like Tailwind.

Beneficial Side Effect:

Implementing this change will also have the added advantage of negating the need for the Tailwind plugin to include its own duplicate and whitespace remover functionalities. This would not only streamline the Tailwind plugin but also reduce redundancy and potential conflicts between these utilities.

We appreciate your consideration and any efforts to enhance the compatibility of these tools, which are crucial for our development workflows.

They should be added to this file: https://github.com/tailwindlabs/prettier-plugin-tailwindcss/blob/3c9ce4e488c09851be1d5be37940b39679e10c1c/src/plugins.js#L174

    '@ianvs/prettier-plugin-sort-imports',
    '@trivago/prettier-plugin-sort-imports',
    'prettier-plugin-organize-imports',
    'prettier-plugin-css-order',
    'prettier-plugin-import-sort',
    'prettier-plugin-jsdoc',
    'prettier-plugin-organize-attributes',
    'prettier-plugin-style-order',
    'prettier-plugin-sort-imports',
    '@softonus/prettier-plugin-whitespace-remover',   // <- this one
    '@softonus/prettier-plugin-duplicate-remover'   // and this one
  ]

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions