@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.
- package/build/eslint/baseConfig.d.mts +3 -1
- package/build/eslint/{material-ui → mui}/config.d.mts +2 -0
- package/build/eslint/{material-ui → mui}/rules/consistent-production-guard.d.mts +1 -1
- package/build/eslint/{material-ui → mui}/rules/require-dev-wrapper.d.mts +1 -1
- package/package.json +4 -4
- package/src/babel-config.mjs +1 -1
- package/src/eslint/baseConfig.mjs +6 -4
- package/src/eslint/{material-ui → mui}/config.mjs +13 -8
- package/src/eslint/{material-ui → mui}/index.mjs +5 -5
- package/src/eslint/{material-ui → mui}/rules/add-undef-to-optional.mjs +1 -1
- package/src/eslint/{material-ui → mui}/rules/consistent-production-guard.mjs +1 -1
- package/src/eslint/{material-ui → mui}/rules/require-dev-wrapper.mjs +1 -1
- package/src/eslint/testConfig.mjs +2 -2
- /package/build/eslint/{material-ui → mui}/index.d.mts +0 -0
- /package/build/eslint/{material-ui → mui}/rules/add-undef-to-optional.d.mts +0 -0
- /package/build/eslint/{material-ui → mui}/rules/disallow-active-element-as-key-event-target.d.mts +0 -0
- /package/build/eslint/{material-ui → mui}/rules/disallow-react-api-in-server-components.d.mts +0 -0
- /package/build/eslint/{material-ui → mui}/rules/docgen-ignore-before-comment.d.mts +0 -0
- /package/build/eslint/{material-ui → mui}/rules/mui-name-matches-component-name.d.mts +0 -0
- /package/build/eslint/{material-ui → mui}/rules/no-empty-box.d.mts +0 -0
- /package/build/eslint/{material-ui → mui}/rules/no-restricted-resolved-imports.d.mts +0 -0
- /package/build/eslint/{material-ui → mui}/rules/no-styled-box.d.mts +0 -0
- /package/build/eslint/{material-ui → mui}/rules/nodeEnvUtils.d.mts +0 -0
- /package/build/eslint/{material-ui → mui}/rules/rules-of-use-theme-variants.d.mts +0 -0
- /package/build/eslint/{material-ui → mui}/rules/straight-quotes.d.mts +0 -0
- /package/src/eslint/{material-ui → mui}/rules/add-undef-to-optional.test.mjs +0 -0
- /package/src/eslint/{material-ui → mui}/rules/consistent-production-guard.test.mjs +0 -0
- /package/src/eslint/{material-ui → mui}/rules/disallow-active-element-as-key-event-target.mjs +0 -0
- /package/src/eslint/{material-ui → mui}/rules/disallow-active-elements-as-key-event-target.test.mjs +0 -0
- /package/src/eslint/{material-ui → mui}/rules/disallow-react-api-in-server-components.mjs +0 -0
- /package/src/eslint/{material-ui → mui}/rules/disallow-react-api-in-server-components.test.mjs +0 -0
- /package/src/eslint/{material-ui → mui}/rules/docgen-ignore-before-comment.mjs +0 -0
- /package/src/eslint/{material-ui → mui}/rules/docgen-ignore-before-comment.test.mjs +0 -0
- /package/src/eslint/{material-ui → mui}/rules/mui-name-matches-component-name.mjs +0 -0
- /package/src/eslint/{material-ui → mui}/rules/mui-name-matches-component-name.test.mjs +0 -0
- /package/src/eslint/{material-ui → mui}/rules/no-empty-box.mjs +0 -0
- /package/src/eslint/{material-ui → mui}/rules/no-empty-box.test.mjs +0 -0
- /package/src/eslint/{material-ui → mui}/rules/no-restricted-resolved-imports.mjs +0 -0
- /package/src/eslint/{material-ui → mui}/rules/no-styled-box.mjs +0 -0
- /package/src/eslint/{material-ui → mui}/rules/no-styled-box.test.mjs +0 -0
- /package/src/eslint/{material-ui → mui}/rules/nodeEnvUtils.mjs +0 -0
- /package/src/eslint/{material-ui → mui}/rules/require-dev-wrapper.test.mjs +0 -0
- /package/src/eslint/{material-ui → mui}/rules/rules-of-use-theme-variants.mjs +0 -0
- /package/src/eslint/{material-ui → mui}/rules/rules-of-use-theme-variants.test.mjs +0 -0
- /package/src/eslint/{material-ui → mui}/rules/straight-quotes.mjs +0 -0
- /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[];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mui/internal-code-infra",
|
|
3
|
-
"version": "0.0.3-canary.
|
|
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.
|
|
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": "
|
|
155
|
+
"gitSha": "cf91f1f4fa54651c2c100f6a84f9201675adf0fb",
|
|
156
156
|
"scripts": {
|
|
157
157
|
"build": "tsc -p tsconfig.build.json",
|
|
158
158
|
"typescript": "tsc -p tsconfig.json",
|
package/src/babel-config.mjs
CHANGED
|
@@ -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
|
|
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 './
|
|
16
|
-
import muiPlugin from './
|
|
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
|
-
|
|
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: '
|
|
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
|
-
'
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
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
|
|
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
|
-
'
|
|
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/
|
|
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';
|
|
@@ -18,7 +18,7 @@ import { isProcessEnvNodeEnv, isLiteralEq, isLiteralNeq } from './nodeEnvUtils.m
|
|
|
18
18
|
* // Usage in ESLint config
|
|
19
19
|
* {
|
|
20
20
|
* rules: {
|
|
21
|
-
* '
|
|
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
|
-
'
|
|
73
|
-
'
|
|
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
|
|
File without changes
|
/package/build/eslint/{material-ui → mui}/rules/disallow-active-element-as-key-event-target.d.mts
RENAMED
|
File without changes
|
/package/build/eslint/{material-ui → mui}/rules/disallow-react-api-in-server-components.d.mts
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
/package/src/eslint/{material-ui → mui}/rules/disallow-active-element-as-key-event-target.mjs
RENAMED
|
File without changes
|
/package/src/eslint/{material-ui → mui}/rules/disallow-active-elements-as-key-event-target.test.mjs
RENAMED
|
File without changes
|
|
File without changes
|
/package/src/eslint/{material-ui → mui}/rules/disallow-react-api-in-server-components.test.mjs
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|