@alexlit/lint-kit 127.5.3 → 127.6.1

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 (304) hide show
  1. package/.npmpackagejsonlintrc.json +0 -0
  2. package/.npmrc +5 -0
  3. package/LICENSE +0 -0
  4. package/README.md +1 -1
  5. package/commitlint.config.js +0 -0
  6. package/lint-staged.config.js +0 -0
  7. package/package.json +11 -9
  8. package/packages/config-commitlint/LICENSE +0 -0
  9. package/packages/config-commitlint/index.js +0 -0
  10. package/packages/config-commitlint/node_modules/.bin/commitlint +17 -0
  11. package/packages/config-commitlint/node_modules/.bin/conventional-changelog +17 -0
  12. package/packages/config-commitlint/node_modules/.bin/conventional-commits-parser +17 -0
  13. package/packages/config-commitlint/node_modules/.bin/tsc +17 -0
  14. package/packages/config-commitlint/node_modules/.bin/tsserver +17 -0
  15. package/packages/config-commitlint/package.json +0 -0
  16. package/packages/config-eslint/LICENSE +0 -0
  17. package/packages/config-eslint/_legacy/LICENSE +0 -0
  18. package/packages/config-eslint/_legacy/dictionaries/index.js +0 -0
  19. package/packages/config-eslint/_legacy/dictionaries/programming/bash.js +0 -0
  20. package/packages/config-eslint/_legacy/dictionaries/programming/django.js +0 -0
  21. package/packages/config-eslint/_legacy/dictionaries/programming/elixir.js +0 -0
  22. package/packages/config-eslint/_legacy/dictionaries/programming/go.js +0 -0
  23. package/packages/config-eslint/_legacy/dictionaries/programming/java.js +0 -0
  24. package/packages/config-eslint/_legacy/dictionaries/programming/latex.js +0 -0
  25. package/packages/config-eslint/_legacy/dictionaries/programming/lua.js +0 -0
  26. package/packages/config-eslint/_legacy/dictionaries/programming/php.js +0 -0
  27. package/packages/config-eslint/_legacy/dictionaries/programming/python.js +0 -0
  28. package/packages/config-eslint/_legacy/dictionaries/programming/ruby.js +0 -0
  29. package/packages/config-eslint/_legacy/dictionaries/programming/rust.js +0 -0
  30. package/packages/config-eslint/_legacy/dictionaries/programming/scala.js +0 -0
  31. package/packages/config-eslint/_legacy/dictionaries/specialized/html-symbol-entities.js +0 -0
  32. package/packages/config-eslint/_legacy/dictionaries/specialized/lorem-ipsum.js +0 -0
  33. package/packages/config-eslint/_legacy/index.js +0 -0
  34. package/packages/config-eslint/_legacy/legacy.js +0 -0
  35. package/packages/config-eslint/_legacy/package.json +0 -0
  36. package/packages/config-eslint/_legacy/plugins/array-func.js +0 -0
  37. package/packages/config-eslint/_legacy/plugins/compat.js +0 -0
  38. package/packages/config-eslint/_legacy/plugins/decorator-position.js +0 -0
  39. package/packages/config-eslint/_legacy/plugins/eslint-comments.js +0 -0
  40. package/packages/config-eslint/_legacy/plugins/etc.js +0 -0
  41. package/packages/config-eslint/_legacy/plugins/ext.js +0 -0
  42. package/packages/config-eslint/_legacy/plugins/filenames.js +0 -0
  43. package/packages/config-eslint/_legacy/plugins/import.js +0 -0
  44. package/packages/config-eslint/_legacy/plugins/jsdoc.js +0 -0
  45. package/packages/config-eslint/_legacy/plugins/jsx-a11y.js +0 -0
  46. package/packages/config-eslint/_legacy/plugins/lit-a11y.js +0 -0
  47. package/packages/config-eslint/_legacy/plugins/lit.js +0 -0
  48. package/packages/config-eslint/_legacy/plugins/more.js +0 -0
  49. package/packages/config-eslint/_legacy/plugins/no-constructor-bind.js +0 -0
  50. package/packages/config-eslint/_legacy/plugins/no-explicit-type-exports.js +0 -0
  51. package/packages/config-eslint/_legacy/plugins/no-loops.js +0 -0
  52. package/packages/config-eslint/_legacy/plugins/no-secrets.js +0 -0
  53. package/packages/config-eslint/_legacy/plugins/no-use-extend-native.js +0 -0
  54. package/packages/config-eslint/_legacy/plugins/node.js +0 -0
  55. package/packages/config-eslint/_legacy/plugins/prettier.js +0 -0
  56. package/packages/config-eslint/_legacy/plugins/promise.js +0 -0
  57. package/packages/config-eslint/_legacy/plugins/regexp.js +0 -0
  58. package/packages/config-eslint/_legacy/plugins/security.js +0 -0
  59. package/packages/config-eslint/_legacy/plugins/simple-import-sort.js +0 -0
  60. package/packages/config-eslint/_legacy/plugins/sonar.js +0 -0
  61. package/packages/config-eslint/_legacy/plugins/sort-class-members.js +0 -0
  62. package/packages/config-eslint/_legacy/plugins/sort-destructure-keys.js +0 -0
  63. package/packages/config-eslint/_legacy/plugins/sort-keys-fix.js +0 -0
  64. package/packages/config-eslint/_legacy/plugins/spellcheck.js +0 -0
  65. package/packages/config-eslint/_legacy/plugins/sql.js +0 -0
  66. package/packages/config-eslint/_legacy/plugins/tanstack-query.js +0 -0
  67. package/packages/config-eslint/_legacy/plugins/testing-library.js +0 -0
  68. package/packages/config-eslint/_legacy/plugins/typescript-sort-keys.js +0 -0
  69. package/packages/config-eslint/_legacy/plugins/unicorn.js +0 -0
  70. package/packages/config-eslint/_legacy/plugins/unused-imports.js +0 -0
  71. package/packages/config-eslint/_legacy/plugins/vitest.js +0 -0
  72. package/packages/config-eslint/_legacy/plugins/vue-i18n.js +0 -0
  73. package/packages/config-eslint/_legacy/plugins/vue.js +0 -0
  74. package/packages/config-eslint/_legacy/plugins/vuejs-accessibility.js +0 -0
  75. package/packages/config-eslint/_legacy/plugins/wc.js +0 -0
  76. package/packages/config-eslint/_legacy/plugins/write-good-comments.js +0 -0
  77. package/packages/config-eslint/_legacy/utils/create-config.js +0 -0
  78. package/packages/config-eslint/index.js +0 -0
  79. package/packages/config-eslint/node_modules/.bin/acorn +17 -0
  80. package/packages/config-eslint/node_modules/.bin/browserslist +17 -0
  81. package/packages/config-eslint/node_modules/.bin/eslint +17 -0
  82. package/packages/config-eslint/node_modules/.bin/eslint-config-prettier +17 -0
  83. package/packages/config-eslint/node_modules/.bin/jiti +17 -0
  84. package/packages/config-eslint/node_modules/.bin/prettier +17 -0
  85. package/packages/config-eslint/node_modules/.bin/tsc +17 -0
  86. package/packages/config-eslint/node_modules/.bin/tsserver +17 -0
  87. package/packages/config-eslint/package.json +3 -3
  88. package/packages/config-eslint/plugins/sonar.js +4 -0
  89. package/packages/config-hooks/LICENSE +0 -0
  90. package/packages/config-hooks/lint-staged.js +0 -0
  91. package/packages/config-hooks/node_modules/.bin/husky +17 -0
  92. package/packages/config-hooks/node_modules/.bin/lint-staged +17 -0
  93. package/packages/config-hooks/package.json +0 -0
  94. package/packages/config-htmllint/LICENSE +0 -0
  95. package/packages/config-htmllint/index.js +0 -0
  96. package/packages/config-htmllint/node_modules/.bin/linthtml +17 -0
  97. package/packages/config-htmllint/node_modules/.bin/tsc +17 -0
  98. package/packages/config-htmllint/node_modules/.bin/tsserver +17 -0
  99. package/packages/config-htmllint/package.json +0 -0
  100. package/packages/config-markdownlint/LICENSE +0 -0
  101. package/packages/config-markdownlint/index.json +0 -0
  102. package/packages/config-markdownlint/node_modules/.bin/markdownlint +17 -0
  103. package/packages/config-markdownlint/package.json +0 -0
  104. package/packages/config-npmlint/LICENSE +0 -0
  105. package/packages/config-npmlint/index.json +0 -0
  106. package/packages/config-npmlint/node_modules/.bin/lockfile-lint +17 -0
  107. package/packages/config-npmlint/node_modules/.bin/npmPkgJsonLint +17 -0
  108. package/packages/config-npmlint/node_modules/.bin/tsc +17 -0
  109. package/packages/config-npmlint/node_modules/.bin/tsserver +17 -0
  110. package/packages/config-npmlint/package.json +0 -0
  111. package/packages/config-prettier/LICENSE +0 -0
  112. package/packages/config-prettier/index.js +0 -0
  113. package/packages/config-prettier/node_modules/.bin/prettier +17 -0
  114. package/packages/config-prettier/package.json +0 -0
  115. package/packages/config-prettier/plugins/jsdoc.js +0 -0
  116. package/packages/config-prettier/plugins/packagejson.js +0 -0
  117. package/packages/config-prettier/plugins/php.js +0 -0
  118. package/packages/config-prettier/plugins/pug.js +0 -0
  119. package/packages/config-prettier/plugins/ruby.js +0 -0
  120. package/packages/config-prettier/plugins/sh.js +0 -0
  121. package/packages/config-prettier/plugins/solidity.js +0 -0
  122. package/packages/config-prettier/plugins/sort-json.js +0 -0
  123. package/packages/config-prettier/plugins/sql.js +0 -0
  124. package/packages/config-prettier/plugins/svelte.js +0 -0
  125. package/packages/config-prettier/plugins/tailwindcss.js +0 -0
  126. package/packages/config-prettier/plugins/xml.js +0 -0
  127. package/packages/config-stylelint/LICENSE +0 -0
  128. package/packages/config-stylelint/index.js +2 -1
  129. package/packages/config-stylelint/node_modules/.bin/browserslist +17 -0
  130. package/packages/config-stylelint/node_modules/.bin/prettier +17 -0
  131. package/packages/config-stylelint/node_modules/.bin/stylelint +17 -0
  132. package/packages/config-stylelint/node_modules/.bin/tsc +17 -0
  133. package/packages/config-stylelint/node_modules/.bin/tsserver +17 -0
  134. package/packages/config-stylelint/package.json +0 -0
  135. package/packages/config-stylelint/plugins/a11y.js +0 -0
  136. package/packages/config-stylelint/plugins/at-rule-no-children.js +0 -0
  137. package/packages/config-stylelint/plugins/color-format.js +0 -0
  138. package/packages/config-stylelint/plugins/declaration-block-no-ignored-properties.js +0 -0
  139. package/packages/config-stylelint/plugins/gamut.js +0 -0
  140. package/packages/config-stylelint/plugins/high-performance-animation.js +0 -0
  141. package/packages/config-stylelint/plugins/logical-css.js +0 -0
  142. package/packages/config-stylelint/plugins/no-indistinguishable-colors.js +0 -0
  143. package/packages/config-stylelint/plugins/no-nested-media.js +0 -0
  144. package/packages/config-stylelint/plugins/no-unresolved-module.js +0 -0
  145. package/packages/config-stylelint/plugins/no-unsupported-browser-features.js +0 -0
  146. package/packages/config-stylelint/plugins/order.js +0 -0
  147. package/packages/config-stylelint/plugins/prettier.js +0 -0
  148. package/packages/config-stylelint/plugins/scss.js +0 -0
  149. package/packages/config-stylelint/plugins/selector-no-empty.js +0 -0
  150. package/packages/config-stylelint/plugins/use-nesting.js +0 -0
  151. package/prettier.config.js +0 -0
  152. package/scripts/check.editorconfig.sh +0 -0
  153. package/scripts/i.sh +1 -1
  154. package/scripts/lint.eslint.sh +0 -0
  155. package/scripts/lint.htmllint.sh +0 -0
  156. package/scripts/lint.markdownlint.sh +0 -0
  157. package/scripts/lint.npmlint.sh +1 -1
  158. package/scripts/lint.sh +5 -5
  159. package/scripts/lint.stylelint.sh +0 -0
  160. package/scripts/ou.sh +8 -0
  161. package/scripts/preinstall.sh +1 -0
  162. package/scripts/release.sh +3 -3
  163. package/scripts/semver.sh +0 -0
  164. package/scripts/up.sh +12 -27
  165. package/stylelint.config.js +0 -0
  166. package/packages/config-markdownlint/node_modules/markdownlint/CHANGELOG.md +0 -457
  167. package/packages/config-markdownlint/node_modules/markdownlint/CONTRIBUTING.md +0 -93
  168. package/packages/config-markdownlint/node_modules/markdownlint/LICENSE +0 -21
  169. package/packages/config-markdownlint/node_modules/markdownlint/README.md +0 -1047
  170. package/packages/config-markdownlint/node_modules/markdownlint/demo/markdownlint-browser.js +0 -7094
  171. package/packages/config-markdownlint/node_modules/markdownlint/doc/CustomRules.md +0 -388
  172. package/packages/config-markdownlint/node_modules/markdownlint/doc/Prettier.md +0 -27
  173. package/packages/config-markdownlint/node_modules/markdownlint/doc/ReleaseProcess.md +0 -20
  174. package/packages/config-markdownlint/node_modules/markdownlint/doc/Rules.md +0 -2528
  175. package/packages/config-markdownlint/node_modules/markdownlint/doc/md001.md +0 -37
  176. package/packages/config-markdownlint/node_modules/markdownlint/doc/md003.md +0 -59
  177. package/packages/config-markdownlint/node_modules/markdownlint/doc/md004.md +0 -49
  178. package/packages/config-markdownlint/node_modules/markdownlint/doc/md005.md +0 -53
  179. package/packages/config-markdownlint/node_modules/markdownlint/doc/md007.md +0 -52
  180. package/packages/config-markdownlint/node_modules/markdownlint/doc/md009.md +0 -51
  181. package/packages/config-markdownlint/node_modules/markdownlint/doc/md010.md +0 -56
  182. package/packages/config-markdownlint/node_modules/markdownlint/doc/md011.md +0 -30
  183. package/packages/config-markdownlint/node_modules/markdownlint/doc/md012.md +0 -38
  184. package/packages/config-markdownlint/node_modules/markdownlint/doc/md013.md +0 -58
  185. package/packages/config-markdownlint/node_modules/markdownlint/doc/md014.md +0 -54
  186. package/packages/config-markdownlint/node_modules/markdownlint/doc/md018.md +0 -27
  187. package/packages/config-markdownlint/node_modules/markdownlint/doc/md019.md +0 -28
  188. package/packages/config-markdownlint/node_modules/markdownlint/doc/md020.md +0 -29
  189. package/packages/config-markdownlint/node_modules/markdownlint/doc/md021.md +0 -31
  190. package/packages/config-markdownlint/node_modules/markdownlint/doc/md022.md +0 -52
  191. package/packages/config-markdownlint/node_modules/markdownlint/doc/md023.md +0 -33
  192. package/packages/config-markdownlint/node_modules/markdownlint/doc/md024.md +0 -44
  193. package/packages/config-markdownlint/node_modules/markdownlint/doc/md025.md +0 -49
  194. package/packages/config-markdownlint/node_modules/markdownlint/doc/md026.md +0 -40
  195. package/packages/config-markdownlint/node_modules/markdownlint/doc/md027.md +0 -24
  196. package/packages/config-markdownlint/node_modules/markdownlint/doc/md028.md +0 -40
  197. package/packages/config-markdownlint/node_modules/markdownlint/doc/md029.md +0 -98
  198. package/packages/config-markdownlint/node_modules/markdownlint/doc/md030.md +0 -82
  199. package/packages/config-markdownlint/node_modules/markdownlint/doc/md031.md +0 -50
  200. package/packages/config-markdownlint/node_modules/markdownlint/doc/md032.md +0 -55
  201. package/packages/config-markdownlint/node_modules/markdownlint/doc/md033.md +0 -27
  202. package/packages/config-markdownlint/node_modules/markdownlint/doc/md034.md +0 -55
  203. package/packages/config-markdownlint/node_modules/markdownlint/doc/md035.md +0 -42
  204. package/packages/config-markdownlint/node_modules/markdownlint/doc/md036.md +0 -45
  205. package/packages/config-markdownlint/node_modules/markdownlint/doc/md037.md +0 -37
  206. package/packages/config-markdownlint/node_modules/markdownlint/doc/md038.md +0 -40
  207. package/packages/config-markdownlint/node_modules/markdownlint/doc/md039.md +0 -21
  208. package/packages/config-markdownlint/node_modules/markdownlint/doc/md040.md +0 -52
  209. package/packages/config-markdownlint/node_modules/markdownlint/doc/md041.md +0 -49
  210. package/packages/config-markdownlint/node_modules/markdownlint/doc/md042.md +0 -32
  211. package/packages/config-markdownlint/node_modules/markdownlint/doc/md043.md +0 -69
  212. package/packages/config-markdownlint/node_modules/markdownlint/doc/md044.md +0 -45
  213. package/packages/config-markdownlint/node_modules/markdownlint/doc/md045.md +0 -40
  214. package/packages/config-markdownlint/node_modules/markdownlint/doc/md046.md +0 -40
  215. package/packages/config-markdownlint/node_modules/markdownlint/doc/md047.md +0 -34
  216. package/packages/config-markdownlint/node_modules/markdownlint/doc/md048.md +0 -41
  217. package/packages/config-markdownlint/node_modules/markdownlint/doc/md049.md +0 -35
  218. package/packages/config-markdownlint/node_modules/markdownlint/doc/md050.md +0 -35
  219. package/packages/config-markdownlint/node_modules/markdownlint/doc/md051.md +0 -87
  220. package/packages/config-markdownlint/node_modules/markdownlint/doc/md052.md +0 -40
  221. package/packages/config-markdownlint/node_modules/markdownlint/doc/md053.md +0 -38
  222. package/packages/config-markdownlint/node_modules/markdownlint/doc/md054.md +0 -100
  223. package/packages/config-markdownlint/node_modules/markdownlint/doc/md055.md +0 -54
  224. package/packages/config-markdownlint/node_modules/markdownlint/doc/md056.md +0 -37
  225. package/packages/config-markdownlint/node_modules/markdownlint/doc/md058.md +0 -48
  226. package/packages/config-markdownlint/node_modules/markdownlint/helpers/LICENSE +0 -21
  227. package/packages/config-markdownlint/node_modules/markdownlint/helpers/README.md +0 -46
  228. package/packages/config-markdownlint/node_modules/markdownlint/helpers/helpers.js +0 -793
  229. package/packages/config-markdownlint/node_modules/markdownlint/helpers/micromark.cjs +0 -544
  230. package/packages/config-markdownlint/node_modules/markdownlint/helpers/package.json +0 -26
  231. package/packages/config-markdownlint/node_modules/markdownlint/helpers/shared.js +0 -10
  232. package/packages/config-markdownlint/node_modules/markdownlint/lib/cache.js +0 -70
  233. package/packages/config-markdownlint/node_modules/markdownlint/lib/configuration-strict.d.ts +0 -1185
  234. package/packages/config-markdownlint/node_modules/markdownlint/lib/configuration.d.ts +0 -8
  235. package/packages/config-markdownlint/node_modules/markdownlint/lib/constants.js +0 -15
  236. package/packages/config-markdownlint/node_modules/markdownlint/lib/markdownlint.d.ts +0 -488
  237. package/packages/config-markdownlint/node_modules/markdownlint/lib/markdownlint.js +0 -1572
  238. package/packages/config-markdownlint/node_modules/markdownlint/lib/md001.js +0 -31
  239. package/packages/config-markdownlint/node_modules/markdownlint/lib/md003.js +0 -50
  240. package/packages/config-markdownlint/node_modules/markdownlint/lib/md004.js +0 -86
  241. package/packages/config-markdownlint/node_modules/markdownlint/lib/md005.js +0 -72
  242. package/packages/config-markdownlint/node_modules/markdownlint/lib/md007.js +0 -88
  243. package/packages/config-markdownlint/node_modules/markdownlint/lib/md009.js +0 -95
  244. package/packages/config-markdownlint/node_modules/markdownlint/lib/md010.js +0 -78
  245. package/packages/config-markdownlint/node_modules/markdownlint/lib/md011.js +0 -57
  246. package/packages/config-markdownlint/node_modules/markdownlint/lib/md012.js +0 -43
  247. package/packages/config-markdownlint/node_modules/markdownlint/lib/md013.js +0 -105
  248. package/packages/config-markdownlint/node_modules/markdownlint/lib/md014.js +0 -54
  249. package/packages/config-markdownlint/node_modules/markdownlint/lib/md018.js +0 -46
  250. package/packages/config-markdownlint/node_modules/markdownlint/lib/md019-md021.js +0 -80
  251. package/packages/config-markdownlint/node_modules/markdownlint/lib/md020.js +0 -71
  252. package/packages/config-markdownlint/node_modules/markdownlint/lib/md022.js +0 -106
  253. package/packages/config-markdownlint/node_modules/markdownlint/lib/md023.js +0 -40
  254. package/packages/config-markdownlint/node_modules/markdownlint/lib/md024.js +0 -48
  255. package/packages/config-markdownlint/node_modules/markdownlint/lib/md025.js +0 -40
  256. package/packages/config-markdownlint/node_modules/markdownlint/lib/md026.js +0 -49
  257. package/packages/config-markdownlint/node_modules/markdownlint/lib/md027.js +0 -37
  258. package/packages/config-markdownlint/node_modules/markdownlint/lib/md028.js +0 -42
  259. package/packages/config-markdownlint/node_modules/markdownlint/lib/md029.js +0 -76
  260. package/packages/config-markdownlint/node_modules/markdownlint/lib/md030.js +0 -60
  261. package/packages/config-markdownlint/node_modules/markdownlint/lib/md031.js +0 -63
  262. package/packages/config-markdownlint/node_modules/markdownlint/lib/md032.js +0 -66
  263. package/packages/config-markdownlint/node_modules/markdownlint/lib/md033.js +0 -41
  264. package/packages/config-markdownlint/node_modules/markdownlint/lib/md034.js +0 -100
  265. package/packages/config-markdownlint/node_modules/markdownlint/lib/md035.js +0 -26
  266. package/packages/config-markdownlint/node_modules/markdownlint/lib/md036.js +0 -51
  267. package/packages/config-markdownlint/node_modules/markdownlint/lib/md037.js +0 -94
  268. package/packages/config-markdownlint/node_modules/markdownlint/lib/md038.js +0 -100
  269. package/packages/config-markdownlint/node_modules/markdownlint/lib/md039.js +0 -83
  270. package/packages/config-markdownlint/node_modules/markdownlint/lib/md040.js +0 -37
  271. package/packages/config-markdownlint/node_modules/markdownlint/lib/md041.js +0 -37
  272. package/packages/config-markdownlint/node_modules/markdownlint/lib/md042.js +0 -63
  273. package/packages/config-markdownlint/node_modules/markdownlint/lib/md043.js +0 -73
  274. package/packages/config-markdownlint/node_modules/markdownlint/lib/md044.js +0 -110
  275. package/packages/config-markdownlint/node_modules/markdownlint/lib/md045.js +0 -62
  276. package/packages/config-markdownlint/node_modules/markdownlint/lib/md046.js +0 -34
  277. package/packages/config-markdownlint/node_modules/markdownlint/lib/md047.js +0 -31
  278. package/packages/config-markdownlint/node_modules/markdownlint/lib/md048.js +0 -39
  279. package/packages/config-markdownlint/node_modules/markdownlint/lib/md049-md050.js +0 -103
  280. package/packages/config-markdownlint/node_modules/markdownlint/lib/md051.js +0 -170
  281. package/packages/config-markdownlint/node_modules/markdownlint/lib/md052.js +0 -42
  282. package/packages/config-markdownlint/node_modules/markdownlint/lib/md053.js +0 -62
  283. package/packages/config-markdownlint/node_modules/markdownlint/lib/md054.js +0 -125
  284. package/packages/config-markdownlint/node_modules/markdownlint/lib/md055.js +0 -79
  285. package/packages/config-markdownlint/node_modules/markdownlint/lib/md056.js +0 -56
  286. package/packages/config-markdownlint/node_modules/markdownlint/lib/md058.js +0 -43
  287. package/packages/config-markdownlint/node_modules/markdownlint/lib/rules.js +0 -74
  288. package/packages/config-markdownlint/node_modules/markdownlint/package.json +0 -105
  289. package/packages/config-markdownlint/node_modules/markdownlint/schema/.markdownlint.jsonc +0 -307
  290. package/packages/config-markdownlint/node_modules/markdownlint/schema/.markdownlint.yaml +0 -275
  291. package/packages/config-markdownlint/node_modules/markdownlint/schema/ValidatingConfiguration.md +0 -26
  292. package/packages/config-markdownlint/node_modules/markdownlint/schema/markdownlint-config-schema-strict.json +0 -1819
  293. package/packages/config-markdownlint/node_modules/markdownlint/schema/markdownlint-config-schema.json +0 -1824
  294. package/packages/config-markdownlint/node_modules/markdownlint/style/all.json +0 -5
  295. package/packages/config-markdownlint/node_modules/markdownlint/style/cirosantilli.json +0 -22
  296. package/packages/config-markdownlint/node_modules/markdownlint/style/prettier.json +0 -27
  297. package/packages/config-markdownlint/node_modules/markdownlint/style/relaxed.json +0 -12
  298. package/packages/config-markdownlint/node_modules/markdownlint-micromark/LICENSE +0 -21
  299. package/packages/config-markdownlint/node_modules/markdownlint-micromark/README.md +0 -10
  300. package/packages/config-markdownlint/node_modules/markdownlint-micromark/micromark-browser.js +0 -2
  301. package/packages/config-markdownlint/node_modules/markdownlint-micromark/micromark-html-browser.js +0 -2
  302. package/packages/config-markdownlint/node_modules/markdownlint-micromark/micromark.cjs +0 -1
  303. package/packages/config-markdownlint/node_modules/markdownlint-micromark/micromark.d.cts +0 -1751
  304. package/packages/config-markdownlint/node_modules/markdownlint-micromark/package.json +0 -46
