Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 32 additions & 0 deletions .eslint-doc-generatorrc.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
const path = require('path');

const HBS_ONLY_NOTE =
'> **HBS Only**: This rule applies to classic `.hbs` template files only (loose mode). It is not relevant for `gjs`/`gts` files (strict mode), where these patterns cannot occur.';

const END_HEADER_MARKER = '<!-- end auto-generated rule header -->';

/** @type {import('eslint-doc-generator').GenerateOptions} */
module.exports = {
configEmoji: [
Expand All @@ -8,4 +15,29 @@ module.exports = {
ruleDocTitleFormat: 'prefix-name',
ruleListSplit: 'meta.docs.category',
urlConfigs: 'https://github.com/ember-cli/eslint-plugin-ember#-configurations',
postprocess(content, filePath) {
// Only process rule doc files
if (!filePath.includes(path.join('docs', 'rules'))) {
return content;
}

const ruleName = path.basename(filePath, '.md');

let rule;
try {
rule = require(path.join(__dirname, 'lib', 'rules', ruleName));
} catch {
return content;
}

// Strip any existing HBS Only note (with surrounding blank lines)
let result = content.replace(/\n> \*\*HBS Only\*\*:[^\n]+\n/, '\n');

// Add HBS Only note for loose-mode rules
if (rule.meta?.docs?.templateMode === 'loose') {
result = result.replace(END_HEADER_MARKER, `${HBS_ONLY_NOTE}\n\n${END_HEADER_MARKER}`);
}

return result;
},
};
Loading