0

Our team is working with mock permission sets in our project for testing features. We have triggers to apply prettier when saving or committing files, and it's been breaking our perm set metadata files.

For example, we have these tags in one of our perm set metadata files:

<flowAccesses>
    <enabled>true</enabled>
    <flow>Mock_Object_Link_Flow</flow>
</flowAccesses>

Adding a carriage return anywhere (just to edit the file and cause the saving to trigger prettier) changes the above to the following:

<flowAccesses>
    <enabled>true</enabled>
    <flow>
Mock_Object_Link_Flow;
    </flow>
</flowAccesses>

At this point the source tracking sees that there's a change and if we try to deploy to our sandbox or scratch org we get errors.

We currently work around this by correcting the file outside of VS Code or by committing with the --no-verify flag.

For reference, here are the contents of our .prettierrc:

**/staticresources/**
.sfdx

and .prettierignore:

{
    "trailingComma": "none",
    "singleQuote": true,
    "tabWidth": 4,
    "overrides": [
        {
            "files": "**/lwc/**/*.html",
            "options": { "parser": "lwc" }
        },
        {
            "files": "*.{cmp,page,component}",
            "options": { "parser": "html" }
        }
    ]
}

What is causing this and how can we fix it?

2
  • Have you tried updating your .prettierignore file?
    – Nick C
    Commented Jan 19 at 0:29
  • @NickC, I don't know what update might affect this, but I've included the contents of our prettier config files above. prettier famously offers few customization options, and I don't see which one available for prettier itself, nor for the XML parser (github.com/prettier/plugin-xml) that would solve this. Adding **/*.xml to .prettierignore does prevent parsing XML files and "fixes" the problem, but we do want XML properly parsed by prettier. So that's at least a temporary solution.
    – Chuck
    Commented Jan 19 at 16:21

1 Answer 1

0

Apparently there's another prettier plugin that works with something called "flow." I think it's something to do with the Flow Parser, but am not sure. I do see a parser-flow.mjsn file within the prettier package.

Regardless, the <flow> tag in the XML seems to be getting messed up by this. The solution is to add "embeddedLanguageFormatting": "off" to .prettierrc.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .