Proposal:
HandwrittenJavascriptDetector recognises JavaScript by three spellings: an opening const/let, one of eight DOM member names, or a reach through document./window. A class that builds a JavaScript CONDITION out of none of those is missed. Compiler/Instructions/Guard is the case: Guard::stateKey builds "event.detail?.key !== X", Guard::keys builds "keysOf(event) !== X", Guard::stateHolds builds "getState(A, B) !== true". All three are JavaScript assembled as a string by a class that is neither an InstructionWriter nor in the RECORDED contracts, which is exactly what the rule forbids, and none is flagged. Guard::outside was flagged only because it happened to spell document.contains. So the rule under-flags: whether it fires depends on which browser member the condition names rather than on the class writing JavaScript at all. Suggest recognising an expression built with a JavaScript operator (=== / !== / ?. / => ) inside a class outside the allowed layers, so the whole of Guard is caught in one wave and can be moved into ListenWriter together.
Filed via commandments feature-request from a consumer project.
Proposal:
HandwrittenJavascriptDetector recognises JavaScript by three spellings: an opening const/let, one of eight DOM member names, or a reach through document./window. A class that builds a JavaScript CONDITION out of none of those is missed. Compiler/Instructions/Guard is the case: Guard::stateKey builds "event.detail?.key !== X", Guard::keys builds "keysOf(event) !== X", Guard::stateHolds builds "getState(A, B) !== true". All three are JavaScript assembled as a string by a class that is neither an InstructionWriter nor in the RECORDED contracts, which is exactly what the rule forbids, and none is flagged. Guard::outside was flagged only because it happened to spell document.contains. So the rule under-flags: whether it fires depends on which browser member the condition names rather than on the class writing JavaScript at all. Suggest recognising an expression built with a JavaScript operator (=== / !== / ?. / => ) inside a class outside the allowed layers, so the whole of Guard is caught in one wave and can be moved into ListenWriter together.
Filed via
commandments feature-requestfrom a consumer project.