linter-bundle 5.1.0 → 6.1.0

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 (195) hide show
  1. package/.linter-bundle.js +2 -0
  2. package/CHANGELOG.md +83 -9
  3. package/README.md +5 -3
  4. package/TODO.md +5 -0
  5. package/eslint/index.cjs +10 -4
  6. package/eslint/overrides-javascript.cjs +7 -1
  7. package/eslint/overrides-jest.cjs +1 -0
  8. package/eslint/overrides-jsdoc.cjs +1 -0
  9. package/eslint/rules/no-global-undefined-check.js +5 -3
  10. package/eslint/rules/no-unnecessary-typeof.js +26 -24
  11. package/eslint/rules/restricted-filenames.js +3 -1
  12. package/helper/ensure-type.cjs +2 -2
  13. package/helper/get-git-files.js +1 -1
  14. package/helper/get-outdated-dependencies.js +1 -1
  15. package/helper/get-outdated-overrides.js +1 -1
  16. package/helper/get-stylelint-path.js +1 -1
  17. package/helper/is-npm-or-yarn.js +1 -1
  18. package/helper/linter-bundle-config.js +22 -7
  19. package/helper/run-process.js +3 -3
  20. package/lint.js +31 -35
  21. package/package.json +27 -26
  22. package/stylelint/index.cjs +90 -5
  23. package/stylelint/plugins/stylelint-15.11.0-stylistic/LICENSE +20 -0
  24. package/stylelint/plugins/stylelint-15.11.0-stylistic/html-tags/LICENSE +9 -0
  25. package/stylelint/plugins/stylelint-15.11.0-stylistic/html-tags/index.cjs +122 -0
  26. package/stylelint/plugins/stylelint-15.11.0-stylistic/reference/selectors.cjs +327 -0
  27. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/at-rule-name-case/README.md +110 -0
  28. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/at-rule-name-case/index.cjs +66 -0
  29. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/at-rule-name-space-after/README.md +117 -0
  30. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/at-rule-name-space-after/index.cjs +55 -0
  31. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/at-rule-semicolon-newline-after/README.md +63 -0
  32. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/at-rule-semicolon-newline-after/index.cjs +87 -0
  33. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/at-rule-semicolon-space-before/README.md +50 -0
  34. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/at-rule-semicolon-space-before/index.cjs +70 -0
  35. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/atRuleNameSpaceChecker.cjs +56 -0
  36. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/block-closing-brace-empty-line-before/README.md +238 -0
  37. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/block-closing-brace-empty-line-before/index.cjs +130 -0
  38. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/block-closing-brace-newline-after/README.md +196 -0
  39. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/block-closing-brace-newline-after/index.cjs +154 -0
  40. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/block-closing-brace-newline-before/README.md +93 -0
  41. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/block-closing-brace-newline-before/index.cjs +133 -0
  42. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/block-closing-brace-space-before/README.md +174 -0
  43. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/block-closing-brace-space-before/index.cjs +111 -0
  44. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/block-opening-brace-newline-after/README.md +138 -0
  45. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/block-opening-brace-newline-after/index.cjs +184 -0
  46. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/block-opening-brace-space-after/README.md +191 -0
  47. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/block-opening-brace-space-after/index.cjs +118 -0
  48. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/block-opening-brace-space-before/README.md +218 -0
  49. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/block-opening-brace-space-before/index.cjs +141 -0
  50. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/color-hex-case/README.md +58 -0
  51. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/color-hex-case/index.cjs +95 -0
  52. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/declaration-bang-space-after/README.md +72 -0
  53. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/declaration-bang-space-after/index.cjs +95 -0
  54. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/declaration-bang-space-before/README.md +67 -0
  55. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/declaration-bang-space-before/index.cjs +96 -0
  56. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/declaration-block-semicolon-newline-after/README.md +141 -0
  57. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/declaration-block-semicolon-newline-after/index.cjs +109 -0
  58. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/declaration-block-semicolon-newline-before/README.md +120 -0
  59. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/declaration-block-semicolon-newline-before/index.cjs +75 -0
  60. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/declaration-block-semicolon-space-after/README.md +147 -0
  61. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/declaration-block-semicolon-space-after/index.cjs +97 -0
  62. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/declaration-block-semicolon-space-before/README.md +130 -0
  63. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/declaration-block-semicolon-space-before/index.cjs +106 -0
  64. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/declaration-block-trailing-semicolon/README.md +108 -0
  65. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/declaration-block-trailing-semicolon/index.cjs +147 -0
  66. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/declaration-colon-newline-after/README.md +78 -0
  67. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/declaration-colon-newline-after/index.cjs +99 -0
  68. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/declaration-colon-space-after/README.md +111 -0
  69. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/declaration-colon-space-after/index.cjs +75 -0
  70. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/declaration-colon-space-before/README.md +72 -0
  71. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/declaration-colon-space-before/index.cjs +74 -0
  72. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/declarationBangSpaceChecker.cjs +63 -0
  73. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/declarationColonSpaceChecker.cjs +58 -0
  74. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/findMediaOperator.cjs +32 -0
  75. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/function-comma-newline-after/README.md +113 -0
  76. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/function-comma-newline-after/index.cjs +61 -0
  77. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/function-comma-newline-before/README.md +129 -0
  78. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/function-comma-newline-before/index.cjs +61 -0
  79. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/function-comma-space-after/README.md +144 -0
  80. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/function-comma-space-after/index.cjs +62 -0
  81. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/function-comma-space-before/README.md +144 -0
  82. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/function-comma-space-before/index.cjs +62 -0
  83. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/function-max-empty-lines/README.md +78 -0
  84. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/function-max-empty-lines/index.cjs +115 -0
  85. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/function-parentheses-newline-inside/README.md +144 -0
  86. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/function-parentheses-newline-inside/index.cjs +282 -0
  87. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/function-parentheses-space-inside/README.md +140 -0
  88. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/function-parentheses-space-inside/index.cjs +182 -0
  89. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/function-whitespace-after/README.md +80 -0
  90. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/function-whitespace-after/index.cjs +198 -0
  91. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/functionCommaSpaceChecker.cjs +125 -0
  92. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/functionCommaSpaceFix.cjs +51 -0
  93. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/indentation/README.md +339 -0
  94. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/indentation/index.cjs +743 -0
  95. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/linebreaks/README.md +21 -0
  96. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/linebreaks/index.cjs +132 -0
  97. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/max-empty-lines/README.md +116 -0
  98. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/max-empty-lines/index.cjs +225 -0
  99. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/max-line-length/README.md +151 -0
  100. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/max-line-length/index.cjs +200 -0
  101. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/media-feature-colon-space-after/README.md +72 -0
  102. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/media-feature-colon-space-after/index.cjs +91 -0
  103. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/media-feature-colon-space-before/README.md +72 -0
  104. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/media-feature-colon-space-before/index.cjs +91 -0
  105. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/media-feature-name-case/README.md +108 -0
  106. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/media-feature-name-case/index.cjs +93 -0
  107. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/media-feature-parentheses-space-inside/README.md +62 -0
  108. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/media-feature-parentheses-space-inside/index.cjs +112 -0
  109. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/media-feature-range-operator-space-after/README.md +72 -0
  110. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/media-feature-range-operator-space-after/index.cjs +109 -0
  111. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/media-feature-range-operator-space-before/README.md +72 -0
  112. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/media-feature-range-operator-space-before/index.cjs +109 -0
  113. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/media-query-list-comma-newline-after/README.md +113 -0
  114. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/media-query-list-comma-newline-after/index.cjs +97 -0
  115. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/media-query-list-comma-newline-before/README.md +111 -0
  116. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/media-query-list-comma-newline-before/index.cjs +49 -0
  117. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/media-query-list-comma-space-after/README.md +136 -0
  118. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/media-query-list-comma-space-after/index.cjs +93 -0
  119. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/media-query-list-comma-space-before/README.md +136 -0
  120. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/media-query-list-comma-space-before/index.cjs +93 -0
  121. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/mediaFeatureColonSpaceChecker.cjs +54 -0
  122. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/mediaQueryListCommaWhitespaceChecker.cjs +73 -0
  123. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/no-empty-first-line/README.md +34 -0
  124. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/no-empty-first-line/index.cjs +63 -0
  125. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/no-eol-whitespace/README.md +79 -0
  126. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/no-eol-whitespace/index.cjs +302 -0
  127. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/no-extra-semicolons/README.md +78 -0
  128. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/no-extra-semicolons/index.cjs +246 -0
  129. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/no-missing-end-of-source-newline/README.md +34 -0
  130. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/no-missing-end-of-source-newline/index.cjs +62 -0
  131. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/number-leading-zero/README.md +74 -0
  132. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/number-leading-zero/index.cjs +197 -0
  133. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/number-no-trailing-zeros/README.md +40 -0
  134. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/number-no-trailing-zeros/index.cjs +139 -0
  135. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/property-case/README.md +192 -0
  136. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/property-case/index.cjs +95 -0
  137. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/selector-attribute-brackets-space-inside/README.md +112 -0
  138. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/selector-attribute-brackets-space-inside/index.cjs +214 -0
  139. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/selector-attribute-operator-space-after/README.md +162 -0
  140. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/selector-attribute-operator-space-after/index.cjs +109 -0
  141. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/selector-attribute-operator-space-before/README.md +162 -0
  142. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/selector-attribute-operator-space-before/index.cjs +88 -0
  143. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/selector-combinator-space-after/README.md +78 -0
  144. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/selector-combinator-space-after/index.cjs +67 -0
  145. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/selector-combinator-space-before/README.md +78 -0
  146. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/selector-combinator-space-before/index.cjs +67 -0
  147. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/selector-descendant-combinator-no-non-space/README.md +40 -0
  148. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/selector-descendant-combinator-no-non-space/index.cjs +95 -0
  149. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/selector-list-comma-newline-after/README.md +120 -0
  150. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/selector-list-comma-newline-after/index.cjs +126 -0
  151. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/selector-list-comma-newline-before/README.md +112 -0
  152. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/selector-list-comma-newline-before/index.cjs +101 -0
  153. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/selector-list-comma-space-after/README.md +110 -0
  154. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/selector-list-comma-space-after/index.cjs +92 -0
  155. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/selector-list-comma-space-before/README.md +110 -0
  156. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/selector-list-comma-space-before/index.cjs +92 -0
  157. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/selector-max-empty-lines/README.md +103 -0
  158. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/selector-max-empty-lines/index.cjs +74 -0
  159. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/selector-pseudo-class-case/README.md +108 -0
  160. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/selector-pseudo-class-case/index.cjs +104 -0
  161. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/selector-pseudo-class-parentheses-space-inside/README.md +62 -0
  162. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/selector-pseudo-class-parentheses-space-inside/index.cjs +162 -0
  163. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/selector-pseudo-element-case/README.md +128 -0
  164. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/selector-pseudo-element-case/index.cjs +90 -0
  165. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/selectorAttributeOperatorSpaceChecker.cjs +95 -0
  166. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/selectorCombinatorSpaceChecker.cjs +113 -0
  167. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/selectorListCommaWhitespaceChecker.cjs +64 -0
  168. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/string-quotes/README.md +130 -0
  169. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/string-quotes/index.cjs +256 -0
  170. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/unicode-bom/README.md +41 -0
  171. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/unicode-bom/index.cjs +67 -0
  172. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/unit-case/README.md +126 -0
  173. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/unit-case/index.cjs +133 -0
  174. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/value-list-comma-newline-after/README.md +102 -0
  175. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/value-list-comma-newline-after/index.cjs +107 -0
  176. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/value-list-comma-newline-before/README.md +100 -0
  177. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/value-list-comma-newline-before/index.cjs +49 -0
  178. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/value-list-comma-space-after/README.md +136 -0
  179. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/value-list-comma-space-after/index.cjs +94 -0
  180. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/value-list-comma-space-before/README.md +136 -0
  181. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/value-list-comma-space-before/index.cjs +94 -0
  182. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/value-list-max-empty-lines/README.md +121 -0
  183. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/value-list-max-empty-lines/index.cjs +68 -0
  184. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/valueListCommaWhitespaceChecker.cjs +74 -0
  185. package/stylelint/plugins/stylelint-15.11.0-stylistic/style-search/LICENSE +13 -0
  186. package/stylelint/plugins/stylelint-15.11.0-stylistic/style-search/index.cjs +216 -0
  187. package/stylelint/plugins/stylelint-15.11.0-stylistic/utils/addEmptyLineAfter.cjs +30 -0
  188. package/stylelint/plugins/stylelint-15.11.0-stylistic/utils/hasEmptyBlock.cjs +14 -0
  189. package/stylelint/plugins/stylelint-15.11.0-stylistic/utils/nextNonCommentNode.cjs +21 -0
  190. package/stylelint/plugins/stylelint-15.11.0-stylistic/utils/removeEmptyLinesAfter.cjs +16 -0
  191. package/stylelint/plugins/stylelint-15.11.0-stylistic/utils/whitespaceChecker.cjs +361 -0
  192. package/stylelint/plugins/stylelint-selector-no-empty.js +8 -8
  193. package/stylelint/plugins/stylelint-selector-tag-no-without-class.js +4 -4
  194. package/stylelint/plugins/stylelint-high-performance-animation.js +0 -276
  195. package/stylelint/plugins/stylelint-stylistic.js +0 -188
