eslint-plugin-microsoft-typescript
Advanced tools
Comparing version 0.1.6 to 0.1.7
@@ -22,3 +22,4 @@ "use strict"; | ||
create: function (context) { | ||
var isString = function (node) { return node.type === experimental_utils_1.AST_NODE_TYPES.Literal && typeof node.value === 'string'; }; | ||
var isArrowFunction = function (node) { return node.type === experimental_utils_1.AST_NODE_TYPES.ArrowFunctionExpression; }; | ||
var isStringLiteral = function (node) { return ((node.type === experimental_utils_1.AST_NODE_TYPES.Literal && typeof node.value === 'string') || node.type === experimental_utils_1.AST_NODE_TYPES.TemplateLiteral); }; | ||
var isDebugAssert = function (node) { return (node.object.type === experimental_utils_1.AST_NODE_TYPES.Identifier | ||
@@ -35,3 +36,3 @@ && node.object.name === 'Debug' | ||
var message1Node = args[1]; | ||
if (message1Node && !isString(message1Node)) { | ||
if (message1Node && !isStringLiteral(message1Node)) { | ||
context.report({ messageId: 'secondArgumentDebugAssertError', node: message1Node }); | ||
@@ -43,3 +44,3 @@ } | ||
var message2Node = args[2]; | ||
if (message2Node && (!isString(message2Node) && message2Node.type !== experimental_utils_1.AST_NODE_TYPES.ArrowFunctionExpression)) { | ||
if (message2Node && (!isStringLiteral(message2Node) && !isArrowFunction(message2Node))) { | ||
context.report({ messageId: 'thirdArgumentDebugAssertError', node: message2Node }); | ||
@@ -46,0 +47,0 @@ } |
{ | ||
"name": "eslint-plugin-microsoft-typescript", | ||
"version": "0.1.6", | ||
"version": "0.1.7", | ||
"description": "ESlint rules for TypeScript", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
21839
420