Strong Marker

ESLint rule to enforce a specific Markdown strong marker in JSDoc descriptions.

Usage

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

rule

ESLint rule to enforce a specific Markdown strong marker in JSDoc descriptions.

Bad:

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

Good:

/**
* Beep **boop**.
*
* @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 that * be used as the Markdown strong marker in JSDoc descriptions.

Examples

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

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

// Generate our source code:
code = [
    '/**',
    '* Beep __boop__.',
    '*',
    '* @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-strong-marker', rule );

// Lint the code:
result = linter.verify( code, {
    'rules': {
        'jsdoc-strong-marker': [ 'error', '*' ]
    }
});
console.log( result );
/* =>
    [
        {
            'ruleId': 'jsdoc-strong-marker',
            'severity': 2,
            'message': 'Strong should use `*` as a marker',
            'line': 2,
            'column': 8,
            'nodeType': null,
            'source': '* Beep __boop__.',
            'endLine': 10,
            'endColumn': 3
        }
    ]
*/