Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FEATURE] Option to install Prettier plugins #22

Closed
infotexture opened this issue Oct 10, 2020 · 7 comments · Fixed by #34 or #36
Closed

[FEATURE] Option to install Prettier plugins #22

infotexture opened this issue Oct 10, 2020 · 7 comments · Fixed by #34 or #36
Labels
enhancement New feature or request hacktoberfest

Comments

@infotexture
Copy link
Contributor

I'd like to use this action on repos that include XML files, and format them with @prettier/plugin-xml.

When I run the action as is, I get errors in the log:

[warn] Ignored unknown option { xmlWhitespaceSensitivity: "strict" }. Did you mean htmlWhitespaceSensitivity?
Error:  No parser could be inferred for file: index.dita

This works fine when I run Prettier locally, as these options are provided by plugin-xml.

Suggestion

💡 Add an option to that would allow users to specify the names of Prettier plugins to install.

I realize it would be possible to fork this action and hard-code additional plugins into the # PROGRAM section where Prettier itself is installed, but it seems like something that others might want to do too, so it might be best to support this here with an option instead.

@infotexture infotexture added the enhancement New feature or request label Oct 10, 2020
@creyD
Copy link
Owner

creyD commented Oct 12, 2020

Sounds cool, if you want you can create a PR for this!

@infotexture
Copy link
Contributor Author

Parameterizing this might be beyond my ken, but I'll try to put something together and submit for your review.

@creyD
Copy link
Owner

creyD commented Oct 15, 2020

Can you provide me with step by step instructions what needs to be done to achieve this?

@infotexture
Copy link
Contributor Author

Prettier plug-ins are installed like Prettier itself, so where you do that on Line 32 of entrypoint.sh, you'd need to add the plug-ins to the list of things to install, like plugin-xml:

 npm install --silent --global prettier @prettier/plugin-xml

But I'm not sure whether you'd want to install all the official plugins, or how to best allow users to specify which plugins they want to install. 🤔

infotexture added a commit to infotexture/prettier_xml_action that referenced this issue Oct 16, 2020
@creyD
Copy link
Owner

creyD commented Oct 17, 2020

I think it would be best to let users specify which plugins they want to install..

@stemount
Copy link
Contributor

stemount commented Nov 10, 2020

@creyD @infotexture for sure, checked out the PR.

It'd need to be something that ideally did a regex on another env variable such as...

jobs:
    prettier:
        runs-on: ubuntu-latest

        steps:
            - name: Checkout
              uses: actions/checkout@v2
              with:
                  # Make sure the actual branch is checked out when running on pull requests
                  ref: ${{ github.head_ref }}
                  # This is important to fetch the changes to the previous commit
                  fetch-depth: 0

            - name: Prettify code
              uses: creyD/prettier_action@v3.1
              with:
                  # You'd wanna ensure this worked out as a nice simple regex
                  # e.g (@prettier\/)+(plugin-[a-z\-]+)
                  plugins:
                      - plugin-xml

@stemount
Copy link
Contributor

oh damn, I forgot to change the issue to add regex

(@prettier\/)+(plugin-[a-z\-]+)

as suggested to ensure that the plugin could not "expand" out of this other than dashes and a-z chars.

@creyD creyD closed this as completed in #36 Jan 10, 2021
infotexture added a commit to dita-ot/docs that referenced this issue Feb 27, 2021
No need for the infotexture fork now that the upstream action repo has added support for Prettier plugins:

- creyD/prettier_action#22
- creyD/prettier_action#34
- creyD/prettier_action#36

Signed-off-by: Roger Sheen <roger@infotexture.net>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request hacktoberfest
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants