Skip to content

Commit 9922684

Browse files
committed
Merge branch 'master' of github.com:gajus/eslint-plugin-jsdoc
2 parents 25cbc06 + a075dec commit 9922684

40 files changed

+2122
-38
lines changed

.README/README.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,11 @@ This table maps the rules between `eslint-plugin-jsdoc` and `jscs-jsdoc`.
1515

1616
| `eslint-plugin-jsdoc` | `jscs-jsdoc` |
1717
| --- | --- |
18+
| [`check-alignment`](https://github.com/gajus/eslint-plugin-jsdoc#eslint-plugin-jsdoc-rules-check-alignment) | N/A |
1819
| [`check-examples`](https://github.com/gajus/eslint-plugin-jsdoc#eslint-plugin-jsdoc-rules-check-examples) | N/A |
20+
| [`check-indentation`](https://github.com/gajus/eslint-plugin-jsdoc#eslint-plugin-jsdoc-rules-check-indentation) | N/A |
1921
| [`check-param-names`](https://github.com/gajus/eslint-plugin-jsdoc#eslint-plugin-jsdoc-rules-check-param-names) | [`checkParamNames`](https://github.com/jscs-dev/jscs-jsdoc#checkparamnames) |
22+
| [`check-syntax`](https://github.com/gajus/eslint-plugin-jsdoc#eslint-plugin-jsdoc-rules-check-syntax) | N/A |
2023
| [`check-tag-names`](https://github.com/gajus/eslint-plugin-jsdoc#eslint-plugin-jsdoc-rules-check-tag-names) | N/A ~ [`checkAnnotations`](https://github.com/jscs-dev/jscs-jsdoc#checkannotations) |
2124
| [`check-types`](https://github.com/gajus/eslint-plugin-jsdoc#eslint-plugin-jsdoc-rules-check-types) | [`checkTypes`](https://github.com/jscs-dev/jscs-jsdoc#checktypes) |
2225
| [`newline-after-description`](https://github.com/gajus/eslint-plugin-jsdoc#eslint-plugin-jsdoc-rules-newline-after-description) | [`requireNewlineAfterDescription`](https://github.com/jscs-dev/jscs-jsdoc#requirenewlineafterdescription) and [`disallowNewlineAfterDescription`](https://github.com/jscs-dev/jscs-jsdoc#disallownewlineafterdescription) |
@@ -72,8 +75,11 @@ Finally, enable all of the rules that you would like to use.
7275
```json
7376
{
7477
"rules": {
78+
"jsdoc/check-alignment": 1,
7579
"jsdoc/check-examples": 1,
80+
"jsdoc/check-indentation": 1,
7681
"jsdoc/check-param-names": 1,
82+
"jsdoc/check-syntax": 1,
7783
"jsdoc/check-tag-names": 1,
7884
"jsdoc/check-types": 1,
7985
"jsdoc/newline-after-description": 1,
@@ -246,8 +252,11 @@ Finally, the following rule pertains to inline disable directives:
246252

247253
## Rules
248254

255+
{"gitdown": "include", "file": "./rules/check-alignment.md"}
249256
{"gitdown": "include", "file": "./rules/check-examples.md"}
257+
{"gitdown": "include", "file": "./rules/check-indentation.md"}
250258
{"gitdown": "include", "file": "./rules/check-param-names.md"}
259+
{"gitdown": "include", "file": "./rules/check-syntax.md"}
251260
{"gitdown": "include", "file": "./rules/check-tag-names.md"}
252261
{"gitdown": "include", "file": "./rules/check-types.md"}
253262
{"gitdown": "include", "file": "./rules/newline-after-description.md"}

.README/rules/check-alignment.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
### `check-alignment`
2+
3+
Reports invalid alignment of JSDoc block asterisks.
4+
5+
|||
6+
|---|---|
7+
|Context|`ArrowFunctionExpression`, `FunctionDeclaration`, `FunctionExpression`|
8+
|Tags|N/A|
9+
10+
<!-- assertions checkAlignment -->

.README/rules/check-indentation.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
### `check-indentation`
2+
3+
Reports invalid padding inside JSDoc block.
4+
5+
|||
6+
|---|---|
7+
|Context|`ArrowFunctionExpression`, `FunctionDeclaration`, `FunctionExpression`|
8+
|Tags|N/A|
9+
10+
<!-- assertions checkIndentation -->

.README/rules/check-syntax.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
### `check-syntax`
2+
3+
Reports against Google Closure Compiler syntax.
4+
5+
|||
6+
|---|---|
7+
|Context|`ArrowFunctionExpression`, `FunctionDeclaration`, `FunctionExpression`|
8+
|Tags|N/A|
9+
10+
<!-- assertions checkSyntax -->

.README/rules/check-tag-names.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ Valid [JSDoc 3 Block Tags](http://usejsdoc.org/#block-tags) are:
88
abstract
99
access
1010
alias
11+
async
1112
augments
1213
author
1314
borrows
@@ -28,7 +29,9 @@ external
2829
file
2930
fires
3031
function
32+
generator
3133
global
34+
hideconstructor
3235
ignore
3336
implements
3437
inheritdoc
@@ -41,12 +44,14 @@ license
4144
listens
4245
member
4346
memberof
47+
memberof!
4448
mixes
4549
mixin
4650
module
4751
name
4852
namespace
4953
override
54+
package
5055
param
5156
private
5257
property
@@ -67,6 +72,7 @@ type
6772
typedef
6873
variation
6974
version
75+
yields
7076
```
7177

7278
|||

.README/rules/check-types.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ Reports invalid types.
55
Ensures that case of native types is the same as in this list:
66

77
```
8+
undefined
9+
null
810
boolean
911
number
1012
string
@@ -16,9 +18,9 @@ RegExp
1618

1719
#### Why not capital case everything?
1820

19-
Why are `boolean`, `number` and `string` exempt from starting with a capital letter? Let's take `string` as an example. In Javascript, everything is an object. The string Object has prototypes for string functions such as `.toUpperCase()`.
21+
Why are `boolean`, `number` and `string` exempt from starting with a capital letter? Let's take `string` as an example. In Javascript, everything is an object. The string Object has prototypes for string functions such as `.toUpperCase()`.
2022

21-
Fortunately we don't have to write `new String()` everywhere in our code. Javascript will automatically wrap string primitives into string Objects when we're applying a string function to a string primitive. This way the memory footprint is a tiny little bit smaller, and the [GC](https://en.wikipedia.org/wiki/Garbage_collection_(computer_science)) has less work to do.
23+
Fortunately we don't have to write `new String()` everywhere in our code. Javascript will automatically wrap string primitives into string Objects when we're applying a string function to a string primitive. This way the memory footprint is a tiny little bit smaller, and the [GC](https://en.wikipedia.org/wiki/Garbage_collection_(computer_science)) has less work to do.
2224

2325
So in a sense, there two types of strings in Javascript; `{string}` literals, also called primitives and `{String}` Objects. We use the primitives because it's easier to write and uses less memory. `{String}` and `{string}` are technically both valid, but they are not the same.
2426

.README/rules/require-hyphen-before-param-description.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
Requires a hyphen before the `@param` description.
44

5+
This rule takes one argument. If it is `"always"` then a problem is raised when there is no hyphen before the description. If it is `"never"` then a problem is raised when there is a hyphen before the description. The default value is `"always"`.
6+
57
|||
68
|---|---|
79
|Context|`ArrowFunctionExpression`, `FunctionDeclaration`, `FunctionExpression`|

.README/rules/valid-types.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,18 @@
22

33
Requires all types to be valid JSDoc or Closure compiler types without syntax errors.
44

5+
Also impacts behaviors on namepath-pointing or event-pointing tags:
6+
7+
1. `@alias`, `@augments`, `@extends`, `@lends`, `@memberof`, `@memberof!`, `@mixes`, `@name`, `@this`
8+
1. `@callback`, `@event`, `@listens`, `@fires`, `@emits`
9+
1. `@borrows`
10+
11+
The following apply to the above sets:
12+
13+
- Expect tags in set 1 or 2 to have a valid namepath if present
14+
- Prevent set 2 from being empty by setting `allowEmptyNamepaths` to `false` as these tags might have some indicative value without a path (but set 1 will always fail if empty)
15+
- For the special case of set 3, i.e., `@borrows <that namepath> as <this namepath>`, check that both namepaths are present and valid and ensure there is an `as ` between them.
16+
517
|||
618
|---|---|
719
|Context|`ArrowFunctionExpression`, `FunctionDeclaration`, `FunctionExpression`|

0 commit comments

Comments
 (0)