@mui/internal-code-infra 0.0.4-canary.73 → 0.0.4-canary.74

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 (51) hide show
  1. package/package.json +5 -3
  2. package/src/cli/cmdPublish.mjs +32 -3
  3. package/src/brokenLinksChecker/__fixtures__/static-site/broken-links.html +0 -20
  4. package/src/brokenLinksChecker/__fixtures__/static-site/broken-targets.html +0 -22
  5. package/src/brokenLinksChecker/__fixtures__/static-site/example.md +0 -20
  6. package/src/brokenLinksChecker/__fixtures__/static-site/external-links.html +0 -21
  7. package/src/brokenLinksChecker/__fixtures__/static-site/ignored-page.html +0 -17
  8. package/src/brokenLinksChecker/__fixtures__/static-site/index.html +0 -29
  9. package/src/brokenLinksChecker/__fixtures__/static-site/invalid-html.html +0 -15
  10. package/src/brokenLinksChecker/__fixtures__/static-site/known-targets.json +0 -5
  11. package/src/brokenLinksChecker/__fixtures__/static-site/nested/page.html +0 -21
  12. package/src/brokenLinksChecker/__fixtures__/static-site/orphaned-page.html +0 -20
  13. package/src/brokenLinksChecker/__fixtures__/static-site/page-with-api-links.html +0 -20
  14. package/src/brokenLinksChecker/__fixtures__/static-site/page-with-custom-targets.html +0 -24
  15. package/src/brokenLinksChecker/__fixtures__/static-site/page-with-ignored-content.html +0 -28
  16. package/src/brokenLinksChecker/__fixtures__/static-site/page-with-known-target-links.html +0 -19
  17. package/src/brokenLinksChecker/__fixtures__/static-site/unclosed-tags.html +0 -1
  18. package/src/brokenLinksChecker/__fixtures__/static-site/valid.html +0 -20
  19. package/src/brokenLinksChecker/__fixtures__/static-site/with-anchors.html +0 -31
  20. package/src/brokenLinksChecker/index.test.ts +0 -301
  21. package/src/changelog/categorizeCommits.test.ts +0 -319
  22. package/src/changelog/filterCommits.test.ts +0 -363
  23. package/src/changelog/parseCommitLabels.test.ts +0 -509
  24. package/src/changelog/renderChangelog.test.ts +0 -378
  25. package/src/changelog/sortSections.test.ts +0 -199
  26. package/src/cli/cmdVale.test.mjs +0 -644
  27. package/src/eslint/mui/rules/add-undef-to-optional.test.mjs +0 -361
  28. package/src/eslint/mui/rules/consistent-production-guard.test.mjs +0 -162
  29. package/src/eslint/mui/rules/disallow-active-elements-as-key-event-target.test.mjs +0 -66
  30. package/src/eslint/mui/rules/disallow-react-api-in-server-components.test.mjs +0 -305
  31. package/src/eslint/mui/rules/docgen-ignore-before-comment.test.mjs +0 -52
  32. package/src/eslint/mui/rules/flatten-parentheses.test.mjs +0 -245
  33. package/src/eslint/mui/rules/mui-name-matches-component-name.test.mjs +0 -247
  34. package/src/eslint/mui/rules/no-empty-box.test.mjs +0 -40
  35. package/src/eslint/mui/rules/no-floating-cleanup.test.mjs +0 -141
  36. package/src/eslint/mui/rules/no-guarded-throw.test.mjs +0 -206
  37. package/src/eslint/mui/rules/no-presentation-role.test.mjs +0 -33
  38. package/src/eslint/mui/rules/no-styled-box.test.mjs +0 -73
  39. package/src/eslint/mui/rules/require-dev-wrapper.test.mjs +0 -265
  40. package/src/eslint/mui/rules/rules-of-use-theme-variants.test.mjs +0 -149
  41. package/src/eslint/mui/rules/straight-quotes.test.mjs +0 -67
  42. package/src/remark/firstBlockHeading.test.mjs +0 -107
  43. package/src/remark/gitDiff.test.mjs +0 -45
  44. package/src/remark/noSpaceInLinks.test.mjs +0 -22
  45. package/src/remark/straightQuotes.test.mjs +0 -25
  46. package/src/remark/tableAlignment.test.mjs +0 -28
  47. package/src/remark/terminalLanguage.test.mjs +0 -17
  48. package/src/utils/build.test.mjs +0 -1263
  49. package/src/utils/pnpm.test.mjs +0 -731
  50. package/src/utils/template.test.mjs +0 -133
  51. package/src/utils/typescript.test.mjs +0 -341
@@ -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
- });