<a name="user-content-check-alignment"></a>
<a name="check-alignment"></a>
# <code>check-alignment</code>

* [Fixer](#user-content-check-alignment-fixer)
* [Options](#user-content-check-alignment-options)
    * [`innerIndent`](#user-content-check-alignment-options-innerindent)
* [Context and settings](#user-content-check-alignment-context-and-settings)
* [Failing examples](#user-content-check-alignment-failing-examples)
* [Passing examples](#user-content-check-alignment-passing-examples)


Reports invalid alignment of JSDoc block asterisks.

<a name="user-content-check-alignment-fixer"></a>
<a name="check-alignment-fixer"></a>
## Fixer

Fixes alignment.

<a name="user-content-check-alignment-options"></a>
<a name="check-alignment-options"></a>
## Options

A single options object has the following properties.

<a name="user-content-check-alignment-options-innerindent"></a>
<a name="check-alignment-options-innerindent"></a>
### <code>innerIndent</code>

Set to 0 if you wish to avoid the normal requirement for an inner indentation of
one space. Defaults to 1 (one space of normal inner indentation).


<a name="user-content-check-alignment-context-and-settings"></a>
<a name="check-alignment-context-and-settings"></a>
## Context and settings

|||
|---|---|
|Context|everywhere|
|Tags|N/A|
|Recommended|true|
|Options|`innerIndent`|

<a name="user-content-check-alignment-failing-examples"></a>
<a name="check-alignment-failing-examples"></a>
## Failing examples

The following patterns are considered problems:

````ts
/**
  * @param {Number} foo
 */
function quux (foo) {
  // with spaces
}
// Message: Expected JSDoc block to be aligned.

/**
  * @param {Number} foo
 */
function quux (foo) {
	// with tabs
}
// Message: Expected JSDoc block to be aligned.

/**
  * @param {Number} foo
 */
function quux (foo) {
  // with spaces
}
// Message: Expected JSDoc block to be aligned.

/**
* @param {Number} foo
*/
function quux (foo) {
  // with spaces
}
// Message: Expected JSDoc block to be aligned.

/**
 * @param {Number} foo
  */
function quux (foo) {

}
// Message: Expected JSDoc block to be aligned.

 /**
 * @param {Number} foo
 */
function quux (foo) {

}
// Message: Expected JSDoc block to be aligned.

 /**
  * @param {Number} foo
 */
function quux (foo) {

}
// Message: Expected JSDoc block to be aligned.

/**
  * @param {Number} foo
  */
 function quux (foo) {

 }
// Message: Expected JSDoc block to be aligned.

/**
   * A JSDoc not attached to any node.
 */
// Message: Expected JSDoc block to be aligned.

class Foo {
  /**
   *  Some method
    * @param a
   */
  quux(a) {}
}
// Message: Expected JSDoc block to be aligned.

export const myVar = {/**
  * This is JSDoc
  */
  myProperty: 'hello'
}
// Message: Expected JSDoc block to be aligned.

/**
 * @param {Number} foo
* @access private
*/
function quux (foo) {
  // with spaces
}
// "jsdoc/check-alignment": ["error"|"warn", {"innerIndent":0}]
// Message: Expected JSDoc block to be aligned.

/**
Some desc.
@param {Number} foo
@access private
 */
function quux (foo) {
  // with spaces
}
// "jsdoc/check-alignment": ["error"|"warn", {"innerIndent":0}]
// Message: Expected JSDoc block to be aligned.
````



<a name="user-content-check-alignment-passing-examples"></a>
<a name="check-alignment-passing-examples"></a>
## Passing examples

The following patterns are not considered problems:

````ts
/**
 * Desc
 *
 * @param {Number} foo
 */
function quux (foo) {

}

/**
 * Desc
 *
 * @param {{
  foo: Bar,
  bar: Baz
 * }} foo
 *
 */
function quux (foo) {

}

/*  <- JSDoc must start with 2 stars.
  *    So this is unchecked.
 */
function quux (foo) {}

/**
  * @param {Number} foo
  * @private
 */
function quux (foo) {
  // with spaces
}
// Settings: {"jsdoc":{"ignorePrivate":true}}

/**
  * @param {Number} foo
  * @access private
 */
function quux (foo) {
  // with spaces
}
// Settings: {"jsdoc":{"ignorePrivate":true}}

/**
* @param {Number} foo
* @access private
*/
function quux (foo) {
  // with spaces
}
// "jsdoc/check-alignment": ["error"|"warn", {"innerIndent":0}]

/**
Some desc.
@param {Number} foo
@access private
*/
function quux (foo) {
  // with spaces
}
// "jsdoc/check-alignment": ["error"|"warn", {"innerIndent":0}]
````