Repository: prettier/prettier (JavaScript)

Issue:
Ugly format for `require()` call
**Prettier 3.0.0**
[Playground link](https://prettier.io/playground/#N4Igxg9gdgLgprEAuEcAeAHCAnGACSKAZ3wwBsBXAcwEso8BePbOARwppYAoqyIAjAIZkAdAGUAKgEEAcgBEpAGQDyMgKIAdengD8eDIJgALEQCsIdLgH0rAE05RBAWzgAaPBpAiRAehKCoW2FoODMiTwBKLTw8JH1DE3NLG3tsRxd3T29IiIBuLS10LFwCaBJ9Slp6Jis2Dm5eAWFxaXklVU1tPQNjMwsoazsHZzcPL19-QOCoUNNwkCjtOJ7E-sHU9NGskRzckFcQCAwYGjLkUEFsbAgAdwAFS4QiZBBhG8EAT2eD-mxBMAA1nAYGIRoo6HBkAAzYRENwgX7-IEggxgOhUZAwbAUeFwpw0THY3HoshwACKFAg8GhsPhczQYhJ5Mp1KQMLIcIO7CpcDu1wwzxQgiIAFoZnBbBL9iAsYIaGR0QBhCBOJyCF7CMjSohMqQwLE0fgUeB3ODYcEzGkc+FGGBOMgAdSMNHgRFRcDETxdNAAbi6Pi8wERviAfTiAJKBBAgsDYGjHKSBMQwD6kq2ckAYa5wh1-DAvLNwOHYH2Qg50YswPmCKhq9PwgzYYsvIT8OBag5ZugwB00WzGZAADgADAcWOxOLy-rX1WzaQcYIJ+L3+0ZkAAmA4UOESJeC9kZuBONu2SW2RQBKgUGtwABiODV+vRGuNEBAAF930A)
<!-- prettier-ignore -->
```sh
--parser babel
```

**Input:**
<!-- prettier-ignore -->
```jsx
export const plugin = require(global.STANDALONE
  ? path.join(__dirname, "../standalone.js")
  : path.join(__dirname, ".."));

export const plugin = _equire(global.STANDALONE
  ? path.join(__dirname, "../standalone.js")
  : path.join(__dirname, ".."));
```

**Output:**
<!-- prettier-ignore -->
```jsx
export const plugin = require(global.STANDALONE
  ? path.join(__dirname, "../standalone.js")
  : path.join(__dirname, ".."));

export const plugin = _equire(
  global.STANDALONE
    ? path.join(__dirname, "../standalone.js")
    : path.join(__dirname, ".."),
);

```

**Expected behavior:**


<!-- prettier-ignore -->
```jsx
export const plugin = require(
  global.STANDALONE
    ? path.join(__dirname, "../standalone.js")
    : path.join(__dirname, ".."),
);

export const plugin = _equire(
  global.STANDALONE
    ? path.join(__dirname, "../standalone.js")
    : path.join(__dirname, ".."),
);

```



Hints:

Patch:
diff --git a/src/language-js/print/call-expression.js b/src/language-js/print/call-expression.js
--- a/src/language-js/print/call-expression.js
+++ b/src/language-js/print/call-expression.js
@@ -89,7 +89,8 @@ function isCommonsJsOrAmdCall(node, parentNode) {
   }
 
   if (node.callee.name === "require") {
-    return true;
+    const args = getCallArguments(node);
+    return (args.length === 1 && isStringLiteral(args[0])) || args.length > 1;
   }
 
   if (node.callee.name === "define") {


Test patch:
diff --git a/tests/format/js/require/__snapshots__/jsfmt.spec.js.snap b/tests/format/js/require/__snapshots__/jsfmt.spec.js.snap
--- a/tests/format/js/require/__snapshots__/jsfmt.spec.js.snap
+++ b/tests/format/js/require/__snapshots__/jsfmt.spec.js.snap
@@ -11,6 +11,19 @@ const { one1, two1, three1, four1, five1, six1, seven1, eight1, nine1, ten1, ele
 
 const MyReallyExtrememlyLongModuleName = require('MyReallyExtrememlyLongModuleName');
 
+const plugin = require(
+  global.STANDALONE
+    ? path.join(__dirname, "../standalone.js")
+    : path.join(__dirname, "..")
+);
+
+const plugin2 = require(
+  path.join(
+    __dirname,
+    global.STANDALONE ? "../standalone.js" : '..'
+  )
+);
+
 =====================================output=====================================
 const {
   one,
@@ -40,5 +53,15 @@ const {
 
 const MyReallyExtrememlyLongModuleName = require("MyReallyExtrememlyLongModuleName");
 
+const plugin = require(
+  global.STANDALONE
+    ? path.join(__dirname, "../standalone.js")
+    : path.join(__dirname, ".."),
+);
+
+const plugin2 = require(
+  path.join(__dirname, global.STANDALONE ? "../standalone.js" : ".."),
+);
+
 ================================================================================
 `;
diff --git a/tests/format/js/require/require.js b/tests/format/js/require/require.js
--- a/tests/format/js/require/require.js
+++ b/tests/format/js/require/require.js
@@ -2,3 +2,16 @@ const { one, two, three, four, five, six, seven, eight, nine, ten } = require('.
 const { one1, two1, three1, four1, five1, six1, seven1, eight1, nine1, ten1, eleven1 } = require('./my-utils');
 
 const MyReallyExtrememlyLongModuleName = require('MyReallyExtrememlyLongModuleName');
+
+const plugin = require(
+  global.STANDALONE
+    ? path.join(__dirname, "../standalone.js")
+    : path.join(__dirname, "..")
+);
+
+const plugin2 = require(
+  path.join(
+    __dirname,
+    global.STANDALONE ? "../standalone.js" : '..'
+  )
+);