I am getting the below error when I run npm run prettier and when I commit (since I have a husky hook) a couple of Apex classes that use namespace placeholders .

Error: Found punctuation symbol or operator '%' that isn't valid in Apex.

I tried telling prettier and eslint to ignore these lines of code but I keep getting the same errors. Example:

// eslint-disable-next-line prettier-ignore
   %%%NAMESPACE_DOT%%%DateUtils.formatDate(firstMonday('3/30/2015'), 'M/d/yyyy'));
  • Why do you need %%%NAMESPACE_DOT%%%? Under normal circumstances, you don't need to worry about namespaces in Apex. I'd say there's more a problem with your packaging strategy.
    – sfdcfox
    Jun 8, 2023 at 15:23
  • I have an unlocked package that depends on another unlocked package. They share the same namespace. I am deploying to both namespaced orgs and persistent orgs... Now that you mention it, I don't necessarily have to use namespace placeholders in my packaged code... I do need it in my unpackaged code. Thanks for the pointer :)
    – dangt85
    Jun 8, 2023 at 15:47


You must log in to answer this question.

Browse other questions tagged .