Closed chancancode closed 1 month ago
Do they support StaticBlock?
Possibly, it's more about what doesn't cause their code (and other plugins) to not blow up; I won't have time to look into it until next week at the earliest. In this case it is missing node.key
which they seem to assume (reasonably or not) every node inside the class body to have.
I suspect for linting purposes, pretending to be a method body is closer to the actual semantics, if some plugin checks the content and see this
it's more likely to assume the correct thing over when it's inside a static block.
static block is also part if the body and doesn't have key. So they probably need to validate if a key is available. https://astexplorer.net/#/gist/8eeee786f08a003c55e6851cfe95bb46/latest
Making template a method ast node has other issues. Like eslint plugins that try to order members and methods
Something about this causes this code to blow up: https://github.com/gajus/eslint-plugin-jsdoc/blob/v48.0.6/src/exportParser.js#L216-L220
I think it was not expecting the
GlimmerTemplate
node inside the class body, and so it tried to accessnode.key.name
on it and it blows up becauseGlimmerTemplate
doesn't have akey
. The fact that the code only runs when there is an unexported class is incidental.I think the bottomline is there are probably code out there outside of our control (well, we can try to PR a fix, but would have to explain a lot of background and convince people to care, and it's kind of a whack-a-mole situation), that have some implicit expectation on what can appear inside a class body.
I think either:
GlimmerTemplate
node by default and only expose it with some kind of opt-in