@mui/internal-code-infra 0.0.3-canary.83 → 0.0.3-canary.85

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (46) hide show
  1. package/build/eslint/baseConfig.d.mts +3 -1
  2. package/build/eslint/{material-ui → mui}/config.d.mts +2 -0
  3. package/build/eslint/{material-ui → mui}/rules/consistent-production-guard.d.mts +1 -1
  4. package/build/eslint/{material-ui → mui}/rules/require-dev-wrapper.d.mts +1 -1
  5. package/package.json +4 -4
  6. package/src/babel-config.mjs +1 -1
  7. package/src/eslint/baseConfig.mjs +6 -4
  8. package/src/eslint/{material-ui → mui}/config.mjs +13 -8
  9. package/src/eslint/{material-ui → mui}/index.mjs +5 -5
  10. package/src/eslint/{material-ui → mui}/rules/add-undef-to-optional.mjs +1 -1
  11. package/src/eslint/{material-ui → mui}/rules/consistent-production-guard.mjs +1 -1
  12. package/src/eslint/{material-ui → mui}/rules/require-dev-wrapper.mjs +1 -1
  13. package/src/eslint/testConfig.mjs +2 -2
  14. /package/build/eslint/{material-ui → mui}/index.d.mts +0 -0
  15. /package/build/eslint/{material-ui → mui}/rules/add-undef-to-optional.d.mts +0 -0
  16. /package/build/eslint/{material-ui → mui}/rules/disallow-active-element-as-key-event-target.d.mts +0 -0
  17. /package/build/eslint/{material-ui → mui}/rules/disallow-react-api-in-server-components.d.mts +0 -0
  18. /package/build/eslint/{material-ui → mui}/rules/docgen-ignore-before-comment.d.mts +0 -0
  19. /package/build/eslint/{material-ui → mui}/rules/mui-name-matches-component-name.d.mts +0 -0
  20. /package/build/eslint/{material-ui → mui}/rules/no-empty-box.d.mts +0 -0
  21. /package/build/eslint/{material-ui → mui}/rules/no-restricted-resolved-imports.d.mts +0 -0
  22. /package/build/eslint/{material-ui → mui}/rules/no-styled-box.d.mts +0 -0
  23. /package/build/eslint/{material-ui → mui}/rules/nodeEnvUtils.d.mts +0 -0
  24. /package/build/eslint/{material-ui → mui}/rules/rules-of-use-theme-variants.d.mts +0 -0
  25. /package/build/eslint/{material-ui → mui}/rules/straight-quotes.d.mts +0 -0
  26. /package/src/eslint/{material-ui → mui}/rules/add-undef-to-optional.test.mjs +0 -0
  27. /package/src/eslint/{material-ui → mui}/rules/consistent-production-guard.test.mjs +0 -0
  28. /package/src/eslint/{material-ui → mui}/rules/disallow-active-element-as-key-event-target.mjs +0 -0
  29. /package/src/eslint/{material-ui → mui}/rules/disallow-active-elements-as-key-event-target.test.mjs +0 -0
  30. /package/src/eslint/{material-ui → mui}/rules/disallow-react-api-in-server-components.mjs +0 -0
  31. /package/src/eslint/{material-ui → mui}/rules/disallow-react-api-in-server-components.test.mjs +0 -0
  32. /package/src/eslint/{material-ui → mui}/rules/docgen-ignore-before-comment.mjs +0 -0
  33. /package/src/eslint/{material-ui → mui}/rules/docgen-ignore-before-comment.test.mjs +0 -0
  34. /package/src/eslint/{material-ui → mui}/rules/mui-name-matches-component-name.mjs +0 -0
  35. /package/src/eslint/{material-ui → mui}/rules/mui-name-matches-component-name.test.mjs +0 -0
  36. /package/src/eslint/{material-ui → mui}/rules/no-empty-box.mjs +0 -0
  37. /package/src/eslint/{material-ui → mui}/rules/no-empty-box.test.mjs +0 -0
  38. /package/src/eslint/{material-ui → mui}/rules/no-restricted-resolved-imports.mjs +0 -0
  39. /package/src/eslint/{material-ui → mui}/rules/no-styled-box.mjs +0 -0
  40. /package/src/eslint/{material-ui → mui}/rules/no-styled-box.test.mjs +0 -0
  41. /package/src/eslint/{material-ui → mui}/rules/nodeEnvUtils.mjs +0 -0
  42. /package/src/eslint/{material-ui → mui}/rules/require-dev-wrapper.test.mjs +0 -0
  43. /package/src/eslint/{material-ui → mui}/rules/rules-of-use-theme-variants.mjs +0 -0
  44. /package/src/eslint/{material-ui → mui}/rules/rules-of-use-theme-variants.test.mjs +0 -0
  45. /package/src/eslint/{material-ui → mui}/rules/straight-quotes.mjs +0 -0
  46. /package/src/eslint/{material-ui → mui}/rules/straight-quotes.test.mjs +0 -0
