-
Notifications
You must be signed in to change notification settings - Fork 12.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
221 changed files
with
5,651 additions
and
2,193 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
This directory contains miscellaneous documentation such as the TypeScript language specification and logo. | ||
If you are looking for more introductory material, you might want to take a look at the [TypeScript Handbook](https://github.com/Microsoft/TypeScript-Handbook). | ||
|
||
# Spec Contributions | ||
|
||
The specification is first authored as a Microsoft Word (docx) file and then generated into Markdown and PDF formats. | ||
Due to the binary format of docx files, and the merging difficulties that may come with it, it is preferred that any suggestions or problems found in the spec should be [filed as issues](https://github.com/Microsoft/TypeScript/issues/new) rather than sent as pull requests. |
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
import * as Lint from "tslint/lib/lint"; | ||
import * as ts from "typescript"; | ||
|
||
|
||
export class Rule extends Lint.Rules.AbstractRule { | ||
public static POSTFIX_FAILURE_STRING = "Don't use '++' or '--' postfix operators outside statements or for loops."; | ||
public static PREFIX_FAILURE_STRING = "Don't use '++' or '--' prefix operators."; | ||
|
||
public apply(sourceFile: ts.SourceFile): Lint.RuleFailure[] { | ||
return this.applyWithWalker(new IncrementDecrementWalker(sourceFile, this.getOptions())); | ||
} | ||
} | ||
|
||
class IncrementDecrementWalker extends Lint.RuleWalker { | ||
|
||
visitPostfixUnaryExpression(node: ts.PostfixUnaryExpression) { | ||
super.visitPostfixUnaryExpression(node); | ||
if (node.operator === ts.SyntaxKind.PlusPlusToken || node.operator == ts.SyntaxKind.MinusMinusToken) { | ||
this.visitIncrementDecrement(node); | ||
} | ||
} | ||
|
||
visitPrefixUnaryExpression(node: ts.PrefixUnaryExpression) { | ||
super.visitPrefixUnaryExpression(node); | ||
if (node.operator === ts.SyntaxKind.PlusPlusToken || node.operator == ts.SyntaxKind.MinusMinusToken) { | ||
this.addFailure(this.createFailure(node.getStart(), node.getWidth(), Rule.PREFIX_FAILURE_STRING)); | ||
} | ||
} | ||
|
||
visitIncrementDecrement(node: ts.UnaryExpression) { | ||
if (node.parent && (node.parent.kind === ts.SyntaxKind.ExpressionStatement || | ||
node.parent.kind === ts.SyntaxKind.ForStatement)) { | ||
return; | ||
} | ||
this.addFailure(this.createFailure(node.getStart(), node.getWidth(), Rule.POSTFIX_FAILURE_STRING)); | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.