Skip to content

Commit

Permalink
chore: add no-negated-condition lint rule
Browse files Browse the repository at this point in the history
  • Loading branch information
SimenB committed Aug 6, 2019
1 parent d285f8b commit 85e4195
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
1 change: 1 addition & 0 deletions .eslintrc.js
Expand Up @@ -30,6 +30,7 @@ module.exports = {
'@typescript-eslint/ban-ts-ignore': 'warn',
'@typescript-eslint/ban-types': 'error',
'no-else-return': 'error',
'no-negated-condition': 'error',
eqeqeq: ['error', 'smart'],
strict: 'error',
'prefer-template': 'warn',
Expand Down
6 changes: 3 additions & 3 deletions src/rules/prefer-expect-assertions.js
Expand Up @@ -54,13 +54,13 @@ export default {
'CallExpression[callee.name=/^(it|test)$/][arguments.1.body.body]'(node) {
const testFuncBody = node.arguments[1].body.body;

if (!isFirstLineExprStmt(testFuncBody)) {
reportMsg(context, node);
} else {
if (isFirstLineExprStmt(testFuncBody)) {
const testFuncFirstLine = getFunctionFirstLine(testFuncBody);
if (!isExpectAssertionsOrHasAssertionsCall(testFuncFirstLine)) {
reportMsg(context, node);
}
} else {
reportMsg(context, node);
}
},
};
Expand Down

0 comments on commit 85e4195

Please sign in to comment.