Skip to content

oxc/no-rest-spread-properties Restriction ​

What it does ​

Disallow Object Rest/Spread Properties.

Example ​

javascript
let { x, ...y } = z;
let z = { x, ...y };

Options ​

json
{
  "rules": {
    "no-rest-spread-properties": [
      "error",
      {
        "objectSpreadMessage": "Object spread properties are not allowed.",
        "objectRestMessage": "Object rest properties are not allowed."
      }
    ]
  }
}
  • objectSpreadMessage: A message to display when object spread properties are found.
  • objectRestMessage: A message to display when object rest properties are found.

How to use ​

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

bash
oxlint --deny oxc/no-rest-spread-properties
json
{
  "rules": {
    "oxc/no-rest-spread-properties": "error"
  }
}

References ​

Released under the MIT License.