NiklasPor / prettier-plugin-organize-attributes

Organize your HTML attributes automatically with Prettier 🧼
MIT License
197 stars 12 forks source link

Add ability to ignore a file #9

Closed danjor closed 2 years ago

danjor commented 2 years ago

Hello,

Could it be possible to add a feature to ignore a file so imports will not be ordered ? For instance, in my project we used previously "prettier-plugin-organize-imports", and they added a feature later to ignore a file from being formatted by the plugin, by adding the following comment :

// organize-imports-ignore

Full explaination could be found here, and related commit also here, that consists only of having an if condition to check if the file constains that comment.

Thank you.

NiklasPor commented 2 years ago

For the whole file or for a section / single tag? There's also always the option if just disabling the sorting for specific files inside the .prettierrc.

If you're interested in that I can give you an example.

danjor commented 2 years ago

Thanks for your reply.

We finally manage to ignore some files completly by using the .prettierignore and .prettierrc

NiklasPor commented 2 years ago

If you only want to disable sorting for a specific file (or file-matcher) you can do it in the following way:

{
  "overrides": [
    {
      "files": "unsorted.html",
      "options": {
        "attributeGroups": ["$DEFAULT"],
      }
    }
  ]
}

I'll mark this as resolved for now, if there are any other questions just comment here or in a new issue :)