Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 073bf6c

Browse files
chore(website): fix base rule source links for extended rules (typescript-eslint#6294)
* chore(website): fix base rule source links forextended rules * Corrected and moved generated link
1 parent 5e874cf commit 073bf6c

File tree

1 file changed

+37
-33
lines changed

1 file changed

+37
-33
lines changed

packages/website/plugins/generated-rule-docs.ts

Lines changed: 37 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -298,39 +298,7 @@ export const generatedRuleDocs: Plugin = () => {
298298
}
299299
}
300300

301-
// 6. Add a notice about coming from ESLint core for extension rules
302-
if (meta.docs.extendsBaseRule) {
303-
root.children.push({
304-
children: [
305-
{
306-
type: 'jsx',
307-
value: '<sup>',
308-
},
309-
{
310-
type: 'text',
311-
value: 'Taken with ❤️ ',
312-
},
313-
{
314-
type: 'link',
315-
title: null,
316-
url: `https://github.com/eslint/eslint/blob/main/docs/rules/${meta.docs.extendsBaseRule}.md`,
317-
children: [
318-
{
319-
type: 'text',
320-
value: 'from ESLint core',
321-
},
322-
],
323-
},
324-
{
325-
type: 'jsx',
326-
value: '</sup>',
327-
},
328-
],
329-
type: 'paragraph',
330-
} as mdast.Paragraph);
331-
}
332-
333-
// 7. Also add a link to view the rule's source and test code
301+
// 6. Add a link to view the rule's source and test code
334302
root.children.push(
335303
{
336304
children: [
@@ -388,6 +356,42 @@ export const generatedRuleDocs: Plugin = () => {
388356
type: 'list',
389357
} as mdast.List,
390358
);
359+
360+
// 7. Also add a notice about coming from ESLint core for extension rules
361+
if (meta.docs.extendsBaseRule) {
362+
root.children.push({
363+
children: [
364+
{
365+
type: 'jsx',
366+
value: '<sup>',
367+
},
368+
{
369+
type: 'text',
370+
value: 'Taken with ❤️ ',
371+
},
372+
{
373+
type: 'link',
374+
title: null,
375+
url: `https://github.com/eslint/eslint/blob/main/docs/src/rules/${
376+
meta.docs.extendsBaseRule === true
377+
? file.stem
378+
: meta.docs.extendsBaseRule
379+
}.md`,
380+
children: [
381+
{
382+
type: 'text',
383+
value: 'from ESLint core',
384+
},
385+
],
386+
},
387+
{
388+
type: 'jsx',
389+
value: '</sup>',
390+
},
391+
],
392+
type: 'paragraph',
393+
} as mdast.Paragraph);
394+
}
391395
};
392396
};
393397

0 commit comments

Comments
 (0)