@mui/internal-code-infra 0.0.4-canary.7 → 0.0.4-canary.70

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 (120) hide show
  1. package/LICENSE +1 -1
  2. package/README.md +19 -8
  3. package/build/babel-config.d.mts +11 -3
  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/github.d.mts +1 -1
  40. package/build/utils/pnpm.d.mts +81 -2
  41. package/build/utils/testUtils.d.mts +7 -0
  42. package/build/utils/typescript.d.mts +6 -16
  43. package/package.json +60 -38
  44. package/src/babel-config.mjs +9 -3
  45. package/src/brokenLinksChecker/__fixtures__/static-site/index.html +1 -0
  46. package/src/brokenLinksChecker/__fixtures__/static-site/invalid-html.html +15 -0
  47. package/src/brokenLinksChecker/crawlWorker.mjs +217 -0
  48. package/src/brokenLinksChecker/index.mjs +263 -188
  49. package/src/brokenLinksChecker/index.test.ts +50 -13
  50. package/src/changelog/categorizeCommits.test.ts +5 -5
  51. package/src/changelog/fetchChangelogs.mjs +6 -2
  52. package/src/changelog/parseCommitLabels.test.ts +5 -5
  53. package/src/changelog/renderChangelog.mjs +1 -1
  54. package/src/changelog/types.ts +1 -1
  55. package/src/cli/cmdBuild.mjs +51 -85
  56. package/src/cli/cmdListWorkspaces.mjs +12 -27
  57. package/src/cli/cmdNetlifyIgnore.mjs +34 -93
  58. package/src/cli/cmdPublish.mjs +55 -15
  59. package/src/cli/cmdPublishCanary.mjs +128 -132
  60. package/src/cli/cmdPublishNewPackage.mjs +27 -6
  61. package/src/cli/cmdSetVersionOverrides.mjs +8 -9
  62. package/src/cli/cmdVale.mjs +513 -0
  63. package/src/cli/cmdVale.test.mjs +644 -0
  64. package/src/cli/index.mjs +2 -0
  65. package/src/cli/packageJson.d.ts +1 -1
  66. package/src/eslint/baseConfig.mjs +51 -19
  67. package/src/eslint/docsConfig.mjs +2 -1
  68. package/src/eslint/mui/config.mjs +22 -3
  69. package/src/eslint/mui/index.mjs +6 -0
  70. package/src/eslint/mui/rules/no-floating-cleanup.mjs +187 -0
  71. package/src/eslint/mui/rules/no-floating-cleanup.test.mjs +141 -0
  72. package/src/eslint/mui/rules/no-guarded-throw.mjs +115 -0
  73. package/src/eslint/mui/rules/no-guarded-throw.test.mjs +206 -0
  74. package/src/eslint/mui/rules/no-presentation-role.mjs +60 -0
  75. package/src/eslint/mui/rules/no-presentation-role.test.mjs +33 -0
  76. package/src/eslint/mui/rules/nodeEnvUtils.mjs +52 -0
  77. package/src/eslint/mui/rules/require-dev-wrapper.mjs +25 -40
  78. package/src/estree-typescript.d.ts +1 -1
  79. package/src/remark/config.mjs +157 -0
  80. package/src/remark/createLintTester.mjs +19 -0
  81. package/src/remark/firstBlockHeading.mjs +87 -0
  82. package/src/remark/firstBlockHeading.test.mjs +107 -0
  83. package/src/remark/gitDiff.mjs +43 -0
  84. package/src/remark/gitDiff.test.mjs +45 -0
  85. package/src/remark/noSpaceInLinks.mjs +42 -0
  86. package/src/remark/noSpaceInLinks.test.mjs +22 -0
  87. package/src/remark/straightQuotes.mjs +31 -0
  88. package/src/remark/straightQuotes.test.mjs +25 -0
  89. package/src/remark/tableAlignment.mjs +23 -0
  90. package/src/remark/tableAlignment.test.mjs +28 -0
  91. package/src/remark/terminalLanguage.mjs +19 -0
  92. package/src/remark/terminalLanguage.test.mjs +17 -0
  93. package/src/untyped-plugins.d.ts +11 -11
  94. package/src/utils/build.mjs +604 -270
  95. package/src/utils/build.test.mjs +1079 -521
  96. package/src/utils/git.mjs +16 -7
  97. package/src/utils/pnpm.mjs +255 -3
  98. package/src/utils/pnpm.test.mjs +731 -0
  99. package/src/utils/testUtils.mjs +18 -0
  100. package/src/utils/typescript.mjs +23 -42
  101. package/src/utils/typescript.test.mjs +234 -273
  102. package/vale/.vale.ini +1 -0
  103. package/vale/styles/MUI/CorrectReferenceAllCases.yml +43 -0
  104. package/vale/styles/MUI/CorrectRererenceCased.yml +14 -0
  105. package/vale/styles/MUI/GoogleLatin.yml +11 -0
  106. package/vale/styles/MUI/MuiBrandName.yml +22 -0
  107. package/vale/styles/MUI/NoBritish.yml +112 -0
  108. package/vale/styles/MUI/NoCompanyName.yml +17 -0
  109. package/build/markdownlint/duplicate-h1.d.mts +0 -56
  110. package/build/markdownlint/git-diff.d.mts +0 -11
  111. package/build/markdownlint/index.d.mts +0 -52
  112. package/build/markdownlint/straight-quotes.d.mts +0 -11
  113. package/build/markdownlint/table-alignment.d.mts +0 -11
  114. package/build/markdownlint/terminal-language.d.mts +0 -11
  115. package/src/markdownlint/duplicate-h1.mjs +0 -69
  116. package/src/markdownlint/git-diff.mjs +0 -31
  117. package/src/markdownlint/index.mjs +0 -62
  118. package/src/markdownlint/straight-quotes.mjs +0 -26
  119. package/src/markdownlint/table-alignment.mjs +0 -42
  120. package/src/markdownlint/terminal-language.mjs +0 -19
