diff --git a/src/lint/collect-spelling-diagnostics.ts b/src/lint/collect-spelling-diagnostics.ts index 4f9af34f..f2e6da1d 100644 --- a/src/lint/collect-spelling-diagnostics.ts +++ b/src/lint/collect-spelling-diagnostics.ts @@ -65,6 +65,10 @@ let matchers = [ message: 'clauses should be referenced using tags rather than hardcoding clause numbers', }, + { + pattern: /(?<=[^ \n]) +<\/p>/gu, + message: '

tags should not contain trailing whitespace', + }, ]; export function collectSpellingDiagnostics( diff --git a/test/lint-spelling.js b/test/lint-spelling.js index 90fc2bf1..3dfc9659 100644 --- a/test/lint-spelling.js +++ b/test/lint-spelling.js @@ -211,6 +211,19 @@ windows:${M}\r ); }); + it('

trailing whitespace', async function () { + await assertLint( + positioned` +

This is an example:${M}

+ `, + { + ruleId: 'spelling', + nodeType: 'html', + message: '

tags should not contain trailing whitespace', + } + ); + }); + it('negative', async function () { await assertLintFree(`

@@ -240,6 +253,10 @@ windows:${M}\r

See clause .

+ +

+ Paragraphs with the open/close tags on their own line are OK. +

`); }); });