You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Add self-contained frontend linting to the RedHerb example
RedHerb's JavaScript, Vue, and LESS resources were not linted. The lint
scope of ci-ts.yml (resources/**) predates RedHerb and never grew to cover
tests/RedHerb, so the example extension was held to a lower standard than the
code it is meant to demonstrate.
RedHerb now carries its own lint setup, so the example stands on its own and
can be lifted wholesale into a real extension rather than borrowing
ext.neowiki's TypeScript toolchain:
* tests/RedHerb/package.json with eslint, stylelint, and banana-checker, plus
an "npm run lint" script that runs all three, a committed package-lock.json,
and a local .gitignore so the directory is self-contained.
* .eslintrc.json using the Wikimedia plain-JavaScript profile
(wikimedia/client + wikimedia/mediawiki) for the .js and Vue SFC resources,
not the TypeScript profile ext.neowiki uses.
* .stylelintrc.json using stylelint-config-wikimedia for the <style> blocks.
* .github/workflows/ci-redherb.yml running the lint on every push and PR.
The aim is to mirror a real third-party MediaWiki extension, so RedHerb follows
MediaWiki's standard plain-JavaScript lint defaults and code style even where
those differ from ext.neowiki's TypeScript-specific choices (for example, the
profile requires explicit-close Vue component tags, while ext.neowiki allows
self-closing). A NeoWiki choice is carried over only where it is deliberate and
applies: the dependency versions track ext.neowiki rather than MediaWiki core's
older pins, and the max-len / no-descending-specificity relaxations are kept.
The README documents the three rule disables: max-len and no-descending-specificity
mirror ext.neowiki's own config, while compat/compat is off because NeoWiki targets a
modern browser baseline above the browserslist floor the rule checks (it comes from the
wikimedia/mediawiki profile, which ext.neowiki's TypeScript setup does not include).
Every existing RedHerb resource is made lint-clean with mechanical,
behaviour-preserving changes only: var to const/let, function callbacks to
arrow functions, indexOf to includes, redundant 'use strict' and a stale
eslint-disable removed, a shadowed variable renamed, and // @vue/component
markers added to the component exports. The JavaScript snippets in
docs/reference/extending.md are updated to the same modern style so the
documented examples stay consistent with the linted code.
banana-checker runs against RedHerb's own i18n only; NeoWiki's i18n check
remains as it was.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
0 commit comments