Files
luci/.github/workflows/eslint.yml
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

2.0 KiB