@mui/internal-code-infra 0.0.2-canary.46 → 0.0.2-canary.48
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 +5 -5
- package/src/cli/cmdJsonLint.mjs +26 -30
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.48",
|
|
4
4
|
"description": "Infra scripts and configs to be used across MUI repos.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -46,7 +46,7 @@
|
|
|
46
46
|
"eslint-plugin-mocha": "^11.1.0",
|
|
47
47
|
"eslint-plugin-react": "^7.37.5",
|
|
48
48
|
"eslint-plugin-react-compiler": "^19.1.0-rc.2",
|
|
49
|
-
"eslint-plugin-react-hooks": "^6.0.0-
|
|
49
|
+
"eslint-plugin-react-hooks": "^6.0.0-rc1",
|
|
50
50
|
"eslint-plugin-testing-library": "^7.6.6",
|
|
51
51
|
"execa": "^7.2.0",
|
|
52
52
|
"git-url-parse": "^16.1.0",
|
|
@@ -58,8 +58,8 @@
|
|
|
58
58
|
"typescript-eslint": "^8.39.1",
|
|
59
59
|
"yargs": "^18.0.0",
|
|
60
60
|
"@mui/internal-babel-plugin-display-name": "1.0.4-canary.4",
|
|
61
|
-
"@mui/internal-babel-plugin-
|
|
62
|
-
"@mui/internal-babel-plugin-
|
|
61
|
+
"@mui/internal-babel-plugin-resolve-imports": "2.0.7-canary.16",
|
|
62
|
+
"@mui/internal-babel-plugin-minify-errors": "2.0.8-canary.6"
|
|
63
63
|
},
|
|
64
64
|
"peerDependencies": {
|
|
65
65
|
"eslint": "^9.0.0",
|
|
@@ -89,7 +89,7 @@
|
|
|
89
89
|
"publishConfig": {
|
|
90
90
|
"access": "public"
|
|
91
91
|
},
|
|
92
|
-
"gitSha": "
|
|
92
|
+
"gitSha": "5db8d84581f8b8e06427ef5b997322bec20cf97f",
|
|
93
93
|
"scripts": {
|
|
94
94
|
"typescript": "tsc -p tsconfig.json",
|
|
95
95
|
"test": "pnpm -w test --project @mui/internal-code-infra",
|
package/src/cli/cmdJsonLint.mjs
CHANGED
|
@@ -33,46 +33,42 @@ export default /** @type {import('yargs').CommandModule<{}, Args>} */ ({
|
|
|
33
33
|
},
|
|
34
34
|
handler: async (args) => {
|
|
35
35
|
const cwd = process.cwd();
|
|
36
|
-
const lintIgnoreContent = await (async () => {
|
|
37
|
-
// Reads both for backwards compatibility in the desired order
|
|
38
|
-
for (const ignoreFile of ['.lintignore', '.eslintignore']) {
|
|
39
|
-
const lintIgnorePath = path.join(cwd, ignoreFile);
|
|
40
|
-
try {
|
|
41
|
-
// eslint-disable-next-line no-await-in-loop
|
|
42
|
-
return await fs.readFile(lintIgnorePath, { encoding: 'utf8' });
|
|
43
|
-
} catch (ex) {
|
|
44
|
-
console.error(ex);
|
|
45
|
-
continue;
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
return '';
|
|
49
|
-
})();
|
|
50
|
-
|
|
51
|
-
const lintignore = lintIgnoreContent.split(/\r?\n/).filter(Boolean);
|
|
52
36
|
|
|
53
37
|
const filenames = await globby('**/*.json', {
|
|
54
38
|
cwd,
|
|
55
39
|
gitignore: true,
|
|
56
|
-
|
|
40
|
+
ignoreFiles: ['.lintignore'],
|
|
41
|
+
ignore: ['**/tsconfig*.json'],
|
|
57
42
|
followSymbolicLinks: false,
|
|
58
43
|
});
|
|
59
44
|
|
|
45
|
+
const fileIterator = filenames[Symbol.iterator]();
|
|
46
|
+
const concurrency = Math.min(20, filenames.length);
|
|
60
47
|
let passed = true;
|
|
61
|
-
const
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
48
|
+
const workers = [];
|
|
49
|
+
|
|
50
|
+
for (let i = 0; i < concurrency; i += 1) {
|
|
51
|
+
// eslint-disable-next-line @typescript-eslint/no-loop-func
|
|
52
|
+
const worker = Promise.resolve().then(async () => {
|
|
53
|
+
for (const filename of fileIterator) {
|
|
54
|
+
// eslint-disable-next-line no-await-in-loop
|
|
55
|
+
const content = await fs.readFile(path.join(cwd, filename), { encoding: 'utf8' });
|
|
56
|
+
try {
|
|
57
|
+
JSON.parse(content);
|
|
58
|
+
if (!args.silent) {
|
|
59
|
+
// eslint-disable-next-line no-console
|
|
60
|
+
console.log(passMessage(filename));
|
|
61
|
+
}
|
|
62
|
+
} catch (error) {
|
|
63
|
+
passed = false;
|
|
64
|
+
console.error(failMessage(`Error parsing ${filename}:\n\n${String(error)}`));
|
|
65
|
+
}
|
|
68
66
|
}
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
}
|
|
73
|
-
});
|
|
67
|
+
});
|
|
68
|
+
workers.push(worker);
|
|
69
|
+
}
|
|
74
70
|
|
|
75
|
-
await Promise.allSettled(
|
|
71
|
+
await Promise.allSettled(workers);
|
|
76
72
|
if (!passed) {
|
|
77
73
|
throw new Error('❌ At least one file did not pass. Check the console output');
|
|
78
74
|
}
|