@mui/internal-code-infra 0.0.4-canary.8 → 0.0.4-canary.80

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 (140) hide show
  1. package/LICENSE +1 -1
  2. package/README.md +19 -8
  3. package/build/babel-config.d.mts +5 -1
  4. package/build/brokenLinksChecker/crawlWorker.d.mts +1 -0
  5. package/build/brokenLinksChecker/index.d.mts +45 -2
  6. package/build/changelog/types.d.ts +1 -1
  7. package/build/cli/cmdArgosPush.d.mts +2 -2
  8. package/build/cli/cmdBuild.d.mts +3 -2
  9. package/build/cli/cmdCopyFiles.d.mts +2 -2
  10. package/build/cli/cmdExtractErrorCodes.d.mts +2 -2
  11. package/build/cli/cmdGenerateChangelog.d.mts +2 -2
  12. package/build/cli/cmdGithubAuth.d.mts +2 -2
  13. package/build/cli/cmdListWorkspaces.d.mts +6 -4
  14. package/build/cli/cmdNetlifyIgnore.d.mts +3 -2
  15. package/build/cli/cmdPublish.d.mts +4 -2
  16. package/build/cli/cmdPublishCanary.d.mts +3 -3
  17. package/build/cli/cmdPublishNewPackage.d.mts +4 -2
  18. package/build/cli/cmdSetVersionOverrides.d.mts +2 -2
  19. package/build/cli/cmdVale.d.mts +46 -0
  20. package/build/cli/cmdValidateBuiltTypes.d.mts +2 -2
  21. package/build/eslint/baseConfig.d.mts +3 -1
  22. package/build/eslint/mui/rules/disallow-react-api-in-server-components.d.mts +2 -2
  23. package/build/eslint/mui/rules/docgen-ignore-before-comment.d.mts +2 -2
  24. package/build/eslint/mui/rules/no-floating-cleanup.d.mts +5 -0
  25. package/build/eslint/mui/rules/no-guarded-throw.d.mts +31 -0
  26. package/build/eslint/mui/rules/no-presentation-role.d.mts +5 -0
  27. package/build/eslint/mui/rules/no-restricted-resolved-imports.d.mts +2 -2
  28. package/build/eslint/mui/rules/nodeEnvUtils.d.mts +18 -0
  29. package/build/remark/config.d.mts +43 -0
  30. package/build/remark/createLintTester.d.mts +10 -0
  31. package/build/remark/firstBlockHeading.d.mts +4 -0
  32. package/build/remark/gitDiff.d.mts +2 -0
  33. package/build/remark/noSpaceInLinks.d.mts +2 -0
  34. package/build/remark/straightQuotes.d.mts +2 -0
  35. package/build/remark/tableAlignment.d.mts +2 -0
  36. package/build/remark/terminalLanguage.d.mts +2 -0
  37. package/build/utils/babel.d.mts +1 -1
  38. package/build/utils/build.d.mts +56 -37
  39. package/build/utils/git.d.mts +7 -0
  40. package/build/utils/github.d.mts +1 -1
  41. package/build/utils/pnpm.d.mts +81 -2
  42. package/build/utils/testUtils.d.mts +7 -0
  43. package/build/utils/typescript.d.mts +6 -16
  44. package/package.json +65 -41
  45. package/src/babel-config.mjs +3 -1
  46. package/src/brokenLinksChecker/crawlWorker.mjs +240 -0
  47. package/src/brokenLinksChecker/index.mjs +263 -188
  48. package/src/changelog/fetchChangelogs.mjs +6 -2
  49. package/src/changelog/renderChangelog.mjs +1 -1
  50. package/src/changelog/types.ts +1 -1
  51. package/src/cli/cmdBuild.mjs +51 -85
  52. package/src/cli/cmdListWorkspaces.mjs +12 -27
  53. package/src/cli/cmdNetlifyIgnore.mjs +34 -93
  54. package/src/cli/cmdPublish.mjs +95 -20
  55. package/src/cli/cmdPublishCanary.mjs +128 -132
  56. package/src/cli/cmdPublishNewPackage.mjs +27 -6
  57. package/src/cli/cmdSetVersionOverrides.mjs +8 -9
  58. package/src/cli/cmdVale.mjs +513 -0
  59. package/src/cli/index.mjs +2 -0
  60. package/src/cli/packageJson.d.ts +1 -1
  61. package/src/eslint/baseConfig.mjs +51 -19
  62. package/src/eslint/docsConfig.mjs +2 -1
  63. package/src/eslint/mui/config.mjs +24 -4
  64. package/src/eslint/mui/index.mjs +6 -0
  65. package/src/eslint/mui/rules/no-floating-cleanup.mjs +187 -0
  66. package/src/eslint/mui/rules/no-guarded-throw.mjs +115 -0
  67. package/src/eslint/mui/rules/no-presentation-role.mjs +60 -0
  68. package/src/eslint/mui/rules/nodeEnvUtils.mjs +52 -0
  69. package/src/eslint/mui/rules/require-dev-wrapper.mjs +25 -40
  70. package/src/estree-typescript.d.ts +1 -1
  71. package/src/remark/config.mjs +157 -0
  72. package/src/remark/createLintTester.mjs +19 -0
  73. package/src/remark/firstBlockHeading.mjs +87 -0
  74. package/src/remark/gitDiff.mjs +43 -0
  75. package/src/remark/noSpaceInLinks.mjs +42 -0
  76. package/src/remark/straightQuotes.mjs +31 -0
  77. package/src/remark/tableAlignment.mjs +23 -0
  78. package/src/remark/terminalLanguage.mjs +19 -0
  79. package/src/untyped-plugins.d.ts +11 -11
  80. package/src/utils/build.mjs +604 -270
  81. package/src/utils/git.mjs +27 -7
  82. package/src/utils/pnpm.mjs +277 -10
  83. package/src/utils/testUtils.mjs +18 -0
  84. package/src/utils/typescript.mjs +23 -42
  85. package/vale/.vale.ini +1 -0
  86. package/vale/styles/MUI/CorrectReferenceAllCases.yml +42 -0
  87. package/vale/styles/MUI/CorrectRererenceCased.yml +14 -0
  88. package/vale/styles/MUI/GoogleLatin.yml +11 -0
  89. package/vale/styles/MUI/MuiBrandName.yml +22 -0
  90. package/vale/styles/MUI/NoBritish.yml +112 -0
  91. package/vale/styles/MUI/NoCompanyName.yml +17 -0
  92. package/build/markdownlint/duplicate-h1.d.mts +0 -56
  93. package/build/markdownlint/git-diff.d.mts +0 -11
  94. package/build/markdownlint/index.d.mts +0 -52
  95. package/build/markdownlint/straight-quotes.d.mts +0 -11
  96. package/build/markdownlint/table-alignment.d.mts +0 -11
  97. package/build/markdownlint/terminal-language.d.mts +0 -11
  98. package/src/brokenLinksChecker/__fixtures__/static-site/broken-links.html +0 -20
  99. package/src/brokenLinksChecker/__fixtures__/static-site/broken-targets.html +0 -22
  100. package/src/brokenLinksChecker/__fixtures__/static-site/example.md +0 -20
  101. package/src/brokenLinksChecker/__fixtures__/static-site/external-links.html +0 -21
  102. package/src/brokenLinksChecker/__fixtures__/static-site/ignored-page.html +0 -17
  103. package/src/brokenLinksChecker/__fixtures__/static-site/index.html +0 -28
  104. package/src/brokenLinksChecker/__fixtures__/static-site/known-targets.json +0 -5
  105. package/src/brokenLinksChecker/__fixtures__/static-site/nested/page.html +0 -21
  106. package/src/brokenLinksChecker/__fixtures__/static-site/orphaned-page.html +0 -20
  107. package/src/brokenLinksChecker/__fixtures__/static-site/page-with-api-links.html +0 -20
  108. package/src/brokenLinksChecker/__fixtures__/static-site/page-with-custom-targets.html +0 -24
  109. package/src/brokenLinksChecker/__fixtures__/static-site/page-with-ignored-content.html +0 -28
  110. package/src/brokenLinksChecker/__fixtures__/static-site/page-with-known-target-links.html +0 -19
  111. package/src/brokenLinksChecker/__fixtures__/static-site/unclosed-tags.html +0 -1
  112. package/src/brokenLinksChecker/__fixtures__/static-site/valid.html +0 -20
  113. package/src/brokenLinksChecker/__fixtures__/static-site/with-anchors.html +0 -31
  114. package/src/brokenLinksChecker/index.test.ts +0 -261
  115. package/src/changelog/categorizeCommits.test.ts +0 -319
  116. package/src/changelog/filterCommits.test.ts +0 -363
  117. package/src/changelog/parseCommitLabels.test.ts +0 -509
  118. package/src/changelog/renderChangelog.test.ts +0 -378
  119. package/src/changelog/sortSections.test.ts +0 -199
  120. package/src/eslint/mui/rules/add-undef-to-optional.test.mjs +0 -361
  121. package/src/eslint/mui/rules/consistent-production-guard.test.mjs +0 -162
  122. package/src/eslint/mui/rules/disallow-active-elements-as-key-event-target.test.mjs +0 -66
  123. package/src/eslint/mui/rules/disallow-react-api-in-server-components.test.mjs +0 -305
  124. package/src/eslint/mui/rules/docgen-ignore-before-comment.test.mjs +0 -52
  125. package/src/eslint/mui/rules/flatten-parentheses.test.mjs +0 -245
  126. package/src/eslint/mui/rules/mui-name-matches-component-name.test.mjs +0 -247
  127. package/src/eslint/mui/rules/no-empty-box.test.mjs +0 -40
  128. package/src/eslint/mui/rules/no-styled-box.test.mjs +0 -73
  129. package/src/eslint/mui/rules/require-dev-wrapper.test.mjs +0 -265
  130. package/src/eslint/mui/rules/rules-of-use-theme-variants.test.mjs +0 -149
  131. package/src/eslint/mui/rules/straight-quotes.test.mjs +0 -67
  132. package/src/markdownlint/duplicate-h1.mjs +0 -69
  133. package/src/markdownlint/git-diff.mjs +0 -31
  134. package/src/markdownlint/index.mjs +0 -62
  135. package/src/markdownlint/straight-quotes.mjs +0 -26
  136. package/src/markdownlint/table-alignment.mjs +0 -42
  137. package/src/markdownlint/terminal-language.mjs +0 -19
  138. package/src/utils/build.test.mjs +0 -705
  139. package/src/utils/template.test.mjs +0 -133
  140. package/src/utils/typescript.test.mjs +0 -380
