Commit Graph

6 Commits

Author SHA1 Message Date
Paul Donald
4900913d2a github: add linting for JS and MD
bump checkout to 6

Included is a selection of rules which flag common problems.

Lint
-JS ( ESlint )
-JSON ( https://github.com/eslint/json )
-JSDoc (comment matter) in the luci-base module
-Markdown ( https://github.com/eslint/markdown )

For JSON, mandate standard JSON (not JSONC or JSON5) format,
**/*.json checks across the whole repo.

For JS, mandate sourceType: 'script', otherwise the linter
errors out about return methods in modules which masks other
problems. There are a number of structural design changes
needed to bring this repo into compliance with standards.
Each JS file is an individual script, despite their module
like structure, so functions and classes offloaded to
'common' files (individual scripts and not modules) are
invisible to linters unless we define them under the 'globals'
key. Custom rules and parsers are also possible.

For JSDoc, mandate some common checks to ensure the repo
will generate consistent documentation which links and displays
well.

For MD, check also JS syntax inside MD, as well as MD itself.
JS checks inside MD are not strict.

Included also eslint-formatter-gha (-f gha) which comments
on PRs when problems are detected in code additions. Actions
show green when no errors are reported (warnings are a pass)
but the gha will comment about warnings.

Flag `--diff-filter=ACM` shows only additions, and not
deletions.

Signed-off-by: Paul Donald <newtwen+github@gmail.com>
2026-02-16 01:42:55 +01:00
Paul Donald
44fd0155ff docs: refresh for JS and drop Lua references
- style with clean-jsdoc-theme (supports dark mode)
- add tutorials (jaguar has a problem with this structure)
- move doc gen stubs to doc_gen folder

This change moves the generated JS API docs from /luci/jsapi
to /luci via README.md which forms the index, and shall
point to a generated html file which exists. It currently
points to LuCI.html, which depends on JSDoc naming
conventions. So it's possible the link can break if modules
change names. But the TOC is always valid.

Signed-off-by: Paul Donald <newtwen+github@gmail.com>
2026-02-16 01:06:46 +01:00
Paul Spooren
56ef04849d CI: automatically update jsapi docs
Use a GitHub Action to keep the docs updated, the current onces are 14
month old and outdated.

Use latest jsdoc package

Add full URL to LuCI.html file in README.md

Ignore generated HTML files via .gitignore

Signed-off-by: Paul Spooren <mail@aparcar.org>
2021-10-08 17:16:04 -10:00
Jo-Philipp Wich
489fc4b263 docs: various updates
- jsapi: include source links
 - README.md: link to github pages
 - docs/README.md: add stub index page

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2019-11-07 12:39:24 +01:00
Jo-Philipp Wich
355a48866d documentation: change JS docs template
Use another template for the JS api documentation which provides a better
overview over the classes and methods.

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2019-11-05 10:18:51 +01:00
Jo-Philipp Wich
3942789dc6 documentation: add JS api docs
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
(cherry picked from commit d9452d1157aef6b8752fac0f4ed1e0b9221abb31)
2019-11-05 09:37:52 +01:00