8000 remove redundant condition · StyleShit/typescript-eslint@ac595ca · GitHub
[go: up one dir, main page]

Skip to content

Commit ac595ca

Browse files
committed
remove redundant condition
1 parent 00d7d51 commit ac595ca

File tree

1 file changed

+5
-10
lines changed

1 file changed

+5
-10
lines changed

packages/eslint-plugin/src/rules/no-array-delete.ts

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -51,14 +51,13 @@ export default createRule<[], MessageId>({
5151
'UnaryExpression[operator="delete"]'(
5252
node: TSESTree.UnaryExpression,
5353
): void {
54-
if (node.argument.type !== AST_NODE_TYPES.MemberExpression) {
54+
const { argument } = node;
55+
56+
if (argument.type !== AST_NODE_TYPES.MemberExpression) {
5557
return;
5658
}
5759

58-
const type = getConstrainedTypeAtLocation(
59-
services,
60-
node.argument.object,
61-
);
60+
const type = getConstrainedTypeAtLocation(services, argument.object);
6261

6362
if (!isUnderlyingTypeArray(type)) {
6463
return;
@@ -71,11 +70,7 @@ export default createRule<[], MessageId>({
7170
{
7271
messageId: 'useSplice',
7372
fix(fixer): TSESLint.RuleFix | null {
74-
if (node.argument.type !== AST_NODE_TYPES.MemberExpression) {
75-
return null;
76-
}
77-
78-
const { object, property } = node.argument;
73+
const { object, property } = argument;
7974

8075
const shouldHaveParentheses =
8176
property.type === AST_NODE_TYPES.SequenceExpression;

0 commit comments

Comments
 (0)
0