@@ -1,793 +0,0 @@
1
- // @ts-check
2
-
3
- "use strict";
4
-
5
- const micromark = require("./micromark.cjs");
6
-
7
- const { newLineRe, nextLinesRe } = require("./shared.js");
8
-
9
- module.exports.newLineRe = newLineRe;
10
- module.exports.nextLinesRe = nextLinesRe;
11
-
12
- // Regular expression for matching common front matter (YAML and TOML)
13
- module.exports.frontMatterRe =
14
- /((^---\s*$[\s\S]+?^---\s*)|(^\+\+\+\s*$[\s\S]+?^(\+\+\+|\.\.\.)\s*)|(^\{\s*$[\s\S]+?^\}\s*))(\r\n|\r|\n|$)/m;
15
-
16
- // Regular expression for matching the start of inline disable/enable comments
17
- const inlineCommentStartRe =
18
- /(<!--\s*markdownlint-(disable|enable|capture|restore|disable-file|enable-file|disable-line|disable-next-line|configure-file))(?:\s|-->)/gi;
19
- module.exports.inlineCommentStartRe = inlineCommentStartRe;
20
-
21
- // Regular expression for blockquote prefixes
22
- const blockquotePrefixRe = /^[>\s]*/;
23
- module.exports.blockquotePrefixRe = blockquotePrefixRe;
24
-
25
- // Regular expression for link reference definitions
26
- const linkReferenceDefinitionRe = /^ {0,3}\[([^\]]*[^\\])\]:/;
27
- module.exports.linkReferenceDefinitionRe = linkReferenceDefinitionRe;
28
-
29
- // Regular expression for identifying an HTML entity at the end of a line
30
- module.exports.endOfLineHtmlEntityRe =
31
- /&(?:#\d+|#[xX][\da-fA-F]+|[a-zA-Z]{2,31}|blk\d{2}|emsp1[34]|frac\d{2}|sup\d|there4);$/;
32
-
33
- // Regular expression for identifying a GitHub emoji code at the end of a line
34
- module.exports.endOfLineGemojiCodeRe =
35
- /:(?:[abmovx]|[-+]1|100|1234|(?:1st|2nd|3rd)_place_medal|8ball|clock\d{1,4}|e-mail|non-potable_water|o2|t-rex|u5272|u5408|u55b6|u6307|u6708|u6709|u6e80|u7121|u7533|u7981|u7a7a|[a-z]{2,15}2?|[a-z]{1,14}(?:_[a-z\d]{1,16})+):$/;
36
-
37
- // All punctuation characters (normal and full-width)
38
- const allPunctuation = ".,;:!?。,;:!?";
39
- module.exports.allPunctuation = allPunctuation;
40
-
41
- // All punctuation characters without question mark (normal and full-width)
42
- module.exports.allPunctuationNoQuestion = allPunctuation.replace(/[??]/gu, "");
43
-
44
- /**
45
- * Returns true iff the input is a Number.
46
- *
47
- * @param {Object} obj Object of unknown type.
48
- * @returns {boolean} True iff obj is a Number.
49
- */
50
- function isNumber(obj) {
51
- return typeof obj === "number";
52
- }
53
- module.exports.isNumber = isNumber;
54
-
55
- /**
56
- * Returns true iff the input is a String.
57
- *
58
- * @param {Object} obj Object of unknown type.
59
- * @returns {boolean} True iff obj is a String.
60
- */
61
- function isString(obj) {
62
- return typeof obj === "string";
63
- }
64
- module.exports.isString = isString;
65
-
66
- /**
67
- * Returns true iff the input String is empty.
68
- *
69
- * @param {string} str String of unknown length.
70
- * @returns {boolean} True iff the input String is empty.
71
- */
72
- function isEmptyString(str) {
73
- return str.length === 0;
74
- }
75
- module.exports.isEmptyString = isEmptyString;
76
-
77
- /**
78
- * Returns true iff the input is an Object.
79
- *
80
- * @param {Object} obj Object of unknown type.
81
- * @returns {boolean} True iff obj is an Object.
82
- */
83
- function isObject(obj) {
84
- return !!obj && (typeof obj === "object") && !Array.isArray(obj);
85
- }
86
- module.exports.isObject = isObject;
87
-
88
- /**
89
- * Returns true iff the input is a URL.
90
- *
91
- * @param {Object} obj Object of unknown type.
92
- * @returns {boolean} True iff obj is a URL.
93
- */
94
- function isUrl(obj) {
95
- return !!obj && (Object.getPrototypeOf(obj) === URL.prototype);
96
- }
97
- module.exports.isUrl = isUrl;
98
-
99
- /**
100
- * Clones the input if it is an Array.
101
- *
102
- * @param {Object} arr Object of unknown type.
103
- * @returns {Object} Clone of obj iff obj is an Array.
104
- */
105
- function cloneIfArray(arr) {
106
- return Array.isArray(arr) ? [ ...arr ] : arr;
107
- }
108
- module.exports.cloneIfArray = cloneIfArray;
109
-
110
- /**
111
- * Clones the input if it is a URL.
112
- *
113
- * @param {Object} url Object of unknown type.
114
- * @returns {Object} Clone of obj iff obj is a URL.
115
- */
116
- function cloneIfUrl(url) {
117
- return isUrl(url) ? new URL(url) : url;
118
- }
119
- module.exports.cloneIfUrl = cloneIfUrl;
120
-
121
- /**
122
- * Gets a Regular Expression for matching the specified HTML attribute.
123
- *
124
- * @param {string} name HTML attribute name.
125
- * @returns {RegExp} Regular Expression for matching.
126
- */
127
- module.exports.getHtmlAttributeRe = function getHtmlAttributeRe(name) {
128
- return new RegExp(`\\s${name}\\s*=\\s*['"]?([^'"\\s>]*)`, "iu");
129
- };
130
-
131
- /**
132
- * Returns true iff the input line is blank (contains nothing, whitespace, or
133
- * comments (unclosed start/end comments allowed)).
134
- *
135
- * @param {string} line Input line.
136
- * @returns {boolean} True iff line is blank.
137
- */
138
- function isBlankLine(line) {
139
- const startComment = "<!--";
140
- const endComment = "-->";
141
- const removeComments = (s) => {
142
- while (true) {
143
- const start = s.indexOf(startComment);
144
- const end = s.indexOf(endComment);
145
- if ((end !== -1) && ((start === -1) || (end < start))) {
146
- // Unmatched end comment is first
147
- s = s.slice(end + endComment.length);
148
- } else if ((start !== -1) && (end !== -1)) {
149
- // Start comment is before end comment
150
- s = s.slice(0, start) + s.slice(end + endComment.length);
151
- } else if ((start !== -1) && (end === -1)) {
152
- // Unmatched start comment is last
153
- s = s.slice(0, start);
154
- } else {
155
- // No more comments to remove
156
- return s;
157
- }
158
- }
159
- };
160
- return (
161
- !line ||
162
- !line.trim() ||
163
- !removeComments(line).replace(/>/g, "").trim()
164
- );
165
- }
166
- module.exports.isBlankLine = isBlankLine;
167
-
168
- // Replaces the content of properly-formatted CommonMark comments with "."
169
- // This preserves the line/column information for the rest of the document
170
- // https://spec.commonmark.org/0.29/#html-blocks
171
- // https://spec.commonmark.org/0.29/#html-comment
172
- const htmlCommentBegin = "<!--";
173
- const htmlCommentEnd = "-->";
174
- const safeCommentCharacter = ".";
175
- const startsWithPipeRe = /^ *\|/;
176
- const notCrLfRe = /[^\r\n]/g;
177
- const notSpaceCrLfRe = /[^ \r\n]/g;
178
- const trailingSpaceRe = / +[\r\n]/g;
179
- const replaceTrailingSpace = (s) => s.replace(notCrLfRe, safeCommentCharacter);
180
- module.exports.clearHtmlCommentText = function clearHtmlCommentText(text) {
181
- let i = 0;
182
- while ((i = text.indexOf(htmlCommentBegin, i)) !== -1) {
183
- const j = text.indexOf(htmlCommentEnd, i + 2);
184
- if (j === -1) {
185
- // Un-terminated comments are treated as text
186
- break;
187
- }
188
- // If the comment has content...
189
- if (j > i + htmlCommentBegin.length) {
190
- const content = text.slice(i + htmlCommentBegin.length, j);
191
- const lastLf = text.lastIndexOf("\n", i) + 1;
192
- const preText = text.slice(lastLf, i);
193
- const isBlock = preText.trim().length === 0;
194
- const couldBeTable = startsWithPipeRe.test(preText);
195
- const spansTableCells = couldBeTable && content.includes("\n");
196
- const isValid =
197
- isBlock ||
198
- !(
199
- spansTableCells ||
200
- content.startsWith(">") ||
201
- content.startsWith("->") ||
202
- content.endsWith("-") ||
203
- content.includes("--")
204
- );
205
- // If a valid block/inline comment...
206
- if (isValid) {
207
- const clearedContent = content
208
- .replace(notSpaceCrLfRe, safeCommentCharacter)
209
- .replace(trailingSpaceRe, replaceTrailingSpace);
210
- text =
211
- text.slice(0, i + htmlCommentBegin.length) +
212
- clearedContent +
213
- text.slice(j);
214
- }
215
- }
216
- i = j + htmlCommentEnd.length;
217
- }
218
- return text;
219
- };
220
-
221
- // Escapes a string for use in a RegExp
222
- module.exports.escapeForRegExp = function escapeForRegExp(str) {
223
- return str.replace(/[-/\\^$*+?.()|[\]{}]/g, "\\$&");
224
- };
225
-
226
- /**
227
- * Return the string representation of a fence markup character.
228
- *
229
- * @param {string} markup Fence string.
230
- * @returns {string} String representation.
231
- */
232
- module.exports.fencedCodeBlockStyleFor =
233
- function fencedCodeBlockStyleFor(markup) {
234
- switch (markup[0]) {
235
- case "~":
236
- return "tilde";
237
- default:
238
- return "backtick";
239
- }
240
- };
241
-
242
- /**
243
- * Return the string representation of a emphasis or strong markup character.
244
- *
245
- * @param {string} markup Emphasis or strong string.
246
- * @returns {"asterisk" | "underscore"} String representation.
247
- */
248
- module.exports.emphasisOrStrongStyleFor =
249
- function emphasisOrStrongStyleFor(markup) {
250
- switch (markup[0]) {
251
- case "*":
252
- return "asterisk";
253
- default:
254
- return "underscore";
255
- }
256
- };
257
-
258
- /**
259
- * @callback InlineCodeSpanCallback
260
- * @param {string} code Code content.
261
- * @param {number} lineIndex Line index (0-based).
262
- * @param {number} columnIndex Column index (0-based).
263
- * @param {number} ticks Count of backticks.
264
- * @returns {void}
265
- */
266
-
267
- /**
268
- * Calls the provided function for each inline code span's content.
269
- *
270
- * @param {string} input Markdown content.
271
- * @param {InlineCodeSpanCallback} handler Callback function taking (code,
272
- * lineIndex, columnIndex, ticks).
273
- * @returns {void}
274
- */
275
- function forEachInlineCodeSpan(input, handler) {
276
- const backtickRe = /`+/g;
277
- let match = null;
278
- const backticksLengthAndIndex = [];
279
- while ((match = backtickRe.exec(input)) !== null) {
280
- backticksLengthAndIndex.push([ match[0].length, match.index ]);
281
- }
282
- const newLinesIndex = [];
283
- while ((match = newLineRe.exec(input)) !== null) {
284
- newLinesIndex.push(match.index);
285
- }
286
- let lineIndex = 0;
287
- let lineStartIndex = 0;
288
- let k = 0;
289
- for (let i = 0; i < backticksLengthAndIndex.length - 1; i++) {
290
- const [ startLength, startIndex ] = backticksLengthAndIndex[i];
291
- if ((startIndex === 0) || (input[startIndex - 1] !== "\\")) {
292
- for (let j = i + 1; j < backticksLengthAndIndex.length; j++) {
293
- const [ endLength, endIndex ] = backticksLengthAndIndex[j];
294
- if (startLength === endLength) {
295
- for (; k < newLinesIndex.length; k++) {
296
- const newLineIndex = newLinesIndex[k];
297
- if (startIndex < newLineIndex) {
298
- break;
299
- }
300
- lineIndex++;
301
- lineStartIndex = newLineIndex + 1;
302
- }
303
- const columnIndex = startIndex - lineStartIndex + startLength;
304
- handler(
305
- input.slice(startIndex + startLength, endIndex),
306
- lineIndex,
307
- columnIndex,
308
- startLength
309
- );
310
- i = j;
311
- break;
312
- }
313
- }
314
- }
315
- }
316
- }
317
- module.exports.forEachInlineCodeSpan = forEachInlineCodeSpan;
318
-
319
- /**
320
- * Adds ellipsis to the left/right/middle of the specified text.
321
- *
322
- * @param {string} text Text to ellipsify.
323
- * @param {boolean} [start] True iff the start of the text is important.
324
- * @param {boolean} [end] True iff the end of the text is important.
325
- * @returns {string} Ellipsified text.
326
- */
327
- function ellipsify(text, start, end) {
328
- if (text.length <= 30) {
329
- // Nothing to do
330
- } else if (start && end) {
331
- text = text.slice(0, 15) + "..." + text.slice(-15);
332
- } else if (end) {
333
- text = "..." + text.slice(-30);
334
- } else {
335
- text = text.slice(0, 30) + "...";
336
- }
337
- return text;
338
- }
339
- module.exports.ellipsify = ellipsify;
340
-
341
- /**
342
- * Adds a generic error object via the onError callback.
343
- *
344
- * @param {Object} onError RuleOnError instance.
345
- * @param {number} lineNumber Line number.
346
- * @param {string} [detail] Error details.
347
- * @param {string} [context] Error context.
348
- * @param {number[]} [range] Column and length of error.
349
- * @param {Object} [fixInfo] RuleOnErrorFixInfo instance.
350
- * @returns {void}
351
- */
352
- function addError(onError, lineNumber, detail, context, range, fixInfo) {
353
- onError({
354
- lineNumber,
355
- detail,
356
- context,
357
- range,
358
- fixInfo
359
- });
360
- }
361
- module.exports.addError = addError;
362
-
363
- /**
364
- * Adds an error object with details conditionally via the onError callback.
365
- *
366
- * @param {Object} onError RuleOnError instance.
367
- * @param {number} lineNumber Line number.
368
- * @param {Object} expected Expected value.
369
- * @param {Object} actual Actual value.
370
- * @param {string} [detail] Error details.
371
- * @param {string} [context] Error context.
372
- * @param {number[]} [range] Column and length of error.
373
- * @param {Object} [fixInfo] RuleOnErrorFixInfo instance.
374
- * @returns {void}
375
- */
376
- function addErrorDetailIf(
377
- onError, lineNumber, expected, actual, detail, context, range, fixInfo) {
378
- if (expected !== actual) {
379
- addError(
380
- onError,
381
- lineNumber,
382
- "Expected: " + expected + "; Actual: " + actual +
383
- (detail ? "; " + detail : ""),
384
- context,
385
- range,
386
- fixInfo);
387
- }
388
- }
389
- module.exports.addErrorDetailIf = addErrorDetailIf;
390
-
391
- /**
392
- * Adds an error object with context via the onError callback.
393
- *
394
- * @param {Object} onError RuleOnError instance.
395
- * @param {number} lineNumber Line number.
396
- * @param {string} context Error context.
397
- * @param {boolean} [start] True iff the start of the text is important.
398
- * @param {boolean} [end] True iff the end of the text is important.
399
- * @param {number[]} [range] Column and length of error.
400
- * @param {Object} [fixInfo] RuleOnErrorFixInfo instance.
401
- * @returns {void}
402
- */
403
- function addErrorContext(
404
- onError, lineNumber, context, start, end, range, fixInfo) {
405
- context = ellipsify(context, start, end);
406
- addError(onError, lineNumber, undefined, context, range, fixInfo);
407
- }
408
- module.exports.addErrorContext = addErrorContext;
409
-
410
- /**
411
- * Adds an error object with context for a construct missing a blank line.
412
- *
413
- * @param {Object} onError RuleOnError instance.
414
- * @param {string[]} lines Lines of Markdown content.
415
- * @param {number} lineIndex Line index of line.
416
- * @param {number} [lineNumber] Line number for override.
417
- * @returns {void}
418
- */
419
- function addErrorContextForLine(onError, lines, lineIndex, lineNumber) {
420
- const line = lines[lineIndex];
421
- // @ts-ignore
422
- const quotePrefix = line.match(blockquotePrefixRe)[0].trimEnd();
423
- addErrorContext(
424
- onError,
425
- lineIndex + 1,
426
- line.trim(),
427
- undefined,
428
- undefined,
429
- undefined,
430
- {
431
- lineNumber,
432
- "insertText": `${quotePrefix}\n`
433
- }
434
- );
435
- }
436
- module.exports.addErrorContextForLine = addErrorContextForLine;
437
-
438
- /**
439
- * Determines whether the specified range is within another range.
440
- *
441
- * @param {number[][]} ranges Array of ranges (line, index, length).
442
- * @param {number} lineIndex Line index to check.
443
- * @param {number} index Index to check.
444
- * @param {number} length Length to check.
445
- * @returns {boolean} True iff the specified range is within.
446
- */
447
- const withinAnyRange = (ranges, lineIndex, index, length) => (
448
- !ranges.every((span) => (
449
- (lineIndex !== span[0]) ||
450
- (index < span[1]) ||
451
- (index + length > span[1] + span[2])
452
- ))
453
- );
454
- module.exports.withinAnyRange = withinAnyRange;
455
-
456
- // Determines if the front matter includes a title
457
- module.exports.frontMatterHasTitle =
458
- function frontMatterHasTitle(frontMatterLines, frontMatterTitlePattern) {
459
- const ignoreFrontMatter =
460
- (frontMatterTitlePattern !== undefined) && !frontMatterTitlePattern;
461
- const frontMatterTitleRe =
462
- new RegExp(
463
- String(frontMatterTitlePattern || "^\\s*\"?title\"?\\s*[:=]"),
464
- "i"
465
- );
466
- return !ignoreFrontMatter &&
467
- frontMatterLines.some((line) => frontMatterTitleRe.test(line));
468
- };
469
-
470
- /**
471
- * Returns an object with information about reference links and images.
472
- *
473
- * @param {import("../helpers/micromark.cjs").Token[]} tokens Micromark tokens.
474
- * @returns {Object} Reference link/image data.
475
- */
476
- function getReferenceLinkImageData(tokens) {
477
- const normalizeReference = (s) => s.toLowerCase().trim().replace(/\s+/g, " ");
478
- const definitions = new Map();
479
- const definitionLineIndices = [];
480
- const duplicateDefinitions = [];
481
- const references = new Map();
482
- const shortcuts = new Map();
483
- const filteredTokens =
484
- micromark.filterByTypes(
485
- tokens,
486
- [
487
- // definitionLineIndices
488
- "definition", "gfmFootnoteDefinition",
489
- // definitions and definitionLineIndices
490
- "definitionLabelString", "gfmFootnoteDefinitionLabelString",
491
- // references and shortcuts
492
- "gfmFootnoteCall", "image", "link"
493
- ]
494
- );
495
- for (const token of filteredTokens) {
496
- let labelPrefix = "";
497
- // eslint-disable-next-line default-case
498
- switch (token.type) {
499
- case "definition":
500
- case "gfmFootnoteDefinition":
501
- // definitionLineIndices
502
- for (let i = token.startLine; i <= token.endLine; i++) {
503
- definitionLineIndices.push(i - 1);
504
- }
505
- break;
506
- case "gfmFootnoteDefinitionLabelString":
507
- labelPrefix = "^";
508
- case "definitionLabelString": // eslint-disable-line no-fallthrough
509
- {
510
- // definitions and definitionLineIndices
511
- const reference = normalizeReference(`${labelPrefix}${token.text}`);
512
- if (definitions.has(reference)) {
513
- duplicateDefinitions.push([ reference, token.startLine - 1 ]);
514
- } else {
515
- let destinationString = null;
516
- const parent =
517
- micromark.getTokenParentOfType(token, [ "definition" ]);
518
- if (parent) {
519
- destinationString = micromark.getTokenTextByType(
520
- micromark.filterByPredicate(parent.children),
521
- "definitionDestinationString"
522
- );
523
- }
524
- definitions.set(
525
- reference,
526
- [ token.startLine - 1, destinationString ]
527
- );
528
- }
529
- }
530
- break;
531
- case "gfmFootnoteCall":
532
- case "image":
533
- case "link":
534
- {
535
- let isShortcut = false;
536
- let isFullOrCollapsed = false;
537
- let labelText = null;
538
- let referenceStringText = null;
539
- const shortcutCandidate =
540
- micromark.matchAndGetTokensByType(token.children, [ "label" ]);
541
- if (shortcutCandidate) {
542
- labelText =
543
- micromark.getTokenTextByType(
544
- shortcutCandidate[0].children, "labelText"
545
- );
546
- isShortcut = (labelText !== null);
547
- }
548
- const fullAndCollapsedCandidate =
549
- micromark.matchAndGetTokensByType(
550
- token.children, [ "label", "reference" ]
551
- );
552
- if (fullAndCollapsedCandidate) {
553
- labelText =
554
- micromark.getTokenTextByType(
555
- fullAndCollapsedCandidate[0].children, "labelText"
556
- );
557
- referenceStringText =
558
- micromark.getTokenTextByType(
559
- fullAndCollapsedCandidate[1].children, "referenceString"
560
- );
561
- isFullOrCollapsed = (labelText !== null);
562
- }
563
- const footnote = micromark.matchAndGetTokensByType(
564
- token.children,
565
- [
566
- "gfmFootnoteCallLabelMarker", "gfmFootnoteCallMarker",
567
- "gfmFootnoteCallString", "gfmFootnoteCallLabelMarker"
568
- ],
569
- [ "gfmFootnoteCallMarker", "gfmFootnoteCallString" ]
570
- );
571
- if (footnote) {
572
- const callMarkerText = footnote[0].text;
573
- const callString = footnote[1].text;
574
- labelText = `${callMarkerText}${callString}`;
575
- isShortcut = true;
576
- }
577
- // Track shortcuts separately due to ambiguity in "text [text] text"
578
- if (isShortcut || isFullOrCollapsed) {
579
- const referenceDatum = [
580
- token.startLine - 1,
581
- token.startColumn - 1,
582
- token.text.length,
583
- // @ts-ignore
584
- labelText.length,
585
- (referenceStringText || "").length
586
- ];
587
- const reference =
588
- normalizeReference(referenceStringText || labelText);
589
- const dictionary = isShortcut ? shortcuts : references;
590
- const referenceData = dictionary.get(reference) || [];
591
- referenceData.push(referenceDatum);
592
- dictionary.set(reference, referenceData);
593
- }
594
- }
595
- break;
596
- }
597
- }
598
- return {
599
- references,
600
- shortcuts,
601
- definitions,
602
- duplicateDefinitions,
603
- definitionLineIndices
604
- };
605
- }
606
- module.exports.getReferenceLinkImageData = getReferenceLinkImageData;
607
-
608
- /**
609
- * Gets the most common line ending, falling back to the platform default.
610
- *
611
- * @param {string} input Markdown content to analyze.
612
- * @param {Object} [os] Node.js "os" module.
613
- * @returns {string} Preferred line ending.
614
- */
615
- function getPreferredLineEnding(input, os) {
616
- let cr = 0;
617
- let lf = 0;
618
- let crlf = 0;
619
- const endings = input.match(newLineRe) || [];
620
- for (const ending of endings) {
621
- // eslint-disable-next-line default-case
622
- switch (ending) {
623
- case "\r":
624
- cr++;
625
- break;
626
- case "\n":
627
- lf++;
628
- break;
629
- case "\r\n":
630
- crlf++;
631
- break;
632
- }
633
- }
634
- let preferredLineEnding = null;
635
- if (!cr && !lf && !crlf) {
636
- preferredLineEnding = (os && os.EOL) || "\n";
637
- } else if ((lf >= crlf) && (lf >= cr)) {
638
- preferredLineEnding = "\n";
639
- } else if (crlf >= cr) {
640
- preferredLineEnding = "\r\n";
641
- } else {
642
- preferredLineEnding = "\r";
643
- }
644
- return preferredLineEnding;
645
- }
646
- module.exports.getPreferredLineEnding = getPreferredLineEnding;
647
-
648
- /**
649
- * Normalizes the fields of a RuleOnErrorFixInfo instance.
650
- *
651
- * @param {Object} fixInfo RuleOnErrorFixInfo instance.
652
- * @param {number} [lineNumber] Line number.
653
- * @returns {Object} Normalized RuleOnErrorFixInfo instance.
654
- */
655
- function normalizeFixInfo(fixInfo, lineNumber) {
656
- return {
657
- "lineNumber": fixInfo.lineNumber || lineNumber,
658
- "editColumn": fixInfo.editColumn || 1,
659
- "deleteCount": fixInfo.deleteCount || 0,
660
- "insertText": fixInfo.insertText || ""
661
- };
662
- }
663
-
664
- /**
665
- * Fixes the specified error on a line of Markdown content.
666
- *
667
- * @param {string} line Line of Markdown content.
668
- * @param {Object} fixInfo RuleOnErrorFixInfo instance.
669
- * @param {string} [lineEnding] Line ending to use.
670
- * @returns {string | null} Fixed content.
671
- */
672
- function applyFix(line, fixInfo, lineEnding) {
673
- const { editColumn, deleteCount, insertText } = normalizeFixInfo(fixInfo);
674
- const editIndex = editColumn - 1;
675
- return (deleteCount === -1) ?
676
- null :
677
- line.slice(0, editIndex) +
678
- insertText.replace(/\n/g, lineEnding || "\n") +
679
- line.slice(editIndex + deleteCount);
680
- }
681
- module.exports.applyFix = applyFix;
682
-
683
- /**
684
- * Applies as many fixes as possible to Markdown content.
685
- *
686
- * @param {string} input Lines of Markdown content.
687
- * @param {Object[]} errors RuleOnErrorInfo instances.
688
- * @returns {string} Corrected content.
689
- */
690
- function applyFixes(input, errors) {
691
- const lineEnding = getPreferredLineEnding(input, require("node:os"));
692
- const lines = input.split(newLineRe);
693
- // Normalize fixInfo objects
694
- let fixInfos = errors
695
- .filter((error) => error.fixInfo)
696
- .map((error) => normalizeFixInfo(error.fixInfo, error.lineNumber));
697
- // Sort bottom-to-top, line-deletes last, right-to-left, long-to-short
698
- fixInfos.sort((a, b) => {
699
- const aDeletingLine = (a.deleteCount === -1);
700
- const bDeletingLine = (b.deleteCount === -1);
701
- return (
702
- (b.lineNumber - a.lineNumber) ||
703
- (aDeletingLine ? 1 : (bDeletingLine ? -1 : 0)) ||
704
- (b.editColumn - a.editColumn) ||
705
- (b.insertText.length - a.insertText.length)
706
- );
707
- });
708
- // Remove duplicate entries (needed for following collapse step)
709
- let lastFixInfo = {};
710
- fixInfos = fixInfos.filter((fixInfo) => {
711
- const unique = (
712
- (fixInfo.lineNumber !== lastFixInfo.lineNumber) ||
713
- (fixInfo.editColumn !== lastFixInfo.editColumn) ||
714
- (fixInfo.deleteCount !== lastFixInfo.deleteCount) ||
715
- (fixInfo.insertText !== lastFixInfo.insertText)
716
- );
717
- lastFixInfo = fixInfo;
718
- return unique;
719
- });
720
- // Collapse insert/no-delete and no-insert/delete for same line/column
721
- lastFixInfo = {
722
- "lineNumber": -1
723
- };
724
- for (const fixInfo of fixInfos) {
725
- if (
726
- (fixInfo.lineNumber === lastFixInfo.lineNumber) &&
727
- (fixInfo.editColumn === lastFixInfo.editColumn) &&
728
- !fixInfo.insertText &&
729
- (fixInfo.deleteCount > 0) &&
730
- lastFixInfo.insertText &&
731
- !lastFixInfo.deleteCount) {
732
- fixInfo.insertText = lastFixInfo.insertText;
733
- lastFixInfo.lineNumber = 0;
734
- }
735
- lastFixInfo = fixInfo;
736
- }
737
- fixInfos = fixInfos.filter((fixInfo) => fixInfo.lineNumber);
738
- // Apply all (remaining/updated) fixes
739
- let lastLineIndex = -1;
740
- let lastEditIndex = -1;
741
- for (const fixInfo of fixInfos) {
742
- const { lineNumber, editColumn, deleteCount } = fixInfo;
743
- const lineIndex = lineNumber - 1;
744
- const editIndex = editColumn - 1;
745
- if (
746
- (lineIndex !== lastLineIndex) ||
747
- (deleteCount === -1) ||
748
- ((editIndex + deleteCount) <=
749
- (lastEditIndex - ((deleteCount > 0) ? 0 : 1)))
750
- ) {
751
- // @ts-ignore
752
- lines[lineIndex] = applyFix(lines[lineIndex], fixInfo, lineEnding);
753
- }
754
- lastLineIndex = lineIndex;
755
- lastEditIndex = editIndex;
756
- }
757
- // Return corrected input
758
- return lines.filter((line) => line !== null).join(lineEnding);
759
- }
760
- module.exports.applyFixes = applyFixes;
761
-
762
- /**
763
- * Expands a path with a tilde to an absolute path.
764
- *
765
- * @param {string} file Path that may begin with a tilde.
766
- * @param {Object} os Node.js "os" module.
767
- * @returns {string} Absolute path (or original path).
768
- */
769
- function expandTildePath(file, os) {
770
- const homedir = os && os.homedir && os.homedir();
771
- return homedir ? file.replace(/^~($|\/|\\)/, `${homedir}$1`) : file;
772
- }
773
- module.exports.expandTildePath = expandTildePath;
774
-
775
- // Copied from markdownlint.js to avoid TypeScript compiler import() issue.
776
- /**
777
- * @typedef {Object} MarkdownItToken
778
- * @property {string[][]} attrs HTML attributes.
779
- * @property {boolean} block Block-level token.
780
- * @property {MarkdownItToken[]} children Child nodes.
781
- * @property {string} content Tag contents.
782
- * @property {boolean} hidden Ignore element.
783
- * @property {string} info Fence info.
784
- * @property {number} level Nesting level.
785
- * @property {number[]} map Beginning/ending line numbers.
786
- * @property {string} markup Markup text.
787
- * @property {Object} meta Arbitrary data.
788
- * @property {number} nesting Level change.
789
- * @property {string} tag HTML tag name.
790
- * @property {string} type Token type.
791
- * @property {number} lineNumber Line number (1-based).
792
- * @property {string} line Line content.
793
- */