<commit_before># Table Indentation

> [ESLint rule][eslint-rules] to prevent unnecessary indentation before tables in JSDoc descriptions.

<section class="intro">

</section>

<!-- /.intro -->

<section class="usage">

## Usage

```javascript
var rule = require( '@stdlib/_tools/eslint/rules/jsdoc-no-table-indentation' );
```

#### rule

[ESLint rule][eslint-rules] to prevent unnecessary indentation before tables in JSDoc descriptions.

**Bad**:

<!-- eslint-disable stdlib/jsdoc-no-table-indentation, stdlib/jsdoc-markdown-remark -->

```javascript
/**
* Boop beep.
*
*   | x   | y    |
*   | any | boop |
*
* @returns {string} a value
*
* @example
* var str = beep();
* // returns 'boop'
*/
function beep() {
    return 'boop';
}
```

**Good**:

```javascript
/**
* Boop beep.
*
* | x   | y    |
* | any | boop |
*
* @returns {string} a value
*
* @example
* var str = beep();
* // returns 'boop'
*/
function beep() {
    return 'boop';
}
```

</section>

<!-- /.usage -->

<section class="examples">

## Examples

<!-- eslint no-undef: "error" -->

```javascript
var Linter = require( 'eslint' ).Linter;
var rule = require( '@stdlib/_tools/eslint/rules/jsdoc-no-table-indentation' );

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

// Generate our source code:
code = [
    '/**',
    '* Squares a number.',
    '*',
    '* Input | Output',
    '* ----- | ------',
    '* 2     | 4',
    '*',
    '* @param {number} x - input value',
    '* @returns {number} output value',
    '*',
    '* @example',
    '* var out = square( 2 );',
    '* // returns 4',
    '*/',
    'function square( x ) {',
    '\treturn x*x;',
    '}'
].join( '\n' );

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

// Lint the code:
result = linter.verify( code, {
    'rules': {
        'jsdoc-no-table-indentation': 'error'
    }
});
console.log( result );
/* =>
    [
        {
            'ruleId': 'jsdoc-no-table-indentation',
            'severity': 2,
            'message': 'Do not indent table rows',
            'line': 4,<commit_msg>Fix example code<commit_after># Table Indentation

> [ESLint rule][eslint-rules] to prevent unnecessary indentation before tables in JSDoc descriptions.

<section class="intro">

</section>

<!-- /.intro -->

<section class="usage">

## Usage

```javascript
var rule = require( '@stdlib/_tools/eslint/rules/jsdoc-no-table-indentation' );
```

#### rule

[ESLint rule][eslint-rules] to prevent unnecessary indentation before tables in JSDoc descriptions.

**Bad**:

<!-- eslint-disable stdlib/jsdoc-no-table-indentation, stdlib/jsdoc-markdown-remark -->

```javascript
/**
* Boop beep.
*
*   | x   | y    |
*   | any | boop |
*
* @returns {string} a value
*
* @example
* var str = beep();
* // returns 'boop'
*/
function beep() {
    return 'boop';
}
```

**Good**:

```javascript
/**
* Boop beep.
*
* | x   | y    |
* | any | boop |
*
* @returns {string} a value
*
* @example
* var str = beep();
* // returns 'boop'
*/
function beep() {
    return 'boop';
}
```

</section>

<!-- /.usage -->

<section class="examples">

## Examples

<!-- eslint no-undef: "error" -->

```javascript
var Linter = require( 'eslint' ).Linter;
var rule = require( '@stdlib/_tools/eslint/rules/jsdoc-no-table-indentation' );

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

// Generate our source code:
code = [
    '/**',
    '* Squares a number.',
    '*',
    '*    | Input | Output |',
    '*    | ----- | ------ |',
    '*    | 2     | 4      |',
    '*',
    '* @param {number} x - input value',
    '* @returns {number} output value',
    '*',
    '* @example',
    '* var out = square( 2 );',
    '* // returns 4',
    '*/',
    'function square( x ) {',
    '\treturn x*x;',
    '}'
].join( '\n' );

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

// Lint the code:
result = linter.verify( code, {
    'rules': {
        'jsdoc-no-table-indentation': 'error'
    }
});
console.log( result );
/* =>
    [
        {
            'ruleId': 'jsdoc-no-table-indentation',
            'severity': 2,
            'message': 'Do not indent table rows',
            'line': 4,
{'fraction_non_alphanumeric': 0.20860370103340542, 'fraction_numerical': 0.002883922134102379, 'mean_word_length': 2.542127659574468, 'pattern_counts': {'":': 0, '<': 21, '<?xml version=': 0, '>': 25, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '537169', 'n_tokens_mistral': 1535, 'n_tokens_neox': 1488, 'n_words': 353}