Skip to content
This repository has been archived by the owner on Mar 25, 2021. It is now read-only.

New completed-docs "tags" property doesn't work with single-line doc comments #3365

Closed
buu700 opened this issue Oct 20, 2017 · 6 comments · Fixed by #3557
Closed

New completed-docs "tags" property doesn't work with single-line doc comments #3365

buu700 opened this issue Oct 20, 2017 · 6 comments · Fixed by #3557

Comments

@buu700
Copy link
Contributor

buu700 commented Oct 20, 2017

Bug Report

  • TSLint version: 5.8.0
  • TypeScript version: 2.5.3
  • Running TSLint via: CLI

TypeScript code being linted

...
/** @see Class */
export const balls: string = 'balls';
...
    /** @inheritDoc */
    public async doSomething () : Promise<string> {
        return balls;
    }
...

with tslint.json configuration:

...
"completed-docs": [true, {
	"classes": {"visibilities": ["exported"]},
	"enums": {"visibilities": ["exported"]},
	"functions": {"visibilities": ["exported"]},
	"interfaces": {"visibilities": ["exported"]},
	"methods": {"privacies": ["protected", "public"]},
	"namespaces": {"visibilities": ["exported"]},
	"properties": {"privacies": ["protected", "public"]},
	"types": {"visibilities": ["exported"]},
	"variables": {"visibilities": ["exported"]},
	"tags": {
		"content": {"see": [".*"]},
		"exists": ["inheritDoc"]
	}
}],
...

(Also tested with tags copied and pasted as a nested property of all of its sibling properties.)

Actual behavior

...
ERROR: /path/to/file.ts[12, 14]: Documentation must exist for exported variables.
ERROR: /path/to/file.ts[43, 2]: Documentation must exist for public,async methods.
...

Expected behavior

No errors.

@ajafff
Copy link
Contributor

ajafff commented Oct 20, 2017

Can you try without the curly braces:

"content": {"see": ".*"},

Looks like an issue with the docs and examples

(Also tested with tags copied and pasted as a nested property of all of its sibling properties.)

That seems to be the way it works. At least that's how it's done in the tests.

@buu700
Copy link
Contributor Author

buu700 commented Oct 20, 2017

Thanks for the quick reply! Just tested with the two configurations below and reproduced the same result:

...
"completed-docs": [true, {
	"classes": {"visibilities": ["exported"]},
	"enums": {"visibilities": ["exported"]},
	"functions": {"visibilities": ["exported"]},
	"interfaces": {"visibilities": ["exported"]},
	"methods": {"privacies": ["protected", "public"]},
	"namespaces": {"visibilities": ["exported"]},
	"properties": {"privacies": ["protected", "public"]},
	"types": {"visibilities": ["exported"]},
	"variables": {"visibilities": ["exported"]},
	"tags": {"content": {"see": ".*"}, "exists": ["inheritDoc"]}
}],
...
...
"completed-docs": [true, {
	"classes": {"visibilities": ["exported"], "tags": {"content": {"see": ".*"}, "exists": ["inheritDoc"]}},
	"enums": {"visibilities": ["exported"], "tags": {"content": {"see": ".*"}, "exists": ["inheritDoc"]}},
	"functions": {"visibilities": ["exported"], "tags": {"content": {"see": ".*"}, "exists": ["inheritDoc"]}},
	"interfaces": {"visibilities": ["exported"], "tags": {"content": {"see": ".*"}, "exists": ["inheritDoc"]}},
	"methods": {"privacies": ["protected", "public"], "tags": {"content": {"see": ".*"}, "exists": ["inheritDoc"]}},
	"namespaces": {"visibilities": ["exported"], "tags": {"content": {"see": ".*"}, "exists": ["inheritDoc"]}},
	"properties": {"privacies": ["protected", "public"], "tags": {"content": {"see": ".*"}, "exists": ["inheritDoc"]}},
	"types": {"visibilities": ["exported"], "tags": {"content": {"see": ".*"}, "exists": ["inheritDoc"]}},
	"variables": {"visibilities": ["exported"], "tags": {"content": {"see": ".*"}, "exists": ["inheritDoc"]}}
}],
...

@ajafff
Copy link
Contributor

ajafff commented Oct 20, 2017

Testing the rule revealed that the new tags logic doesn't handle singleline JSDoc.
If you make it multiline, everything should work as expected.

@buu700
Copy link
Contributor Author

buu700 commented Oct 20, 2017

Interesting, thanks! I'll wait for that to be resolved then before re-enabling this rule.

@buu700 buu700 changed the title New completed-docs "tags" property doesn't work New completed-docs "tags" property doesn't work with single-line doc comments Oct 20, 2017
@lemtzas
Copy link

lemtzas commented Jan 16, 2018

/** {@inheritdoc} */ appears to pass the rule, but I'm not sure it's properly valid.

@JoshuaKGoldberg
Copy link
Contributor

This was fixed by #3841 while waiting for #3557. 🎉

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants