Skip to content

Commit 85e4195

Browse files
committed
chore: add no-negated-condition lint rule
1 parent d285f8b commit 85e4195

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

.eslintrc.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ module.exports = {
3030
'@typescript-eslint/ban-ts-ignore': 'warn',
3131
'@typescript-eslint/ban-types': 'error',
3232
'no-else-return': 'error',
33+
'no-negated-condition': 'error',
3334
eqeqeq: ['error', 'smart'],
3435
strict: 'error',
3536
'prefer-template': 'warn',

src/rules/prefer-expect-assertions.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,13 +54,13 @@ export default {
5454
'CallExpression[callee.name=/^(it|test)$/][arguments.1.body.body]'(node) {
5555
const testFuncBody = node.arguments[1].body.body;
5656

57-
if (!isFirstLineExprStmt(testFuncBody)) {
58-
reportMsg(context, node);
59-
} else {
57+
if (isFirstLineExprStmt(testFuncBody)) {
6058
const testFuncFirstLine = getFunctionFirstLine(testFuncBody);
6159
if (!isExpectAssertionsOrHasAssertionsCall(testFuncFirstLine)) {
6260
reportMsg(context, node);
6361
}
62+
} else {
63+
reportMsg(context, node);
6464
}
6565
},
6666
};

0 commit comments

Comments
 (0)