@mui/internal-code-infra 0.0.4-canary.6 → 0.0.4-canary.61
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/LICENSE +1 -1
- package/README.md +19 -8
- package/build/babel-config.d.mts +11 -3
- package/build/brokenLinksChecker/crawlWorker.d.mts +1 -0
- package/build/brokenLinksChecker/index.d.mts +45 -2
- package/build/changelog/types.d.ts +1 -1
- package/build/cli/cmdArgosPush.d.mts +2 -2
- package/build/cli/cmdBuild.d.mts +3 -2
- package/build/cli/cmdCopyFiles.d.mts +2 -2
- package/build/cli/cmdExtractErrorCodes.d.mts +2 -2
- package/build/cli/cmdGenerateChangelog.d.mts +2 -2
- package/build/cli/cmdGithubAuth.d.mts +2 -2
- package/build/cli/cmdListWorkspaces.d.mts +6 -4
- package/build/cli/cmdNetlifyIgnore.d.mts +3 -2
- package/build/cli/cmdPublish.d.mts +4 -2
- package/build/cli/cmdPublishCanary.d.mts +3 -3
- package/build/cli/cmdPublishNewPackage.d.mts +4 -2
- package/build/cli/cmdSetVersionOverrides.d.mts +2 -2
- package/build/cli/cmdVale.d.mts +46 -0
- package/build/cli/cmdValidateBuiltTypes.d.mts +2 -2
- package/build/eslint/baseConfig.d.mts +3 -1
- package/build/eslint/mui/rules/disallow-react-api-in-server-components.d.mts +2 -2
- package/build/eslint/mui/rules/docgen-ignore-before-comment.d.mts +2 -2
- package/build/eslint/mui/rules/no-guarded-throw.d.mts +31 -0
- package/build/eslint/mui/rules/no-presentation-role.d.mts +5 -0
- package/build/eslint/mui/rules/no-restricted-resolved-imports.d.mts +2 -2
- package/build/eslint/mui/rules/nodeEnvUtils.d.mts +18 -0
- package/build/markdownlint/duplicate-h1.d.mts +1 -1
- package/build/markdownlint/git-diff.d.mts +1 -1
- package/build/markdownlint/index.d.mts +1 -1
- package/build/markdownlint/straight-quotes.d.mts +1 -1
- package/build/markdownlint/table-alignment.d.mts +1 -1
- package/build/markdownlint/terminal-language.d.mts +1 -1
- package/build/remark/config.d.mts +43 -0
- package/build/remark/createLintTester.d.mts +10 -0
- package/build/remark/firstBlockHeading.d.mts +4 -0
- package/build/remark/gitDiff.d.mts +2 -0
- package/build/remark/noSpaceInLinks.d.mts +2 -0
- package/build/remark/straightQuotes.d.mts +2 -0
- package/build/remark/tableAlignment.d.mts +2 -0
- package/build/remark/terminalLanguage.d.mts +2 -0
- package/build/utils/babel.d.mts +1 -1
- package/build/utils/build.d.mts +61 -25
- package/build/utils/github.d.mts +1 -1
- package/build/utils/pnpm.d.mts +68 -2
- package/build/utils/testUtils.d.mts +7 -0
- package/build/utils/typescript.d.mts +2 -2
- package/package.json +61 -34
- package/src/babel-config.mjs +9 -3
- package/src/brokenLinksChecker/__fixtures__/static-site/index.html +1 -0
- package/src/brokenLinksChecker/__fixtures__/static-site/invalid-html.html +15 -0
- package/src/brokenLinksChecker/crawlWorker.mjs +217 -0
- package/src/brokenLinksChecker/index.mjs +217 -164
- package/src/brokenLinksChecker/index.test.ts +50 -13
- package/src/changelog/categorizeCommits.test.ts +5 -5
- package/src/changelog/fetchChangelogs.mjs +6 -2
- package/src/changelog/parseCommitLabels.test.ts +5 -5
- package/src/changelog/renderChangelog.mjs +1 -1
- package/src/changelog/types.ts +1 -1
- package/src/cli/cmdBuild.mjs +39 -16
- package/src/cli/cmdListWorkspaces.mjs +12 -27
- package/src/cli/cmdNetlifyIgnore.mjs +34 -93
- package/src/cli/cmdPublish.mjs +55 -15
- package/src/cli/cmdPublishCanary.mjs +128 -132
- package/src/cli/cmdPublishNewPackage.mjs +27 -6
- package/src/cli/cmdVale.mjs +513 -0
- package/src/cli/cmdVale.test.mjs +644 -0
- package/src/cli/index.mjs +2 -0
- package/src/cli/packageJson.d.ts +1 -1
- package/src/eslint/baseConfig.mjs +53 -20
- package/src/eslint/docsConfig.mjs +4 -2
- package/src/eslint/jsonConfig.mjs +2 -1
- package/src/eslint/mui/config.mjs +24 -4
- package/src/eslint/mui/index.mjs +4 -0
- package/src/eslint/mui/rules/no-guarded-throw.mjs +115 -0
- package/src/eslint/mui/rules/no-guarded-throw.test.mjs +206 -0
- package/src/eslint/mui/rules/no-presentation-role.mjs +60 -0
- package/src/eslint/mui/rules/no-presentation-role.test.mjs +33 -0
- package/src/eslint/mui/rules/nodeEnvUtils.mjs +52 -0
- package/src/eslint/mui/rules/require-dev-wrapper.mjs +25 -40
- package/src/eslint/testConfig.mjs +2 -1
- package/src/estree-typescript.d.ts +1 -1
- package/src/remark/config.mjs +157 -0
- package/src/remark/createLintTester.mjs +19 -0
- package/src/remark/firstBlockHeading.mjs +87 -0
- package/src/remark/firstBlockHeading.test.mjs +107 -0
- package/src/remark/gitDiff.mjs +43 -0
- package/src/remark/gitDiff.test.mjs +45 -0
- package/src/remark/noSpaceInLinks.mjs +42 -0
- package/src/remark/noSpaceInLinks.test.mjs +22 -0
- package/src/remark/straightQuotes.mjs +31 -0
- package/src/remark/straightQuotes.test.mjs +25 -0
- package/src/remark/tableAlignment.mjs +23 -0
- package/src/remark/tableAlignment.test.mjs +28 -0
- package/src/remark/terminalLanguage.mjs +19 -0
- package/src/remark/terminalLanguage.test.mjs +17 -0
- package/src/untyped-plugins.d.ts +11 -11
- package/src/utils/build.mjs +621 -256
- package/src/utils/build.test.mjs +1064 -485
- package/src/utils/git.mjs +16 -7
- package/src/utils/pnpm.mjs +192 -3
- package/src/utils/pnpm.test.mjs +580 -0
- package/src/utils/testUtils.mjs +18 -0
- package/src/utils/typescript.test.mjs +249 -272
- package/vale/.vale.ini +1 -0
- package/vale/styles/MUI/CorrectReferenceAllCases.yml +43 -0
- package/vale/styles/MUI/CorrectRererenceCased.yml +14 -0
- package/vale/styles/MUI/GoogleLatin.yml +11 -0
- package/vale/styles/MUI/MuiBrandName.yml +22 -0
- package/vale/styles/MUI/NoBritish.yml +112 -0
- package/vale/styles/MUI/NoCompanyName.yml +17 -0
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { describe, it, expect } from 'vitest';
|
|
2
|
+
import { createLintTester } from './createLintTester.mjs';
|
|
3
|
+
import plugin from './noSpaceInLinks.mjs';
|
|
4
|
+
|
|
5
|
+
const lint = createLintTester(plugin);
|
|
6
|
+
|
|
7
|
+
describe('remark-lint-mui-no-space-in-links', () => {
|
|
8
|
+
it('accepts links without surrounding whitespace', () => {
|
|
9
|
+
expect(lint(`[link text](https://example.com)\n`)).toEqual([]);
|
|
10
|
+
expect(lint(`Some [inline](https://example.com) text.\n`)).toEqual([]);
|
|
11
|
+
});
|
|
12
|
+
|
|
13
|
+
it('flags leading whitespace in link text', () => {
|
|
14
|
+
const messages = lint(`[ link text ](https://example.com)\n`);
|
|
15
|
+
expect(messages).toHaveLength(1);
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
it('flags trailing whitespace in link text', () => {
|
|
19
|
+
const messages = lint(`[trailing ](https://example.com)\n`);
|
|
20
|
+
expect(messages).toHaveLength(1);
|
|
21
|
+
});
|
|
22
|
+
});
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { lintRule } from 'unified-lint-rule';
|
|
2
|
+
|
|
3
|
+
const curlyQuotes = new Set(['‘', '’', '“', '”']);
|
|
4
|
+
|
|
5
|
+
const remarkLintMuiStraightQuotes = lintRule(
|
|
6
|
+
{
|
|
7
|
+
origin: 'remark-lint:mui-straight-quotes',
|
|
8
|
+
url: 'https://github.com/mui/mui-public',
|
|
9
|
+
},
|
|
10
|
+
/** @param {import('mdast').Root} _tree */
|
|
11
|
+
(_tree, file) => {
|
|
12
|
+
const text = String(file.value);
|
|
13
|
+
let line = 1;
|
|
14
|
+
let lineStart = 0;
|
|
15
|
+
for (let index = 0; index < text.length; index += 1) {
|
|
16
|
+
const char = text[index];
|
|
17
|
+
if (char === '\n') {
|
|
18
|
+
line += 1;
|
|
19
|
+
lineStart = index + 1;
|
|
20
|
+
} else if (curlyQuotes.has(char)) {
|
|
21
|
+
const column = index - lineStart + 1;
|
|
22
|
+
file.message('Use straight quotes instead of curly quotes.', {
|
|
23
|
+
start: { line, column },
|
|
24
|
+
end: { line, column: column + 1 },
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
},
|
|
29
|
+
);
|
|
30
|
+
|
|
31
|
+
export default remarkLintMuiStraightQuotes;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { describe, it, expect } from 'vitest';
|
|
2
|
+
import { createLintTester } from './createLintTester.mjs';
|
|
3
|
+
import plugin from './straightQuotes.mjs';
|
|
4
|
+
|
|
5
|
+
const lint = createLintTester(plugin);
|
|
6
|
+
|
|
7
|
+
describe('remark-lint-mui-straight-quotes', () => {
|
|
8
|
+
it('accepts straight quotes', () => {
|
|
9
|
+
expect(lint(`# Title\n\nA paragraph with "straight" and 'simple' quotes.\n`)).toEqual([]);
|
|
10
|
+
});
|
|
11
|
+
|
|
12
|
+
it('flags curly double quotes with correct location', () => {
|
|
13
|
+
const messages = lint(`# Title\n\nA paragraph with “curly” quotes.\n`);
|
|
14
|
+
expect(messages).toHaveLength(2);
|
|
15
|
+
expect(messages[0]).toMatchObject({ line: 3, column: 18 });
|
|
16
|
+
expect(messages[1]).toMatchObject({ line: 3, column: 24 });
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
it('flags curly single quotes', () => {
|
|
20
|
+
const messages = lint(`Use ‘single’ curly quotes too.\n`);
|
|
21
|
+
expect(messages).toHaveLength(2);
|
|
22
|
+
expect(messages[0]).toMatchObject({ line: 1, column: 5 });
|
|
23
|
+
expect(messages[1]).toMatchObject({ line: 1, column: 12 });
|
|
24
|
+
});
|
|
25
|
+
});
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { lintRule } from 'unified-lint-rule';
|
|
2
|
+
import { visit } from 'unist-util-visit';
|
|
3
|
+
|
|
4
|
+
const remarkLintMuiTableAlignment = lintRule(
|
|
5
|
+
{
|
|
6
|
+
origin: 'remark-lint:mui-table-alignment',
|
|
7
|
+
url: 'https://github.com/mui/mui-public',
|
|
8
|
+
},
|
|
9
|
+
/** @param {import('mdast').Root} tree */
|
|
10
|
+
(tree, file) => {
|
|
11
|
+
visit(tree, 'table', (node) => {
|
|
12
|
+
const align = node.align ?? [];
|
|
13
|
+
if (align.some((value) => value == null)) {
|
|
14
|
+
file.message(
|
|
15
|
+
'Table columns should declare an explicit alignment (`:---`, `---:`, or `:---:`).',
|
|
16
|
+
node,
|
|
17
|
+
);
|
|
18
|
+
}
|
|
19
|
+
});
|
|
20
|
+
},
|
|
21
|
+
);
|
|
22
|
+
|
|
23
|
+
export default remarkLintMuiTableAlignment;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { describe, it, expect } from 'vitest';
|
|
2
|
+
import { createLintTester } from './createLintTester.mjs';
|
|
3
|
+
import plugin from './tableAlignment.mjs';
|
|
4
|
+
|
|
5
|
+
const lint = createLintTester(plugin);
|
|
6
|
+
|
|
7
|
+
describe('remark-lint-mui-table-alignment', () => {
|
|
8
|
+
it('accepts tables with explicit alignment on every column', () => {
|
|
9
|
+
const input = `| A | B |\n| :- | -: |\n| 1 | 2 |\n`;
|
|
10
|
+
expect(lint(input)).toEqual([]);
|
|
11
|
+
});
|
|
12
|
+
|
|
13
|
+
it('flags tables with at least one column missing alignment', () => {
|
|
14
|
+
const input = `| A | B |\n| :- | -- |\n| 1 | 2 |\n`;
|
|
15
|
+
const messages = lint(input);
|
|
16
|
+
expect(messages).toHaveLength(1);
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
it('flags tables with no alignment at all', () => {
|
|
20
|
+
const input = `| A | B |\n| - | - |\n| 1 | 2 |\n`;
|
|
21
|
+
const messages = lint(input);
|
|
22
|
+
expect(messages).toHaveLength(1);
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
it('does not flag non-table content', () => {
|
|
26
|
+
expect(lint(`# Heading\n\nSome paragraph.\n`)).toEqual([]);
|
|
27
|
+
});
|
|
28
|
+
});
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { lintRule } from 'unified-lint-rule';
|
|
2
|
+
import { visit } from 'unist-util-visit';
|
|
3
|
+
|
|
4
|
+
const remarkLintMuiTerminalLanguage = lintRule(
|
|
5
|
+
{
|
|
6
|
+
origin: 'remark-lint:mui-terminal-language',
|
|
7
|
+
url: 'https://github.com/mui/mui-public',
|
|
8
|
+
},
|
|
9
|
+
/** @param {import('mdast').Root} tree */
|
|
10
|
+
(tree, file) => {
|
|
11
|
+
visit(tree, 'code', (node) => {
|
|
12
|
+
if (node.lang === 'sh' && node.position) {
|
|
13
|
+
file.message('Use `bash` instead of `sh` as the code block language.', node);
|
|
14
|
+
}
|
|
15
|
+
});
|
|
16
|
+
},
|
|
17
|
+
);
|
|
18
|
+
|
|
19
|
+
export default remarkLintMuiTerminalLanguage;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { describe, it, expect } from 'vitest';
|
|
2
|
+
import { createLintTester } from './createLintTester.mjs';
|
|
3
|
+
import plugin from './terminalLanguage.mjs';
|
|
4
|
+
|
|
5
|
+
const lint = createLintTester(plugin);
|
|
6
|
+
|
|
7
|
+
describe('remark-lint-mui-terminal-language', () => {
|
|
8
|
+
it('accepts bash and other languages', () => {
|
|
9
|
+
expect(lint(`\`\`\`bash\necho hi\n\`\`\`\n`)).toEqual([]);
|
|
10
|
+
expect(lint(`\`\`\`js\nconst x = 1;\n\`\`\`\n`)).toEqual([]);
|
|
11
|
+
});
|
|
12
|
+
|
|
13
|
+
it('flags `sh` code fences', () => {
|
|
14
|
+
const messages = lint(`\`\`\`sh\necho hi\n\`\`\`\n`);
|
|
15
|
+
expect(messages).toHaveLength(1);
|
|
16
|
+
});
|
|
17
|
+
});
|
package/src/untyped-plugins.d.ts
CHANGED
|
@@ -13,77 +13,77 @@ declare module 'eslint-config-airbnb' {
|
|
|
13
13
|
}
|
|
14
14
|
|
|
15
15
|
declare module 'eslint-config-airbnb-base/rules/best-practices' {
|
|
16
|
-
import { Linter } from 'eslint';
|
|
16
|
+
import { type Linter } from 'eslint';
|
|
17
17
|
|
|
18
18
|
declare const config: Omit<Linter.LegacyConfig, 'extends' | 'plugins'>;
|
|
19
19
|
export default config;
|
|
20
20
|
}
|
|
21
21
|
|
|
22
22
|
declare module 'eslint-config-airbnb-base/rules/errors' {
|
|
23
|
-
import { Linter } from 'eslint';
|
|
23
|
+
import { type Linter } from 'eslint';
|
|
24
24
|
|
|
25
25
|
declare const config: Omit<Linter.LegacyConfig, 'extends' | 'plugins'>;
|
|
26
26
|
export default config;
|
|
27
27
|
}
|
|
28
28
|
|
|
29
29
|
declare module 'eslint-config-airbnb-base/rules/es6' {
|
|
30
|
-
import { Linter } from 'eslint';
|
|
30
|
+
import { type Linter } from 'eslint';
|
|
31
31
|
|
|
32
32
|
declare const config: Omit<Linter.LegacyConfig, 'extends' | 'plugins'>;
|
|
33
33
|
export default config;
|
|
34
34
|
}
|
|
35
35
|
|
|
36
36
|
declare module 'eslint-config-airbnb-base/rules/imports' {
|
|
37
|
-
import { Linter } from 'eslint';
|
|
37
|
+
import { type Linter } from 'eslint';
|
|
38
38
|
|
|
39
39
|
declare const config: Omit<Linter.LegacyConfig, 'extends' | 'plugins'>;
|
|
40
40
|
export default config;
|
|
41
41
|
}
|
|
42
42
|
|
|
43
43
|
declare module 'eslint-config-airbnb-base/rules/node' {
|
|
44
|
-
import { Linter } from 'eslint';
|
|
44
|
+
import { type Linter } from 'eslint';
|
|
45
45
|
|
|
46
46
|
declare const config: Omit<Linter.LegacyConfig, 'extends' | 'plugins'>;
|
|
47
47
|
export default config;
|
|
48
48
|
}
|
|
49
49
|
|
|
50
50
|
declare module 'eslint-config-airbnb-base/rules/strict' {
|
|
51
|
-
import { Linter } from 'eslint';
|
|
51
|
+
import { type Linter } from 'eslint';
|
|
52
52
|
|
|
53
53
|
declare const config: Omit<Linter.LegacyConfig, 'extends' | 'plugins'>;
|
|
54
54
|
export default config;
|
|
55
55
|
}
|
|
56
56
|
|
|
57
57
|
declare module 'eslint-config-airbnb-base/rules/style' {
|
|
58
|
-
import { Linter } from 'eslint';
|
|
58
|
+
import { type Linter } from 'eslint';
|
|
59
59
|
|
|
60
60
|
declare const config: Omit<Linter.LegacyConfig, 'extends' | 'plugins'>;
|
|
61
61
|
export default config;
|
|
62
62
|
}
|
|
63
63
|
|
|
64
64
|
declare module 'eslint-config-airbnb-base/rules/variables' {
|
|
65
|
-
import { Linter } from 'eslint';
|
|
65
|
+
import { type Linter } from 'eslint';
|
|
66
66
|
|
|
67
67
|
declare const config: Omit<Linter.LegacyConfig, 'extends' | 'plugins'>;
|
|
68
68
|
export default config;
|
|
69
69
|
}
|
|
70
70
|
|
|
71
71
|
declare module 'eslint-config-airbnb/rules/react' {
|
|
72
|
-
import { Linter } from 'eslint';
|
|
72
|
+
import { type Linter } from 'eslint';
|
|
73
73
|
|
|
74
74
|
declare const config: Omit<Linter.LegacyConfig, 'extends' | 'plugins'>;
|
|
75
75
|
export default config;
|
|
76
76
|
}
|
|
77
77
|
|
|
78
78
|
declare module 'eslint-config-airbnb/rules/react-a11y' {
|
|
79
|
-
import { Linter } from 'eslint';
|
|
79
|
+
import { type Linter } from 'eslint';
|
|
80
80
|
|
|
81
81
|
declare const config: Omit<Linter.LegacyConfig, 'extends' | 'plugins'>;
|
|
82
82
|
export default config;
|
|
83
83
|
}
|
|
84
84
|
|
|
85
85
|
declare module '@next/eslint-plugin-next' {
|
|
86
|
-
import { Linter } from 'eslint';
|
|
86
|
+
import { type Linter } from 'eslint';
|
|
87
87
|
|
|
88
88
|
interface NextEslintPluginConfig extends Linter.LegacyConfig {
|
|
89
89
|
flatConfig: {
|