Skip to content

Commit

Permalink
fix(check-tag-names): add record and undocumented tags in Closure…
Browse files Browse the repository at this point in the history
… source to Closure tags; fixes #306

Also removes mistaken use of anchor in documentation URL (minor), indicates Closure synonyms; and gives URL for source of undocumented `modifies`
  • Loading branch information
brettz9 committed Oct 29, 2019
1 parent 42e8de2 commit 42476b2
Show file tree
Hide file tree
Showing 3 changed files with 66 additions and 6 deletions.
25 changes: 22 additions & 3 deletions .README/rules/check-tag-names.md
Expand Up @@ -47,7 +47,6 @@ memberof
memberof!
mixes
mixin
modifies (Currently undocumented but in source)
module
name
namespace
Expand Down Expand Up @@ -76,6 +75,8 @@ version
yields
```

`modifies` is also supported (see [source](https://github.com/jsdoc/jsdoc/blob/master/packages/jsdoc/lib/jsdoc/tag/dictionary/definitions.js#L594)) but is undocumented.

The following synonyms are also recognized:

```
Expand Down Expand Up @@ -108,12 +109,12 @@ one may also use the following:
template
```

And for [Closure](https://github.com/google/closure-compiler/wiki/Annotating-JavaScript-for-the-Closure-Compiler#nosideeffects-modifies-thisarguments),
And for [Closure](https://github.com/google/closure-compiler/wiki/Annotating-JavaScript-for-the-Closure-Compiler),
when `settings.jsdoc.mode` is set to `closure`, one may use the following (in
addition to the jsdoc and TypeScript tags):

```
define
define (synonym of `const` per jsdoc source)
dict
export
externs
Expand All @@ -128,11 +129,29 @@ nosideeffects
polymer
polymerBehavior
preserve
record (synonym of `interface` per jsdoc source)
struct
suppress
unrestricted
```

...and these undocumented tags which are only in [source](https://github.com/google/closure-compiler/blob/master/src/com/google/javascript/jscomp/parsing/Annotation.java):

```
closurePrimitive
customElement
expose
hidden
idGenerator
meaning
mixinClass
mixinFunction
ngInject
owner
typeSummary
wizaction
```

Note that the tags indicated as replacements in `settings.jsdoc.tagNamePreference` will automatically be considered as valid.

#### Options
Expand Down
25 changes: 22 additions & 3 deletions README.md
Expand Up @@ -1451,7 +1451,6 @@ memberof
memberof!
mixes
mixin
modifies (Currently undocumented but in source)
module
name
namespace
Expand Down Expand Up @@ -1480,6 +1479,8 @@ version
yields
```

`modifies` is also supported (see [source](https://github.com/jsdoc/jsdoc/blob/master/packages/jsdoc/lib/jsdoc/tag/dictionary/definitions.js#L594)) but is undocumented.

The following synonyms are also recognized:

```
Expand Down Expand Up @@ -1512,12 +1513,12 @@ one may also use the following:
template
```

And for [Closure](https://github.com/google/closure-compiler/wiki/Annotating-JavaScript-for-the-Closure-Compiler#nosideeffects-modifies-thisarguments),
And for [Closure](https://github.com/google/closure-compiler/wiki/Annotating-JavaScript-for-the-Closure-Compiler),
when `settings.jsdoc.mode` is set to `closure`, one may use the following (in
addition to the jsdoc and TypeScript tags):

```
define
define (synonym of `const` per jsdoc source)
dict
export
externs
Expand All @@ -1532,11 +1533,29 @@ nosideeffects
polymer
polymerBehavior
preserve
record (synonym of `interface` per jsdoc source)
struct
suppress
unrestricted
```

...and these undocumented tags which are only in [source](https://github.com/google/closure-compiler/blob/master/src/com/google/javascript/jscomp/parsing/Annotation.java):

```
closurePrimitive
customElement
expose
hidden
idGenerator
meaning
mixinClass
mixinFunction
ngInject
owner
typeSummary
wizaction
```

Note that the tags indicated as replacements in `settings.jsdoc.tagNamePreference` will automatically be considered as valid.

<a name="eslint-plugin-jsdoc-rules-check-tag-names-options-2"></a>
Expand Down
22 changes: 22 additions & 0 deletions src/tagNames.js
Expand Up @@ -122,8 +122,26 @@ const typeScriptTags = {
template: [],
};

const undocumentedClosureTags = {
// These are in Closure source but not in jsdoc source nor in the Closure
// docs: https://github.com/google/closure-compiler/blob/master/src/com/google/javascript/jscomp/parsing/Annotation.java
closurePrimitive: [],
customElement: [],
expose: [],
hidden: [],
idGenerator: [],
meaning: [],
mixinClass: [],
mixinFunction: [],
ngInject: [],
owner: [],
typeSummary: [],
wizaction: [],
};

const closureTags = {
...typeScriptTags,
...undocumentedClosureTags,

// From https://github.com/google/closure-compiler/wiki/Annotating-JavaScript-for-the-Closure-Compiler
// These are all recognized in https://github.com/jsdoc/jsdoc/blob/master/packages/jsdoc/lib/jsdoc/tag/dictionary/definitions.js
Expand Down Expand Up @@ -151,6 +169,10 @@ const closureTags = {
polymer: [],
polymerBehavior: [],
preserve: [],

// Defined as a synonym of `interface` in jsdoc `definitions.js`
record: [],

struct: [],
suppress: [],

Expand Down

0 comments on commit 42476b2

Please sign in to comment.