Repository: dprint/dprint-plugin-typescript (rust)

Issue:
Doesn't remove unnecessary parenthesis
Version: 0.39.0

Input:

```js
const options = { foo: false };
(options).foo = true;
```

Output:
```js
const options = { foo: false };
(options).foo = true;
```

Expected output:

```js
const options = { foo: false };
options.foo = true;
```

Pull request description:
feat: remove unneeded parenthesis exprs around idents and member exprs
Fixes #539 .

Patch:
diff --git a/src/generation/generate.rs b/src/generation/generate.rs
index e2a37d2..9edb95e 100644
--- a/src/generation/generate.rs
+++ b/src/generation/generate.rs
@@ -2767,7 +2767,11 @@ fn should_skip_paren_expr<'a>(node: &'a ParenExpr<'a>, context: &Context<'a>) ->
     return false;
   }
 
-  if matches!(node.expr.kind(), NodeKind::ArrayLit) {
+  if matches!(node.expr.kind(), NodeKind::ArrayLit) || matches!(node.expr.kind(), NodeKind::Ident) {
+    return true;
+  }
+
+  if parent.kind() == NodeKind::MemberExpr && node.expr.kind() == NodeKind::MemberExpr {
     return true;
   }
 


Test patch:
diff --git a/tests/specs/general/Parentheses_All.txt b/tests/specs/general/Parentheses_All.txt
index 6055217..c90eef6 100644
--- a/tests/specs/general/Parentheses_All.txt
+++ b/tests/specs/general/Parentheses_All.txt
@@ -65,9 +65,7 @@ if (
         }
         && {
             other: 6,
-        } && (
-            test
-        )
+        } && test
 ) {
 }
 
diff --git a/tests/specs/issues/issue0372.txt b/tests/specs/issues/issue0372.txt
index 85acda3..f00dd4f 100644
--- a/tests/specs/issues/issue0372.txt
+++ b/tests/specs/issues/issue0372.txt
@@ -11,9 +11,7 @@ if (
 [expect]
 if (
   (a &&
-    ((
-      test
-    ) ||
+    (test ||
       aatestingThisOutTestteststestTestingatesttestatesttesttesttesttestestaa))
 ) {
 }
diff --git a/tests/specs/issues/issue0539.txt b/tests/specs/issues/issue0539.txt
new file mode 100644
index 0000000..2510a24
--- /dev/null
+++ b/tests/specs/issues/issue0539.txt
@@ -0,0 +1,10 @@
+~~ arrowFunction.useParentheses: preferNone ~~
+== should remove parens around identifier ==
+const options = { foo: false, bar: { bob: false } };
+(options).foo = true;
+(options.bar).bob = true;
+
+[expect]
+const options = { foo: false, bar: { bob: false } };
+options.foo = true;
+options.bar.bob = true;