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,182 @@
1
+ /* eslint-disable -- We want to keep as much of the original code as possible */
2
+ // @ts-nocheck
3
+
4
+ const valueParser = require('postcss-value-parser');
5
+ const stylelint = require('stylelint');
6
+ const declarationValueIndex = require('stylelint/lib/utils/declarationValueIndex.cjs');
7
+ const getDeclarationValue = require('stylelint/lib/utils/getDeclarationValue.cjs');
8
+ const isSingleLineString = require('stylelint/lib/utils/isSingleLineString.cjs');
9
+ const isStandardSyntaxFunction = require('stylelint/lib/utils/isStandardSyntaxFunction.cjs');
10
+ const report = require('stylelint/lib/utils/report.cjs');
11
+ const ruleMessages = require('stylelint/lib/utils/ruleMessages.cjs');
12
+ const setDeclarationValue = require('stylelint/lib/utils/setDeclarationValue.cjs');
13
+ const validateOptions = require('stylelint/lib/utils/validateOptions.cjs');
14
+
15
+ const ruleName = 'plugin/function-parentheses-space-inside';
16
+
17
+ const messages = ruleMessages(ruleName, {
18
+ expectedOpening: 'Expected single space after "("',
19
+ rejectedOpening: 'Unexpected whitespace after "("',
20
+ expectedClosing: 'Expected single space before ")"',
21
+ rejectedClosing: 'Unexpected whitespace before ")"',
22
+ expectedOpeningSingleLine: 'Expected single space after "(" in a single-line function',
23
+ rejectedOpeningSingleLine: 'Unexpected whitespace after "(" in a single-line function',
24
+ expectedClosingSingleLine: 'Expected single space before ")" in a single-line function',
25
+ rejectedClosingSingleLine: 'Unexpected whitespace before ")" in a single-line function'
26
+ });
27
+
28
+ const meta = {
29
+ url: 'https://github.com/jens-duttke/linter-bundle/blob/main/stylelint/plugins/stylelint-15.11.0-stylistic/rules/function-parentheses-space-inside/README.md',
30
+ fixable: true
31
+ };
32
+
33
+ /** @type {import('stylelint').Rule} */
34
+ const rule = (primary, _secondaryOptions, context) => (root, result) => {
35
+ const validOptions = validateOptions(result, ruleName, {
36
+ actual: primary,
37
+ possible: ['always', 'never', 'always-single-line', 'never-single-line']
38
+ });
39
+
40
+ if (!validOptions) {
41
+ return;
42
+ }
43
+
44
+ root.walkDecls((decl) => {
45
+ if (!decl.value.includes('(')) {
46
+ return;
47
+ }
48
+
49
+ let hasFixed = false;
50
+ const declValue = getDeclarationValue(decl);
51
+ const parsedValue = valueParser(declValue);
52
+
53
+ parsedValue.walk((valueNode) => {
54
+ if (valueNode.type !== 'function') {
55
+ return;
56
+ }
57
+
58
+ if (!isStandardSyntaxFunction(valueNode)) {
59
+ return;
60
+ }
61
+
62
+ // Ignore function without parameters
63
+ if (valueNode.nodes.length === 0) {
64
+ return;
65
+ }
66
+
67
+ const functionString = valueParser.stringify(valueNode);
68
+ const isSingleLine = isSingleLineString(functionString);
69
+
70
+ // Check opening ...
71
+
72
+ const openingIndex = valueNode.sourceIndex + valueNode.value.length + 1;
73
+
74
+ if (primary === 'always' && valueNode.before !== ' ') {
75
+ if (context.fix) {
76
+ hasFixed = true;
77
+ valueNode.before = ' ';
78
+ }
79
+ else {
80
+ complain(messages.expectedOpening, openingIndex);
81
+ }
82
+ }
83
+
84
+ if (primary === 'never' && valueNode.before !== '') {
85
+ if (context.fix) {
86
+ hasFixed = true;
87
+ valueNode.before = '';
88
+ }
89
+ else {
90
+ complain(messages.rejectedOpening, openingIndex);
91
+ }
92
+ }
93
+
94
+ if (isSingleLine && primary === 'always-single-line' && valueNode.before !== ' ') {
95
+ if (context.fix) {
96
+ hasFixed = true;
97
+ valueNode.before = ' ';
98
+ }
99
+ else {
100
+ complain(messages.expectedOpeningSingleLine, openingIndex);
101
+ }
102
+ }
103
+
104
+ if (isSingleLine && primary === 'never-single-line' && valueNode.before !== '') {
105
+ if (context.fix) {
106
+ hasFixed = true;
107
+ valueNode.before = '';
108
+ }
109
+ else {
110
+ complain(messages.rejectedOpeningSingleLine, openingIndex);
111
+ }
112
+ }
113
+
114
+ // Check closing ...
115
+
116
+ const closingIndex = valueNode.sourceIndex + functionString.length - 2;
117
+
118
+ if (primary === 'always' && valueNode.after !== ' ') {
119
+ if (context.fix) {
120
+ hasFixed = true;
121
+ valueNode.after = ' ';
122
+ }
123
+ else {
124
+ complain(messages.expectedClosing, closingIndex);
125
+ }
126
+ }
127
+
128
+ if (primary === 'never' && valueNode.after !== '') {
129
+ if (context.fix) {
130
+ hasFixed = true;
131
+ valueNode.after = '';
132
+ }
133
+ else {
134
+ complain(messages.rejectedClosing, closingIndex);
135
+ }
136
+ }
137
+
138
+ if (isSingleLine && primary === 'always-single-line' && valueNode.after !== ' ') {
139
+ if (context.fix) {
140
+ hasFixed = true;
141
+ valueNode.after = ' ';
142
+ }
143
+ else {
144
+ complain(messages.expectedClosingSingleLine, closingIndex);
145
+ }
146
+ }
147
+
148
+ if (isSingleLine && primary === 'never-single-line' && valueNode.after !== '') {
149
+ if (context.fix) {
150
+ hasFixed = true;
151
+ valueNode.after = '';
152
+ }
153
+ else {
154
+ complain(messages.rejectedClosingSingleLine, closingIndex);
155
+ }
156
+ }
157
+ });
158
+
159
+ if (hasFixed) {
160
+ setDeclarationValue(decl, parsedValue.toString());
161
+ }
162
+
163
+ /**
164
+ * @param {string} message
165
+ * @param {number} offset
166
+ */
167
+ function complain (message, offset) {
168
+ report({
169
+ ruleName,
170
+ result,
171
+ message,
172
+ node: decl,
173
+ index: declarationValueIndex(decl) + offset
174
+ });
175
+ }
176
+ });
177
+ };
178
+
179
+ rule.ruleName = ruleName;
180
+ rule.messages = messages;
181
+ rule.meta = meta;
182
+ module.exports = stylelint.createPlugin(ruleName, rule);
@@ -0,0 +1,80 @@
1
+ # function-whitespace-after
2
+
3
+ Require or disallow whitespace after functions.
4
+
5
+ <!-- prettier-ignore -->
6
+ ```css
7
+ a { transform: translate(1, 1) scale(3); }
8
+ /** ↑
9
+ * This space */
10
+ ```
11
+
12
+ This rule does not check for space immediately after `)` if the very next character is `,`, `)`, `/` or `}`, allowing some of the patterns exemplified below.
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
+ `string`: `"always"|"never"`
19
+
20
+ ### `"always"`
21
+
22
+ There _must always_ be whitespace after the function.
23
+
24
+ The following patterns are considered problems:
25
+
26
+ <!-- prettier-ignore -->
27
+ ```css
28
+ a { transform: translate(1, 1)scale(3); }
29
+ ```
30
+
31
+ The following patterns are _not_ considered problems:
32
+
33
+ <!-- prettier-ignore -->
34
+ ```css
35
+ a { transform: translate(1, 1) scale(3); }
36
+ ```
37
+
38
+ <!-- prettier-ignore -->
39
+ ```css
40
+ a { transform: translate(1, 1) scale(3); }
41
+ ```
42
+
43
+ <!-- prettier-ignore -->
44
+ ```css
45
+ a {
46
+ transform:
47
+ translate(1, 1)
48
+ scale(3);
49
+ }
50
+ ```
51
+
52
+ <!-- prettier-ignore -->
53
+ ```css
54
+ /* notice the two closing parentheses without a space between */
55
+ a { top: calc(1 * (1 + 3)); }
56
+ ```
57
+
58
+ <!-- prettier-ignore -->
59
+ ```css
60
+ /* notice the ), with no space after the closing parenthesis */
61
+ a { padding: calc(1 * 2px), calc(2 * 5px); }
62
+ ```
63
+
64
+ ### `"never"`
65
+
66
+ There _must never_ be whitespace after the function.
67
+
68
+ The following patterns are considered problems:
69
+
70
+ <!-- prettier-ignore -->
71
+ ```css
72
+ a { transform: translate(1, 1) scale(3); }
73
+ ```
74
+
75
+ The following patterns are _not_ considered problems:
76
+
77
+ <!-- prettier-ignore -->
78
+ ```css
79
+ a { transform: translate(1, 1)scale(3); }
80
+ ```
@@ -0,0 +1,198 @@
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 atRuleParamIndex = require('stylelint/lib/utils/atRuleParamIndex.cjs');
6
+ const declarationValueIndex = require('stylelint/lib/utils/declarationValueIndex.cjs');
7
+ const getDeclarationValue = require('stylelint/lib/utils/getDeclarationValue.cjs');
8
+ const isWhitespace = require('stylelint/lib/utils/isWhitespace.cjs');
9
+ const report = require('stylelint/lib/utils/report.cjs');
10
+ const ruleMessages = require('stylelint/lib/utils/ruleMessages.cjs');
11
+ const setDeclarationValue = require('stylelint/lib/utils/setDeclarationValue.cjs');
12
+ const validateOptions = require('stylelint/lib/utils/validateOptions.cjs');
13
+
14
+ const styleSearch = require('../../style-search/index.cjs');
15
+
16
+ const ruleName = 'plugin/function-whitespace-after';
17
+
18
+ const messages = ruleMessages(ruleName, {
19
+ expected: 'Expected whitespace after ")"',
20
+ rejected: 'Unexpected whitespace after ")"'
21
+ });
22
+
23
+ const meta = {
24
+ url: 'https://github.com/jens-duttke/linter-bundle/blob/main/stylelint/plugins/stylelint-15.11.0-stylistic/rules/function-whitespace-after/README.md',
25
+ fixable: true
26
+ };
27
+
28
+ const ACCEPTABLE_AFTER_CLOSING_PAREN = new Set([')', ',', '}', ':', '/', undefined]);
29
+
30
+ /** @type {import('stylelint').Rule} */
31
+ const rule = (primary, _secondaryOptions, context) => (root, result) => {
32
+ const validOptions = validateOptions(result, ruleName, {
33
+ actual: primary,
34
+ possible: ['always', 'never']
35
+ });
36
+
37
+ if (!validOptions) {
38
+ return;
39
+ }
40
+
41
+ /**
42
+ * @param {import('postcss').Node} node
43
+ * @param {string} value
44
+ * @param {number} nodeIndex
45
+ * @param {((index: number) => void) | undefined} fix
46
+ */
47
+ function check (node, value, nodeIndex, fix) {
48
+ styleSearch(
49
+ {
50
+ source: value,
51
+ target: ')',
52
+ functionArguments: 'only'
53
+ },
54
+ (match) => {
55
+ checkClosingParen(value, match.startIndex + 1, node, nodeIndex, fix);
56
+ }
57
+ );
58
+ }
59
+
60
+ /**
61
+ * @param {string} source
62
+ * @param {number} index
63
+ * @param {import('postcss').Node} node
64
+ * @param {number} nodeIndex
65
+ * @param {((index: number) => void) | undefined} fix
66
+ */
67
+ function checkClosingParen (source, index, node, nodeIndex, fix) {
68
+ const nextChar = source.charAt(index);
69
+
70
+ if (!nextChar) { return; }
71
+
72
+ if (primary === 'always') {
73
+ // Allow for the next character to be a single empty space,
74
+ // another closing parenthesis, a comma, or the end of the value
75
+ if (nextChar === ' ') {
76
+ return;
77
+ }
78
+
79
+ if (nextChar === '\n') {
80
+ return;
81
+ }
82
+
83
+ if (source.slice(index, index + 2) === '\r\n') {
84
+ return;
85
+ }
86
+
87
+ if (ACCEPTABLE_AFTER_CLOSING_PAREN.has(nextChar)) {
88
+ return;
89
+ }
90
+
91
+ if (fix) {
92
+ fix(index);
93
+
94
+ return;
95
+ }
96
+
97
+ report({
98
+ message: messages.expected,
99
+ node,
100
+ index: nodeIndex + index,
101
+ result,
102
+ ruleName
103
+ });
104
+ }
105
+ else if (primary === 'never' && isWhitespace(nextChar)) {
106
+ if (fix) {
107
+ fix(index);
108
+
109
+ return;
110
+ }
111
+
112
+ report({
113
+ message: messages.rejected,
114
+ node,
115
+ index: nodeIndex + index,
116
+ result,
117
+ ruleName
118
+ });
119
+ }
120
+ }
121
+
122
+ /**
123
+ * @param {string} value
124
+ */
125
+ function createFixer (value) {
126
+ let fixed = '';
127
+ let lastIndex = 0;
128
+ /** @type {(index: number) => void} */
129
+ let applyFix;
130
+
131
+ if (primary === 'always') {
132
+ applyFix = (index) => {
133
+
134
+ fixed += value.slice(lastIndex, index) + ' ';
135
+ lastIndex = index;
136
+ };
137
+ }
138
+ else if (primary === 'never') {
139
+ applyFix = (index) => {
140
+ let whitespaceEndIndex = index + 1;
141
+
142
+ while (
143
+ whitespaceEndIndex < value.length &&
144
+ isWhitespace(value.charAt(whitespaceEndIndex))
145
+ ) {
146
+ whitespaceEndIndex++;
147
+ }
148
+
149
+ fixed += value.slice(lastIndex, index);
150
+ lastIndex = whitespaceEndIndex;
151
+ };
152
+ }
153
+ else {
154
+ throw new Error(`Unexpected option: "${primary}"`);
155
+ }
156
+
157
+ return {
158
+ applyFix,
159
+ get hasFixed () {
160
+ return Boolean(lastIndex);
161
+ },
162
+ get fixed () {
163
+ return fixed + value.slice(lastIndex);
164
+ }
165
+ };
166
+ }
167
+
168
+ root.walkAtRules(/^import$/i, (atRule) => {
169
+ const parameter = (atRule.raws.params?.raw) || atRule.params;
170
+ const fixer = context.fix && createFixer(parameter);
171
+
172
+ check(atRule, parameter, atRuleParamIndex(atRule), fixer ? fixer.applyFix : undefined);
173
+
174
+ if (fixer && fixer.hasFixed) {
175
+ if (atRule.raws.params) {
176
+ atRule.raws.params.raw = fixer.fixed;
177
+ }
178
+ else {
179
+ atRule.params = fixer.fixed;
180
+ }
181
+ }
182
+ });
183
+ root.walkDecls((decl) => {
184
+ const value = getDeclarationValue(decl);
185
+ const fixer = context.fix && createFixer(value);
186
+
187
+ check(decl, value, declarationValueIndex(decl), fixer ? fixer.applyFix : undefined);
188
+
189
+ if (fixer && fixer.hasFixed) {
190
+ setDeclarationValue(decl, fixer.fixed);
191
+ }
192
+ });
193
+ };
194
+
195
+ rule.ruleName = ruleName;
196
+ rule.messages = messages;
197
+ rule.meta = meta;
198
+ module.exports = stylelint.createPlugin(ruleName, rule);
@@ -0,0 +1,125 @@
1
+ /* eslint-disable -- We want to keep as much of the original code as possible */
2
+ // @ts-nocheck
3
+
4
+ const valueParser = require('postcss-value-parser');
5
+ const declarationValueIndex = require('stylelint/lib/utils/declarationValueIndex.cjs');
6
+ const getDeclarationValue = require('stylelint/lib/utils/getDeclarationValue.cjs');
7
+ const isStandardSyntaxFunction = require('stylelint/lib/utils/isStandardSyntaxFunction.cjs');
8
+ const report = require('stylelint/lib/utils/report.cjs');
9
+ const setDeclarationValue = require('stylelint/lib/utils/setDeclarationValue.cjs');
10
+
11
+ /** @typedef {import('postcss-value-parser').Node} ValueParserNode */
12
+ /** @typedef {import('postcss-value-parser').DivNode} ValueParserDivNode */
13
+ /** @typedef {(args: { source: string, index: number, err: (message: string) => void }) => void} LocationChecker */
14
+
15
+ /**
16
+ * @param {{
17
+ * root: import('postcss').Root,
18
+ * locationChecker: LocationChecker,
19
+ * fix: ((node: ValueParserDivNode, index: number, nodes: ValueParserNode[]) => boolean) | null,
20
+ * result: import('stylelint').PostcssResult,
21
+ * checkedRuleName: string,
22
+ * }} opts
23
+ * @param options
24
+ */
25
+ module.exports = function functionCommaSpaceChecker (options) {
26
+ options.root.walkDecls((decl) => {
27
+ const declValue = getDeclarationValue(decl);
28
+
29
+ let hasFixed;
30
+ const parsedValue = valueParser(declValue);
31
+
32
+ parsedValue.walk((valueNode) => {
33
+ if (valueNode.type !== 'function') {
34
+ return;
35
+ }
36
+
37
+ if (!isStandardSyntaxFunction(valueNode)) {
38
+ return;
39
+ }
40
+
41
+ // Ignore `url()` arguments, which may contain data URIs or other funky stuff
42
+ if (valueNode.value.toLowerCase() === 'url') {
43
+ return;
44
+ }
45
+
46
+ const argumentStrings = valueNode.nodes.map((node) => valueParser.stringify(node));
47
+
48
+ const functionArguments = (() => {
49
+ // Remove function name and parens
50
+ let result = valueNode.before + argumentStrings.join('') + valueNode.after;
51
+
52
+ // 1. Remove comments including preceding whitespace (when only succeeded by whitespace)
53
+ // 2. Remove all other comments, but leave adjacent whitespace intact
54
+ // eslint-disable-next-line regexp/no-dupe-disjunctions -- TODO: Possible to simplify the regex.
55
+ result = result.replace(/( *\/(\*.*\*\/(?!\S)|\/.*)|(\/(\*.*\*\/|\/.*)))/, '');
56
+
57
+ return result;
58
+ })();
59
+
60
+ /**
61
+ * Gets the index of the comma for checking.
62
+ * @param {ValueParserDivNode} commaNode - The comma node
63
+ * @param {number} nodeIndex - The index of the comma node
64
+ * @returns {number} The index of the comma for checking
65
+ */
66
+ const getCommaCheckIndex = (commaNode, nodeIndex) => {
67
+ let commaBefore =
68
+ valueNode.before + argumentStrings.slice(0, nodeIndex).join('') + commaNode.before;
69
+
70
+ // 1. Remove comments including preceding whitespace (when only succeeded by whitespace)
71
+ // 2. Remove all other comments, but leave adjacent whitespace intact
72
+ // eslint-disable-next-line regexp/no-dupe-disjunctions -- TODO: Possible to simplify the regex.
73
+ commaBefore = commaBefore.replace(/( *\/(\*.*\*\/(?!\S)|\/.*)|(\/(\*.*\*\/|\/.*)))/, '');
74
+
75
+ return commaBefore.length;
76
+ };
77
+
78
+ /** @type {{ commaNode: ValueParserDivNode, checkIndex: number, nodeIndex: number }[]} */
79
+ const commaDataList = [];
80
+
81
+ for (const [nodeIndex, node] of valueNode.nodes.entries()) {
82
+ if (node.type !== 'div' || node.value !== ',') {
83
+ continue;
84
+ }
85
+
86
+ const checkIndex = getCommaCheckIndex(node, nodeIndex);
87
+
88
+ commaDataList.push({
89
+ commaNode: node,
90
+ checkIndex,
91
+ nodeIndex
92
+ });
93
+ }
94
+
95
+ for (const { commaNode, checkIndex, nodeIndex } of commaDataList) {
96
+ options.locationChecker({
97
+ source: functionArguments,
98
+ index: checkIndex,
99
+ err: (message) => {
100
+ const index =
101
+ declarationValueIndex(decl) + commaNode.sourceIndex + commaNode.before.length;
102
+
103
+ if (options.fix?.(commaNode, nodeIndex, valueNode.nodes)) {
104
+ hasFixed = true;
105
+
106
+ return;
107
+ }
108
+
109
+ report({
110
+ index,
111
+ message,
112
+ node: decl,
113
+ result: options.result,
114
+ ruleName: options.checkedRuleName
115
+ });
116
+ }
117
+ });
118
+ }
119
+ });
120
+
121
+ if (hasFixed) {
122
+ setDeclarationValue(decl, parsedValue.toString());
123
+ }
124
+ });
125
+ };
@@ -0,0 +1,51 @@
1
+ /* eslint-disable -- We want to keep as much of the original code as possible */
2
+ // @ts-nocheck
3
+
4
+ /**
5
+ * @param {{
6
+ * div: import('postcss-value-parser').DivNode,
7
+ * index: number,
8
+ * nodes: import('postcss-value-parser').Node[],
9
+ * expectation: string,
10
+ * position: 'before' | 'after',
11
+ * symb: string,
12
+ * }} params
13
+ * @param parameters
14
+ * @returns {boolean}
15
+ */
16
+ module.exports = function functionCommaSpaceFix (parameters) {
17
+ const { div, index, nodes, expectation, position, symb } = parameters;
18
+
19
+ if (expectation.startsWith('always')) {
20
+ div[position] = symb;
21
+
22
+ return true;
23
+ }
24
+
25
+ if (expectation.startsWith('never')) {
26
+ div[position] = '';
27
+
28
+ for (let i = index + 1; i < nodes.length; i++) {
29
+ const node = nodes[i];
30
+
31
+ if (node === undefined) {
32
+ continue;
33
+ }
34
+
35
+ if (node.type === 'comment') {
36
+ continue;
37
+ }
38
+
39
+ if (node.type === 'space') {
40
+ node.value = '';
41
+ continue;
42
+ }
43
+
44
+ break;
45
+ }
46
+
47
+ return true;
48
+ }
49
+
50
+ return false;
51
+ };