Skip to content

Fix the rollup-plugin-typescript2 objectHashIgnoreUnknownHack warning - #339

Merged
fi3ework merged 1 commit into
egoist:masterfrom
chocolateboy:fix-rpt2-warning
Apr 28, 2020
Merged

Fix the rollup-plugin-typescript2 objectHashIgnoreUnknownHack warning#339
fi3ework merged 1 commit into
egoist:masterfrom
chocolateboy:fix-rpt2-warning

Conversation

@chocolateboy

@chocolateboy chocolateboy commented Apr 27, 2020

Copy link
Copy Markdown
Contributor

rollup-plugin-typescript2 < v0.26 needs the objectHashIgnoreUnknownHack option to be enabled to correctly handle async functions in the plugin configuration, but it's no longer needed (and causes a warning) if the user has a more recent version installed.

This PR detects the version of the plugin, if installed, and enables/disables the option accordingly.

Manually tested against rpt2 v0.25.3 and v0.27.0.

Closes #305

@vercel

vercel Bot commented Apr 27, 2020

Copy link
Copy Markdown

This pull request is being automatically deployed with Vercel (learn more).
To see the status of your deployment, click below or on the icon next to each commit.

🔍 Inspect: https://vercel.com/egoist/bili/ns68hjy49
✅ Preview: https://bili-git-fork-chocolateboy-fix-rpt2-warning.egoist.now.sh

@codecov

codecov Bot commented Apr 27, 2020

Copy link
Copy Markdown

Codecov Report

Merging #339 into master will increase coverage by 0.09%.
The diff coverage is 83.33%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #339      +/-   ##
==========================================
+ Coverage   76.16%   76.26%   +0.09%     
==========================================
  Files          11       11              
  Lines         428      434       +6     
  Branches      161      165       +4     
==========================================
+ Hits          326      331       +5     
- Misses         97       98       +1     
  Partials        5        5              
Impacted Files Coverage Δ
src/index.ts 73.70% <83.33%> (+0.20%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 633e01a...61514a3. Read the comment docs.

@fi3ework

fi3ework commented Apr 28, 2020

Copy link
Copy Markdown
Collaborator

hi @chocolateboy. Thanks for PR. What about we upgrade the bili internal rtp2 to latest version and set objectHashIgnoreUnknownHack to false by default?

@chocolateboy

Copy link
Copy Markdown
Contributor Author

@fi3ework That's fine by me, but I think you'd need to stop requiring/supporting the user-installed version, which would at least be a breaking change. The internal version is a dev dependency, so I assume it's only used for tests?

Otherwise, because there's no constraint on the user-installed version of rpt2 (i.e. it's not a peer dependency), users could end up using an old version (< v0.26) without enabling this option and things would break.

@chocolateboy

Copy link
Copy Markdown
Contributor Author

P.S. If the idea is to make TypeScript work out of the box, without the user needing to install anything, it might be worth looking at another plugin, as suggested here.

@fi3ework

Copy link
Copy Markdown
Collaborator

The internal version is a dev dependency, so I assume it's only used for tests?

Looked a bit at the source code. rtp2 is required from user-land so actually rpt2 is an useless dep for bili now. It could be removed. For test cases, they will require rpt2 from test/fixtures/node_moudles.

If the idea is to make TypeScript work out of the box, without the user needing to install anything, it might be worth looking at another plugin, as suggested here.

This could be a break change. May could be used in next major version 😊

LGTM

@fi3ework
fi3ework requested a review from egoist April 28, 2020 07:30
@pull-assistant

pull-assistant Bot commented Apr 28, 2020

Copy link
Copy Markdown

Score: 1.00

Best reviewed: commit by commit


Optimal code review plan

     fix the rollup-plugin-typescript2 objectHashIgnoreUnknownHack warning

Powered by Pull Assistant. Last update 61514a3 ... 61514a3. Read the comment docs.

rollup-plugin-typescript2 < v0.26 needs the `objectHashIgnoreUnknownHack`
option to be enabled to correctly handle async plugins, but it's no
longer needed (and causes a warning) if the user has a more recent
version installed.

this PR detects the version of the plugin, if installed, and
enables/disables the option accordingly.
@vercel
vercel Bot requested a deployment to Preview April 28, 2020 13:56 Abandoned
@fi3ework
fi3ework merged commit 3621d65 into egoist:master Apr 28, 2020
@egoist

egoist commented Apr 28, 2020

Copy link
Copy Markdown
Owner

🎉 This PR is included in version 4.9.3 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Warning about using objectHashIgnoreUnknownHack in rollup-plugin-typescript2

3 participants