Blockquote Indentation

ESLint rule to enforce Markdown blockquote indentation in JSDoc descriptions.

Usage

var rule = require( '@stdlib/_tools/eslint/rules/jsdoc-blockquote-indentation' );

rule

ESLint rule to enforce Markdown blockquote indentation in JSDoc descriptions.

Bad:

/**
* Beep.
*
* >   This is a blockquote.
*
* @returns {string} a value
*
* @example
* var str = beep();
* // returns 'boop'
*/
function beep() {
    return 'boop';
}

Good:

/**
* Beep.
*
* > This is a blockquote.
*
* @returns {string} a value
*
* @example
* var str = beep();
* // returns 'boop'
*/
function beep() {
    return 'boop';
}

The rule may be configured using the same options as supported by remark. By default, the rule enforces an indentation of 2 characters, which includes the > symbol.

Examples

var Linter = require( 'eslint' ).Linter;
var rule = require( '@stdlib/_tools/eslint/rules/jsdoc-blockquote-indentation' );

var linter = new Linter();
var result;
var code;

// Generate our source code:
code = [
    '/**',
    '* Beep boop.',
    '*',
    '* >    This is an indented blockquote.',
    '*',
    '*',
    '* @param {string} str - input value',
    '* @returns {string} output value',
    '*',
    '* @example',
    '* var out = beep( "boop" );',
    '* // returns "beepboop"',
    '*/',
    'function beep( str ) {',
    '\treturn "beep" + str;',
    '}'
].join( '\n' );

// Register the ESLint rule:
linter.defineRule( 'jsdoc-blockquote-indentation', rule );

// Lint the code:
result = linter.verify( code, {
    'rules': {
        'jsdoc-blockquote-indentation': [ 'error', 2 ]
    }
});
console.log( result );
/* =>
    [
        {
            'ruleId': 'jsdoc-blockquote-indentation',
            'severity': 2,
            'message': 'Remove 3 spaces between blockquote and content',
            'line': 4,
            'column': 5,
            'nodeType': null,
            'source': '* >    This is an indented blockquote.',
            'endLine': 13,
            'endColumn': 3
        }
    ]
*/