Closed Tsury closed 6 years ago
@Tsury Actually, eslint-import-resolver-alias
uses Node.js native package resolution to find a module and does not support custom file extensions now. That's why it works fine when you specify the extension. I'm going to add this new feature recently and hope that will be helpful.
I have same problem with .jsx
extensions.
@johvin Got it, thanks!
Version 1.1.0
is released to support custom file extensions. @Tsury You can try again with the following configuration in your .eslintrc.js
file.
"settings": {
"import/resolver": {
"alias": {
"map": [
["@dpStores", path.resolve(__dirname, './src/stores')]
],
"extensions": ['.js', '.ts', '.tsx', '.d.ts', '.json']
}
}
}
@dhlavaty You can solve your problem with a similar configuration as above, like "extensions": ['.jsx', '.js', '.json']
@johvin Thanks, confirmed working!
Works. Thank You
I'm using
eslint-import-resolver-alias
along witheslint-import-resolver-typescript
.I have the following alias:
["@dpStores", path.resolve(__dirname, './src/stores')]
But have the following
eslint
error when I try to import atypes.tsx
file without specifying the extension:If I specify the extension it works just fine. Importing files without an extension works fine when not using an alias.
This is my
resolver
settings in.eslintrc
:"settings": { "import/resolver": { "node": true, "eslint-import-resolver-typescript": true, "alias": [ ["@dpStores", path.resolve(__dirname, './src/stores')] ] } }