I have installed the eslint-plugin-import to my project and my goal is to use the 'import/no-relative-parent-imports': 'error' setting to forbid relative imports in my project to enhance readibility.
However this setting produces errors across my project because it does not pick up my tsconfig alias to the root folder.
My tsconfig.json has the following setting.
"paths": {
"src/": ["./src/*"]
}
I try importing components in my project the following way.
import { Component } from 'src/components/ComponentA' but then eslint complains about using relative imports when in fact I import my component absolutely with the help of the tsconfig path alias. I have installed the eslint-import-resolver-typescript and enabled it in my .eslintrc.js file.
settings: {
'import/resolver': {
typescript: {},
},
},
My error message is the following.
Relative imports from parent directories are not allowed. Please either pass what you're importing through at runtime (dependency injection), move `example.ts` to same directory as `src/components/ComponentA` or consider making `src/components/ComponentA` a package. (eslintimport/no-relative-parent-imports)