@mui/internal-code-infra 0.0.2-canary.2 → 0.0.2-canary.3
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/package.json +4 -5
- package/src/eslint/airbnb/base.mjs +109 -14
- package/src/eslint/baseConfig.mjs +4 -3
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mui/internal-code-infra",
|
|
3
|
-
"version": "0.0.2-canary.
|
|
3
|
+
"version": "0.0.2-canary.3",
|
|
4
4
|
"description": "Infra scripts and configs to be used across MUI repos.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"repository": {
|
|
@@ -19,11 +19,10 @@
|
|
|
19
19
|
}
|
|
20
20
|
},
|
|
21
21
|
"dependencies": {
|
|
22
|
-
"@eslint/eslintrc": "^3.3.1",
|
|
23
22
|
"eslint-config-airbnb": "^19.0.4",
|
|
24
23
|
"eslint-config-airbnb-base": "^15.0.0",
|
|
25
24
|
"eslint-config-prettier": "^10.1.5",
|
|
26
|
-
"eslint-import-resolver-typescript": "^4.4.
|
|
25
|
+
"eslint-import-resolver-typescript": "^4.4.4",
|
|
27
26
|
"eslint-module-utils": "^2.12.1",
|
|
28
27
|
"eslint-plugin-import": "^2.32.0",
|
|
29
28
|
"eslint-plugin-jsx-a11y": "^6.10.2",
|
|
@@ -35,7 +34,7 @@
|
|
|
35
34
|
"@next/eslint-plugin-next": "^15.0.0",
|
|
36
35
|
"globals": "^16.2.0",
|
|
37
36
|
"minimatch": "^10.0.3",
|
|
38
|
-
"typescript-eslint": "^8.35.
|
|
37
|
+
"typescript-eslint": "^8.35.1"
|
|
39
38
|
},
|
|
40
39
|
"peerDependencies": {
|
|
41
40
|
"eslint": "^9.0.0",
|
|
@@ -61,7 +60,7 @@
|
|
|
61
60
|
"publishConfig": {
|
|
62
61
|
"access": "public"
|
|
63
62
|
},
|
|
64
|
-
"gitSha": "
|
|
63
|
+
"gitSha": "1c8c4a4b8bf8b6b3c54d8333c43a098a7c7d84f8",
|
|
65
64
|
"scripts": {
|
|
66
65
|
"typescript": "tsc -p tsconfig.json",
|
|
67
66
|
"test": "pnpm -w test --project @mui/internal-code-infra"
|
|
@@ -1,18 +1,113 @@
|
|
|
1
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Reassembles the ESLint Airbnb base configuration for usage with
|
|
3
|
+
* flat Eslint configuration.
|
|
4
|
+
*/
|
|
5
|
+
import baseBestPractices from 'eslint-config-airbnb-base/rules/best-practices';
|
|
6
|
+
import baseErrors from 'eslint-config-airbnb-base/rules/errors';
|
|
7
|
+
import baseEs6 from 'eslint-config-airbnb-base/rules/es6';
|
|
8
|
+
import baseImports from 'eslint-config-airbnb-base/rules/imports';
|
|
9
|
+
import baseNode from 'eslint-config-airbnb-base/rules/node';
|
|
10
|
+
import baseStrict from 'eslint-config-airbnb-base/rules/strict';
|
|
11
|
+
import baseStyle from 'eslint-config-airbnb-base/rules/style';
|
|
12
|
+
import baseVariables from 'eslint-config-airbnb-base/rules/variables';
|
|
13
|
+
import airbnbReact from 'eslint-config-airbnb/rules/react';
|
|
14
|
+
import airbnbReactA11y from 'eslint-config-airbnb/rules/react-a11y';
|
|
15
|
+
import eslintPluginImport from 'eslint-plugin-import';
|
|
16
|
+
import eslintPluginJsxA11y from 'eslint-plugin-jsx-a11y';
|
|
17
|
+
import eslintPluginReact from 'eslint-plugin-react';
|
|
18
|
+
|
|
19
|
+
import globals from 'globals';
|
|
2
20
|
import * as tseslint from 'typescript-eslint';
|
|
3
21
|
|
|
22
|
+
const baseES6Plugin = {
|
|
23
|
+
languageOptions: {
|
|
24
|
+
globals: {
|
|
25
|
+
...globals.es2016,
|
|
26
|
+
},
|
|
27
|
+
parserOptions: baseEs6.parserOptions,
|
|
28
|
+
},
|
|
29
|
+
rules: baseEs6.rules,
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
const baseImportPlugin = {
|
|
33
|
+
languageOptions: {
|
|
34
|
+
globals: {
|
|
35
|
+
...globals.es2016,
|
|
36
|
+
},
|
|
37
|
+
parserOptions: baseImports.parserOptions,
|
|
38
|
+
},
|
|
39
|
+
settings: baseImports.settings,
|
|
40
|
+
rules: baseImports.rules,
|
|
41
|
+
plugins: {
|
|
42
|
+
import: eslintPluginImport,
|
|
43
|
+
},
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
const baseNodePlugin = {
|
|
47
|
+
languageOptions: {
|
|
48
|
+
globals: {
|
|
49
|
+
...globals.node,
|
|
50
|
+
},
|
|
51
|
+
},
|
|
52
|
+
rules: baseNode.rules,
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
export const airbnbBaseConfig = /** @type {import('eslint').Linter.Config[]} */ (
|
|
56
|
+
tseslint.config(
|
|
57
|
+
{
|
|
58
|
+
name: 'base-best-practices',
|
|
59
|
+
...baseBestPractices,
|
|
60
|
+
},
|
|
61
|
+
{
|
|
62
|
+
name: 'base-errors',
|
|
63
|
+
...baseErrors,
|
|
64
|
+
},
|
|
65
|
+
{
|
|
66
|
+
name: 'base-node',
|
|
67
|
+
...baseNodePlugin,
|
|
68
|
+
},
|
|
69
|
+
{ name: 'base-style', ...baseStyle },
|
|
70
|
+
{ name: 'base-variables', ...baseVariables },
|
|
71
|
+
{ name: 'base-es6-plugin', ...baseES6Plugin },
|
|
72
|
+
{ name: 'base-import-plugin', ...baseImportPlugin },
|
|
73
|
+
{ name: 'base-strict', ...baseStrict },
|
|
74
|
+
)
|
|
75
|
+
);
|
|
76
|
+
|
|
4
77
|
/**
|
|
5
|
-
* @
|
|
6
|
-
* @param {string} [options.baseDirectory] - The base directory for the configuration.
|
|
7
|
-
* @returns {import('eslint').Linter.Config[]}
|
|
78
|
+
* @type {import('typescript-eslint').InfiniteDepthConfigWithExtends}
|
|
8
79
|
*/
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
80
|
+
const airbnbReactPlugin = {
|
|
81
|
+
languageOptions: {
|
|
82
|
+
parserOptions: {
|
|
83
|
+
ecmaFeatures: {
|
|
84
|
+
jsx: true,
|
|
85
|
+
},
|
|
86
|
+
},
|
|
87
|
+
},
|
|
88
|
+
plugins: {
|
|
89
|
+
react: eslintPluginReact,
|
|
90
|
+
},
|
|
91
|
+
rules: airbnbReact.rules,
|
|
92
|
+
};
|
|
93
|
+
|
|
94
|
+
const airbnbReactA11yPlugin = {
|
|
95
|
+
plugins: {
|
|
96
|
+
'jsx-a11y': eslintPluginJsxA11y,
|
|
97
|
+
},
|
|
98
|
+
languageOptions: {
|
|
99
|
+
parserOptions: {
|
|
100
|
+
ecmaFeatures: {
|
|
101
|
+
jsx: true,
|
|
102
|
+
},
|
|
103
|
+
},
|
|
104
|
+
},
|
|
105
|
+
rules: airbnbReactA11y.rules,
|
|
106
|
+
};
|
|
107
|
+
|
|
108
|
+
export const airbnbReactConfig = /** @type {import('eslint').Linter.Config[]} */ (
|
|
109
|
+
tseslint.config(
|
|
110
|
+
{ name: 'airbnb-react', ...airbnbReactPlugin },
|
|
111
|
+
{ name: 'airbnb-react-a11y', ...airbnbReactA11yPlugin },
|
|
112
|
+
)
|
|
113
|
+
);
|
|
@@ -4,7 +4,7 @@ import { configs as reactHookConfigs } from 'eslint-plugin-react-hooks';
|
|
|
4
4
|
import globals from 'globals';
|
|
5
5
|
import * as tseslint from 'typescript-eslint';
|
|
6
6
|
|
|
7
|
-
import {
|
|
7
|
+
import { airbnbBaseConfig, airbnbReactConfig } from './airbnb/base.mjs';
|
|
8
8
|
import airbnbTypescript from './airbnb/typescript.mjs';
|
|
9
9
|
import { createCoreConfig } from './material-ui/config.mjs';
|
|
10
10
|
import muiPlugin from './material-ui/index.mjs';
|
|
@@ -14,10 +14,11 @@ import muiPlugin from './material-ui/index.mjs';
|
|
|
14
14
|
* @param {string} [params.baseDirectory] - The base directory for the configuration.
|
|
15
15
|
* @returns {import('eslint').Linter.Config[]}
|
|
16
16
|
*/
|
|
17
|
-
export function createBaseConfig({ enableReactCompiler = false
|
|
17
|
+
export function createBaseConfig({ enableReactCompiler = false } = {}) {
|
|
18
18
|
return /** @type {import('eslint').Linter.Config[]} */ (
|
|
19
19
|
tseslint.config(
|
|
20
|
-
|
|
20
|
+
airbnbBaseConfig,
|
|
21
|
+
airbnbReactConfig,
|
|
21
22
|
airbnbTypescript,
|
|
22
23
|
reactHookConfigs.recommended,
|
|
23
24
|
enableReactCompiler ? reactCompilerPlugin.configs.recommended : {},
|