jaredpalmer / tsdx

Zero-config CLI for TypeScript package development
https://tsdx.io
MIT License
11.28k stars 507 forks source link

`rootDir` warnings in Webstorm in test files #700

Closed ildar-icoosoft closed 4 years ago

ildar-icoosoft commented 4 years ago

Current Behavior

Steps to reproduce:

  1. npx tsdx create mylib
  2. open /test/blah.test.tsx file in WebStorm
  3. You will see highlighted line: "import { Default as Thing } from '../stories/Thing.stories';": tsdx2

Additional context

Your environment

Software Version(s)
TSDX "^0.13.2"
TypeScript "^3.8.3"
Browser Latest Chrome
npm/Yarn npm 6.12.0
Node v12.13.0
Operating System Win 10
agilgur5 commented 4 years ago

Duplicate of https://github.com/jaredpalmer/tsdx/issues/638#issuecomment-605722222, which points to upstream: https://youtrack.jetbrains.com/issue/WEB-44587?p=IDEA-236281

This doesn't occur in VS Code and the error doesn't really make sense: src is where your source folder is, stories isn't source, and so it not being part of rootDir should be fine. As a result, sounds like an upstream issue to me in Webstorm, not sure if there's a way to configure it so it doesn't give this erroneous warning, I don't use Webstorm.

There is a workaround that I've mentioned in the same issue that can be used, but it's somewhat complex: https://github.com/jaredpalmer/tsdx/issues/638#issuecomment-605728767

ghost commented 2 years ago

encountered the same error on vscode today Screenshot (662)

agilgur5 commented 2 years ago

@shadesOfcodes this is a 2.5 year old issue in an unmaintained library, but that's not the same error. TSDX's templates' include does not have ./stories in it. Stories are examples, and so shouldn't be compiled as part of your build. So the error you're getting is correct, and not a TSDX issue.

Webstorm users, as above, were getting this in test files, which are also not in the include, so that was an editor/IDE issue. tsc, VS Code, and TSDX did not error on that. In your case, you will get errors from tsc etc as well, unlike Webstorm users.

ghost commented 2 years ago

removing stories from include causes tsdx build to fail, tsdx is only able to build only when stories is in include

ghost commented 2 years ago

removing stories from include causes tsdx build to fail, tsdx is only able to build only when stories is in include

ignore the above statement, build error was coming from index.d.ts in the include, was conflicting with input file, changing it to asset.d.ts, fixed it, and also i removed ./stories from includes, everything works fine now. thanks a lot.