Makefile.js
function generateRuleIndexPage(basedir) {
    const outputFile = "../eslint.github.io/_data/rules.yml",
        categoryList = "conf/category-list.json",
        categoriesData = JSON.parse(cat(path.resolve(categoryList)));

    find(path.join(basedir, "/lib/rules/")).filter(fileType("js"))
        .map(filename => [filename, path.basename(filename, ".js")])
        .sort((a, b) => a[1].localeCompare(b[1]))
        .forEach(pair => {
            const filename = pair[0];
            const basename = pair[1];
            const rule = require(filename);

            if (rule.meta.deprecated) {
                categoriesData.deprecated.rules.push({
                    name: basename,
                    replacedBy: rule.meta.replacedBy || []
                });
            } else {
                const output = {
                        name: basename,
                        description: rule.meta.docs.description,
                        recommended: rule.meta.docs.recommended || false,
                        fixable: !!rule.meta.fixable
                    },
                    category = lodash.find(categoriesData.categories, { name: rule.meta.docs.category });

                if (!category.rules) {
                    category.rules = [];
                }

                category.rules.push(output);
            }
        });

    const output = yaml.safeDump(categoriesData, { sortKeys: true });

    output.to(outputFile);
}
function generateRuleIndexPage(basedir) {
    const outputFile = "../eslint.github.io/_data/rules.yml",
        categoryList = "conf/category-list.json",
        categoriesData = JSON.parse(cat(path.resolve(categoryList)));

    find(path.join(basedir, "/lib/rules/")).filter(fileType("js"))
        .map(filename => [filename, path.basename(filename, ".js")])
        .sort((a, b) => a[1].localeCompare(b[1]))
        .forEach(pair => {
            const filename = pair[0];
            const basename = pair[1];
            const rule = require(filename);

            if (rule.meta.deprecated) {
                categoriesData.deprecated.rules.push({
                    name: basename,
                    replacedBy: rule.meta.replacedBy || []
                });
            } else {
                const output = {
                        name: basename,
                        description: rule.meta.docs.description,
                        recommended: rule.meta.docs.recommended || false,
                        fixable: !!rule.meta.fixable
                    },
                    category = lodash.find(categoriesData.categories, { name: rule.meta.docs.category });

                if (!category.rules) {
                    category.rules = [];
                }

                category.rules.push(output);
            }
        });

    const output = yaml.safeDump(categoriesData, { sortKeys: true });

    output.to(outputFile);
}
function generateRuleIndexPage ( basedir ) { const outputFile = "../eslint.github.io/_data/rules.yml" , categoryList = "conf/category-list.json" , categoriesData = JSON . parse ( cat ( path . resolve ( categoryList ) ) ) ; find ( path . join ( basedir , "/lib/rules/" ) ) . filter ( fileType ( "js" ) ) . map ( filename => [ filename , path . basename ( filename , ".js" ) ] ) . sort ( ( a , b ) => a [ 1 ] . localeCompare ( b [ 1 ] ) ) . forEach ( pair => { const filename = pair [ 0 ] ; const basename = pair [ 1 ] ; const rule = require ( filename ) ; if ( rule . meta . deprecated ) { categoriesData . deprecated . rules . push ( { name : basename , replacedBy : rule . meta . replacedBy || [ ] } ) ; } else { const output = { name : basename , description : rule . meta . docs . description , recommended : rule . meta . docs . recommended || false , fixable : ! ! rule . meta . fixable } , category = lodash . find ( categoriesData . categories , { name : rule . meta . docs . category } ) ; if ( ! category . rules ) { category . rules = [ ] ; } category . rules . push ( output ) ; } } ) ; const output = yaml . safeDump ( categoriesData , { sortKeys : true } ) ; output . to ( outputFile ) ; }
Generate a doc page that lists all of the rules and links to them
@param {string} basedir The directory in which to look for code.
@returns {void}
Generate a doc page that lists all of the rules and links to them