Skip to content

unicorn/require-array-join-separator Style

🛠️ An auto-fix is available for this rule for some violations.

What it does

Enforce using the separator argument with Array#join()

Why is this bad?

It's better to make it clear what the separator is when calling Array#join(), instead of relying on the default comma (',') separator.

Example

Examples of incorrect code for this rule:

javascript
foo.join();

Examples of correct code for this rule:

javascript
foo.join(",");

How to use

To enable this rule in the CLI or using the config file, you can use:

bash
oxlint --deny unicorn/require-array-join-separator
json
{
  "rules": {
    "unicorn/require-array-join-separator": "error"
  }
}

References

Released under the MIT License.