mui / mui/material-ui

[docs] Passing sx example causes eslint "unsafe spready of 'any' value in an array" error

Open
#37,730 9 comments 5 reactions 1 assignee View on GitHub

@mnajdova is already working on this.

Since Jun 26, 2023.

docs has workaround scope: system
Dominant language
JavaScript
Stars
99.1k
Forks
32.5k
Avg merge
2d 17h
Merged PRs (30d)
106

Description

Duplicates
  • I have searched the existing issues
Related page

https://mui.com/system/getting-started/the-sx-prop/#passing-the-sx-prop

Kind of issue

Broken demonstration

Issue description

Perhaps the expectation is that users are not prohibiting the use of the any type via eslint, but if I copy the ListHeader component example from the referenced docs page, eslint marks it as an error. Specifically, the case where sx is an array, eslint sees it as type any[] (see screenshot). I'm wondering if there's a way to make this work with the eslint setting to prevent the use of any?

image

Context 🔦

Attempting to make a component that accepts an sx property and passes it to its first child component (a MUI Box) and add a few style prop settings. See screenshot.

image

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.