diff --git a/src/rules/no-test-callback.ts b/src/rules/no-test-callback.ts index 33e4dbf79..2707d1fcb 100644 --- a/src/rules/no-test-callback.ts +++ b/src/rules/no-test-callback.ts @@ -63,13 +63,6 @@ export default createRule({ fix(fixer) { const { body } = callback; - /* istanbul ignore if https://github.com/typescript-eslint/typescript-eslint/issues/734 */ - if (!body) { - throw new Error( - `Unexpected null when attempting to fix ${context.getFilename()} - please file a github issue at https://github.com/jest-community/eslint-plugin-jest`, - ); - } - const sourceCode = context.getSourceCode(); const firstBodyToken = sourceCode.getFirstToken(body); const lastBodyToken = sourceCode.getLastToken(body); diff --git a/src/rules/no-test-return-statement.ts b/src/rules/no-test-return-statement.ts index 94caac433..0f26398e3 100644 --- a/src/rules/no-test-return-statement.ts +++ b/src/rules/no-test-return-statement.ts @@ -15,7 +15,6 @@ const getBody = (args: TSESTree.Expression[]) => { if ( secondArg && isFunction(secondArg) && - secondArg.body && secondArg.body.type === AST_NODE_TYPES.BlockStatement ) { return secondArg.body.body; diff --git a/src/rules/prefer-todo.ts b/src/rules/prefer-todo.ts index 9a38d792c..6ba4f2d02 100644 --- a/src/rules/prefer-todo.ts +++ b/src/rules/prefer-todo.ts @@ -19,17 +19,8 @@ function isEmptyFunction(node: TSESTree.Expression) { return false; } - /* istanbul ignore if https://github.com/typescript-eslint/typescript-eslint/issues/734 */ - if (!node.body) { - throw new Error( - `Unexpected null while performing prefer-todo - please file a github issue at https://github.com/jest-community/eslint-plugin-jest`, - ); - } - return ( - node.body.type === AST_NODE_TYPES.BlockStatement && - node.body.body && - !node.body.body.length + node.body.type === AST_NODE_TYPES.BlockStatement && !node.body.body.length ); } diff --git a/src/rules/valid-describe.ts b/src/rules/valid-describe.ts index 0bff6c9ce..a4e706ee9 100644 --- a/src/rules/valid-describe.ts +++ b/src/rules/valid-describe.ts @@ -92,10 +92,7 @@ export default createRule({ }); } - if ( - callback.body && - callback.body.type === AST_NODE_TYPES.BlockStatement - ) { + if (callback.body.type === AST_NODE_TYPES.BlockStatement) { callback.body.body.forEach(node => { if (node.type === AST_NODE_TYPES.ReturnStatement) { context.report({ diff --git a/src/rules/valid-expect-in-promise.ts b/src/rules/valid-expect-in-promise.ts index f15216f41..f559ecb66 100644 --- a/src/rules/valid-expect-in-promise.ts +++ b/src/rules/valid-expect-in-promise.ts @@ -132,14 +132,9 @@ const verifyExpectWithReturn = ( testFunctionBody: TSESTree.Statement[], ) => { promiseCallbacks.some(promiseCallback => { - if ( - promiseCallback && - isFunction(promiseCallback) && - promiseCallback.body - ) { + if (promiseCallback && isFunction(promiseCallback)) { if ( isExpectCallPresentInFunction(promiseCallback.body) && - node.parent && node.parent.parent && !isParentThenOrPromiseReturned(node.parent.parent, testFunctionBody) ) { @@ -187,13 +182,6 @@ export default createRule({ if (testFunction && !isHavingAsyncCallBackParam(testFunction)) { const { body } = testFunction; - /* istanbul ignore if https://github.com/typescript-eslint/typescript-eslint/issues/734 */ - if (!body) { - throw new Error( - `Unexpected null when attempting to fix ${context.getFilename()} - please file a github issue at https://github.com/jest-community/eslint-plugin-jest`, - ); - } - if (body.type !== AST_NODE_TYPES.BlockStatement) { return; }