Skip to content

Commit 1ba3544

Browse files
committed
chore(lint): report error on invalid change versions, except when REPLACEME
1 parent 8c86289 commit 1ba3544

File tree

3 files changed

+13
-5
lines changed

3 files changed

+13
-5
lines changed

src/linter/rules/invalid-change-version.mjs

+2-2
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,11 @@ export const invalidChangeVersion = entry => {
1919
);
2020

2121
const invalidVersions = allVersions.filter(
22-
version => valid(version) === null
22+
version => version !== 'REPLACEME' && valid(version) === null
2323
);
2424

2525
return invalidVersions.map(version => ({
26-
level: 'warn',
26+
level: 'error',
2727
message: LINT_MESSAGES.invalidChangeVersion.replace('{{version}}', version),
2828
location: {
2929
path: entry.api_doc_source,

src/linter/tests/fixtures/entries.mjs

+5
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,11 @@ export const assertEntry = {
3939
'pr-url': 'https://github.com/nodejs/node/pull/34001',
4040
description: "Exposed as `require('node:assert/strict')`.",
4141
},
42+
{
43+
version: 'REPLACEME',
44+
'pr-url': 'https://github.com/nodejs/node/pull/12345',
45+
description: 'This is a test entry.',
46+
},
4247
],
4348
heading: {
4449
type: 'heading',

src/linter/tests/rules/invalid-change-version.test.mjs

+6-3
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,15 @@ describe('invalidChangeVersion', () => {
1313
it('should return an issue if a change version is invalid', () => {
1414
const issues = invalidChangeVersion({
1515
...assertEntry,
16-
changes: [...assertEntry.changes, { version: ['v13.9.0', 'REPLACEME'] }],
16+
changes: [
17+
...assertEntry.changes,
18+
{ version: ['v13.9.0', 'INVALID_VERSION'] },
19+
],
1720
});
1821

1922
deepEqual(issues, [
2023
{
21-
level: 'warn',
24+
level: 'error',
2225
location: {
2326
path: 'doc/api/assert.md',
2427
position: {
@@ -34,7 +37,7 @@ describe('invalidChangeVersion', () => {
3437
},
3538
},
3639
},
37-
message: 'Invalid version number: REPLACEME',
40+
message: 'Invalid version number: INVALID_VERSION',
3841
},
3942
]);
4043
});

0 commit comments

Comments
 (0)