From 1740ee769d1249d7689e35b73520b281c4606d38 Mon Sep 17 00:00:00 2001 From: Juriy Zaytsev Date: Wed, 22 May 2019 18:27:03 -0400 Subject: [PATCH] fix(add-no-commented-out): correct false positives (#271) --- src/rules/__tests__/no-commented-out-tests.test.js | 2 ++ src/rules/no-commented-out-tests.js | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/rules/__tests__/no-commented-out-tests.test.js b/src/rules/__tests__/no-commented-out-tests.test.js index 6d9a41e6f..ec231617e 100644 --- a/src/rules/__tests__/no-commented-out-tests.test.js +++ b/src/rules/__tests__/no-commented-out-tests.test.js @@ -24,6 +24,8 @@ ruleTester.run('no-commented-out-tests', rule, { '(a || b).f()', 'itHappensToStartWithIt()', 'testSomething()', + '// latest(dates)', + '// TODO: unify with Git implementation from Shipit (?)', [ 'import { pending } from "actions"', '', diff --git a/src/rules/no-commented-out-tests.js b/src/rules/no-commented-out-tests.js index 013dc08cf..afc1a5c54 100644 --- a/src/rules/no-commented-out-tests.js +++ b/src/rules/no-commented-out-tests.js @@ -5,7 +5,7 @@ const { getDocsUrl } = require('./util'); const message = 'Some tests seem to be commented'; function hasTests(node) { - return /(x|f)?(test|it|describe)(\.\w+|\[['"]\w+['"]\])?\s*\(/m.test( + return /^\s*(x|f)?(test|it|describe)(\.\w+|\[['"]\w+['"]\])?\s*\(/m.test( node.value, ); }