Commit 633798d
committed
ci(js): lint the backend JavaScript, which nothing did
A file whose methods had landed outside their class passed the whole CI
matrix — 71 green checks — and the rating buttons it shipped would not
have worked. PHPStan does not read JavaScript, the functional suite
renders the template without executing the module, and no Playwright spec
covers that view. A person reading the diff found it.
node --check was the cheaper candidate and lost on evidence, not on
taste: it parses a .js file as a CommonJS script and ACCEPTED the broken
file, while ESLint parses it as an ES module — which is how the browser
loads it — and reports the parse error on the right line. That also
settles a contradiction left open in #842's review: the file was a syntax
error all along; node --check simply read it in the wrong mode.
My stated reason for not deciding this earlier was wrong, and checking it
took one command: "eslint would bring a JS toolchain into a PHP
extension". package.json, package-lock.json and three devDependencies
were already there, and CI already runs npm install for the e2e job.
No sibling extension lints JavaScript — rte_ckeditor_image has a
package.json for commitlint only, nr-vault one for Playwright,
nr-repurpose none. There was no house standard to follow, which is a
reason to set one rather than to wait.
The rule set is small on purpose. no-undef is the error, because that is
the rule that catches the defect above. no-unsanitized is loaded but set
to warn: as an error it reports 12 assignments and NONE is a hole — the
code escapes through escapeHtml(), visibly and with a comment saying so,
and the rule cannot recognise a helper of ours as a sanitizer. Dropping
the plugin was not an option either: two files already carry
eslint-disable-line no-unsanitized/property, suppressions written for a
rule that never ran, which become "rule not found" errors the moment
linting is switched on. Those twelve are triaged in #854 with the
evidence, because a security question belongs where it can be argued.
The clean tree lints at 0 errors. Reintroducing the #825 shape — a method
after the class's closing brace — fails with a parse error and exit 1.
Thin caller of the shared script-check reusable, so no job is defined
here; pre-command installs the devDependencies the runner does not ship.
Closes #825
Signed-off-by: Sebastian Mendel <sebastian.mendel@netresearch.de>1 parent 1c46f74 commit 633798d
4 files changed
Lines changed: 1212 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
0 commit comments