Skip to content

API Extractor now warns when an @internal definition is missing the underscore prefix - #241

Merged
Pete Gonzalez (octogonz) merged 4 commits into
masterfrom
pgonzal/ae-underscore-prefix
Jun 19, 2017
Merged

Pete Gonzalez (octogonz) merged 4 commits into
masterfrom
pgonzal/ae-underscore-prefix

Conversation

@octogonz

Copy link
Copy Markdown
Collaborator

When a definition is explicitly marked as @internal, an underscore prefix should be added to its exported name. Some examples:

/** @internal */
// The underscore is optional here, because an underscore is being
// applied separately where MyClass is exported.
class MyClass {
  // The myMethod() member is implicitly internal because
  // it's part of an internal class
  public myMethod(): void { // <-- MUST NOT have underscore
  }
}

/** @public */
class MyPublicClass { // <-- MUST NOT have underscore 
  /** @internal */
  public _myInternalMethod(): void { // <-- MUST have underscore  
  }
}

let _MyClass = MyClass;
export default _MyClass;

@octogonz Pete Gonzalez (octogonz) changed the title API Extractor now warns for @internal definitions missing the underscore prefix API Extractor now warns when an @internal definition is missing the underscore prefix Jun 19, 2017
}

function assertCapturedErrors(expectedMessages: string[]): void {
assert.deepEqual(capturedErrors.map(x => x.message), expectedMessages,

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it an expectation that the errors need to be in this exact same order?
Otherwise check that the length matches, and that all strings are present as capturedError messages

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The behavior is deterministic, so yes they should appear in the expected order. I could also be validating the filenames and line numbers, but that was too much typing.


In reply to: 122826879 [](ancestors = 122826879)

@octogonz

Pete Gonzalez (octogonz) commented Jun 19, 2017 •

Copy link
Copy Markdown
Collaborator Author

:shipit:

Approved with PullApprove Approved with PullApprove

@octogonz
Pete Gonzalez (octogonz) merged commit edbb57a into master Jun 19, 2017
@octogonz
Pete Gonzalez (octogonz) deleted the pgonzal/ae-underscore-prefix branch July 3, 2017 04:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants