I add typescript config for paths (alias):
tsconfig.json
{
"compilerOptions": {
"jsx": "react",
"baseUrl": "src",
"paths": {
"@components/*": ["components/*"]
}
},
"exclude": [
"node_modules",
"public"
]
}
After that I try import somthing like this:
import Header from '@components/header';
And now I get error in eslint: ESLint: Unable to resolve path to module '@components/header'.(import/no-unresolved)
I found a solution in this: eslint-import-resolver-typescript
npm i -D eslint-plugin-import @typescript-eslint/parser eslint-import-resolver-typescript
.eslintrc.js
module.exports = {
'settings': {
'import/resolver': {
'typescript': {},
},
},
}