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

deprecation: Rewrite and enhance #2748

Merged
merged 2 commits into from
May 24, 2017
Merged

deprecation: Rewrite and enhance #2748

merged 2 commits into from
May 24, 2017

Conversation

ajafff
Copy link
Contributor

@ajafff ajafff commented May 12, 2017

PR checklist

  • Addresses an existing issue: #0000
  • New feature, bugfix, or enhancement
    • Includes tests
  • Documentation update

Overview of change:

Rewrite to walker function.
Use TypeScript's JsDoc parser
[enhancement] deprecation: error message includes deprecation text if available

Is there anything you'd like reviewers to focus on?

CHANGELOG.md entry:

Rewrite to walker function.
Use TypeScript's JsDoc parser
[enhancement] `deprecation`: error message includes deprecation text if available
this.addFailureAtNode(node, `${node.text} is deprecated.`);
function getDeprecation(node: ts.Identifier, tc: ts.TypeChecker): string | undefined {
let symbol = tc.getSymbolAtLocation(node);
if (symbol !== undefined && Lint.isSymbolFlagSet(symbol, ts.SymbolFlags.Alias)) {
Copy link
Contributor

Choose a reason for hiding this comment

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

We could use a skipAliasSymbol helper in tsutils.

if (declarations === undefined) {
super.visitIdentifier(node);
return;
function isDeclaration(identifier: ts.Identifier): boolean {
Copy link
Contributor

Choose a reason for hiding this comment

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

TypeScript has ts.isDeclarationName, but it's internal. You could make an issue on the TypeScript issue asking it to be made non-internal since it seems pretty useful.

Copy link
Contributor

Choose a reason for hiding this comment

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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The implementation used here is slightly different. For example typescript's implementation includes ShorthandPropertyAssignment which actually uses the variable and should therefore be checked by this rule. Same with NamespaceImport, ...

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

Successfully merging this pull request may close these issues.

3 participants