Code style for services
-
ESLint 10 is bundled; Node.js
^20.19.0 || ^22.13.0 || >=24. -
TypeScript 6 (
peerDependencies.typescript: ^6.0) installed in the project, as typed linting uses it. typescript-eslint does not support TypeScript 7, which has no compiler API; to type-check with TypeScript 7, keep TypeScript 6 under thetypescriptname:{ "devDependencies": { "@typescript/native": "npm:typescript@^7.0.2", "typescript": "npm:@typescript/typescript6@^6.0.2" } }
Markdown tables in docs/**/*.md are printed compact (| a | b |) instead of padded to the column width, because padding wide tables in
long documents more than doubles their size. Set the markdownTables option to aligned or compact in a project's prettier overrides to
change it.
Lints CHANGELOG.md files to enforce the Keep a Changelog format. It is enabled for
**/CHANGELOG.md files using the custom sos/changelog language and is auto-fixable where possible (it intentionally does not fix anything
where meaning is ambiguous).
It checks:
- Preamble – the file must start with the standard Keep a Changelog / Semantic Versioning header (auto-fixed).
- Versions – each released version heading must be
[<semver>] - <date>, with a valid semver version and a valid date (orunknown). The[Unreleased]heading is recognized as a special version. - Sections – section headings must be one of
Added,Fixed,Changed,Removed,Deprecated,Security. Headings can't be indented. - Entries – entries in released versions must start with
-(auto-fixed for wrong prefixes where possible); entries under[Unreleased]must start with+instead. Optional tab indentation is allowed for nesting. Top-level entries must also start with one of the configured entry prefixes, e.g.(public)/(internal). - Whitespace – flags irregular (double) whitespace, and requires a trailing empty line after the last entry in a section (auto-fixed).
allowedSections(string[]) – override the list of permitted section names. Defaults to['Added', 'Fixed', 'Changed', 'Removed', 'Deprecated', 'Security'].entryPrefixes(string[]) – override the list of allowed entry prefixes. Defaults to['(public)', '(internal)']. Pass[]to disable the check.
{
files: ['**/CHANGELOG.md'],
language: 'sos/changelog',
plugins: {
sos: eslintPluginSos,
},
rules: {
'prettier/prettier': 'off',
'sos/changelog': ['error', { allowedSections: ['Added', 'Fixed', 'Changed'] }],
},
}Lints changelog/<feature>.md fragment files — the per-branch files a fragment workflow writes entries to instead of editing CHANGELOG.md
directly, later spliced into a version by @signageos/changelog's appendSections.
It is enabled for **/changelog/*.md files using the custom sos/changelog-fragment language and checks the same rules as sos/changelog,
minus the ones that only apply to a whole CHANGELOG.md (preamble, version headings, version order):
- Sections – section headings must be one of
Added,Fixed,Changed,Removed,Deprecated,Security. Headings can't be indented. - Entries – entries must start with
-(auto-fixed for wrong prefixes where possible) and one of the configured entry prefixes, e.g.(public)/(internal). Optional tab indentation is allowed for nesting. - Whitespace – flags irregular (double) whitespace, and requires a trailing empty line after the last entry in a section (auto-fixed).
allowedSections(string[]) – override the list of permitted section names. Defaults to['Added', 'Fixed', 'Changed', 'Removed', 'Deprecated', 'Security'].entryPrefixes(string[]) – override the list of allowed entry prefixes. Defaults to['(public)', '(internal)']. Pass[]to disable the check.
{
files: ['**/changelog/*.md'],
language: 'sos/changelog-fragment',
plugins: {
sos: eslintPluginSos,
},
rules: {
'prettier/prettier': 'off',
'sos/changelog-fragment': 'error',
},
}