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.
- package/.linter-bundle.js +2 -0
- package/CHANGELOG.md +83 -9
- package/README.md +5 -3
- package/TODO.md +5 -0
- package/eslint/index.cjs +10 -4
- package/eslint/overrides-javascript.cjs +7 -1
- package/eslint/overrides-jest.cjs +1 -0
- package/eslint/overrides-jsdoc.cjs +1 -0
- package/eslint/rules/no-global-undefined-check.js +5 -3
- package/eslint/rules/no-unnecessary-typeof.js +26 -24
- package/eslint/rules/restricted-filenames.js +3 -1
- package/helper/ensure-type.cjs +2 -2
- package/helper/get-git-files.js +1 -1
- package/helper/get-outdated-dependencies.js +1 -1
- package/helper/get-outdated-overrides.js +1 -1
- package/helper/get-stylelint-path.js +1 -1
- package/helper/is-npm-or-yarn.js +1 -1
- package/helper/linter-bundle-config.js +22 -7
- package/helper/run-process.js +3 -3
- package/lint.js +31 -35
- package/package.json +27 -26
- package/stylelint/index.cjs +90 -5
- package/stylelint/plugins/stylelint-15.11.0-stylistic/LICENSE +20 -0
- package/stylelint/plugins/stylelint-15.11.0-stylistic/html-tags/LICENSE +9 -0
- package/stylelint/plugins/stylelint-15.11.0-stylistic/html-tags/index.cjs +122 -0
- package/stylelint/plugins/stylelint-15.11.0-stylistic/reference/selectors.cjs +327 -0
- package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/at-rule-name-case/README.md +110 -0
- package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/at-rule-name-case/index.cjs +66 -0
- package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/at-rule-name-space-after/README.md +117 -0
- package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/at-rule-name-space-after/index.cjs +55 -0
- package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/at-rule-semicolon-newline-after/README.md +63 -0
- package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/at-rule-semicolon-newline-after/index.cjs +87 -0
- package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/at-rule-semicolon-space-before/README.md +50 -0
- package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/at-rule-semicolon-space-before/index.cjs +70 -0
- package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/atRuleNameSpaceChecker.cjs +56 -0
- package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/block-closing-brace-empty-line-before/README.md +238 -0
- package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/block-closing-brace-empty-line-before/index.cjs +130 -0
- package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/block-closing-brace-newline-after/README.md +196 -0
- package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/block-closing-brace-newline-after/index.cjs +154 -0
- package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/block-closing-brace-newline-before/README.md +93 -0
- package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/block-closing-brace-newline-before/index.cjs +133 -0
- package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/block-closing-brace-space-before/README.md +174 -0
- package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/block-closing-brace-space-before/index.cjs +111 -0
- package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/block-opening-brace-newline-after/README.md +138 -0
- package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/block-opening-brace-newline-after/index.cjs +184 -0
- package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/block-opening-brace-space-after/README.md +191 -0
- package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/block-opening-brace-space-after/index.cjs +118 -0
- package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/block-opening-brace-space-before/README.md +218 -0
- package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/block-opening-brace-space-before/index.cjs +141 -0
- package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/color-hex-case/README.md +58 -0
- package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/color-hex-case/index.cjs +95 -0
- package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/declaration-bang-space-after/README.md +72 -0
- package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/declaration-bang-space-after/index.cjs +95 -0
- package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/declaration-bang-space-before/README.md +67 -0
- package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/declaration-bang-space-before/index.cjs +96 -0
- package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/declaration-block-semicolon-newline-after/README.md +141 -0
- package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/declaration-block-semicolon-newline-after/index.cjs +109 -0
- package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/declaration-block-semicolon-newline-before/README.md +120 -0
- package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/declaration-block-semicolon-newline-before/index.cjs +75 -0
- package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/declaration-block-semicolon-space-after/README.md +147 -0
- package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/declaration-block-semicolon-space-after/index.cjs +97 -0
- package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/declaration-block-semicolon-space-before/README.md +130 -0
- package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/declaration-block-semicolon-space-before/index.cjs +106 -0
- package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/declaration-block-trailing-semicolon/README.md +108 -0
- package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/declaration-block-trailing-semicolon/index.cjs +147 -0
- package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/declaration-colon-newline-after/README.md +78 -0
- package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/declaration-colon-newline-after/index.cjs +99 -0
- package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/declaration-colon-space-after/README.md +111 -0
- package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/declaration-colon-space-after/index.cjs +75 -0
- package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/declaration-colon-space-before/README.md +72 -0
- package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/declaration-colon-space-before/index.cjs +74 -0
- package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/declarationBangSpaceChecker.cjs +63 -0
- package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/declarationColonSpaceChecker.cjs +58 -0
- package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/findMediaOperator.cjs +32 -0
- package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/function-comma-newline-after/README.md +113 -0
- package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/function-comma-newline-after/index.cjs +61 -0
- package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/function-comma-newline-before/README.md +129 -0
- package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/function-comma-newline-before/index.cjs +61 -0
- package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/function-comma-space-after/README.md +144 -0
- package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/function-comma-space-after/index.cjs +62 -0
- package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/function-comma-space-before/README.md +144 -0
- package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/function-comma-space-before/index.cjs +62 -0
- package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/function-max-empty-lines/README.md +78 -0
- package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/function-max-empty-lines/index.cjs +115 -0
- package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/function-parentheses-newline-inside/README.md +144 -0
- package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/function-parentheses-newline-inside/index.cjs +282 -0
- package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/function-parentheses-space-inside/README.md +140 -0
- package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/function-parentheses-space-inside/index.cjs +182 -0
- package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/function-whitespace-after/README.md +80 -0
- package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/function-whitespace-after/index.cjs +198 -0
- package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/functionCommaSpaceChecker.cjs +125 -0
- package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/functionCommaSpaceFix.cjs +51 -0
- package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/indentation/README.md +339 -0
- package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/indentation/index.cjs +743 -0
- package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/linebreaks/README.md +21 -0
- package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/linebreaks/index.cjs +132 -0
- package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/max-empty-lines/README.md +116 -0
- package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/max-empty-lines/index.cjs +225 -0
- package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/max-line-length/README.md +151 -0
- package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/max-line-length/index.cjs +200 -0
- package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/media-feature-colon-space-after/README.md +72 -0
- package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/media-feature-colon-space-after/index.cjs +91 -0
- package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/media-feature-colon-space-before/README.md +72 -0
- package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/media-feature-colon-space-before/index.cjs +91 -0
- package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/media-feature-name-case/README.md +108 -0
- package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/media-feature-name-case/index.cjs +93 -0
- package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/media-feature-parentheses-space-inside/README.md +62 -0
- package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/media-feature-parentheses-space-inside/index.cjs +112 -0
- package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/media-feature-range-operator-space-after/README.md +72 -0
- package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/media-feature-range-operator-space-after/index.cjs +109 -0
- package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/media-feature-range-operator-space-before/README.md +72 -0
- package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/media-feature-range-operator-space-before/index.cjs +109 -0
- package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/media-query-list-comma-newline-after/README.md +113 -0
- package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/media-query-list-comma-newline-after/index.cjs +97 -0
- package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/media-query-list-comma-newline-before/README.md +111 -0
- package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/media-query-list-comma-newline-before/index.cjs +49 -0
- package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/media-query-list-comma-space-after/README.md +136 -0
- package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/media-query-list-comma-space-after/index.cjs +93 -0
- package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/media-query-list-comma-space-before/README.md +136 -0
- package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/media-query-list-comma-space-before/index.cjs +93 -0
- package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/mediaFeatureColonSpaceChecker.cjs +54 -0
- package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/mediaQueryListCommaWhitespaceChecker.cjs +73 -0
- package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/no-empty-first-line/README.md +34 -0
- package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/no-empty-first-line/index.cjs +63 -0
- package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/no-eol-whitespace/README.md +79 -0
- package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/no-eol-whitespace/index.cjs +302 -0
- package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/no-extra-semicolons/README.md +78 -0
- package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/no-extra-semicolons/index.cjs +246 -0
- package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/no-missing-end-of-source-newline/README.md +34 -0
- package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/no-missing-end-of-source-newline/index.cjs +62 -0
- package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/number-leading-zero/README.md +74 -0
- package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/number-leading-zero/index.cjs +197 -0
- package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/number-no-trailing-zeros/README.md +40 -0
- package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/number-no-trailing-zeros/index.cjs +139 -0
- package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/property-case/README.md +192 -0
- package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/property-case/index.cjs +95 -0
- package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/selector-attribute-brackets-space-inside/README.md +112 -0
- package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/selector-attribute-brackets-space-inside/index.cjs +214 -0
- package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/selector-attribute-operator-space-after/README.md +162 -0
- package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/selector-attribute-operator-space-after/index.cjs +109 -0
- package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/selector-attribute-operator-space-before/README.md +162 -0
- package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/selector-attribute-operator-space-before/index.cjs +88 -0
- package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/selector-combinator-space-after/README.md +78 -0
- package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/selector-combinator-space-after/index.cjs +67 -0
- package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/selector-combinator-space-before/README.md +78 -0
- package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/selector-combinator-space-before/index.cjs +67 -0
- package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/selector-descendant-combinator-no-non-space/README.md +40 -0
- package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/selector-descendant-combinator-no-non-space/index.cjs +95 -0
- package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/selector-list-comma-newline-after/README.md +120 -0
- package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/selector-list-comma-newline-after/index.cjs +126 -0
- package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/selector-list-comma-newline-before/README.md +112 -0
- package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/selector-list-comma-newline-before/index.cjs +101 -0
- package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/selector-list-comma-space-after/README.md +110 -0
- package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/selector-list-comma-space-after/index.cjs +92 -0
- package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/selector-list-comma-space-before/README.md +110 -0
- package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/selector-list-comma-space-before/index.cjs +92 -0
- package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/selector-max-empty-lines/README.md +103 -0
- package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/selector-max-empty-lines/index.cjs +74 -0
- package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/selector-pseudo-class-case/README.md +108 -0
- package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/selector-pseudo-class-case/index.cjs +104 -0
- package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/selector-pseudo-class-parentheses-space-inside/README.md +62 -0
- package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/selector-pseudo-class-parentheses-space-inside/index.cjs +162 -0
- package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/selector-pseudo-element-case/README.md +128 -0
- package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/selector-pseudo-element-case/index.cjs +90 -0
- package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/selectorAttributeOperatorSpaceChecker.cjs +95 -0
- package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/selectorCombinatorSpaceChecker.cjs +113 -0
- package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/selectorListCommaWhitespaceChecker.cjs +64 -0
- package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/string-quotes/README.md +130 -0
- package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/string-quotes/index.cjs +256 -0
- package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/unicode-bom/README.md +41 -0
- package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/unicode-bom/index.cjs +67 -0
- package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/unit-case/README.md +126 -0
- package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/unit-case/index.cjs +133 -0
- package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/value-list-comma-newline-after/README.md +102 -0
- package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/value-list-comma-newline-after/index.cjs +107 -0
- package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/value-list-comma-newline-before/README.md +100 -0
- package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/value-list-comma-newline-before/index.cjs +49 -0
- package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/value-list-comma-space-after/README.md +136 -0
- package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/value-list-comma-space-after/index.cjs +94 -0
- package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/value-list-comma-space-before/README.md +136 -0
- package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/value-list-comma-space-before/index.cjs +94 -0
- package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/value-list-max-empty-lines/README.md +121 -0
- package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/value-list-max-empty-lines/index.cjs +68 -0
- package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/valueListCommaWhitespaceChecker.cjs +74 -0
- package/stylelint/plugins/stylelint-15.11.0-stylistic/style-search/LICENSE +13 -0
- package/stylelint/plugins/stylelint-15.11.0-stylistic/style-search/index.cjs +216 -0
- package/stylelint/plugins/stylelint-15.11.0-stylistic/utils/addEmptyLineAfter.cjs +30 -0
- package/stylelint/plugins/stylelint-15.11.0-stylistic/utils/hasEmptyBlock.cjs +14 -0
- package/stylelint/plugins/stylelint-15.11.0-stylistic/utils/nextNonCommentNode.cjs +21 -0
- package/stylelint/plugins/stylelint-15.11.0-stylistic/utils/removeEmptyLinesAfter.cjs +16 -0
- package/stylelint/plugins/stylelint-15.11.0-stylistic/utils/whitespaceChecker.cjs +361 -0
- package/stylelint/plugins/stylelint-selector-no-empty.js +8 -8
- package/stylelint/plugins/stylelint-selector-tag-no-without-class.js +4 -4
- package/stylelint/plugins/stylelint-high-performance-animation.js +0 -276
- package/stylelint/plugins/stylelint-stylistic.js +0 -188
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
# selector-list-comma-newline-after
|
|
2
|
+
|
|
3
|
+
Require a newline or disallow whitespace after the commas of selector lists.
|
|
4
|
+
|
|
5
|
+
<!-- prettier-ignore -->
|
|
6
|
+
```css
|
|
7
|
+
a,
|
|
8
|
+
b↑{ color: pink; }
|
|
9
|
+
/** ↑
|
|
10
|
+
* The newline after this comma */
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
End-of-line comments are allowed one space after the comma.
|
|
14
|
+
|
|
15
|
+
<!-- prettier-ignore -->
|
|
16
|
+
```css
|
|
17
|
+
a, /* comment */
|
|
18
|
+
b { color: pink; }
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
The [`fix` option](https://stylelint.io/user-guide/options/#fix) can automatically fix all of the problems reported by this rule.
|
|
22
|
+
|
|
23
|
+
## Options
|
|
24
|
+
|
|
25
|
+
`string`: `"always"|"always-multi-line"|"never-multi-line"`
|
|
26
|
+
|
|
27
|
+
### `"always"`
|
|
28
|
+
|
|
29
|
+
There _must always_ be a newline after the commas.
|
|
30
|
+
|
|
31
|
+
The following patterns are considered problems:
|
|
32
|
+
|
|
33
|
+
<!-- prettier-ignore -->
|
|
34
|
+
```css
|
|
35
|
+
a, b { color: pink; }
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
<!-- prettier-ignore -->
|
|
39
|
+
```css
|
|
40
|
+
a
|
|
41
|
+
, b { color: pink; }
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
The following patterns are _not_ considered problems:
|
|
45
|
+
|
|
46
|
+
<!-- prettier-ignore -->
|
|
47
|
+
```css
|
|
48
|
+
a,
|
|
49
|
+
b { color: pink; }
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
<!-- prettier-ignore -->
|
|
53
|
+
```css
|
|
54
|
+
a
|
|
55
|
+
,
|
|
56
|
+
b { color: pink; }
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
### `"always-multi-line"`
|
|
60
|
+
|
|
61
|
+
There _must always_ be a newline after the commas in multi-line selector lists.
|
|
62
|
+
|
|
63
|
+
The following patterns are considered problems:
|
|
64
|
+
|
|
65
|
+
<!-- prettier-ignore -->
|
|
66
|
+
```css
|
|
67
|
+
a
|
|
68
|
+
, b { color: pink; }
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
The following patterns are _not_ considered problems:
|
|
72
|
+
|
|
73
|
+
<!-- prettier-ignore -->
|
|
74
|
+
```css
|
|
75
|
+
a, b { color: pink; }
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
<!-- prettier-ignore -->
|
|
79
|
+
```css
|
|
80
|
+
a,
|
|
81
|
+
b { color: pink; }
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
<!-- prettier-ignore -->
|
|
85
|
+
```css
|
|
86
|
+
a
|
|
87
|
+
,
|
|
88
|
+
b { color: pink; }
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
### `"never-multi-line"`
|
|
92
|
+
|
|
93
|
+
There _must never_ be whitespace after the commas in multi-line selector lists.
|
|
94
|
+
|
|
95
|
+
The following patterns are considered problems:
|
|
96
|
+
|
|
97
|
+
<!-- prettier-ignore -->
|
|
98
|
+
```css
|
|
99
|
+
a
|
|
100
|
+
, b { color: pink; }
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
<!-- prettier-ignore -->
|
|
104
|
+
```css
|
|
105
|
+
a,
|
|
106
|
+
b { color: pink; }
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
The following patterns are _not_ considered problems:
|
|
110
|
+
|
|
111
|
+
<!-- prettier-ignore -->
|
|
112
|
+
```css
|
|
113
|
+
a,b { color: pink; }
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
<!-- prettier-ignore -->
|
|
117
|
+
```css
|
|
118
|
+
a
|
|
119
|
+
,b { color: pink; }
|
|
120
|
+
```
|
|
@@ -0,0 +1,126 @@
|
|
|
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 isStandardSyntaxRule = require('stylelint/lib/utils/isStandardSyntaxRule.cjs');
|
|
6
|
+
const report = require('stylelint/lib/utils/report.cjs');
|
|
7
|
+
const ruleMessages = require('stylelint/lib/utils/ruleMessages.cjs');
|
|
8
|
+
const validateOptions = require('stylelint/lib/utils/validateOptions.cjs');
|
|
9
|
+
|
|
10
|
+
const styleSearch = require('../../style-search/index.cjs');
|
|
11
|
+
const whitespaceChecker = require('../../utils/whitespaceChecker.cjs');
|
|
12
|
+
|
|
13
|
+
const ruleName = 'plugin/selector-list-comma-newline-after';
|
|
14
|
+
|
|
15
|
+
const messages = ruleMessages(ruleName, {
|
|
16
|
+
expectedAfter: () => 'Expected newline after ","',
|
|
17
|
+
expectedAfterMultiLine: () => 'Expected newline after "," in a multi-line list',
|
|
18
|
+
rejectedAfterMultiLine: () => 'Unexpected whitespace after "," in a multi-line list'
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
const meta = {
|
|
22
|
+
url: 'https://github.com/jens-duttke/linter-bundle/blob/main/stylelint/plugins/stylelint-15.11.0-stylistic/rules/selector-list-comma-newline-after/README.md',
|
|
23
|
+
fixable: true
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
/** @type {import('stylelint').Rule} */
|
|
27
|
+
const rule = (primary, _secondaryOptions, context) => {
|
|
28
|
+
const checker = whitespaceChecker('newline', primary, messages);
|
|
29
|
+
|
|
30
|
+
return (root, result) => {
|
|
31
|
+
const validOptions = validateOptions(result, ruleName, {
|
|
32
|
+
actual: primary,
|
|
33
|
+
possible: ['always', 'always-multi-line', 'never-multi-line']
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
if (!validOptions) {
|
|
37
|
+
return;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
root.walkRules((ruleNode) => {
|
|
41
|
+
if (!isStandardSyntaxRule(ruleNode)) {
|
|
42
|
+
return;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
// Get raw selector so we can allow end-of-line comments, e.g.
|
|
46
|
+
// a, /* comment */
|
|
47
|
+
// b {}
|
|
48
|
+
const selector = ruleNode.raws.selector ? ruleNode.raws.selector.raw : ruleNode.selector;
|
|
49
|
+
|
|
50
|
+
/** @type {number[]} */
|
|
51
|
+
const fixIndices = [];
|
|
52
|
+
|
|
53
|
+
styleSearch(
|
|
54
|
+
{
|
|
55
|
+
source: selector,
|
|
56
|
+
target: ',',
|
|
57
|
+
functionArguments: 'skip'
|
|
58
|
+
},
|
|
59
|
+
(match) => {
|
|
60
|
+
const nextChars = selector.slice(match.endIndex);
|
|
61
|
+
|
|
62
|
+
// If there's a // comment, that means there has to be a newline
|
|
63
|
+
// ending the comment so we're fine
|
|
64
|
+
if ((/^\s+\/\//).test(nextChars)) {
|
|
65
|
+
return;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
// If there are spaces and then a comment begins, look for the newline
|
|
69
|
+
const indextoCheckAfter = (/^\s+\/\*/).test(nextChars) ?
|
|
70
|
+
selector.indexOf('*/', match.endIndex) + 1
|
|
71
|
+
: match.startIndex;
|
|
72
|
+
|
|
73
|
+
checker.afterOneOnly({
|
|
74
|
+
source: selector,
|
|
75
|
+
index: indextoCheckAfter,
|
|
76
|
+
err: (m) => {
|
|
77
|
+
if (context.fix) {
|
|
78
|
+
fixIndices.push(indextoCheckAfter + 1);
|
|
79
|
+
|
|
80
|
+
return;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
report({
|
|
84
|
+
message: m,
|
|
85
|
+
node: ruleNode,
|
|
86
|
+
index: match.startIndex,
|
|
87
|
+
result,
|
|
88
|
+
ruleName
|
|
89
|
+
});
|
|
90
|
+
}
|
|
91
|
+
});
|
|
92
|
+
}
|
|
93
|
+
);
|
|
94
|
+
|
|
95
|
+
if (fixIndices.length > 0) {
|
|
96
|
+
let fixedSelector = selector;
|
|
97
|
+
|
|
98
|
+
for (const index of fixIndices.sort((a, b) => b - a)) {
|
|
99
|
+
const beforeSelector = fixedSelector.slice(0, index);
|
|
100
|
+
let afterSelector = fixedSelector.slice(index);
|
|
101
|
+
|
|
102
|
+
if (primary.startsWith('always')) {
|
|
103
|
+
afterSelector = context.newline + afterSelector;
|
|
104
|
+
}
|
|
105
|
+
else if (primary.startsWith('never-multi-line')) {
|
|
106
|
+
afterSelector = afterSelector.replace(/^\s*/, '');
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
fixedSelector = beforeSelector + afterSelector;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
if (ruleNode.raws.selector) {
|
|
113
|
+
ruleNode.raws.selector.raw = fixedSelector;
|
|
114
|
+
}
|
|
115
|
+
else {
|
|
116
|
+
ruleNode.selector = fixedSelector;
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
});
|
|
120
|
+
};
|
|
121
|
+
};
|
|
122
|
+
|
|
123
|
+
rule.ruleName = ruleName;
|
|
124
|
+
rule.messages = messages;
|
|
125
|
+
rule.meta = meta;
|
|
126
|
+
module.exports = stylelint.createPlugin(ruleName, rule);
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
# selector-list-comma-newline-before
|
|
2
|
+
|
|
3
|
+
Require a newline or disallow whitespace before the commas of selector lists.
|
|
4
|
+
|
|
5
|
+
<!-- prettier-ignore -->
|
|
6
|
+
```css
|
|
7
|
+
a
|
|
8
|
+
, b { color: pink; }
|
|
9
|
+
/** ↑
|
|
10
|
+
* The newline before this comma */
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
The [`fix` option](https://stylelint.io/user-guide/options/#fix) can automatically fix all of the problems reported by this rule.
|
|
14
|
+
|
|
15
|
+
## Options
|
|
16
|
+
|
|
17
|
+
`string`: `"always"|"always-multi-line"|"never-multi-line"`
|
|
18
|
+
|
|
19
|
+
### `"always"`
|
|
20
|
+
|
|
21
|
+
There _must always_ be a newline before the commas.
|
|
22
|
+
|
|
23
|
+
The following patterns are considered problems:
|
|
24
|
+
|
|
25
|
+
<!-- prettier-ignore -->
|
|
26
|
+
```css
|
|
27
|
+
a, b { color: pink; }
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
<!-- prettier-ignore -->
|
|
31
|
+
```css
|
|
32
|
+
a,
|
|
33
|
+
b { color: pink; }
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
The following patterns are _not_ considered problems:
|
|
37
|
+
|
|
38
|
+
<!-- prettier-ignore -->
|
|
39
|
+
```css
|
|
40
|
+
a
|
|
41
|
+
, b { color: pink; }
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
<!-- prettier-ignore -->
|
|
45
|
+
```css
|
|
46
|
+
a
|
|
47
|
+
,b { color: pink; }
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
### `"always-multi-line"`
|
|
51
|
+
|
|
52
|
+
There _must always_ be a newline before the commas in multi-line selector lists.
|
|
53
|
+
|
|
54
|
+
The following patterns are considered problems:
|
|
55
|
+
|
|
56
|
+
<!-- prettier-ignore -->
|
|
57
|
+
```css
|
|
58
|
+
a,
|
|
59
|
+
b { color: pink; }
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
The following patterns are _not_ considered problems:
|
|
63
|
+
|
|
64
|
+
<!-- prettier-ignore -->
|
|
65
|
+
```css
|
|
66
|
+
a, b { color: pink; }
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
<!-- prettier-ignore -->
|
|
70
|
+
```css
|
|
71
|
+
a
|
|
72
|
+
,b { color: pink; }
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
<!-- prettier-ignore -->
|
|
76
|
+
```css
|
|
77
|
+
a
|
|
78
|
+
,
|
|
79
|
+
b { color: pink; }
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
### `"never-multi-line"`
|
|
83
|
+
|
|
84
|
+
There _must never_ be whitespace before the commas in multi-line selector lists.
|
|
85
|
+
|
|
86
|
+
The following patterns are considered problems:
|
|
87
|
+
|
|
88
|
+
<!-- prettier-ignore -->
|
|
89
|
+
```css
|
|
90
|
+
a
|
|
91
|
+
, b { color: pink; }
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
<!-- prettier-ignore -->
|
|
95
|
+
```css
|
|
96
|
+
a
|
|
97
|
+
,
|
|
98
|
+
b { color: pink; }
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
The following patterns are _not_ considered problems:
|
|
102
|
+
|
|
103
|
+
<!-- prettier-ignore -->
|
|
104
|
+
```css
|
|
105
|
+
a,b { color: pink; }
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
<!-- prettier-ignore -->
|
|
109
|
+
```css
|
|
110
|
+
a,
|
|
111
|
+
b { color: pink; }
|
|
112
|
+
```
|
|
@@ -0,0 +1,101 @@
|
|
|
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 ruleMessages = require('stylelint/lib/utils/ruleMessages.cjs');
|
|
6
|
+
const validateOptions = require('stylelint/lib/utils/validateOptions.cjs');
|
|
7
|
+
|
|
8
|
+
const whitespaceChecker = require('../../utils/whitespaceChecker.cjs');
|
|
9
|
+
const selectorListCommaWhitespaceChecker = require('../selectorListCommaWhitespaceChecker.cjs');
|
|
10
|
+
|
|
11
|
+
const ruleName = 'plugin/selector-list-comma-newline-before';
|
|
12
|
+
|
|
13
|
+
const messages = ruleMessages(ruleName, {
|
|
14
|
+
expectedBefore: () => 'Expected newline before ","',
|
|
15
|
+
expectedBeforeMultiLine: () => 'Expected newline before "," in a multi-line list',
|
|
16
|
+
rejectedBeforeMultiLine: () => 'Unexpected whitespace before "," in a multi-line list'
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
const meta = {
|
|
20
|
+
url: 'https://github.com/jens-duttke/linter-bundle/blob/main/stylelint/plugins/stylelint-15.11.0-stylistic/rules/selector-list-comma-newline-before/README.md',
|
|
21
|
+
fixable: true
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
/** @type {import('stylelint').Rule} */
|
|
25
|
+
const rule = (primary, _secondaryOptions, context) => {
|
|
26
|
+
const checker = whitespaceChecker('newline', primary, messages);
|
|
27
|
+
|
|
28
|
+
return (root, result) => {
|
|
29
|
+
const validOptions = validateOptions(result, ruleName, {
|
|
30
|
+
actual: primary,
|
|
31
|
+
possible: ['always', 'always-multi-line', 'never-multi-line']
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
if (!validOptions) {
|
|
35
|
+
return;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
/** @type {Map<import('postcss').Rule, number[]> | undefined} */
|
|
39
|
+
let fixData;
|
|
40
|
+
|
|
41
|
+
selectorListCommaWhitespaceChecker({
|
|
42
|
+
root,
|
|
43
|
+
result,
|
|
44
|
+
locationChecker: checker.beforeAllowingIndentation,
|
|
45
|
+
checkedRuleName: ruleName,
|
|
46
|
+
fix: context.fix ?
|
|
47
|
+
(ruleNode, index) => {
|
|
48
|
+
fixData ||= new Map();
|
|
49
|
+
const commaIndices = fixData.get(ruleNode) || [];
|
|
50
|
+
|
|
51
|
+
commaIndices.push(index);
|
|
52
|
+
fixData.set(ruleNode, commaIndices);
|
|
53
|
+
|
|
54
|
+
return true;
|
|
55
|
+
}
|
|
56
|
+
: null
|
|
57
|
+
});
|
|
58
|
+
|
|
59
|
+
if (fixData) {
|
|
60
|
+
for (const [ruleNode, commaIndices] of fixData.entries()) {
|
|
61
|
+
let selector = ruleNode.raws.selector ? ruleNode.raws.selector.raw : ruleNode.selector;
|
|
62
|
+
|
|
63
|
+
for (const index of commaIndices.sort((a, b) => b - a)) {
|
|
64
|
+
let beforeSelector = selector.slice(0, index);
|
|
65
|
+
const afterSelector = selector.slice(index);
|
|
66
|
+
|
|
67
|
+
if (primary.startsWith('always')) {
|
|
68
|
+
const spaceIndex = beforeSelector.search(/\s+$/);
|
|
69
|
+
|
|
70
|
+
if (spaceIndex >= 0) {
|
|
71
|
+
beforeSelector =
|
|
72
|
+
beforeSelector.slice(0, spaceIndex) +
|
|
73
|
+
context.newline +
|
|
74
|
+
beforeSelector.slice(spaceIndex);
|
|
75
|
+
}
|
|
76
|
+
else {
|
|
77
|
+
beforeSelector += context.newline;
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
else if (primary === 'never-multi-line') {
|
|
81
|
+
beforeSelector = beforeSelector.replace(/\s*$/, '');
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
selector = beforeSelector + afterSelector;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
if (ruleNode.raws.selector) {
|
|
88
|
+
ruleNode.raws.selector.raw = selector;
|
|
89
|
+
}
|
|
90
|
+
else {
|
|
91
|
+
ruleNode.selector = selector;
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
};
|
|
96
|
+
};
|
|
97
|
+
|
|
98
|
+
rule.ruleName = ruleName;
|
|
99
|
+
rule.messages = messages;
|
|
100
|
+
rule.meta = meta;
|
|
101
|
+
module.exports = stylelint.createPlugin(ruleName, rule);
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
# selector-list-comma-space-after
|
|
2
|
+
|
|
3
|
+
Require a single space or disallow whitespace after the commas of selector lists.
|
|
4
|
+
|
|
5
|
+
<!-- prettier-ignore -->
|
|
6
|
+
```css
|
|
7
|
+
a, b { color: pink; }
|
|
8
|
+
/** ↑
|
|
9
|
+
* The space after this comma */
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
The [`fix` option](https://stylelint.io/user-guide/options/#fix) can automatically fix all of the problems reported by this rule.
|
|
13
|
+
|
|
14
|
+
## Options
|
|
15
|
+
|
|
16
|
+
`string`: `"always"|"never"|"always-single-line"|"never-single-line"`
|
|
17
|
+
|
|
18
|
+
### `"always"`
|
|
19
|
+
|
|
20
|
+
There _must always_ be a single space after the commas.
|
|
21
|
+
|
|
22
|
+
The following patterns are considered problems:
|
|
23
|
+
|
|
24
|
+
<!-- prettier-ignore -->
|
|
25
|
+
```css
|
|
26
|
+
a,b { color: pink; }
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
<!-- prettier-ignore -->
|
|
30
|
+
```css
|
|
31
|
+
a ,b { color: pink; }
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
The following patterns are _not_ considered problems:
|
|
35
|
+
|
|
36
|
+
<!-- prettier-ignore -->
|
|
37
|
+
```css
|
|
38
|
+
a, b { color: pink; }
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
<!-- prettier-ignore -->
|
|
42
|
+
```css
|
|
43
|
+
a , b { color: pink; }
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
### `"never"`
|
|
47
|
+
|
|
48
|
+
There _must never_ be whitespace after the commas.
|
|
49
|
+
|
|
50
|
+
The following patterns are considered problems:
|
|
51
|
+
|
|
52
|
+
<!-- prettier-ignore -->
|
|
53
|
+
```css
|
|
54
|
+
a, b { color: pink; }
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
<!-- prettier-ignore -->
|
|
58
|
+
```css
|
|
59
|
+
a , b { color: pink; }
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
The following patterns are _not_ considered problems:
|
|
63
|
+
|
|
64
|
+
<!-- prettier-ignore -->
|
|
65
|
+
```css
|
|
66
|
+
a,b { color: pink; }
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
<!-- prettier-ignore -->
|
|
70
|
+
```css
|
|
71
|
+
a ,b { color: pink; }
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
### `"always-single-line"`
|
|
75
|
+
|
|
76
|
+
There _must always_ be a single space after the commas in single-line selector lists.
|
|
77
|
+
|
|
78
|
+
The following patterns are considered problems:
|
|
79
|
+
|
|
80
|
+
<!-- prettier-ignore -->
|
|
81
|
+
```css
|
|
82
|
+
a,b { color: pink; }
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
The following patterns are _not_ considered problems:
|
|
86
|
+
|
|
87
|
+
<!-- prettier-ignore -->
|
|
88
|
+
```css
|
|
89
|
+
a
|
|
90
|
+
,b { color: pink; }
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
### `"never-single-line"`
|
|
94
|
+
|
|
95
|
+
There _must never_ be a single space after the commas in single-line selector lists.
|
|
96
|
+
|
|
97
|
+
The following patterns are considered problems:
|
|
98
|
+
|
|
99
|
+
<!-- prettier-ignore -->
|
|
100
|
+
```css
|
|
101
|
+
a, b { color: pink; }
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
The following patterns are _not_ considered problems:
|
|
105
|
+
|
|
106
|
+
<!-- prettier-ignore -->
|
|
107
|
+
```css
|
|
108
|
+
a
|
|
109
|
+
, b { color: pink; }
|
|
110
|
+
```
|
|
@@ -0,0 +1,92 @@
|
|
|
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 ruleMessages = require('stylelint/lib/utils/ruleMessages.cjs');
|
|
6
|
+
const validateOptions = require('stylelint/lib/utils/validateOptions.cjs');
|
|
7
|
+
|
|
8
|
+
const whitespaceChecker = require('../../utils/whitespaceChecker.cjs');
|
|
9
|
+
const selectorListCommaWhitespaceChecker = require('../selectorListCommaWhitespaceChecker.cjs');
|
|
10
|
+
|
|
11
|
+
const ruleName = 'plugin/selector-list-comma-space-after';
|
|
12
|
+
|
|
13
|
+
const messages = ruleMessages(ruleName, {
|
|
14
|
+
expectedAfter: () => 'Expected single space after ","',
|
|
15
|
+
rejectedAfter: () => 'Unexpected whitespace after ","',
|
|
16
|
+
expectedAfterSingleLine: () => 'Expected single space after "," in a single-line list',
|
|
17
|
+
rejectedAfterSingleLine: () => 'Unexpected whitespace after "," in a single-line list'
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
const meta = {
|
|
21
|
+
url: 'https://github.com/jens-duttke/linter-bundle/blob/main/stylelint/plugins/stylelint-15.11.0-stylistic/rules/selector-list-comma-space-after/README.md',
|
|
22
|
+
fixable: true
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
/** @type {import('stylelint').Rule} */
|
|
26
|
+
const rule = (primary, _secondaryOptions, context) => {
|
|
27
|
+
const checker = whitespaceChecker('space', primary, messages);
|
|
28
|
+
|
|
29
|
+
return (root, result) => {
|
|
30
|
+
const validOptions = validateOptions(result, ruleName, {
|
|
31
|
+
actual: primary,
|
|
32
|
+
possible: ['always', 'never', 'always-single-line', 'never-single-line']
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
if (!validOptions) {
|
|
36
|
+
return;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
/** @type {Map<import('postcss').Rule, number[]> | undefined} */
|
|
40
|
+
let fixData;
|
|
41
|
+
|
|
42
|
+
selectorListCommaWhitespaceChecker({
|
|
43
|
+
root,
|
|
44
|
+
result,
|
|
45
|
+
locationChecker: checker.after,
|
|
46
|
+
checkedRuleName: ruleName,
|
|
47
|
+
fix: context.fix ?
|
|
48
|
+
(ruleNode, index) => {
|
|
49
|
+
fixData ||= new Map();
|
|
50
|
+
const commaIndices = fixData.get(ruleNode) || [];
|
|
51
|
+
|
|
52
|
+
commaIndices.push(index);
|
|
53
|
+
fixData.set(ruleNode, commaIndices);
|
|
54
|
+
|
|
55
|
+
return true;
|
|
56
|
+
}
|
|
57
|
+
: null
|
|
58
|
+
});
|
|
59
|
+
|
|
60
|
+
if (fixData) {
|
|
61
|
+
for (const [ruleNode, commaIndices] of fixData.entries()) {
|
|
62
|
+
let selector = ruleNode.raws.selector ? ruleNode.raws.selector.raw : ruleNode.selector;
|
|
63
|
+
|
|
64
|
+
for (const index of commaIndices.sort((a, b) => b - a)) {
|
|
65
|
+
const beforeSelector = selector.slice(0, index + 1);
|
|
66
|
+
let afterSelector = selector.slice(index + 1);
|
|
67
|
+
|
|
68
|
+
if (primary.startsWith('always')) {
|
|
69
|
+
afterSelector = afterSelector.replace(/^\s*/, ' ');
|
|
70
|
+
}
|
|
71
|
+
else if (primary.startsWith('never')) {
|
|
72
|
+
afterSelector = afterSelector.replace(/^\s*/, '');
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
selector = beforeSelector + afterSelector;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
if (ruleNode.raws.selector) {
|
|
79
|
+
ruleNode.raws.selector.raw = selector;
|
|
80
|
+
}
|
|
81
|
+
else {
|
|
82
|
+
ruleNode.selector = selector;
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
};
|
|
87
|
+
};
|
|
88
|
+
|
|
89
|
+
rule.ruleName = ruleName;
|
|
90
|
+
rule.messages = messages;
|
|
91
|
+
rule.meta = meta;
|
|
92
|
+
module.exports = stylelint.createPlugin(ruleName, rule);
|