vizhub-core / vizhub-feedback

VizHub feedback issue tracker
32 stars 3 forks source link

Error when running Prettier on index.html #686

Closed curran closed 2 years ago

curran commented 3 years ago

To reproduce: run Prettier on this viz (or a fork of it):

https://vizhub.com/curran/469e558ba77941aa9e1b416ea521b0aa?edit=files&file=index.html

image

curran commented 3 years ago

Spent some time investigating. Prettier works for all languages except .html.

This is the full error:

TypeError: Cannot convert undefined or null to object
    at getPrototypeOf (<anonymous>)
    at _getPrototypeOf (getPrototypeOf.js:5)
    at r.parse (parser-html.js:113)
    at Object.t.parse (parser-html.js:113)
    at Mn (parser-html.js:113)
    at Un (parser-html.js:113)
    at Object.parse (parser-html.js:113)
    at Object.parse (standalone.js:15)
    at ts (standalone.js:15)
    at us (standalone.js:15)
    at standalone.js:55
    at Object.format (standalone.js:55)
    at usePrettier.js:66

This is on our top-level call into Prettier, so the error is originating from within the Prettier code somewhere.

It's been quite difficult to debug in minified files, have not yet been able to pinpoint the cause.

curran commented 3 years ago

The bug is not there in the version from a month ago - commit 5dced7a8bb7a45524bb0232eb53edaf7ec184a9b .

curran commented 3 years ago

Also not there as of ee30aa1fd5e08da542684c8084fe710066622b7a (17 days ago)

curran commented 3 years ago

It is there as of e4866a440e7cdd0bb0c1aaf0d1b2f53aa0ea765c.

So it must have been introduced somewhere between ee30aa1fd5e08da542684c8084fe710066622b7a and e4866a440e7cdd0bb0c1aaf0d1b2f53aa0ea765c

curran commented 3 years ago

Not there as of a5878722c0bda7d07387cb6032ac207feab5ad66

curran commented 3 years ago

OK - pinpointed that this is the commit where this bug was introduced: f41c1a7a4cba92af934b40a79ef94fca72a26dda

This commit upgraded Prettier in NeoFrontend from "prettier": "^2.1.2" to "prettier": "^2.2.1".

I can try reverting that version and see if that fixes it.

thorn0 commented 3 years ago

Upgrade Babel. This was fixed in v7.12.13 (2021-02-03) by https://github.com/babel/babel/pull/12544

curran commented 3 years ago

Oh good to know! Thanks for this.

curran commented 3 years ago

In theory this should automatically happen when Upgrade Dependencies May 2021 #736 gets done. Let's see!