# 1. Support join('\n')
I'm trying to run `just new-rule no-unexpected-multiline`, It found
rulegen not support test code pieced together using `array.json("\n")`,
like
```js
{
code: [
"const x = aaaa<",
" test",
">/*",
"test",
"*/`foo`"
].join("\n")
}
```
I found this kind of code widely in the eslint codebase, so it will be
great if we can support this.

# 2. remove extra `,`
And I found when meet unsupported code, rulegen will generate an extra
`,`, so I added a filter at
45cf5fc3da/tasks/rulegen/src/main.rs (L363)
# 3. handle escape string
The escape `/` and trailing `/` in the javascript code will break
rulegen. example: `"\"abc\\\n(123)\""`
I made the following changes:
```diff
- test_code.replace('\n', "\n\t\t\t")
+ test_code.replace('\n', "\n\t\t\t").replace('\\', "\\\\").replace('\"', "\\\"")
```
For #634.
This PR prepares for the fix of #634, adding an option to formatter to
control whether to quote object properties. After this PR, the rulegen
script can use oxc-formatter to output JSON-like object literal.
The `Quote Props` option is from Prettier. For detail:
https://prettier.io/docs/en/options.html#quote-props
> Change when properties in objects are quoted.
> Valid options:
> "as-needed" - Only add quotes around object properties where required.
> "consistent" - If at least one property in an object requires quotes,
quote all properties.
> "preserve" - Respect the input use of quotes in object properties.
---------
Co-authored-by: Don Isaac <donald.isaac@gmail.com>