0
votes

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?

1

1 Answers

0
votes

You could try adding "typescript.preferences.importModuleSpecifier": "relative" in vscodes user settings or otherwise set baseUrl in your tsconfig.json (see module-resolution)