How to put an alias using regexp
The problem, I have this folder structure:
+ src
- components
- pages
- state
- utils
My jsconfig.json sets src as baseUrl:
{
"compilerOptions": {
"baseUrl": "src"
}
}
So I import files using this notation:
import getFilename from 'utils/files/getFilename'
Using this plugin, I need to create an alias for all 4 subfolders and I want to say: "Every direct child inside src should be aliased".
Is that doable? Something like:
"settings": {
"import/resolver": {
"eslint-import-resolver-custom-alias": {
"alias": {
"*": "./src/*"
},
"extensions": [".js", ".jsx"]
}
}
},
@wizevlad were you able to figure this out? I'd like to do something similar, no luck thus far.
I have created a PR #5 , please see if this will solve the problem.
Here is what I think: perhaps * is too complicated for the solution, as I don't think one would create some configuration like "root/*": "./src/*". Thus instead, I create a special case for empty string, i.e. "": "./src" instead.
Let me know if you have any feedback.