๐Ÿ“ฆ mui / mui-public

๐Ÿ“„ eslint.config.mjs ยท 99 lines
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99import { defineConfig } from 'eslint/config';
import {
  createBaseConfig,
  createTestConfig,
  createDocsConfig,
  EXTENSION_TEST_FILE,
  EXTENSION_TS,
} from '@mui/internal-code-infra/eslint';
import nPlugin from 'eslint-plugin-n';

export default /** @type {import('eslint').Linter.Config[]} */ (
  defineConfig(
    createBaseConfig({ baseDirectory: import.meta.dirname }),
    {
      files: [`**/*${EXTENSION_TS}`],
      plugins: {
        n: nPlugin,
      },
      rules: {
        // not needed in this repo
        'compat/compat': 'off',
        // No time for this
        'react/prop-types': 'off',
        'jsx-a11y/control-has-associated-label': 'off',
        'jsx-a11y/no-autofocus': 'off',
        '@typescript-eslint/triple-slash-reference': 'off',
        // Enforce using node: protocol for builtin modules
        'n/prefer-node-protocol': 'error',
        'material-ui/no-empty-box': 'off',
      },
      settings: {
        'import/resolver': {
          typescript: {
            project: ['tsconfig.json'],
          },
        },
      },
    },
    {
      files: [
        // matching the pattern of the test runner
        `**/*${EXTENSION_TEST_FILE}`,
      ],
      extends: createTestConfig({ useMocha: false, useVitest: true }),
    },
    {
      files: [`packages/docs-infra/**/*${EXTENSION_TEST_FILE}`],
      rules: {
        // TODO @dav-is
        'vitest/no-conditional-expect': 'off',
      },
    },
    {
      files: ['docs/**/*'],
      extends: createDocsConfig(),
      settings: {
        'import/resolver': {
          typescript: {
            project: ['docs/tsconfig.json'],
          },
        },
      },
      rules: {
        '@next/next/no-img-element': 'off',
      },
    },
    {
      files: [`apps/**/*${EXTENSION_TS}`],
      rules: {
        '@typescript-eslint/no-explicit-any': 'off',
      },
    },
    {
      files: ['renovate/**/*.json'],
      language: 'json/jsonc',
    },
    {
      files: [`packages/babel-*/**/*${EXTENSION_TS}`],
      rules: {
        '@typescript-eslint/no-require-imports': 'off',
      },
    },
    {
      files: [`packages/bundle-size-checker/**/*${EXTENSION_TS}`],
      rules: {
        // Allow .js file extensions in import statements for ESM compatibility
        'import/extensions': [
          'error',
          'ignorePackages',
          {
            js: 'always',
            mjs: 'always',
          },
        ],
      },
    },
  )
);