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

Commit

Permalink
Added location, type, and privacy to completed-docs (#2095)
Browse files Browse the repository at this point in the history
Also adds interfaces, enums, types, and a few other doc-able contructs.
  • Loading branch information
Josh Goldberg authored and nchen63 committed Feb 7, 2017
1 parent dc7c473 commit 290d597
Show file tree
Hide file tree
Showing 14 changed files with 747 additions and 156 deletions.
388 changes: 349 additions & 39 deletions src/rules/completedDocsRule.ts

Large diffs are not rendered by default.

59 changes: 0 additions & 59 deletions test/rules/completed-docs/all/test.ts.lint

This file was deleted.

21 changes: 21 additions & 0 deletions test/rules/completed-docs/defaults/test.ts.lint
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
export class Aaa {
~~~~~~~~~~~~~~~~~~ [Documentation must exist for exported classes.]
public bbb;
~~~~~~~~~~~ [Documentation must exist for public properties.]

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

export enum Ddd { }

export function Eee() { }
~~~~~~~~~~~~~~~~~~~~~~~~~ [Documentation must exist for exported functions.]

export interface Fff { }

export namespace Ggg { }

export type Hhh = any;

export const i = true;
50 changes: 0 additions & 50 deletions test/rules/completed-docs/functions/test.ts.lint

This file was deleted.

8 changes: 0 additions & 8 deletions test/rules/completed-docs/functions/tslint.json

This file was deleted.

31 changes: 31 additions & 0 deletions test/rules/completed-docs/locations/test.ts.lint
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
class Class {
badInstanceProperty = 1;

/**
* ...
*/
goodInstanceProperty = 1;

/**
* ...
*/
static badStaticProperty = 1;

static goodStaticProperty = 1;
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ [Documentation must exist for static properties.]

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

/**
* ...
*/
goodInstanceMethod() { }

static badStaticMethod() { }

/**
* ...
*/
static goodStaticMethod() { }
}
15 changes: 15 additions & 0 deletions test/rules/completed-docs/locations/tslint.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"linterOptions": {
"typeCheck": true
},
"rules": {
"completed-docs": [true, {
"methods": {
"locations": ["instance"]
},
"properties": {
"locations": ["static"]
}
}]
}
}
33 changes: 33 additions & 0 deletions test/rules/completed-docs/privacies/test.ts.lint
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
class Class {
badDefaultMethod() { }
~~~~~~~~~~~~~~~~~~~~~~ [Documentation must exist for methods.]

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

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

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

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

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

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

/**
* ...
*/
private goodPrivateMethod() { }
}
15 changes: 15 additions & 0 deletions test/rules/completed-docs/privacies/tslint.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"linterOptions": {
"typeCheck": true
},
"rules": {
"completed-docs": [true, {
"methods": {
"visibilities": ["public", "protected"]
},
"properties": {
"visibilities": ["public"]
}
}]
}
}

0 comments on commit 290d597

Please sign in to comment.