eslint-plugin-jasmine
Advanced tools
Comparing version 2.7.0 to 2.7.1
@@ -68,4 +68,6 @@ 'use strict' | ||
if (suites.indexOf(suite) !== -1) { | ||
context.report(node, 'Duplicate ' + kind + ': "{{suite}}"', { | ||
suite: suite | ||
context.report({ | ||
data: { kind, suite }, | ||
message: 'Duplicate {{kind}}: "{{suite}}"', | ||
node | ||
}) | ||
@@ -72,0 +74,0 @@ } |
@@ -11,4 +11,8 @@ 'use strict' | ||
if (result) { | ||
context.report(node, 'Unexpected {{name}}.', { | ||
name: result[1] | ||
context.report({ | ||
data: { | ||
name: result[1] | ||
}, | ||
message: 'Unexpected {{name}}.', | ||
node | ||
}) | ||
@@ -15,0 +19,0 @@ } |
@@ -37,3 +37,6 @@ 'use strict' | ||
unchecked.forEach(function (node) { | ||
context.report(node, 'Test has no expectations') | ||
context.report({ | ||
message: 'Test has no expectations', | ||
node | ||
}) | ||
}) | ||
@@ -40,0 +43,0 @@ } |
@@ -42,3 +42,6 @@ 'use strict' | ||
if (!node.arguments.length || node.arguments[0].type !== 'Literal') { | ||
return context.report(node, 'Unnamed spy') | ||
return context.report({ | ||
message: 'Unnamed spy', | ||
node | ||
}) | ||
} | ||
@@ -48,3 +51,6 @@ | ||
if (identifier && node.arguments[0].value !== identifier.name) { | ||
return context.report(identifier, 'Variable should be named after the spy name') | ||
return context.report({ | ||
message: 'Variable should be named after the spy name', | ||
node: identifier | ||
}) | ||
} | ||
@@ -51,0 +57,0 @@ } |
@@ -26,7 +26,7 @@ 'use strict' | ||
context.report({ | ||
node, | ||
message: 'No new line before expect', | ||
fix (fixer) { | ||
return fixer.insertTextBefore(node, '\n') | ||
} | ||
}, | ||
message: 'No new line before expect', | ||
node | ||
}) | ||
@@ -33,0 +33,0 @@ } |
@@ -27,7 +27,7 @@ 'use strict' | ||
context.report({ | ||
node, | ||
message: 'No new line between declarations', | ||
fix (fixer) { | ||
return fixer.insertTextAfter(declWithoutPadding, '\n') | ||
} | ||
}, | ||
message: 'No new line between declarations', | ||
node | ||
}) | ||
@@ -34,0 +34,0 @@ } |
@@ -12,3 +12,6 @@ 'use strict' | ||
if (node.callee.name === 'spyOn' && (node.parent.type === 'AssignmentExpression' || node.parent.type === 'VariableDeclarator')) { | ||
context.report(node, 'The result of spyOn() should not be assigned') | ||
context.report({ | ||
message: 'The result of spyOn() should not be assigned', | ||
node | ||
}) | ||
} | ||
@@ -15,0 +18,0 @@ } |
@@ -9,3 +9,6 @@ 'use strict' | ||
function report (context, node) { | ||
context.report(node, 'Test has variable declaration in the describe block') | ||
context.report({ | ||
message: 'Test has variable declaration in the describe block', | ||
node | ||
}) | ||
} | ||
@@ -12,0 +15,0 @@ |
@@ -28,3 +28,7 @@ 'use strict' | ||
if (allowed.indexOf(functionName) > -1) { | ||
context.report(node, 'Unexpected "' + functionName + '" call in "' + setupFunctionName + '()"') | ||
context.report({ | ||
data: { functionName, setupFunctionName }, | ||
message: 'Unexpected "{{functionName}}" call in "{{setupFunctionName}}()"', | ||
node | ||
}) | ||
} | ||
@@ -31,0 +35,0 @@ } |
@@ -18,3 +18,9 @@ 'use strict' | ||
} else if (setupRegexp.test(node.callee.name) && suiteDepth === 0) { | ||
context.report(node, 'Do not use `' + node.callee.name + '` outside a `describe`.') | ||
context.report({ | ||
data: { | ||
name: node.callee.name | ||
}, | ||
message: 'Do not use `{{name}}` outside a `describe`.', | ||
node | ||
}) | ||
} | ||
@@ -21,0 +27,0 @@ }, |
@@ -17,3 +17,6 @@ 'use strict' | ||
if (arg.type === 'FunctionExpression' && arg.params.length) { | ||
context.report(node, "Unexpected argument in suite's callback") | ||
context.report({ | ||
message: "Unexpected argument in suite's callback", | ||
node | ||
}) | ||
} | ||
@@ -20,0 +23,0 @@ } |
@@ -36,5 +36,8 @@ 'use strict' | ||
context.report(node, 'Spy declared outside of before/after/it block') | ||
context.report({ | ||
message: 'Spy declared outside of before/after/it block', | ||
node | ||
}) | ||
} | ||
} | ||
} |
@@ -22,4 +22,4 @@ 'use strict' | ||
context.report({ | ||
node, | ||
message: 'Prefer jasmine matcher instead of comparison' | ||
message: 'Prefer jasmine matcher instead of comparison', | ||
node | ||
}) | ||
@@ -26,0 +26,0 @@ } |
@@ -14,5 +14,11 @@ 'use strict' | ||
if (node.arguments.length > 1) { | ||
context.report(node, 'More than one argument passed to expect()') | ||
context.report({ | ||
message: 'More than one argument passed to expect()', | ||
node | ||
}) | ||
} else if (node.arguments.length === 0) { | ||
context.report(node, 'No arguments passed to expect()') | ||
context.report({ | ||
message: 'No arguments passed to expect()', | ||
node | ||
}) | ||
} | ||
@@ -23,3 +29,6 @@ | ||
node.parent.parent.type !== 'MemberExpression') { | ||
context.report(node, 'Matcher was not called') | ||
context.report({ | ||
message: 'Matcher was not called', | ||
node | ||
}) | ||
} | ||
@@ -32,3 +41,6 @@ } | ||
if (node.callee.name === 'expect' && node.parent.type === 'ExpressionStatement') { | ||
context.report(node, 'Nothing called on expect()') | ||
context.report({ | ||
message: 'Nothing called on expect()', | ||
node | ||
}) | ||
} | ||
@@ -35,0 +47,0 @@ } |
@@ -54,3 +54,3 @@ { | ||
}, | ||
"version": "2.7.0" | ||
"version": "2.7.1" | ||
} |
166647
2069