Repository: mui/material-ui
File: .eslintrc.js (JavaScript)

Code before:
    // We are a UI library.
    'react/jsx-props-no-spreading': 'off',
    // This rule is great for raising people awareness of what a key is and how it works.
    'react/no-array-index-key': 'off',
    'react/no-danger': 'error',
    'react/no-direct-mutation-state': 'error',
    // Not always relevant
    'react/require-default-props': 'off',
    'react/sort-prop-types': 'error',
    // This depends entirely on what you're doing. There's no universal pattern
    'react/state-in-constructor': 'off',
    // stylistic opinion. For conditional assignment we want it outside, otherwise as static
    'react/static-property-placement': 'off',

    'no-restricted-syntax': [
      // See https://github.com/eslint/eslint/issues/9192 for why it's needed
      ...baseStyleRules['no-restricted-syntax'],
      {
        message:
          "Do not import default from React. Use a namespace import (import * as React from 'react';) instead.",
        selector: 'ImportDeclaration[source.value="react"] ImportDefaultSpecifier',
      },
    ],

    // We re-export default in many places
    'no-restricted-exports': 'off',
    // some of these occurences are deliberate and fixing them will break things in repos that use @monorepo dependency
    'import/no-relative-packages': 'off',
    // Avoid accidental auto-"fixes" https://github.com/jsx-eslint/eslint-plugin-react/issues/3458
    'react/no-invalid-html-attribute': 'off',

    'react/jsx-no-useless-fragment': ['error', { allowExpressions: true }],
  },
  overrides: [
    {
      files: [
        // matching the pattern of the test runner
        '*.test.js',
        '*.test.ts',
        '*.test.tsx',
      ],
      extends: ['plugin:mocha/recommended'],
      rules: {
        // does not work with wildcard imports. Mistakes will throw at runtime anyway
        'import/named': 'off',
        'no-restricted-imports': [
          'error',
          {
            // Use named import from `test/utils` instead.
            // The other files are private.
            patterns: ['test/utils/*'],

Review comment (suggestion):
There's an issue in the ESLint repo that tracks this: https://github.com/eslint/eslint/issues/15617. Could be worth adding a comment that we wait for its resolution.

Code after:
    // We are a UI library.
    'react/jsx-props-no-spreading': 'off',
    // This rule is great for raising people awareness of what a key is and how it works.
    'react/no-array-index-key': 'off',
    'react/no-danger': 'error',
    'react/no-direct-mutation-state': 'error',
    // Not always relevant
    'react/require-default-props': 'off',
    'react/sort-prop-types': 'error',
    // This depends entirely on what you're doing. There's no universal pattern
    'react/state-in-constructor': 'off',
    // stylistic opinion. For conditional assignment we want it outside, otherwise as static
    'react/static-property-placement': 'off',

    'no-restricted-syntax': [
      // See https://github.com/eslint/eslint/issues/9192 for why it's needed
      ...baseStyleRules['no-restricted-syntax'],
      {
        message:
          "Do not import default from React. Use a namespace import (import * as React from 'react';) instead.",
        selector: 'ImportDeclaration[source.value="react"] ImportDefaultSpecifier',
      },
    ],

    // We re-export default in many places, remove when https://github.com/airbnb/javascript/issues/2500 gets resolved
    'no-restricted-exports': 'off',
    // Some of these occurences are deliberate and fixing them will break things in repos that use @monorepo dependency
    'import/no-relative-packages': 'off',
    // Avoid accidental auto-"fixes" https://github.com/jsx-eslint/eslint-plugin-react/issues/3458
    'react/no-invalid-html-attribute': 'off',

    'react/jsx-no-useless-fragment': ['error', { allowExpressions: true }],
  },
  overrides: [
    {
      files: [
        // matching the pattern of the test runner
        '*.test.js',
        '*.test.ts',
        '*.test.tsx',
      ],
      extends: ['plugin:mocha/recommended'],
      rules: {
        // does not work with wildcard imports. Mistakes will throw at runtime anyway
        'import/named': 'off',
        'no-restricted-imports': [
          'error',
          {
            // Use named import from `test/utils` instead.
            // The other files are private.
            patterns: ['test/utils/*'],