@@ -0,0 +1,22 @@
1
+ # Without a non-breaking space, brand names can be split in the middle
2
+ # with the start and end on two different lines.
3
+ # For example, Apple does this meticulously with their brand name: https://www.apple.com/macbook-air/.
4
+ # Also read https://www.chrisdpeters.com/blog/using-non-breaking-spaces-to-help-with-branding/ for why.
5
+ extends: substitution
6
+ message: Use a non-breaking space (option+space on Mac, Alt+0160 on Windows or AltGr+Space on Linux, instead of space) for brand name ('%s' instead of '%s')
7
+ level: error
8
+ ignorecase: true
9
+ # swap maps tokens in form of bad: good
10
+ # for more information: https://vale.sh/docs/topics/styles/#substitution
11
+ swap:
12
+ Material UI: Material UI
13
+ MUI X: MUI X
14
+ Base UI: Base UI
15
+ MUI Base: MUI Base
16
+ MUI System: MUI System
17
+ MUI Store: MUI Store
18
+ MUI Core: MUI Core
19
+ MUI Toolpad: Toolpad
20
+ MUI Toolpad: Toolpad
21
+ MUI Connect: MUI Connect
22
+ Pigment CSS: Pigment CSS
@@ -0,0 +1,112 @@
1
+ extends: substitution
2
+ message: Use the US spelling '%s' instead of the British '%s'
3
+ link: https://www.notion.so/mui-org/Writing-style-guide-2a957a4168a54d47b14bae026d06a24b?pvs=4#25755bff02764565b954631236ab183d
4
+ level: error
5
+ ignorecase: true
6
+ swap:
7
+ aeon: eon
8
+ aeroplane: airplane
9
+ ageing: aging
10
+ aluminium: aluminum
11
+ anaemia: anemia
12
+ anaesthesia: anesthesia
13
+ analyse: analyze
14
+ annexe: annex
15
+ apologise: apologize
16
+ authorisation: authorization
17
+ authorise: authorize
18
+ authorised: authorized
19
+ authorising: authorizing
20
+ behaviour: behavior
21
+ bellow: below
22
+ busses: buses
23
+ calibre: caliber
24
+ categorise: categorize
25
+ categorised: categorized
26
+ categorises: categorizes
27
+ categorising: categorizing
28
+ centre: center
29
+ cheque: check
30
+ civilisation: civilization
31
+ civilise: civilize
32
+ colour: color
33
+ cosy: cozy
34
+ cypher: cipher
35
+ defence: defense
36
+ dependant: dependent
37
+ distil: distill
38
+ draught: draft
39
+ encyclopaedia: encyclopedia
40
+ enquiry: inquiry
41
+ enrol: enroll
42
+ enrolment: enrollment
43
+ enthral: enthrall
44
+ favourite: favorite
45
+ fibre: fiber
46
+ fillet: filet
47
+ flavour: flavor
48
+ fulfil: fulfill
49
+ furore: furor
50
+ gaol: jail
51
+ grey: gray
52
+ honour: honor
53
+ humour: humor
54
+ initialled: initialed
55
+ initialling: initialing
56
+ instil: instill
57
+ jewellery: jewelry
58
+ labelled: labeled
59
+ labelling: labeling
60
+ labour: labor
61
+ libellous: libelous
62
+ licence: license
63
+ likeable: likable
64
+ liveable: livable
65
+ lustre: luster
66
+ manoeuvre: maneuver
67
+ marvellous: marvelous
68
+ meagre: meager
69
+ metre: meter
70
+ modelling: modeling
71
+ moustache: mustache
72
+ neighbour: neighbor
73
+ normalise: normalize
74
+ offence: offense
75
+ optimise: optimize
76
+ optimised: optimized
77
+ optimising: optimizing
78
+ organise: organize
79
+ orientated: oriented
80
+ paralyse: paralyze
81
+ plough: plow
82
+ pretence: pretense
83
+ programme: program
84
+ pyjamas: pajamas
85
+ rateable: ratable
86
+ realise: realize
87
+ recognise: recognize
88
+ reconnoitre: reconnoiter
89
+ rumour: rumor
90
+ sabre: saber
91
+ saleable: salable
92
+ saltpetre: saltpeter
93
+ sceptic: skeptic
94
+ sepulchre: sepulcher
95
+ signalling: signaling
96
+ sizeable: sizable
97
+ skilful: skillful
98
+ smoulder: smolder
99
+ sombre: somber
100
+ speciality: specialty
101
+ spectre: specter
102
+ splendour: splendor
103
+ standardise: standardize
104
+ standardised: standardized
105
+ sulphur: sulfur
106
+ theatre: theater
107
+ travelled: traveled
108
+ traveller: traveler
109
+ travelling: traveling
110
+ unshakeable: unshakable
111
+ wilful: willful
112
+ yoghurt: yogurt
@@ -0,0 +1,17 @@
1
+ extends: existence
2
+ message: We avoid referencing the company name '%s'. Instead you can reference a product or the team.
3
+ level: warning
4
+ ignorecase: false
5
+ tokens:
6
+ - 'MUI \w+'
7
+ exceptions:
8
+ - 'MUI X'
9
+ - 'MUI System'
10
+ - 'MUI Store'
11
+ - 'MUI Core'
12
+ - 'MUI Connect'
13
+ # valid use of a regular space
14
+ - 'MUI organization'
15
+ - 'MUI ecosystem'
16
+ - 'MUI products'
17
+ - 'MUI team'
@@ -1,56 +0,0 @@
1
- /**
2
- * @typedef {[string, string]} Attr
3
- */
4
- export type Attr = [string, string];
5
- export type Token = {
6
- type: string;
7
- info: string;
8
- tag: string;
9
- content: string;
10
- lineNumber: number;
11
- attrs: Attr[];
12
- };
13
- export type OnErrorObj = {
14
- lineNumber: number;
15
- detail?: string;
16
- };
17
- export type OnError = (err: OnErrorObj) => void;
18
- export type MdParams = {
19
- name: string;
20
- lines: string[];
21
- tokens: Token[];
22
- };
23
- /**
24
- * @typedef {Object} Token
25
- * @property {string} type
26
- * @property {string} info
27
- * @property {string} tag
28
- * @property {string} content
29
- * @property {number} lineNumber
30
- * @property {Attr[]} attrs
31
- */
32
- /**
33
- * @typedef {Object} OnErrorObj
34
- * @property {number} lineNumber
35
- * @property {string} [detail]
36
- */
37
- /**
38
- * @typedef {(err: OnErrorObj) => void} OnError
39
- */
40
- /**
41
- * @typedef {Object} MdParams
42
- * @property {string} name
43
- * @property {string[]} lines
44
- * @property {Token[]} tokens
45
- */
46
- declare const _default: {
47
- names: string[];
48
- description: string;
49
- tags: string[];
50
- /**
51
- * @param {import('./duplicate-h1.mjs').MdParams} params
52
- * @param {import('./duplicate-h1.mjs').OnError} onError
53
- */
54
- function: (params: MdParams, onError: OnError) => void;
55
- };
56
- export default _default;
@@ -1,11 +0,0 @@
1
- declare const _default: {
2
- names: string[];
3
- description: string;
4
- tags: string[];
5
- /**
6
- * @param {import('./duplicate-h1.mjs').MdParams} params
7
- * @param {import('./duplicate-h1.mjs').OnError} onError
8
- */
9
- function: (params: import("./duplicate-h1.mjs").MdParams, onError: import("./duplicate-h1.mjs").OnError) => void;
10
- };
11
- export default _default;
@@ -1,52 +0,0 @@
1
- import straightQuotes from './straight-quotes.mjs';
2
- /**
3
- * Create a base configuration for markdownlint.
4
- * @param {Object} options
5
- * @param {(typeof straightQuotes)[]} [options.rules] - An array of custom rules to include.
6
- * @param {string[]} [options.ignores] - An array of glob patterns to ignore.
7
- * @returns
8
- */
9
- export declare function createBaseConfig(options?: {
10
- rules?: (typeof straightQuotes)[];
11
- ignores?: string[];
12
- }): {
13
- config: {
14
- default: boolean;
15
- MD004: boolean;
16
- MD009: {
17
- br_spaces: number;
18
- strict: boolean;
19
- list_item_empty_lines: boolean;
20
- };
21
- MD013: boolean;
22
- MD014: boolean;
23
- MD024: {
24
- siblings_only: boolean;
25
- };
26
- MD025: {
27
- level: number;
28
- front_matter_title: string;
29
- };
30
- MD033: boolean;
31
- MD034: boolean;
32
- MD028: boolean;
33
- MD029: boolean;
34
- MD031: boolean;
35
- MD036: boolean;
36
- MD051: boolean;
37
- MD052: boolean;
38
- MD059: boolean;
39
- straightQuotes: boolean;
40
- gitDiff: boolean;
41
- tableAlignment: boolean;
42
- terminalLanguage: boolean;
43
- duplicateH1: boolean;
44
- };
45
- customRules: {
46
- names: string[];
47
- description: string;
48
- tags: string[];
49
- function: (params: import("./duplicate-h1.mjs").MdParams, onError: import("./duplicate-h1.mjs").OnError) => void;
50
- }[];
51
- ignores: string[];
52
- };
@@ -1,11 +0,0 @@
1
- declare const _default: {
2
- names: string[];
3
- description: string;
4
- tags: string[];
5
- /**
6
- * @param {import('./duplicate-h1.mjs').MdParams} params
7
- * @param {import('./duplicate-h1.mjs').OnError} onError
8
- */
9
- function: (params: import("./duplicate-h1.mjs").MdParams, onError: import("./duplicate-h1.mjs").OnError) => void;
10
- };
11
- export default _default;
@@ -1,11 +0,0 @@
1
- declare const _default: {
2
- names: string[];
3
- description: string;
4
- tags: string[];
5
- /**
6
- * @param {import('./duplicate-h1.mjs').MdParams} params
7
- * @param {import('./duplicate-h1.mjs').OnError} onError
8
- */
9
- function: (params: import("./duplicate-h1.mjs").MdParams, onError: import("./duplicate-h1.mjs").OnError) => void;
10
- };
11
- export default _default;
@@ -1,11 +0,0 @@
1
- declare const _default: {
2
- names: string[];
3
- description: string;
4
- tags: string[];
5
- /**
6
- * @param {import('./duplicate-h1.mjs').MdParams} params
7
- * @param {import('./duplicate-h1.mjs').OnError} onError
8
- */
9
- function: (params: import("./duplicate-h1.mjs").MdParams, onError: import("./duplicate-h1.mjs").OnError) => void;
10
- };
11
- export default _default;
@@ -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
- };