Skip to content

Commit

Permalink
fix(prefer-todo): ensure argument exists before trying to access it (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
G-Rath authored Oct 28, 2019
1 parent b1b6dca commit a87c8c2
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/rules/__tests__/prefer-todo.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ const ruleTester = new TSESLint.RuleTester({

ruleTester.run('prefer-todo', rule, {
valid: [
'test()',
'test.todo("i need to write this test");',
'test(obj)',
'fit("foo")',
Expand Down
2 changes: 1 addition & 1 deletion src/rules/prefer-todo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ export default createRule({
CallExpression(node) {
const [firstArg, secondArg] = node.arguments;

if (!isTargetedTestCase(node) || !isStringNode(firstArg)) {
if (!firstArg || !isTargetedTestCase(node) || !isStringNode(firstArg)) {
return;
}

Expand Down

0 comments on commit a87c8c2

Please sign in to comment.