@mui/internal-code-infra 0.0.4-canary.9 → 0.0.4-canary.91

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 +3 -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 +74 -50
  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 +8 -2
  49. package/src/changelog/renderChangelog.mjs +1 -1
  50. package/src/changelog/types.ts +3 -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 +2 -3
  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,149 +0,0 @@
1
- import eslint from 'eslint';
2
- import parser from '@typescript-eslint/parser';
3
- import rule from './rules-of-use-theme-variants.mjs';
4
-
5
- const ruleTester = new eslint.RuleTester({
6
- languageOptions: {
7
- parser,
8
- parserOptions: {
9
- ecmaFeatures: { jsx: true },
10
- },
11
- },
12
- });
13
-
14
- ruleTester.run('rules-of-use-theme-variants', rule, {
15
- valid: [
16
- // allowed but dangerous
17
- {
18
- name: 'custom useThemeVariants hook',
19
- code: `
20
- {
21
- const useCustomThemeVariants = props => useThemeVariants(props);
22
- }`,
23
- },
24
- {
25
- name: 'basic useThemeVariants call',
26
- code: `
27
- {
28
- useThemeVariants(props);
29
- }
30
- `,
31
- },
32
- {
33
- name: 'useThemeVariants with destructured props',
34
- code: `
35
- {
36
- const { className, value: valueProp, ...other } = props;
37
- useThemeVariants(props);
38
- }
39
- `,
40
- },
41
- {
42
- name: 'useThemeVariants with disabled prop override',
43
- code: `
44
- {
45
- const { className, disabled = false, value: valueProp, ...other } = props;
46
- useThemeVariants({ ...props, disabled });
47
- }
48
- `,
49
- },
50
- {
51
- name: 'useThemeVariants with state variables',
52
- code: `
53
- {
54
- const { className, value: valueProp, ...other } = props;
55
- const [stateA, setStateA] = React.useState(0);
56
- const [stateB, setStateB] = React.useState(0);
57
- useThemeVariants({ stateA, ...props, stateB });
58
- }
59
- `,
60
- },
61
- // unnecessary spread but it's not the responsibility of this rule to catch "unnecessary" spread
62
- {
63
- name: 'useThemeVariants with unnecessary spread',
64
- code: `
65
- {
66
- const { className, value: valueProp, ...other } = props;
67
- useThemeVariants({ ...props});
68
- }
69
- `,
70
- },
71
- ],
72
- invalid: [
73
- {
74
- name: 'disabled prop not passed to useThemeVariants',
75
- code: `
76
- {
77
- const { disabled = false, ...other } = props;
78
- useThemeVariants({ ...props});
79
- }
80
- `,
81
- errors: [
82
- {
83
- message: 'Prop `disabled` is not passed to `useThemeVariants` props.',
84
- line: 4,
85
- column: 20,
86
- endLine: 4,
87
- endColumn: 31,
88
- },
89
- ],
90
- },
91
- {
92
- name: 'variant prop not passed to useThemeVariants',
93
- code: `
94
- {
95
- const { disabled = false, variant = 'text', ...other } = props;
96
- useThemeVariants({ ...props, disabled });
97
- }
98
- `,
99
- errors: [
100
- {
101
- message: 'Prop `variant` is not passed to `useThemeVariants` props.',
102
- line: 4,
103
- column: 20,
104
- endLine: 4,
105
- endColumn: 42,
106
- },
107
- ],
108
- },
109
- {
110
- name: 'props spread must come first',
111
- code: `
112
- {
113
- const { disabled = false, ...other } = props;
114
- useThemeVariants({ disabled, ...props });
115
- }
116
- `,
117
- errors: [
118
- {
119
- message:
120
- 'The props spread must come first in the `useThemeVariants` props. Otherwise destructured props with default values could be overridden.',
121
- line: 4,
122
- column: 32,
123
- endLine: 4,
124
- endColumn: 40,
125
- },
126
- ],
127
- },
128
- // this is valid code but not analyzable by this rule
129
- {
130
- name: 'cannot analyze identifier pattern',
131
- code: `
132
- {
133
- const { disabled = false, ...other } = props;
134
- const themeVariantProps = { ...props, disabled };
135
- useThemeVariants(themeVariantProps);
136
- }
137
- `,
138
- errors: [
139
- {
140
- message: "Can only analyze object patterns but found 'Identifier'. Prefer `{...props}`.",
141
- line: 5,
142
- column: 20,
143
- endLine: 5,
144
- endColumn: 37,
145
- },
146
- ],
147
- },
148
- ],
149
- });
@@ -1,67 +0,0 @@
1
- import eslint from 'eslint';
2
- import parser from '@typescript-eslint/parser';
3
- import rule from './straight-quotes.mjs';
4
-
5
- const ruleTester = new eslint.RuleTester({
6
- languageOptions: {
7
- parser,
8
- },
9
- });
10
-
11
- ruleTester.run('straight-quotes', rule, {
12
- valid: [
13
- `
14
- const values = [
15
- {
16
- title: 'Put community first 💙',
17
- },
18
- ];
19
- `,
20
- ],
21
- invalid: [
22
- {
23
- code: `
24
- const values = [
25
- {
26
- title: 'Put community first 💙',
27
- description: 'We never lose sight of who we’re serving and why.',
28
- },
29
- ];
30
- `,
31
- errors: [
32
- {
33
- messageId: 'wrongQuotes',
34
- line: 5,
35
- },
36
- ],
37
- },
38
- {
39
- code: `
40
- // reference ID (also known as “SHA” or “hash”) of the commit we're building.
41
- const values = 'foo';
42
- `,
43
- errors: [
44
- {
45
- line: 2,
46
- column: 32,
47
- messageId: 'wrongQuotes',
48
- },
49
- {
50
- line: 2,
51
- column: 36,
52
- messageId: 'wrongQuotes',
53
- },
54
- {
55
- line: 2,
56
- column: 41,
57
- messageId: 'wrongQuotes',
58
- },
59
- {
60
- line: 2,
61
- column: 46,
62
- messageId: 'wrongQuotes',
63
- },
64
- ],
65
- },
66
- ],
67
- });
@@ -1,69 +0,0 @@
1
- /**
2
- * @typedef {[string, string]} Attr
3
- */
4
-
5
- /**
6
- * @typedef {Object} Token
7
- * @property {string} type
8
- * @property {string} info
9
- * @property {string} tag
10
- * @property {string} content
11
- * @property {number} lineNumber
12
- * @property {Attr[]} attrs
13
- */
14
-
15
- /**
16
- * @typedef {Object} OnErrorObj
17
- * @property {number} lineNumber
18
- * @property {string} [detail]
19
- */
20
-
21
- /**
22
- * @typedef {(err: OnErrorObj) => void} OnError
23
- */
24
-
25
- /**
26
- * @typedef {Object} MdParams
27
- * @property {string} name
28
- * @property {string[]} lines
29
- * @property {Token[]} tokens
30
- */
31
-
32
- // This rule is an extension of MD025/no-multiple-top-level-headings.
33
- // The rule is buggy https://github.com/DavidAnson/markdownlint/pull/1109
34
- // but also blog headers don't tell you that h1 is already injected.
35
- export default {
36
- names: ['duplicateH1'],
37
- description: 'Multiple top-level headings in the same document.',
38
- tags: ['headings'],
39
- /**
40
- * @param {import('./duplicate-h1.mjs').MdParams} params
41
- * @param {import('./duplicate-h1.mjs').OnError} onError
42
- */
43
- function: (params, onError) => {
44
- /**
45
- * @type {number|boolean}
46
- */
47
- let hasTopLevelHeading = false;
48
- params.tokens.forEach((token) => {
49
- if (token.type === 'heading_open' && token.tag === 'h1') {
50
- // Avoid duplicate errors with MD025.
51
- if (hasTopLevelHeading !== false && hasTopLevelHeading !== 1) {
52
- onError({
53
- lineNumber: token.lineNumber,
54
- });
55
- } else if (params.name.includes('/docs/pages/blog/')) {
56
- onError({
57
- lineNumber: token.lineNumber,
58
- detail: 'In the blog, the h1 is already added using the markdown header.title value.',
59
- });
60
- }
61
-
62
- // Store the first h1 of the page.
63
- if (hasTopLevelHeading === false) {
64
- hasTopLevelHeading = token.lineNumber;
65
- }
66
- }
67
- });
68
- },
69
- };
@@ -1,31 +0,0 @@
1
- export default {
2
- names: ['gitDiff'],
3
- description: 'Respect the format output of git diff.',
4
- tags: ['spaces'],
5
- /**
6
- * @param {import('./duplicate-h1.mjs').MdParams} params
7
- * @param {import('./duplicate-h1.mjs').OnError} onError
8
- */
9
- function: (params, onError) => {
10
- params.tokens.forEach((token) => {
11
- if (token.type === 'fence' && token.info === 'diff') {
12
- token.content.split('\n').forEach((line, index) => {
13
- if (
14
- line[0] !== ' ' &&
15
- line[0] !== '-' &&
16
- line[0] !== '+' &&
17
- line !== '' &&
18
- line.indexOf('@@ ') !== 0 &&
19
- line.indexOf('diff --git ') !== 0 &&
20
- line.indexOf('index ') !== 0
21
- ) {
22
- onError({
23
- lineNumber: token.lineNumber + index + 1,
24
- detail: `The line start with "+" or "-" or " ": ${line}`,
25
- });
26
- }
27
- });
28
- }
29
- });
30
- },
31
- };
@@ -1,62 +0,0 @@
1
- import straightQuotes from './straight-quotes.mjs';
2
- import gitDiff from './git-diff.mjs';
3
- import tableAlignment from './table-alignment.mjs';
4
- import terminalLanguage from './terminal-language.mjs';
5
- import duplicateH1 from './duplicate-h1.mjs';
6
-
7
- /**
8
- * Create a base configuration for markdownlint.
9
- * @param {Object} options
10
- * @param {(typeof straightQuotes)[]} [options.rules] - An array of custom rules to include.
11
- * @param {string[]} [options.ignores] - An array of glob patterns to ignore.
12
- * @returns
13
- */
14
- export function createBaseConfig(options = {}) {
15
- const { rules = [], ignores = [] } = options;
16
- // https://github.com/DavidAnson/markdownlint#rules--aliases
17
- return {
18
- config: {
19
- default: true,
20
- MD004: false, // MD004/ul-style. Buggy
21
- MD009: {
22
- // MD009/no-trailing-spaces
23
- br_spaces: 0,
24
- strict: true,
25
- list_item_empty_lines: false,
26
- },
27
- MD013: false, // MD013/line-length. Already handled by Prettier.
28
- MD014: false, // MD014/commands-show-output. It's OK.
29
- MD024: { siblings_only: true }, // MD024/no-duplicate-heading/no-duplicate-header
30
- MD025: {
31
- // Heading level
32
- level: 1,
33
- // RegExp for matching title in front matter
34
- front_matter_title: '',
35
- },
36
- MD033: false, // MD033/no-inline-html. We use it from time to time, it's fine.
37
- MD034: false, // MD034/no-bare-urls. Not a concern for us, our Markdown interpreter supports it.
38
- MD028: false, // MD028/no-blanks-blockquote prevent double blockquote
39
- MD029: false, // MD029/ol-prefix. Buggy
40
- MD031: false, // MD031/blanks-around-fences Some code blocks inside li
41
- MD036: false, // MD036/no-emphasis-as-heading/no-emphasis-as-header. It's OK.
42
- MD051: false, // MD051/link-fragments. Many false positives in the changelog.
43
- MD052: false, // MD052/reference-links-images. Many false positives in the changelog.
44
- MD059: false, // MD059/descriptive-link-text. Does not allow links on text like "link", whereas we redirect to "Link" component.
45
- straightQuotes: true,
46
- gitDiff: true,
47
- tableAlignment: true,
48
- terminalLanguage: true,
49
- duplicateH1: true,
50
- },
51
- customRules: [straightQuotes, gitDiff, tableAlignment, terminalLanguage, duplicateH1, ...rules],
52
- ignores: [
53
- 'CHANGELOG.old.md',
54
- '**/node_modules/**',
55
- '**/build/**',
56
- '.github/PULL_REQUEST_TEMPLATE.md',
57
- 'docs/public/**',
58
- 'docs/export/**',
59
- ...ignores,
60
- ],
61
- };
62
- }
@@ -1,26 +0,0 @@
1
- const nonStraightQuotes = /[‘’“”]/;
2
-
3
- export default {
4
- names: ['straightQuotes'],
5
- description: 'Only allow straight quotes.',
6
- tags: ['spelling'],
7
- /**
8
- * @param {import('./duplicate-h1.mjs').MdParams} params
9
- * @param {import('./duplicate-h1.mjs').OnError} onError
10
- */
11
- function: (params, onError) => {
12
- params.lines.forEach((line, lineNumber) => {
13
- // It will match
14
- // opening single quote: \xE2\x80\x98
15
- // closing single quote: \xE2\x80\x99
16
- // opening double quote: \xE2\x80\x9C
17
- // closing double quote: \xE2\x80\x9D
18
- if (nonStraightQuotes.test(line)) {
19
- onError({
20
- lineNumber: lineNumber + 1,
21
- detail: `For line: ${line}`,
22
- });
23
- }
24
- });
25
- },
26
- };
@@ -1,42 +0,0 @@
1
- /**
2
- * @param {import('./duplicate-h1.mjs').Attr[]} attrs
3
- * @returns {Record<string, string>}
4
- */
5
- function attr(attrs) {
6
- return (attrs || []).reduce((acc, item) => ({ ...acc, [item[0]]: item[1] }), {});
7
- }
8
-
9
- export default {
10
- names: ['tableAlignment'],
11
- description: 'Set table alignment.',
12
- tags: ['table'],
13
- /**
14
- * @param {import('./duplicate-h1.mjs').MdParams} params
15
- * @param {import('./duplicate-h1.mjs').OnError} onError
16
- */
17
- function: (params, onError) => {
18
- params.tokens.forEach((token) => {
19
- // This is wrong:
20
- // | Version | Supported |
21
- // | ------- | ------------------ |
22
- //
23
- // The second column should be left aligned because it contains text:
24
- // | Version | Supported |
25
- // | ------- | :----------------- |
26
- //
27
- // However, columns that includes numbers should be right aligned:
28
- // | Version | Supported |
29
- // | ------: | :----------------- |
30
- //
31
- // More details: https://ux.stackexchange.com/questions/24066/what-is-the-best-practice-for-data-table-cell-content-alignment
32
- //
33
- // In this check we expect the style to be 'text-align:right' or equivalent.
34
- if (token.type === 'th_open' && attr(token.attrs).style == null) {
35
- onError({
36
- lineNumber: token.lineNumber,
37
- detail: `${params.lines[token.lineNumber - 1]}`,
38
- });
39
- }
40
- });
41
- },
42
- };
@@ -1,19 +0,0 @@
1
- export default {
2
- names: ['terminalLanguage'],
3
- description: 'Set the right language for terminal code.',
4
- tags: ['code'],
5
- /**
6
- * @param {import('./duplicate-h1.mjs').MdParams} params
7
- * @param {import('./duplicate-h1.mjs').OnError} onError
8
- */
9
- function: (params, onError) => {
10
- params.tokens.forEach((token) => {
11
- if (token.type === 'fence' && token.info === 'sh') {
12
- onError({
13
- lineNumber: token.lineNumber,
14
- detail: `Use "bash" instead of "sh".`,
15
- });
16
- }
17
- });
18
- },
19
- };