@@ -1,363 +0,0 @@
1
- import { describe, expect, it } from 'vitest';
2
- // eslint-disable-next-line import/extensions
3
- import { filterCommits } from './filterCommits.mjs';
4
- import type { FetchedCommitDetails, FilterConfig } from './types';
5
-
6
- function createCommit(overrides: Partial<FetchedCommitDetails> = {}): FetchedCommitDetails {
7
- return {
8
- sha: 'abc123',
9
- message: 'test commit',
10
- labels: [],
11
- prNumber: 1,
12
- html_url: 'https://github.com/test/repo/pull/1',
13
- author: {
14
- login: 'testuser',
15
- association: 'contributor',
16
- },
17
- createdAt: '2025-01-01T00:00:00Z',
18
- mergedAt: '2025-01-01T00:00:00Z',
19
- ...overrides,
20
- };
21
- }
22
-
23
- describe('filterCommits', () => {
24
- describe('no filter config', () => {
25
- it('should return all commits when filterConfig is undefined', () => {
26
- const commits = [
27
- createCommit({ sha: '1' }),
28
- createCommit({ sha: '2' }),
29
- createCommit({ sha: '3' }),
30
- ];
31
-
32
- const result = filterCommits(commits, undefined);
33
-
34
- expect(result).toEqual(commits);
35
- });
36
-
37
- it('should return empty array for empty input', () => {
38
- const result = filterCommits([], undefined);
39
-
40
- expect(result).toEqual([]);
41
- });
42
- });
43
-
44
- describe('excludeCommitByAuthors', () => {
45
- it('should exclude commits by author login string match', () => {
46
- const commits = [
47
- createCommit({ sha: '1', author: { login: 'dependabot', association: 'contributor' } }),
48
- createCommit({ sha: '2', author: { login: 'human-user', association: 'contributor' } }),
49
- createCommit({
50
- sha: '3',
51
- author: { login: 'another-dependabot-account', association: 'contributor' },
52
- }),
53
- ];
54
- const filterConfig: FilterConfig = {
55
- excludeCommitByAuthors: ['dependabot'],
56
- };
57
-
58
- const result = filterCommits(commits, filterConfig);
59
-
60
- expect(result.map((c) => c.sha)).toEqual(['2']);
61
- });
62
-
63
- it('should exclude commits by author login regex match', () => {
64
- const commits = [
65
- createCommit({ sha: '1', author: { login: 'renovate[bot]', association: 'contributor' } }),
66
- createCommit({ sha: '2', author: { login: 'human-user', association: 'contributor' } }),
67
- createCommit({
68
- sha: '3',
69
- author: { login: 'dependabot[bot]', association: 'contributor' },
70
- }),
71
- ];
72
- const filterConfig: FilterConfig = {
73
- excludeCommitByAuthors: [/\[bot\]$/],
74
- };
75
-
76
- const result = filterCommits(commits, filterConfig);
77
-
78
- expect(result.map((c) => c.sha)).toEqual(['2']);
79
- });
80
-
81
- it('should handle commits with null author', () => {
82
- const commits = [
83
- createCommit({ sha: '1', author: null }),
84
- createCommit({ sha: '2', author: { login: 'dependabot', association: 'contributor' } }),
85
- createCommit({ sha: '3', author: { login: 'human-user', association: 'contributor' } }),
86
- ];
87
- const filterConfig: FilterConfig = {
88
- excludeCommitByAuthors: ['dependabot'],
89
- };
90
-
91
- const result = filterCommits(commits, filterConfig);
92
-
93
- expect(result.map((c) => c.sha)).toEqual(['1', '3']);
94
- });
95
-
96
- it('should handle multiple author exclusion patterns', () => {
97
- const commits = [
98
- createCommit({
99
- sha: '1',
100
- author: { login: 'dependabot[bot]', association: 'contributor' },
101
- }),
102
- createCommit({ sha: '2', author: { login: 'renovate', association: 'contributor' } }),
103
- createCommit({ sha: '3', author: { login: 'human-user', association: 'contributor' } }),
104
- ];
105
- const filterConfig: FilterConfig = {
106
- excludeCommitByAuthors: [/\[bot\]$/, 'renovate'],
107
- };
108
-
109
- const result = filterCommits(commits, filterConfig);
110
-
111
- expect(result.map((c) => c.sha)).toEqual(['3']);
112
- });
113
-
114
- it('should handle empty excludeCommitByAuthors array', () => {
115
- const commits = [createCommit({ sha: '1' }), createCommit({ sha: '2' })];
116
- const filterConfig: FilterConfig = {
117
- excludeCommitByAuthors: [],
118
- };
119
-
120
- const result = filterCommits(commits, filterConfig);
121
-
122
- expect(result.map((c) => c.sha)).toEqual(['1', '2']);
123
- });
124
- });
125
-
126
- describe('excludeCommitWithLabels', () => {
127
- it('should exclude commits with matching label string', () => {
128
- const commits = [
129
- createCommit({ sha: '1', labels: ['bug', 'skip-changelog'] }),
130
- createCommit({ sha: '2', labels: ['enhancement'] }),
131
- createCommit({ sha: '3', labels: ['internal', 'skip-changelog'] }),
132
- ];
133
- const filterConfig: FilterConfig = {
134
- excludeCommitWithLabels: ['skip-changelog'],
135
- };
136
-
137
- const result = filterCommits(commits, filterConfig);
138
-
139
- expect(result.map((c) => c.sha)).toEqual(['2']);
140
- });
141
-
142
- it('should exclude commits with matching label regex', () => {
143
- const commits = [
144
- createCommit({ sha: '1', labels: ['scope: docs'] }),
145
- createCommit({ sha: '2', labels: ['scope: core'] }),
146
- createCommit({ sha: '3', labels: ['enhancement'] }),
147
- ];
148
- const filterConfig: FilterConfig = {
149
- excludeCommitWithLabels: [/^scope: docs$/],
150
- };
151
-
152
- const result = filterCommits(commits, filterConfig);
153
-
154
- expect(result.map((c) => c.sha)).toEqual(['2', '3']);
155
- });
156
-
157
- it('should handle multiple label exclusion patterns', () => {
158
- const commits = [
159
- createCommit({ sha: '1', labels: ['skip-changelog'] }),
160
- createCommit({ sha: '2', labels: ['internal'] }),
161
- createCommit({ sha: '3', labels: ['enhancement'] }),
162
- createCommit({ sha: '4', labels: ['docs-only'] }),
163
- ];
164
- const filterConfig: FilterConfig = {
165
- excludeCommitWithLabels: ['skip-changelog', 'internal', /docs/],
166
- };
167
-
168
- const result = filterCommits(commits, filterConfig);
169
-
170
- expect(result.map((c) => c.sha)).toEqual(['3']);
171
- });
172
-
173
- it('should handle commits with empty labels array', () => {
174
- const commits = [
175
- createCommit({ sha: '1', labels: [] }),
176
- createCommit({ sha: '2', labels: ['skip-changelog'] }),
177
- ];
178
- const filterConfig: FilterConfig = {
179
- excludeCommitWithLabels: ['skip-changelog'],
180
- };
181
-
182
- const result = filterCommits(commits, filterConfig);
183
-
184
- expect(result.map((c) => c.sha)).toEqual(['1']);
185
- });
186
-
187
- it('should handle empty excludeCommitWithLabels array', () => {
188
- const commits = [
189
- createCommit({ sha: '1', labels: ['any-label'] }),
190
- createCommit({ sha: '2', labels: [] }),
191
- ];
192
- const filterConfig: FilterConfig = {
193
- excludeCommitWithLabels: [],
194
- };
195
-
196
- const result = filterCommits(commits, filterConfig);
197
-
198
- expect(result.map((c) => c.sha)).toEqual(['1', '2']);
199
- });
200
- });
201
-
202
- describe('customFilter', () => {
203
- it('should apply custom filter function', () => {
204
- const commits = [
205
- createCommit({ sha: '1', prNumber: 100 }),
206
- createCommit({ sha: '2', prNumber: 200 }),
207
- createCommit({ sha: '3', prNumber: 300 }),
208
- ];
209
- const filterConfig: FilterConfig = {
210
- customFilter: (commit) => commit.prNumber >= 200,
211
- };
212
-
213
- const result = filterCommits(commits, filterConfig);
214
-
215
- expect(result.map((c) => c.sha)).toEqual(['2', '3']);
216
- });
217
-
218
- it('should apply custom filter after author and label filters', () => {
219
- const commits = [
220
- createCommit({
221
- sha: '1',
222
- author: { login: 'bot', association: 'contributor' },
223
- prNumber: 100,
224
- }),
225
- createCommit({
226
- sha: '2',
227
- author: { login: 'human', association: 'contributor' },
228
- prNumber: 200,
229
- }),
230
- createCommit({
231
- sha: '3',
232
- author: { login: 'human', association: 'contributor' },
233
- prNumber: 300,
234
- }),
235
- ];
236
- const filterConfig: FilterConfig = {
237
- excludeCommitByAuthors: ['bot'],
238
- customFilter: (commit) => commit.prNumber >= 250,
239
- };
240
-
241
- const result = filterCommits(commits, filterConfig);
242
-
243
- // sha: '1' excluded by author filter
244
- // sha: '2' excluded by custom filter (prNumber < 250)
245
- // sha: '3' passes both filters
246
- expect(result.map((c) => c.sha)).toEqual(['3']);
247
- });
248
-
249
- it('should filter based on commit message content', () => {
250
- const commits = [
251
- createCommit({ sha: '1', message: '[skip ci] Update dependencies' }),
252
- createCommit({ sha: '2', message: 'Fix critical bug' }),
253
- createCommit({ sha: '3', message: 'chore: update config [skip ci]' }),
254
- ];
255
- const filterConfig: FilterConfig = {
256
- customFilter: (commit) => !commit.message.includes('[skip ci]'),
257
- };
258
-
259
- const result = filterCommits(commits, filterConfig);
260
-
261
- expect(result.map((c) => c.sha)).toEqual(['2']);
262
- });
263
- });
264
-
265
- describe('combined filters', () => {
266
- it('should apply all filters together', () => {
267
- const commits = [
268
- createCommit({
269
- sha: '1',
270
- author: { login: 'dependabot[bot]', association: 'contributor' },
271
- labels: ['dependencies'],
272
- }),
273
- createCommit({
274
- sha: '2',
275
- author: { login: 'human', association: 'team' },
276
- labels: ['skip-changelog'],
277
- }),
278
- createCommit({
279
- sha: '3',
280
- author: { login: 'human', association: 'team' },
281
- labels: ['bug'],
282
- prNumber: 50,
283
- }),
284
- createCommit({
285
- sha: '4',
286
- author: { login: 'human', association: 'contributor' },
287
- labels: ['enhancement'],
288
- prNumber: 200,
289
- }),
290
- ];
291
- const filterConfig: FilterConfig = {
292
- excludeCommitByAuthors: [/\[bot\]$/],
293
- excludeCommitWithLabels: ['skip-changelog'],
294
- customFilter: (commit) => commit.prNumber >= 100,
295
- };
296
-
297
- const result = filterCommits(commits, filterConfig);
298
-
299
- // sha: '1' excluded by author filter (bot)
300
- // sha: '2' excluded by label filter (skip-changelog)
301
- // sha: '3' excluded by custom filter (prNumber < 100)
302
- // sha: '4' passes all filters
303
- expect(result.map((c) => c.sha)).toEqual(['4']);
304
- });
305
-
306
- it('should return empty array when all commits are filtered', () => {
307
- const commits = [
308
- createCommit({ sha: '1', author: { login: 'bot', association: 'contributor' } }),
309
- createCommit({ sha: '2', labels: ['internal'] }),
310
- ];
311
- const filterConfig: FilterConfig = {
312
- excludeCommitByAuthors: ['bot'],
313
- excludeCommitWithLabels: ['internal'],
314
- };
315
-
316
- const result = filterCommits(commits, filterConfig);
317
-
318
- expect(result).toEqual([]);
319
- });
320
- });
321
-
322
- describe('edge cases', () => {
323
- it('should not mutate the original commits array', () => {
324
- const commits = [
325
- createCommit({ sha: '1', author: { login: 'bot', association: 'contributor' } }),
326
- createCommit({ sha: '2', author: { login: 'human', association: 'contributor' } }),
327
- ];
328
- const originalLength = commits.length;
329
- const filterConfig: FilterConfig = {
330
- excludeCommitByAuthors: ['bot'],
331
- };
332
-
333
- filterCommits(commits, filterConfig);
334
-
335
- expect(commits.length).toBe(originalLength);
336
- });
337
-
338
- it('should handle filterConfig with no filter properties set', () => {
339
- const commits = [createCommit({ sha: '1' }), createCommit({ sha: '2' })];
340
- const filterConfig: FilterConfig = {};
341
-
342
- const result = filterCommits(commits, filterConfig);
343
-
344
- expect(result.map((c) => c.sha)).toEqual(['1', '2']);
345
- });
346
-
347
- it('should use substring matching for string patterns in author exclusion', () => {
348
- const commits = [
349
- createCommit({ sha: '1', author: { login: 'my-bot-account', association: 'contributor' } }),
350
- createCommit({ sha: '2', author: { login: 'botuser', association: 'contributor' } }),
351
- createCommit({ sha: '3', author: { login: 'human', association: 'contributor' } }),
352
- ];
353
- const filterConfig: FilterConfig = {
354
- excludeCommitByAuthors: ['bot'],
355
- };
356
-
357
- const result = filterCommits(commits, filterConfig);
358
-
359
- // Both 'my-bot-account' and 'botuser' contain 'bot'
360
- expect(result.map((c) => c.sha)).toEqual(['3']);
361
- });
362
- });
363
- });