Open slifty opened 4 years ago
That's how regexes work, the $
has special meaning, You'll just have to escape the character in your regexes. Not sure modifying the special char you're using you're using to avoid "import hell" is an ideal solution from a project perspective, given you only configure this tool once, yet write code with your chosen prefix every day.
Thanks @aryzing -- It's been a while, but I believe the root of my issue as posted was that it was unexpected to me that the alias name was being treated as a regular expression at all. It isn't currently documented that this value is being treated as a regular expression, and it was surprising to me as an end user to have my alias be interpreted as such. Hence the issue title.
I appreciate that under the hood the matching uses my configuration value as a regular expression. That should either be:
It seems to be a moot point of course, as this project doesn't appear to be active any longer (and in my case we ended up NOT using aliases at all, opting for just being explicit in our imports).
All that said you're right that having a slightly ugly config in one place makes way more sense than using %
over $
-- it's a very good point!
Thank you for the project!
We're using module-alias in our project to prevent import hell. According to this issue they are recommending a
$
prefix to aliases in order to avoid the@
that is being used as a namespace among npm packages.It looks like your plugin will interpret
$
as regex, which means if I had an alias for$src
defined, I would need to write in my eslint alias settings:'\\$src', './src'
I'm not sure the ideal solution from a project perspective, but it would be great to be able to use $ (or other regex characters) in my aliases.
Note: in our case we are addressing this by changing
$src
to%src
but ideally we wouldn't have to.