mui / mui/material-ui

Add eslint-plugin-material-ui

Open
#31,096 3 comments 14 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

discussion scope: all components type: new feature
Dominant language
JavaScript
Stars
99.1k
Forks
32.5k
Avg merge
2d 17h
Merged PRs (30d)
106

Description

Summary 💡

This issue is mostly here as an opportunity to evaluate the opposite to have a linter for Material UI, Base UI, Pigment CSS, etc. This linter would very likely be implemented with eslint.

Examples 🌈
Motivation 🔦

Ideas:

  1. When using the unitless API, error with all non-integer or half-integer usage: sx: { p: 1.4, m: 1.6 }
  2. Warn when using an invalid import path, e.g. breaking https://mui.com/material-ui/guides/minimizing-bundle-size/
  1. styled(Box) should really be styled('div')
  2. Providing render functions to slots, this is wrong:
  <TimePicker
    defaultValue={time}
    slots={{
      textField: (props) => (
        <TextField sx={{ width: 100 }} {...props} size='small' />
      ),
    }}
  />

Explored with a warning in #14748 but has false-positive, false-negative.

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.

Research direction

Start by reviewing the linked ESLint plugin examples and the warning explored in #14748. Decide which Material UI, Base UI, or Pigment CSS linting scope is in bounds, then define the selected rules and expected diagnostics; done should mean an agreed plugin direction with the chosen cases validated.

Written by the indexing model from the issue text.

Assessment

Tech stack
eslint, javascript, react
Domain
frontend, tooling
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
20/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.