I have following structure.
.
└── src
└── pages
└── Chat
├── Chat.tsx
├── index.ts
└── components
├── index.ts
└── AppsBar
├── AppsBar.tsx
├── AppTile.ts
└── index.ts
From Chat.tsx
I want to import AppsBar
component (each has named exports, and index with export all).
Do it by hand it would look that: import { AppsBar } from './components';
. But VSC or WebStorm creates automatic path: import { AppsBar } from '~/pages/Chat/components/AppsBar';
(I have aliases).
Question : Is there any ESLint rule to force using /.
notation when I want access to file from the same level?
You could try adding "typescript.preferences.importModuleSpecifier": "relative"
in vscodes user settings or otherwise set baseUrl
in your tsconfig.json (see module-resolution )
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.