feature-sliced / steiger

Universal file structure and project architecture linter
https://www.npmjs.com/package/steiger
MIT License
29 stars 1 forks source link

Implement a TypeScript-compliant import resolver #1

Closed illright closed 2 months ago

illright commented 2 months ago

Given a file name, an imported path, and a TSConfig object, produce an absolute path to the imported file.

Example (inside $PROJECT_FOLDER):

// ./src/pages/home/ui/HomePage.tsx
import { Button } from "~/shared/ui";
// ./tsconfig.json
{
  "include": ["**/*.ts", "**/*.tsx"],
  "compilerOptions": {
    "moduleResolution": "Bundler",
    "baseUrl": ".",
    "paths": {
      "~/*": ["./src/*"],
    },
  },
}

Expected output: $PROJECT_FOLDER/src/shared/ui/index.ts

illright commented 2 months ago

Will transfer this issue to filesystem