Skip to content

Commit

Permalink
Add options to check lines alignment rule
Browse files Browse the repository at this point in the history
"Always" will check for the alignemnt.
"Never" is not yet implemented, but will check if there is no more
than one space between the parts.
  • Loading branch information
renatho authored and Brett Zamir committed Jan 11, 2021
1 parent 2193d7e commit d76fe3c
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions .README/rules/check-lines-alignment.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,17 @@
Reports invalid alignment of JSDoc block lines. This is a
[standard recommended to WordPress code](https://make.wordpress.org/core/handbook/best-practices/inline-documentation-standards/javascript/#aligning-comments), for example.

#### Options

This rule allows one optional string argument. If it is `"always"` then a
problem is raised when the lines are not aligned. If it is `"never"` then
a problem should be raised when there is more than one space between the
lines parts. Only the non-default `"always"` is implemented for now.

|||
|---|---|
|Context|everywhere|
|Options|(a string matching `"always"|"never"`)|
|Tags|`param`, `arg`, `argument`, `property`, `prop`|

The following patterns are considered problems:
Expand All @@ -18,6 +26,7 @@ The following patterns are considered problems:
* @param {int} sit Description multi words.
*/
const fn = ( lorem, sit ) => {}
// Options: ["always"]
// Message: Expected JSDoc block lines to be aligned.

/**
Expand All @@ -28,6 +37,7 @@ const fn = ( lorem, sit ) => {}
* @property {string} lorem Description.
* @property {int} sit Description multi words.
*/
// Options: ["always"]
// Message: Expected JSDoc block lines to be aligned.

The following patterns are not considered problems:
Expand All @@ -40,6 +50,7 @@ The following patterns are not considered problems:
* @param {int} sit Description multi words.
*/
const fn = ( lorem, sit ) => {}
// Options: ["always"]

/**
* My object.
Expand All @@ -49,4 +60,5 @@ const fn = ( lorem, sit ) => {}
* @property {string} lorem Description.
* @property {int} sit Description multi words.
*/
// Options: ["always"]
````

0 comments on commit d76fe3c

Please sign in to comment.