jaredpalmer / tsdx

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

Default linting does not work with TypeScript v4 #810

Open aayani opened 4 years ago

aayani commented 4 years ago

Current Behavior

The yarn lint or tsdx lint src test is not behaving as expected after I upgraded TypeScript from v3 to v4. Getting the error Parsing error: Cannot read property 'map' of undefined (in some files) in my case when I run these scripts. This make the pre-commit checks fail, hence rendering the husky hook useless.

Expected behavior

The yarn lint script should work with TypeScript v4 as it was with v3.

Suggested solution(s)

Additional context

Works fine when I revert to TypeScript 3. Problem only lies with the new version.

Your environment

Software Version(s)
TSDX 0.13.2
TypeScript 4.0.2
Browser -
Yarn 1.22.4
Node 12.18.3
Operating System Ubuntu 20.04.1 LTS (Focal Fossa)
agilgur5 commented 4 years ago

Yea TS v4 was released <24 hours ago...

TSDX does not do it's own parsing and ESLint itself does not seem to fully support it yet.

aayani commented 4 years ago

Well that makes sense. Let's just hope they fix it soon enough.

agilgur5 commented 4 years ago

@aayani I mean I think it's a bit unreasonable to expect super fast turnarounds for an entire ecosystem. Having to wait a month or more should be totally normal, much of the folks in open source, including me, are volunteers -- expecting volunteers to drop everything for every breakage in a dependency is asking for a lot.

It's also not always possible, e.g. I could not update TSDX to Rollup v2 as several common plugins weren't compatible (including ones I built integration tests for). TS private fields support (TS 3.8) is also lagging behind in various places (Rollup, ESLint) due to AST changes

agilgur5 commented 4 years ago

So we actually can't upgrade typescript-eslint because TSDX doesn't require the plugin and parser directly, it does so indirectly as a peerDep of eslint-config-react-app, which has yet to upgrade per https://github.com/formium/tsdx/pull/890#issuecomment-700292943 . Its @next pre-release line has upgraded, but no one can tell how stable that will be 😕

diegonvs commented 4 years ago

I solved it adding

"resolutions": {
  "**/@typescript-eslint/eslint-plugin": "^4.1.1",
  "**/@typescript-eslint/parser": "^4.1.1"
}

on my package.json file