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

Make the "completed-docs" rule respect "public" privacies option #2749

Merged
merged 1 commit into from
May 12, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/rules/completedDocsRule.ts
Expand Up @@ -328,7 +328,7 @@ class ClassRequirement extends Requirement<IClassRequirementDescriptor> {
return this.privacies.has(PRIVACY_PROTECTED);
}

return Lint.hasModifier(node.modifiers, ts.SyntaxKind.PublicKeyword);
return this.privacies.has(PRIVACY_PUBLIC);
}
}

Expand Down
30 changes: 30 additions & 0 deletions test/rules/completed-docs/privacies-private/test.ts.lint
@@ -0,0 +1,30 @@
class Class {
badDefaultMethod() { }

/**
* ...
*/
goodDefaultMethod() { }

public badPublicMethod() { }

/**
* ...
*/
public goodPublicMethod() { }

protected badProtectedMethod() { }

/**
* ...
*/
protected goodProtectedMethod() { }

private badPrivateMethod() { }
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ [Documentation must exist for private methods.]

/**
* ...
*/
private goodPrivateMethod() { }
}
12 changes: 12 additions & 0 deletions test/rules/completed-docs/privacies-private/tslint.json
@@ -0,0 +1,12 @@
{
"linterOptions": {
"typeCheck": true
},
"rules": {
"completed-docs": [true, {
"methods": {
"privacies": ["private"]
}
}]
}
}
30 changes: 30 additions & 0 deletions test/rules/completed-docs/privacies-protected/test.ts.lint
@@ -0,0 +1,30 @@
class Class {
badDefaultMethod() { }

/**
* ...
*/
goodDefaultMethod() { }

public badPublicMethod() { }

/**
* ...
*/
public goodPublicMethod() { }

protected badProtectedMethod() { }
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ [Documentation must exist for protected methods.]

/**
* ...
*/
protected goodProtectedMethod() { }

private badPrivateMethod() { }

/**
* ...
*/
private goodPrivateMethod() { }
}
12 changes: 12 additions & 0 deletions test/rules/completed-docs/privacies-protected/tslint.json
@@ -0,0 +1,12 @@
{
"linterOptions": {
"typeCheck": true
},
"rules": {
"completed-docs": [true, {
"methods": {
"privacies": ["protected"]
}
}]
}
}
31 changes: 31 additions & 0 deletions test/rules/completed-docs/privacies-public/test.ts.lint
@@ -0,0 +1,31 @@
class Class {
badDefaultMethod() { }
~~~~~~~~~~~~~~~~~~~~~~ [Documentation must exist for methods.]

/**
* ...
*/
goodDefaultMethod() { }

public badPublicMethod() { }
~~~~~~~~~~~~~~~~~~~~~~~~~~~~ [Documentation must exist for public methods.]

/**
* ...
*/
public goodPublicMethod() { }

protected badProtectedMethod() { }

/**
* ...
*/
protected goodProtectedMethod() { }

private badPrivateMethod() { }

/**
* ...
*/
private goodPrivateMethod() { }
}
12 changes: 12 additions & 0 deletions test/rules/completed-docs/privacies-public/tslint.json
@@ -0,0 +1,12 @@
{
"linterOptions": {
"typeCheck": true
},
"rules": {
"completed-docs": [true, {
"methods": {
"privacies": ["public"]
}
}]
}
}
5 changes: 1 addition & 4 deletions test/rules/completed-docs/privacies/tslint.json
Expand Up @@ -5,10 +5,7 @@
"rules": {
"completed-docs": [true, {
"methods": {
"visibilities": ["public", "protected"]
},
"properties": {
"visibilities": ["public"]
"privacies": ["all"]
}
}]
}
Expand Down