@@ -2,11 +2,13 @@
2
2
  * @param {Object} [params]
3
3
  * @param {boolean} [params.enableReactCompiler] - Whether to enable React Compiler.
4
4
  * @param {boolean} [params.consistentTypeImports] - Whether to enforce consistent type imports.
5
+ * @param {boolean} [params.materialUi] - Whether to enable Material UI specific rules (mui/material-ui-*).
5
6
  * @param {string} [params.baseDirectory] - The base directory for the configuration.
6
7
  * @returns {import('eslint').Linter.Config[]}
7
8
  */
8
- export function createBaseConfig({ enableReactCompiler, consistentTypeImports, baseDirectory, }?: {
9
+ export function createBaseConfig({ enableReactCompiler, consistentTypeImports, materialUi, baseDirectory, }?: {
9
10
  enableReactCompiler?: boolean | undefined;
10
11
  consistentTypeImports?: boolean | undefined;
12
+ materialUi?: boolean | undefined;
11
13
  baseDirectory?: string | undefined;
12
14
  }): import("eslint").Linter.Config[];
@@ -2,9 +2,11 @@
2
2
  * @param {Object} [options]
3
3
  * @param {boolean} [options.enableReactCompiler] - Whether to enable React Compiler.
4
4
  * @param {boolean} [options.consistentTypeImports] - Whether to enforce consistent type imports.
5
+ * @param {boolean} [options.materialUi] - Whether to enable Material UI specific rules (mui/material-ui-*).
5
6
  * @returns {import('eslint').Linter.Config[]}
6
7
  */
7
8
  export function createCoreConfig(options?: {
8
9
  enableReactCompiler?: boolean | undefined;
9
10
  consistentTypeImports?: boolean | undefined;
11
+ materialUi?: boolean | undefined;
10
12
  }): import("eslint").Linter.Config[];
@@ -27,7 +27,7 @@ export default rule;
27
27
  * // Usage in ESLint config
28
28
  * {
29
29
  * rules: {
30
- * 'material-ui/consistent-production-guard': 'error'
30
+ * 'mui/consistent-production-guard': 'error'
31
31
  * }
32
32
  * }
33
33
  *
@@ -17,7 +17,7 @@ export default rule;
17
17
  * // Usage in ESLint config
18
18
  * {
19
19
  * rules: {
20
- * 'material-ui/require-dev-wrapper': ['error', {
20
+ * 'mui/require-dev-wrapper': ['error', {
21
21
  * functionNames: ['warnOnce', 'warn', 'checkSlot']
22
22
  * }]
23
23
  * }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mui/internal-code-infra",
3
- "version": "0.0.3-canary.83",
3
+ "version": "0.0.3-canary.85",
4
4
  "description": "Infra scripts and configs to be used across MUI repos.",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -113,9 +113,9 @@
113
113
  "typescript-eslint": "^8.53.0",
114
114
  "unified": "^11.0.5",
115
115
  "yargs": "^18.0.0",
116
- "@mui/internal-babel-plugin-resolve-imports": "2.0.7-canary.31",
117
116
  "@mui/internal-babel-plugin-display-name": "1.0.4-canary.11",
118
- "@mui/internal-babel-plugin-minify-errors": "2.0.8-canary.19"
117
+ "@mui/internal-babel-plugin-minify-errors": "2.0.8-canary.20",
118
+ "@mui/internal-babel-plugin-resolve-imports": "2.0.7-canary.31"
119
119
  },
120
120
  "peerDependencies": {
121
121
  "@next/eslint-plugin-next": "*",
@@ -152,7 +152,7 @@
152
152
  "publishConfig": {
153
153
  "access": "public"
154
154
  },
155
- "gitSha": "6e68af781b80353e25453b2c671e1b75bb8e2787",
155
+ "gitSha": "cf91f1f4fa54651c2c100f6a84f9201675adf0fb",
156
156
  "scripts": {
157
157
  "build": "tsc -p tsconfig.build.json",
158
158
  "typescript": "tsc -p tsconfig.json",
@@ -166,7 +166,7 @@ export default function getBabelConfig(api) {
166
166
  if (api.env) {
167
167
  // legacy
168
168
  bundle = api.env(['regressions', 'stable']) ? 'esm' : 'cjs';
169
- // eslint-disable-next-line material-ui/consistent-production-guard
169
+ // eslint-disable-next-line mui/consistent-production-guard
170
170
  noResolveImports = api.env('test') || process.env.NODE_ENV === 'test';
171
171
  } else {
172
172
  bundle = api.bundle || 'esm';
@@ -12,8 +12,8 @@ import globals from 'globals';
12
12
  import * as path from 'node:path';
13
13
  import * as tseslint from 'typescript-eslint';
14
14
  import fs from 'node:fs';
15
- import { createCoreConfig } from './material-ui/config.mjs';
16
- import muiPlugin from './material-ui/index.mjs';
15
+ import { createCoreConfig } from './mui/config.mjs';
16
+ import muiPlugin from './mui/index.mjs';
17
17
  import { EXTENSION_TS } from './extensions.mjs';
18
18
  import { createJsonConfig } from './jsonConfig.mjs';
19
19
 
@@ -32,12 +32,14 @@ function includeIgnoreIfExists(filePath, description) {
32
32
  * @param {Object} [params]
33
33
  * @param {boolean} [params.enableReactCompiler] - Whether to enable React Compiler.
34
34
  * @param {boolean} [params.consistentTypeImports] - Whether to enforce consistent type imports.
35
+ * @param {boolean} [params.materialUi] - Whether to enable Material UI specific rules (mui/material-ui-*).
35
36
  * @param {string} [params.baseDirectory] - The base directory for the configuration.
36
37
  * @returns {import('eslint').Linter.Config[]}
37
38
  */
38
39
  export function createBaseConfig({
39
40
  enableReactCompiler = false,
40
41
  consistentTypeImports = false,
42
+ materialUi = false,
41
43
  baseDirectory = process.cwd(),
42
44
  } = {}) {
43
45
  return defineConfig([
@@ -70,7 +72,7 @@ export function createBaseConfig({
70
72
  },
71
73
  },
72
74
  plugins: {
73
- 'material-ui': muiPlugin,
75
+ mui: muiPlugin,
74
76
  },
75
77
  settings: {
76
78
  browserslistOpts: {
@@ -79,7 +81,7 @@ export function createBaseConfig({
79
81
  ignoreUnknownVersions: true,
80
82
  },
81
83
  },
82
- extends: createCoreConfig({ enableReactCompiler, consistentTypeImports }),
84
+ extends: createCoreConfig({ enableReactCompiler, consistentTypeImports, materialUi }),
83
85
  },
84
86
  // Lint rule to disallow usage of typescript namespaces.We've seen at least two problems with them:
85
87
  // * Creates non-portable types in base ui. [1]
@@ -303,12 +303,13 @@ const airbnbJsxA11y = {
303
303
  * @param {Object} [options]
304
304
  * @param {boolean} [options.enableReactCompiler] - Whether to enable React Compiler.
305
305
  * @param {boolean} [options.consistentTypeImports] - Whether to enforce consistent type imports.
306
+ * @param {boolean} [options.materialUi] - Whether to enable Material UI specific rules (mui/material-ui-*).
306
307
  * @returns {import('eslint').Linter.Config[]}
307
308
  */
308
309
  export function createCoreConfig(options = {}) {
309
310
  return defineConfig([
310
311
  {
311
- name: 'material-ui-base',
312
+ name: 'mui-base',
312
313
  settings: {
313
314
  'import/resolver': {
314
315
  node: {
@@ -405,13 +406,17 @@ export function createCoreConfig(options = {}) {
405
406
  // We are a library, we need to support it too
406
407
  'jsx-a11y/no-autofocus': 'off',
407
408
 
408
- 'material-ui/docgen-ignore-before-comment': 'error',
409
- 'material-ui/rules-of-use-theme-variants': 'error',
410
- 'material-ui/no-empty-box': 'error',
411
- 'material-ui/no-styled-box': 'error',
412
- 'material-ui/straight-quotes': 'off',
413
- 'material-ui/consistent-production-guard': 'error',
414
- 'material-ui/add-undef-to-optional': 'off',
409
+ 'mui/docgen-ignore-before-comment': 'error',
410
+ ...(options.materialUi
411
+ ? {
412
+ 'mui/material-ui-rules-of-use-theme-variants': 'error',
413
+ 'mui/material-ui-no-empty-box': 'error',
414
+ 'mui/material-ui-no-styled-box': 'error',
415
+ }
416
+ : {}),
417
+ 'mui/straight-quotes': 'off',
418
+ 'mui/consistent-production-guard': 'error',
419
+ 'mui/add-undef-to-optional': 'off',
415
420
 
416
421
  'react-hooks/exhaustive-deps': [
417
422
  'error',
@@ -13,17 +13,17 @@ import addUndefToOptional from './rules/add-undef-to-optional.mjs';
13
13
 
14
14
  export default /** @type {import('eslint').ESLint.Plugin} */ ({
15
15
  meta: {
16
- name: '@mui/eslint-plugin-material-ui',
16
+ name: '@mui/eslint-plugin',
17
17
  version: '0.1.0',
18
18
  },
19
19
  rules: {
20
20
  'consistent-production-guard': consistentProductionGuard,
21
21
  'disallow-active-element-as-key-event-target': disallowActiveElementAsKeyEventTarget,
22
22
  'docgen-ignore-before-comment': docgenIgnoreBeforeComment,
23
- 'mui-name-matches-component-name': muiNameMatchesComponentName,
24
- 'rules-of-use-theme-variants': rulesOfUseThemeVariants,
25
- 'no-empty-box': noEmptyBox,
26
- 'no-styled-box': noStyledBox,
23
+ 'material-ui-name-matches-component-name': muiNameMatchesComponentName,
24
+ 'material-ui-rules-of-use-theme-variants': rulesOfUseThemeVariants,
25
+ 'material-ui-no-empty-box': noEmptyBox,
26
+ 'material-ui-no-styled-box': noStyledBox,
27
27
  'straight-quotes': straightQuotes,
28
28
  'disallow-react-api-in-server-components': disallowReactApiInServerComponents,
29
29
  'no-restricted-resolved-imports': noRestrictedResolvedImports,
@@ -2,7 +2,7 @@ import { ESLintUtils, AST_NODE_TYPES } from '@typescript-eslint/utils';
2
2
 
3
3
  const createRule = ESLintUtils.RuleCreator(
4
4
  (name) =>
5
- `https://github.com/mui/mui-public/blob/master/packages/code-infra/src/eslint/material-ui/rules/${name}.mjs`,
5
+ `https://github.com/mui/mui-public/blob/master/packages/code-infra/src/eslint/mui/rules/${name}.mjs`,
6
6
  );
7
7
 
8
8
  const RULE_NAME = 'add-undef-to-optional';
@@ -28,7 +28,7 @@ import { isProcessEnvNodeEnv, isLiteralEq } from './nodeEnvUtils.mjs';
28
28
  * // Usage in ESLint config
29
29
  * {
30
30
  * rules: {
31
- * 'material-ui/consistent-production-guard': 'error'
31
+ * 'mui/consistent-production-guard': 'error'
32
32
  * }
33
33
  * }
34
34
  *
@@ -18,7 +18,7 @@ import { isProcessEnvNodeEnv, isLiteralEq, isLiteralNeq } from './nodeEnvUtils.m
18
18
  * // Usage in ESLint config
19
19
  * {
20
20
  * rules: {
21
- * 'material-ui/require-dev-wrapper': ['error', {
21
+ * 'mui/require-dev-wrapper': ['error', {
22
22
  * functionNames: ['warnOnce', 'warn', 'checkSlot']
23
23
  * }]
24
24
  * }
@@ -69,8 +69,8 @@ export function createTestConfig(options = {}) {
69
69
  'compat/compat': 'off',
70
70
  // does not work with wildcard imports. Mistakes will throw at runtime anyway
71
71
  'import/named': 'off',
72
- 'material-ui/disallow-active-element-as-key-event-target': 'error',
73
- 'material-ui/consistent-production-guard': 'off',
72
+ 'mui/disallow-active-element-as-key-event-target': 'error',
73
+ 'mui/consistent-production-guard': 'off',
74
74
 
75
75
  // disable eslint-plugin-jsx-a11y
76
76
  // tests are not driven by assistive technology
File without changes