@@ -0,0 +1,302 @@
1
+ /* eslint-disable -- We want to keep as much of the original code as possible */
2
+ // @ts-nocheck
3
+
4
+ const stylelint = require('stylelint');
5
+ const isOnlyWhitespace = require('stylelint/lib/utils/isOnlyWhitespace.cjs');
6
+ const isStandardSyntaxComment = require('stylelint/lib/utils/isStandardSyntaxComment.cjs');
7
+ const optionsMatches = require('stylelint/lib/utils/optionsMatches.cjs');
8
+ const report = require('stylelint/lib/utils/report.cjs');
9
+ const ruleMessages = require('stylelint/lib/utils/ruleMessages.cjs');
10
+ const { isAtRule, isComment, isDeclaration, isRule } = require('stylelint/lib/utils/typeGuards.cjs');
11
+ const validateOptions = require('stylelint/lib/utils/validateOptions.cjs');
12
+
13
+ const styleSearch = require('../../style-search/index.cjs');
14
+
15
+ const ruleName = 'plugin/no-eol-whitespace';
16
+
17
+ const messages = ruleMessages(ruleName, {
18
+ rejected: 'Unexpected whitespace at end of line'
19
+ });
20
+
21
+ const meta = {
22
+ url: 'https://github.com/jens-duttke/linter-bundle/blob/main/stylelint/plugins/stylelint-15.11.0-stylistic/rules/no-eol-whitespace/README.md',
23
+ fixable: true
24
+ };
25
+
26
+ const whitespacesToReject = new Set([' ', '\t']);
27
+
28
+ /**
29
+ * @param {string} str
30
+ * @param string_
31
+ * @returns {string}
32
+ */
33
+ function fixString (string_) {
34
+ return string_.replace(/[\t ]+$/, '');
35
+ }
36
+
37
+ /**
38
+ * @param {number} lastEOLIndex
39
+ * @param {string} string
40
+ * @param {{ ignoreEmptyLines: boolean, isRootFirst: boolean }} options
41
+ * @returns {number}
42
+ */
43
+ function findErrorStartIndex (lastEOLIndex, string, { ignoreEmptyLines, isRootFirst }) {
44
+ const eolWhitespaceIndex = lastEOLIndex - 1;
45
+
46
+ // If the character before newline is not whitespace, ignore
47
+ if (!whitespacesToReject.has(string.charAt(eolWhitespaceIndex))) {
48
+ return -1;
49
+ }
50
+
51
+ if (ignoreEmptyLines) {
52
+ // If there is only whitespace between the previous newline and
53
+ // this newline, ignore
54
+ const beforeNewlineIndex = string.lastIndexOf('\n', eolWhitespaceIndex);
55
+
56
+ if (beforeNewlineIndex >= 0 || isRootFirst) {
57
+ const line = string.substring(beforeNewlineIndex, eolWhitespaceIndex);
58
+
59
+ if (isOnlyWhitespace(line)) {
60
+ return -1;
61
+ }
62
+ }
63
+ }
64
+
65
+ return eolWhitespaceIndex;
66
+ }
67
+
68
+ /** @type {import('stylelint').Rule} */
69
+ const rule = (primary, secondaryOptions, context) => (root, result) => {
70
+ const validOptions = validateOptions(
71
+ result,
72
+ ruleName,
73
+ {
74
+ actual: primary
75
+ },
76
+ {
77
+ optional: true,
78
+ actual: secondaryOptions,
79
+ possible: {
80
+ ignore: ['empty-lines']
81
+ }
82
+ }
83
+ );
84
+
85
+ if (!validOptions) {
86
+ return;
87
+ }
88
+
89
+ const ignoreEmptyLines = optionsMatches(secondaryOptions, 'ignore', 'empty-lines');
90
+
91
+ if (context.fix) {
92
+ fix(root);
93
+ }
94
+
95
+ const rootString = context.fix ? root.toString() : (root.source?.input.css) || '';
96
+
97
+ /**
98
+ * @param {number} index
99
+ */
100
+ const reportFromIndex = (index) => {
101
+ report({
102
+ message: messages.rejected,
103
+ node: root,
104
+ index,
105
+ result,
106
+ ruleName
107
+ });
108
+ };
109
+
110
+ eachEolWhitespace(rootString, reportFromIndex, true);
111
+
112
+ const errorIndex = findErrorStartIndex(rootString.length, rootString, {
113
+ ignoreEmptyLines,
114
+ isRootFirst: true
115
+ });
116
+
117
+ if (errorIndex > -1) {
118
+ reportFromIndex(errorIndex);
119
+ }
120
+
121
+ /**
122
+ * Iterate each whitespace at the end of each line of the given string.
123
+ *
124
+ * @param {string} string - the source code string
125
+ * @param {(index: number) => void} callback - callback the whitespace index at the end of each line
126
+ * @param {boolean} isRootFirst - set `true` if the given string is the first token of the root
127
+ * @returns {void}
128
+ */
129
+ function eachEolWhitespace (string, callback, isRootFirst) {
130
+ styleSearch(
131
+ {
132
+ source: string,
133
+ target: ['\n', '\r'],
134
+ comments: 'check'
135
+ },
136
+ (match) => {
137
+ const index = findErrorStartIndex(match.startIndex, string, {
138
+ ignoreEmptyLines,
139
+ isRootFirst
140
+ });
141
+
142
+ if (index > -1) {
143
+ callback(index);
144
+ }
145
+ }
146
+ );
147
+ }
148
+
149
+ /**
150
+ * @param {import('postcss').Root} rootNode
151
+ */
152
+ function fix (rootNode) {
153
+ let isRootFirst = true;
154
+
155
+ rootNode.walk((node) => {
156
+ fixText(
157
+ node.raws.before,
158
+ (fixed) => {
159
+ node.raws.before = fixed;
160
+ },
161
+ isRootFirst
162
+ );
163
+ isRootFirst = false;
164
+
165
+ if (isAtRule(node)) {
166
+ fixText(node.raws.afterName, (fixed) => {
167
+ node.raws.afterName = fixed;
168
+ });
169
+
170
+ const rawsParameters = node.raws.params;
171
+
172
+ if (rawsParameters) {
173
+ fixText(rawsParameters.raw, (fixed) => {
174
+ rawsParameters.raw = fixed;
175
+ });
176
+ }
177
+ else {
178
+ fixText(node.params, (fixed) => {
179
+ node.params = fixed;
180
+ });
181
+ }
182
+ }
183
+
184
+ if (isRule(node)) {
185
+ const rawsSelector = node.raws.selector;
186
+
187
+ if (rawsSelector) {
188
+ fixText(rawsSelector.raw, (fixed) => {
189
+ rawsSelector.raw = fixed;
190
+ });
191
+ }
192
+ else {
193
+ fixText(node.selector, (fixed) => {
194
+ node.selector = fixed;
195
+ });
196
+ }
197
+ }
198
+
199
+ if (isAtRule(node) || isRule(node) || isDeclaration(node)) {
200
+ fixText(node.raws.between, (fixed) => {
201
+ node.raws.between = fixed;
202
+ });
203
+ }
204
+
205
+ if (isDeclaration(node)) {
206
+ const rawsValue = node.raws.value;
207
+
208
+ if (rawsValue) {
209
+ fixText(rawsValue.raw, (fixed) => {
210
+ rawsValue.raw = fixed;
211
+ });
212
+ }
213
+ else {
214
+ fixText(node.value, (fixed) => {
215
+ node.value = fixed;
216
+ });
217
+ }
218
+ }
219
+
220
+ if (isComment(node)) {
221
+ fixText(node.raws.left, (fixed) => {
222
+ node.raws.left = fixed;
223
+ });
224
+
225
+ if (!isStandardSyntaxComment(node)) {
226
+ node.raws.right = node.raws.right && fixString(node.raws.right);
227
+ }
228
+ else {
229
+ fixText(node.raws.right, (fixed) => {
230
+ node.raws.right = fixed;
231
+ });
232
+ }
233
+
234
+ fixText(node.text, (fixed) => {
235
+ node.text = fixed;
236
+ });
237
+ }
238
+
239
+ if (isAtRule(node) || isRule(node)) {
240
+ fixText(node.raws.after, (fixed) => {
241
+ node.raws.after = fixed;
242
+ });
243
+ }
244
+ });
245
+
246
+ fixText(
247
+ rootNode.raws.after,
248
+ (fixed) => {
249
+ rootNode.raws.after = fixed;
250
+ },
251
+ isRootFirst
252
+ );
253
+
254
+ if (typeof rootNode.raws.after === 'string') {
255
+ const lastEOL = Math.max(
256
+ rootNode.raws.after.lastIndexOf('\n'),
257
+ rootNode.raws.after.lastIndexOf('\r')
258
+ );
259
+
260
+ if (lastEOL !== rootNode.raws.after.length - 1) {
261
+ rootNode.raws.after =
262
+ rootNode.raws.after.slice(0, lastEOL + 1) +
263
+ fixString(rootNode.raws.after.slice(lastEOL + 1));
264
+ }
265
+ }
266
+ }
267
+
268
+ /**
269
+ * @param {string | undefined} value
270
+ * @param {(text: string) => void} fixFn
271
+ * @param {boolean} isRootFirst
272
+ */
273
+ function fixText (value, fixFn, isRootFirst = false) {
274
+ if (!value) {
275
+ return;
276
+ }
277
+
278
+ let fixed = '';
279
+ let lastIndex = 0;
280
+
281
+ eachEolWhitespace(
282
+ value,
283
+ (index) => {
284
+ const newlineIndex = index + 1;
285
+
286
+ fixed += fixString(value.slice(lastIndex, newlineIndex));
287
+ lastIndex = newlineIndex;
288
+ },
289
+ isRootFirst
290
+ );
291
+
292
+ if (lastIndex) {
293
+ fixed += value.slice(lastIndex);
294
+ fixFn(fixed);
295
+ }
296
+ }
297
+ };
298
+
299
+ rule.ruleName = ruleName;
300
+ rule.messages = messages;
301
+ rule.meta = meta;
302
+ module.exports = stylelint.createPlugin(ruleName, rule);
@@ -0,0 +1,78 @@
1
+ # no-extra-semicolons
2
+
3
+ Disallow extra semicolons.
4
+
5
+ <!-- prettier-ignore -->
6
+ ```css
7
+ a { color: pink;; }
8
+ /** ↑
9
+ * This semicolons */
10
+ ```
11
+
12
+ This rule ignores semicolons after Less mixins.
13
+
14
+ The [`fix` option](https://stylelint.io/user-guide/options/#fix) can automatically fix all of the problems reported by this rule.
15
+
16
+ ## Options
17
+
18
+ ### `true`
19
+
20
+ The following patterns are considered problems:
21
+
22
+ <!-- prettier-ignore -->
23
+ ```css
24
+ @import "x.css";;
25
+ ```
26
+
27
+ <!-- prettier-ignore -->
28
+ ```css
29
+ @import "x.css";
30
+ ;
31
+ ```
32
+
33
+ <!-- prettier-ignore -->
34
+ ```css
35
+ a {
36
+ color: pink;;
37
+ }
38
+ ```
39
+
40
+ <!-- prettier-ignore -->
41
+ ```css
42
+ a {
43
+ ;color: pink;
44
+ }
45
+ ```
46
+
47
+ <!-- prettier-ignore -->
48
+ ```css
49
+ a {
50
+ color: pink;
51
+ ;
52
+ }
53
+ ```
54
+
55
+ <!-- prettier-ignore -->
56
+ ```css
57
+ a {
58
+ color: red;
59
+ }
60
+ ;
61
+ b {
62
+ color: white;
63
+ }
64
+ ```
65
+
66
+ The following patterns are _not_ considered problems:
67
+
68
+ <!-- prettier-ignore -->
69
+ ```css
70
+ @import "x.css";
71
+ ```
72
+
73
+ <!-- prettier-ignore -->
74
+ ```css
75
+ a {
76
+ color: pink;
77
+ }
78
+ ```
@@ -0,0 +1,246 @@
1
+ /* eslint-disable -- We want to keep as much of the original code as possible */
2
+ // @ts-nocheck
3
+
4
+ const stylelint = require('stylelint');
5
+ const isStandardSyntaxAtRule = require('stylelint/lib/utils/isStandardSyntaxAtRule.cjs');
6
+ const isStandardSyntaxRule = require('stylelint/lib/utils/isStandardSyntaxRule.cjs');
7
+ const report = require('stylelint/lib/utils/report.cjs');
8
+ const ruleMessages = require('stylelint/lib/utils/ruleMessages.cjs');
9
+ const { isAtRule } = require('stylelint/lib/utils/typeGuards.cjs');
10
+ const validateOptions = require('stylelint/lib/utils/validateOptions.cjs');
11
+
12
+ const styleSearch = require('../../style-search/index.cjs');
13
+
14
+ const ruleName = 'plugin/no-extra-semicolons';
15
+
16
+ const messages = ruleMessages(ruleName, {
17
+ rejected: 'Unexpected extra semicolon'
18
+ });
19
+
20
+ const meta = {
21
+ url: 'https://github.com/jens-duttke/linter-bundle/blob/main/stylelint/plugins/stylelint-15.11.0-stylistic/rules/no-extra-semicolons/README.md',
22
+ fixable: true
23
+ };
24
+
25
+ /**
26
+ * @param {import('postcss').Node} node
27
+ * @returns {number}
28
+ */
29
+ function getOffsetByNode (node) {
30
+ // @ts-expect-error -- TS2339: Property 'document' does not exist on type 'Document | Container<ChildNode>'
31
+ if (node.parent?.document) {
32
+ return 0;
33
+ }
34
+
35
+ const root = node.root();
36
+
37
+ if (!root.source) { throw new Error('The root node must have a source'); }
38
+
39
+ if (!node.source) { throw new Error('The node must have a source'); }
40
+
41
+ if (!node.source.start) { throw new Error('The source must have a start position'); }
42
+
43
+ const string = root.source.input.css;
44
+ const nodeColumn = node.source.start.column;
45
+ const nodeLine = node.source.start.line;
46
+ let line = 1;
47
+ let column = 1;
48
+ let index = 0;
49
+
50
+ for (let i = 0; i < string.length; i++) {
51
+ if (column === nodeColumn && nodeLine === line) {
52
+ index = i;
53
+ break;
54
+ }
55
+
56
+ if (string[i] === '\n') {
57
+ column = 1;
58
+ line += 1;
59
+ }
60
+ else {
61
+ column += 1;
62
+ }
63
+ }
64
+
65
+ return index;
66
+ }
67
+
68
+ /** @type {import('stylelint').Rule} */
69
+ const rule = (primary, _secondaryOptions, context) => (root, result) => {
70
+ const validOptions = validateOptions(result, ruleName, { actual: primary });
71
+
72
+ if (!validOptions) {
73
+ return;
74
+ }
75
+
76
+ if (root.raws.after && root.raws.after.trim().length > 0) {
77
+ const rawAfterRoot = root.raws.after;
78
+
79
+ /** @type {number[]} */
80
+ const fixSemiIndices = [];
81
+
82
+ styleSearch({ source: rawAfterRoot, target: ';' }, (match) => {
83
+ if (context.fix) {
84
+ fixSemiIndices.push(match.startIndex);
85
+
86
+ return;
87
+ }
88
+
89
+ if (!root.source) { throw new Error('The root node must have a source'); }
90
+
91
+ complain(root.source.input.css.length - rawAfterRoot.length + match.startIndex);
92
+ });
93
+
94
+ // fix
95
+ if (fixSemiIndices.length > 0) {
96
+ root.raws.after = removeIndices(rawAfterRoot, fixSemiIndices);
97
+ }
98
+ }
99
+
100
+ root.walk((node) => {
101
+ if (isAtRule(node) && !isStandardSyntaxAtRule(node)) {
102
+ return;
103
+ }
104
+
105
+ if (node.type === 'rule' && !isStandardSyntaxRule(node)) {
106
+ return;
107
+ }
108
+
109
+ if (node.raws.before && node.raws.before.trim().length > 0) {
110
+ const rawBeforeNode = node.raws.before;
111
+ const allowedSemi = 0;
112
+
113
+ const rawBeforeIndexStart = 0;
114
+
115
+ /** @type {number[]} */
116
+ const fixSemiIndices = [];
117
+
118
+ styleSearch({ source: rawBeforeNode, target: ';' }, (match, count) => {
119
+ if (count === allowedSemi) {
120
+ return;
121
+ }
122
+
123
+ if (context.fix) {
124
+ fixSemiIndices.push(match.startIndex - rawBeforeIndexStart);
125
+
126
+ return;
127
+ }
128
+
129
+ complain(getOffsetByNode(node) - rawBeforeNode.length + match.startIndex);
130
+ });
131
+
132
+ // fix
133
+ if (fixSemiIndices.length > 0) {
134
+ node.raws.before = removeIndices(rawBeforeNode, fixSemiIndices);
135
+ }
136
+ }
137
+
138
+ if (typeof node.raws.after === 'string' && node.raws.after.trim().length > 0) {
139
+ const rawAfterNode = node.raws.after;
140
+
141
+ /**
142
+ * If the last child is a Less mixin followed by more than one semicolon,
143
+ * node.raws.after will be populated with that semicolon.
144
+ * Since we ignore Less mixins, exit here
145
+ */
146
+ if (
147
+ 'last' in node &&
148
+ node.last &&
149
+ node.last.type === 'atrule' &&
150
+ !isStandardSyntaxAtRule(node.last)
151
+ ) {
152
+ return;
153
+ }
154
+
155
+ /** @type {number[]} */
156
+ const fixSemiIndices = [];
157
+
158
+ styleSearch({ source: rawAfterNode, target: ';' }, (match) => {
159
+ if (context.fix) {
160
+ fixSemiIndices.push(match.startIndex);
161
+
162
+ return;
163
+ }
164
+
165
+ const index =
166
+ getOffsetByNode(node) +
167
+ node.toString().length -
168
+ 1 -
169
+ rawAfterNode.length +
170
+ match.startIndex;
171
+
172
+ complain(index);
173
+ });
174
+
175
+ // fix
176
+ if (fixSemiIndices.length > 0) {
177
+ node.raws.after = removeIndices(rawAfterNode, fixSemiIndices);
178
+ }
179
+ }
180
+
181
+ if (typeof node.raws.ownSemicolon === 'string') {
182
+ const rawOwnSemicolon = node.raws.ownSemicolon;
183
+ const allowedSemi = 0;
184
+
185
+ /** @type {number[]} */
186
+ const fixSemiIndices = [];
187
+
188
+ styleSearch({ source: rawOwnSemicolon, target: ';' }, (match, count) => {
189
+ if (count === allowedSemi) {
190
+ return;
191
+ }
192
+
193
+ if (context.fix) {
194
+ fixSemiIndices.push(match.startIndex);
195
+
196
+ return;
197
+ }
198
+
199
+ const index =
200
+ getOffsetByNode(node) +
201
+ node.toString().length -
202
+ rawOwnSemicolon.length +
203
+ match.startIndex;
204
+
205
+ complain(index);
206
+ });
207
+
208
+ // fix
209
+ if (fixSemiIndices.length > 0) {
210
+ node.raws.ownSemicolon = removeIndices(rawOwnSemicolon, fixSemiIndices);
211
+ }
212
+ }
213
+ });
214
+
215
+ /**
216
+ * @param {number} index
217
+ */
218
+ function complain (index) {
219
+ report({
220
+ message: messages.rejected,
221
+ node: root,
222
+ index,
223
+ result,
224
+ ruleName
225
+ });
226
+ }
227
+
228
+ /**
229
+ * @param {string} str
230
+ * @param string_
231
+ * @param {number[]} indices
232
+ * @returns {string}
233
+ */
234
+ function removeIndices (string_, indices) {
235
+ for (const index of indices.reverse()) {
236
+ string_ = string_.slice(0, index) + string_.slice(index + 1);
237
+ }
238
+
239
+ return string_;
240
+ }
241
+ };
242
+
243
+ rule.ruleName = ruleName;
244
+ rule.messages = messages;
245
+ rule.meta = meta;
246
+ module.exports = stylelint.createPlugin(ruleName, rule);
@@ -0,0 +1,34 @@
1
+ # no-missing-end-of-source-newline
2
+
3
+ Disallow missing end-of-source newlines.
4
+
5
+ <!-- prettier-ignore -->
6
+ ```css
7
+ a { color: pink; }
8
+ \n
9
+ /** ↑
10
+ * This newline */
11
+ ```
12
+
13
+ Completely empty files are not considered problems.
14
+
15
+ The [`fix` option](https://stylelint.io/user-guide/options/#fix) can automatically fix all of the problems reported by this rule.
16
+
17
+ ## Options
18
+
19
+ ### `true`
20
+
21
+ The following patterns are considered problems:
22
+
23
+ <!-- prettier-ignore -->
24
+ ```css
25
+ a { color: pink; }
26
+ ```
27
+
28
+ The following patterns are _not_ considered problems:
29
+
30
+ <!-- prettier-ignore -->
31
+ ```css
32
+ a { color: pink; }
33
+ \n
34
+ ```
@@ -0,0 +1,62 @@
1
+ /* eslint-disable -- We want to keep as much of the original code as possible */
2
+ // @ts-nocheck
3
+
4
+ const stylelint = require('stylelint');
5
+ const report = require('stylelint/lib/utils/report.cjs');
6
+ const ruleMessages = require('stylelint/lib/utils/ruleMessages.cjs');
7
+ const validateOptions = require('stylelint/lib/utils/validateOptions.cjs');
8
+
9
+ const ruleName = 'plugin/no-missing-end-of-source-newline';
10
+
11
+ const messages = ruleMessages(ruleName, {
12
+ rejected: 'Unexpected missing end-of-source newline'
13
+ });
14
+
15
+ const meta = {
16
+ url: 'https://github.com/jens-duttke/linter-bundle/blob/main/stylelint/plugins/stylelint-15.11.0-stylistic/rules/no-missing-end-of-source-newline/README.md',
17
+ fixable: true
18
+ };
19
+
20
+ /** @type {import('stylelint').Rule} */
21
+ const rule = (primary, _secondaryOptions, context) => (root, result) => {
22
+ const validOptions = validateOptions(result, ruleName, { actual: primary });
23
+
24
+ if (!validOptions) {
25
+ return;
26
+ }
27
+
28
+ if (root.source == null) {
29
+ throw new Error('The root node must have a source property');
30
+ }
31
+
32
+ // @ts-expect-error -- TS2339: Property 'inline' does not exist on type 'Source'.
33
+ if (root.source.inline || root.source.lang === 'object-literal') {
34
+ return;
35
+ }
36
+
37
+ const rootString = context.fix ? root.toString() : root.source.input.css;
38
+
39
+ if (!rootString.trim() || rootString.endsWith('\n')) {
40
+ return;
41
+ }
42
+
43
+ // Fix
44
+ if (context.fix) {
45
+ root.raws.after = context.newline;
46
+
47
+ return;
48
+ }
49
+
50
+ report({
51
+ message: messages.rejected,
52
+ node: root,
53
+ index: rootString.length - 1,
54
+ result,
55
+ ruleName
56
+ });
57
+ };
58
+
59
+ rule.ruleName = ruleName;
60
+ rule.messages = messages;
61
+ rule.meta = meta;
62
+ module.exports = stylelint.createPlugin(ruleName, rule);