Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Avoid use . or circular dependency in src/options files #398

Closed
JounQin opened this issue Jun 21, 2022 · 0 comments · Fixed by #399
Closed

Avoid use . or circular dependency in src/options files #398

JounQin opened this issue Jun 21, 2022 · 0 comments · Fixed by #399

Comments

@JounQin
Copy link
Member

JounQin commented Jun 21, 2022

Info

Tool Version
Plugin v2.1.0
Prettier v2.7.1
Framework react
Node v16.15.1
OS mac

Prettier config

"@1stg/prettier-config"

Context

I'm using tsx to run .ts files with tsconfig.json, there is "*": ["src/*"] alias:

{
  "extends": "@1stg/tsconfig/app",
  "compilerOptions": {
    "baseUrl": ".",
    "jsx": "react-jsx",
    "paths": {
      "*": ["src/*"], // note this
      "lodash": ["lodash-es"],
      "assets/*": ["assets/*"],
      "server/env": ["server/env"],
      "server": ["server"],
      "shared": ["shared"]
    }
  }
}

import { CATEGORY_PUG } from '.';

It will resolve user's src/index.tsx outside node_modules unexpectedly, of course it should be a tsx issue, but it can be prevented in @prettier/plugin-pug's side.

Additional Context

I'd like to raise a PR for it if you agree.

import { CATEGORY_PUG } from './' would work, or we should extract CATEGORY_PUG into constant.ts.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant