eslint-plugin-microsoft-typescript
Advanced tools
Comparing version 0.1.5 to 0.1.6
@@ -16,19 +16,18 @@ "use strict"; | ||
schema: [], | ||
type: 'suggestion', | ||
type: 'problem', | ||
}, | ||
defaultOptions: [], | ||
create: function (context) { | ||
var sourceCode = context.getSourceCode(); | ||
var checkTypeAssertionWhitespace = function (node) { | ||
var leftSideWhitespaceStart = node.typeAnnotation.range[1] + 1; | ||
var rightSideWhitespaceEnd = node.expression.range[0]; | ||
var startLine = node.loc.start.line; | ||
var endLine = node.loc.end.line; | ||
if (leftSideWhitespaceStart !== rightSideWhitespaceEnd) { | ||
var leftToken = sourceCode.getLastToken(node.typeAnnotation); | ||
var rightToken = sourceCode.getFirstToken(node.expression); | ||
if (!leftToken || !rightToken) { | ||
return; | ||
} | ||
if (sourceCode.isSpaceBetweenTokens(leftToken, rightToken)) { | ||
context.report({ | ||
messageId: 'noTypeAssertionWhitespace', | ||
node: node, | ||
loc: { | ||
start: { column: leftSideWhitespaceStart, line: startLine }, | ||
end: { column: rightSideWhitespaceEnd, line: endLine }, | ||
}, | ||
loc: { column: leftToken.loc.end.column + 1, line: leftToken.loc.end.line }, | ||
}); | ||
@@ -35,0 +34,0 @@ } |
{ | ||
"name": "eslint-plugin-microsoft-typescript", | ||
"version": "0.1.5", | ||
"version": "0.1.6", | ||
"description": "ESlint rules for TypeScript", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
21663
419