Description
What problem does this feature solve?
it would be great to be able to specify specific variables to disregard when showing this warning:
setup() return property "_" should not start with "$" or "_" which are reserved prefixes for Vue internals
Specifically I am using lodash, so I often have something like import _ from 'lodash'
in my files.
When using the options api, this isn't really a huge issue, because usually lodash functions aren't needed in the template, and renaming lodash itself or a specific function while explicitly exposing it to the template isn't too common. However with the new script setup API, this would mean having to always rename lodash itself when importing it. While that's fine, it's not great for readability when lodash being named _
is the norm.
What does the proposed API look like?
A few things come to mind that could help
- ignore the variable name
_
itself from this warning - allow users to explicitly allow specific vars that are prefixed with _ or $, similar to
app.config.globalProperties
but something likeapp.config.allowInternalPrefixSetupProps = ['_', '_myVar', '$somethingSpecial']