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
|
+
# declaration-block-semicolon-newline-before
|
|
2
|
+
|
|
3
|
+
Require a newline or disallow whitespace before the semicolons of declaration blocks.
|
|
4
|
+
|
|
5
|
+
<!-- prettier-ignore -->
|
|
6
|
+
```css
|
|
7
|
+
a {
|
|
8
|
+
color: pink
|
|
9
|
+
; top: 0;
|
|
10
|
+
} ↑
|
|
11
|
+
/** ↑
|
|
12
|
+
* The newline before this semicolon */
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
This rule ignores semicolons that are preceded by Less mixins.
|
|
16
|
+
|
|
17
|
+
## Options
|
|
18
|
+
|
|
19
|
+
`string`: `"always"|"always-multi-line"|"never-multi-line"`
|
|
20
|
+
|
|
21
|
+
### `"always"`
|
|
22
|
+
|
|
23
|
+
There _must always_ be a newline before the semicolons.
|
|
24
|
+
|
|
25
|
+
The following patterns are considered problems:
|
|
26
|
+
|
|
27
|
+
<!-- prettier-ignore -->
|
|
28
|
+
```css
|
|
29
|
+
a { color: pink; }
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
<!-- prettier-ignore -->
|
|
33
|
+
```css
|
|
34
|
+
a {
|
|
35
|
+
color: pink; top: 0;
|
|
36
|
+
}
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
The following patterns are _not_ considered problems:
|
|
40
|
+
|
|
41
|
+
<!-- prettier-ignore -->
|
|
42
|
+
```css
|
|
43
|
+
a { color: pink
|
|
44
|
+
; }
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
<!-- prettier-ignore -->
|
|
48
|
+
```css
|
|
49
|
+
a {
|
|
50
|
+
color: pink
|
|
51
|
+
; top: 0;
|
|
52
|
+
}
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
### `"always-multi-line"`
|
|
56
|
+
|
|
57
|
+
There _must always_ be a newline before the semicolons in multi-line rules.
|
|
58
|
+
|
|
59
|
+
The following patterns are considered problems:
|
|
60
|
+
|
|
61
|
+
<!-- prettier-ignore -->
|
|
62
|
+
```css
|
|
63
|
+
a {
|
|
64
|
+
color: pink; top: 0;
|
|
65
|
+
}
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
The following patterns are _not_ considered problems:
|
|
69
|
+
|
|
70
|
+
<!-- prettier-ignore -->
|
|
71
|
+
```css
|
|
72
|
+
a { color: pink; }
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
<!-- prettier-ignore -->
|
|
76
|
+
```css
|
|
77
|
+
a { color: pink; top: 0; }
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
<!-- prettier-ignore -->
|
|
81
|
+
```css
|
|
82
|
+
a {
|
|
83
|
+
color: pink
|
|
84
|
+
; top: 0;
|
|
85
|
+
}
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
### `"never-multi-line"`
|
|
89
|
+
|
|
90
|
+
There _must never_ be whitespace before the semicolons in multi-line rules.
|
|
91
|
+
|
|
92
|
+
The following patterns are considered problems:
|
|
93
|
+
|
|
94
|
+
<!-- prettier-ignore -->
|
|
95
|
+
```css
|
|
96
|
+
a {
|
|
97
|
+
color: pink
|
|
98
|
+
; top: 0;
|
|
99
|
+
}
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
The following patterns are _not_ considered problems:
|
|
103
|
+
|
|
104
|
+
<!-- prettier-ignore -->
|
|
105
|
+
```css
|
|
106
|
+
a { color: pink; }
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
<!-- prettier-ignore -->
|
|
110
|
+
```css
|
|
111
|
+
a { color: pink; top: 0; }
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
<!-- prettier-ignore -->
|
|
115
|
+
```css
|
|
116
|
+
a {
|
|
117
|
+
color: pink;
|
|
118
|
+
top: 0;
|
|
119
|
+
}
|
|
120
|
+
```
|
|
@@ -0,0 +1,75 @@
|
|
|
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 blockString = require('stylelint/lib/utils/blockString.cjs');
|
|
6
|
+
const report = require('stylelint/lib/utils/report.cjs');
|
|
7
|
+
const ruleMessages = require('stylelint/lib/utils/ruleMessages.cjs');
|
|
8
|
+
const { isAtRule, isRule } = require('stylelint/lib/utils/typeGuards.cjs');
|
|
9
|
+
const validateOptions = require('stylelint/lib/utils/validateOptions.cjs');
|
|
10
|
+
|
|
11
|
+
const whitespaceChecker = require('../../utils/whitespaceChecker.cjs');
|
|
12
|
+
|
|
13
|
+
const ruleName = 'plugin/declaration-block-semicolon-newline-before';
|
|
14
|
+
|
|
15
|
+
const messages = ruleMessages(ruleName, {
|
|
16
|
+
expectedBefore: () => 'Expected newline before ";"',
|
|
17
|
+
expectedBeforeMultiLine: () => 'Expected newline before ";" in a multi-line declaration block',
|
|
18
|
+
rejectedBeforeMultiLine: () => 'Unexpected whitespace before ";" in a multi-line declaration block'
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
const meta = {
|
|
22
|
+
url: 'https://github.com/jens-duttke/linter-bundle/blob/main/stylelint/plugins/stylelint-15.11.0-stylistic/rules/declaration-block-semicolon-newline-before/README.md'
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
/** @type {import('stylelint').Rule} */
|
|
26
|
+
const rule = (primary) => {
|
|
27
|
+
const checker = whitespaceChecker('newline', primary, messages);
|
|
28
|
+
|
|
29
|
+
return (root, result) => {
|
|
30
|
+
const validOptions = validateOptions(result, ruleName, {
|
|
31
|
+
actual: primary,
|
|
32
|
+
possible: ['always', 'always-multi-line', 'never-multi-line']
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
if (!validOptions) {
|
|
36
|
+
return;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
root.walkDecls((decl) => {
|
|
40
|
+
const parentRule = decl.parent;
|
|
41
|
+
|
|
42
|
+
if (!parentRule) { throw new Error('A parent node must be present'); }
|
|
43
|
+
|
|
44
|
+
if (!isAtRule(parentRule) && !isRule(parentRule)) {
|
|
45
|
+
return;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
if (!parentRule.raws.semicolon && parentRule.last === decl) {
|
|
49
|
+
return;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
const declString = decl.toString();
|
|
53
|
+
|
|
54
|
+
checker.beforeAllowingIndentation({
|
|
55
|
+
source: declString,
|
|
56
|
+
index: declString.length,
|
|
57
|
+
lineCheckStr: blockString(parentRule),
|
|
58
|
+
err: (m) => {
|
|
59
|
+
report({
|
|
60
|
+
message: m,
|
|
61
|
+
node: decl,
|
|
62
|
+
index: decl.toString().length - 1,
|
|
63
|
+
result,
|
|
64
|
+
ruleName
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
});
|
|
68
|
+
});
|
|
69
|
+
};
|
|
70
|
+
};
|
|
71
|
+
|
|
72
|
+
rule.ruleName = ruleName;
|
|
73
|
+
rule.messages = messages;
|
|
74
|
+
rule.meta = meta;
|
|
75
|
+
module.exports = stylelint.createPlugin(ruleName, rule);
|
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
# declaration-block-semicolon-space-after
|
|
2
|
+
|
|
3
|
+
Require a single space or disallow whitespace after the semicolons of declaration blocks.
|
|
4
|
+
|
|
5
|
+
<!-- prettier-ignore -->
|
|
6
|
+
```css
|
|
7
|
+
a { color: pink; top: 0; }
|
|
8
|
+
/** ↑
|
|
9
|
+
* The space after this semicolon */
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
This rule ignores:
|
|
13
|
+
|
|
14
|
+
- semicolons that are preceded by Less mixins
|
|
15
|
+
- the last semicolon of declaration blocks
|
|
16
|
+
|
|
17
|
+
Use the `block-closing-brace-*-before` rules to control the whitespace between the last semicolon and the closing brace instead.
|
|
18
|
+
|
|
19
|
+
The [`fix` option](https://stylelint.io/user-guide/options/#fix) can automatically fix all of the problems reported by this rule.
|
|
20
|
+
|
|
21
|
+
## Options
|
|
22
|
+
|
|
23
|
+
`string`: `"always"|"never"|"always-single-line"|"never-single-line"`
|
|
24
|
+
|
|
25
|
+
### `"always"`
|
|
26
|
+
|
|
27
|
+
There _must always_ be a single space after the semicolon.
|
|
28
|
+
|
|
29
|
+
The following patterns are considered problems:
|
|
30
|
+
|
|
31
|
+
<!-- prettier-ignore -->
|
|
32
|
+
```css
|
|
33
|
+
a { color: pink;top: 0; }
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
<!-- prettier-ignore -->
|
|
37
|
+
```css
|
|
38
|
+
a {
|
|
39
|
+
color: pink;
|
|
40
|
+
top: 0;
|
|
41
|
+
}
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
The following patterns are _not_ considered problems:
|
|
45
|
+
|
|
46
|
+
<!-- prettier-ignore -->
|
|
47
|
+
```css
|
|
48
|
+
a { color: pink;}
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
<!-- prettier-ignore -->
|
|
52
|
+
```css
|
|
53
|
+
a { color: pink; }
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
<!-- prettier-ignore -->
|
|
57
|
+
```css
|
|
58
|
+
a { color: pink; top: 0; }
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
### `"never"`
|
|
62
|
+
|
|
63
|
+
There _must never_ be whitespace after the semicolon.
|
|
64
|
+
|
|
65
|
+
The following patterns are considered problems:
|
|
66
|
+
|
|
67
|
+
<!-- prettier-ignore -->
|
|
68
|
+
```css
|
|
69
|
+
a { color: pink; top: 0; }
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
<!-- prettier-ignore -->
|
|
73
|
+
```css
|
|
74
|
+
a {
|
|
75
|
+
color: pink;
|
|
76
|
+
top: 0;
|
|
77
|
+
}
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
The following patterns are _not_ considered problems:
|
|
81
|
+
|
|
82
|
+
<!-- prettier-ignore -->
|
|
83
|
+
```css
|
|
84
|
+
a { color: pink;}
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
<!-- prettier-ignore -->
|
|
88
|
+
```css
|
|
89
|
+
a { color: pink; }
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
<!-- prettier-ignore -->
|
|
93
|
+
```css
|
|
94
|
+
a { color: pink;top: 0; }
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
### `"always-single-line"`
|
|
98
|
+
|
|
99
|
+
There _must always_ be a single space after the semicolon in single-line declaration blocks.
|
|
100
|
+
|
|
101
|
+
The following patterns are considered problems:
|
|
102
|
+
|
|
103
|
+
<!-- prettier-ignore -->
|
|
104
|
+
```css
|
|
105
|
+
a { color: pink;top: 0; }
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
The following patterns are _not_ considered problems:
|
|
109
|
+
|
|
110
|
+
<!-- prettier-ignore -->
|
|
111
|
+
```css
|
|
112
|
+
a { color: pink; top: 0; }
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
<!-- prettier-ignore -->
|
|
116
|
+
```css
|
|
117
|
+
a {
|
|
118
|
+
color: pink;
|
|
119
|
+
top: 0;
|
|
120
|
+
}
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
### `"never-single-line"`
|
|
124
|
+
|
|
125
|
+
There _must never_ be whitespace after the semicolon in single-line declaration blocks.
|
|
126
|
+
|
|
127
|
+
The following patterns are considered problems:
|
|
128
|
+
|
|
129
|
+
<!-- prettier-ignore -->
|
|
130
|
+
```css
|
|
131
|
+
a { color: pink; top: 0; }
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
The following patterns are _not_ considered problems:
|
|
135
|
+
|
|
136
|
+
<!-- prettier-ignore -->
|
|
137
|
+
```css
|
|
138
|
+
a { color: pink;top: 0; }
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
<!-- prettier-ignore -->
|
|
142
|
+
```css
|
|
143
|
+
a {
|
|
144
|
+
color: pink;
|
|
145
|
+
top: 0;
|
|
146
|
+
}
|
|
147
|
+
```
|
|
@@ -0,0 +1,97 @@
|
|
|
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 blockString = require('stylelint/lib/utils/blockString.cjs');
|
|
6
|
+
const rawNodeString = require('stylelint/lib/utils/rawNodeString.cjs');
|
|
7
|
+
const report = require('stylelint/lib/utils/report.cjs');
|
|
8
|
+
const ruleMessages = require('stylelint/lib/utils/ruleMessages.cjs');
|
|
9
|
+
const { isAtRule, isRule } = require('stylelint/lib/utils/typeGuards.cjs');
|
|
10
|
+
const validateOptions = require('stylelint/lib/utils/validateOptions.cjs');
|
|
11
|
+
|
|
12
|
+
const whitespaceChecker = require('../../utils/whitespaceChecker.cjs');
|
|
13
|
+
|
|
14
|
+
const ruleName = 'plugin/declaration-block-semicolon-space-after';
|
|
15
|
+
|
|
16
|
+
const messages = ruleMessages(ruleName, {
|
|
17
|
+
expectedAfter: () => 'Expected single space after ";"',
|
|
18
|
+
rejectedAfter: () => 'Unexpected whitespace after ";"',
|
|
19
|
+
expectedAfterSingleLine: () => 'Expected single space after ";" in a single-line declaration block',
|
|
20
|
+
rejectedAfterSingleLine: () => 'Unexpected whitespace after ";" in a single-line declaration block'
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
const meta = {
|
|
24
|
+
url: 'https://github.com/jens-duttke/linter-bundle/blob/main/stylelint/plugins/stylelint-15.11.0-stylistic/rules/declaration-block-semicolon-space-after/README.md',
|
|
25
|
+
fixable: true
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
/** @type {import('stylelint').Rule} */
|
|
29
|
+
const rule = (primary, _secondaryOptions, context) => {
|
|
30
|
+
const checker = whitespaceChecker('space', primary, messages);
|
|
31
|
+
|
|
32
|
+
return (root, result) => {
|
|
33
|
+
const validOptions = validateOptions(result, ruleName, {
|
|
34
|
+
actual: primary,
|
|
35
|
+
possible: ['always', 'never', 'always-single-line', 'never-single-line']
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
if (!validOptions) {
|
|
39
|
+
return;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
root.walkDecls((decl) => {
|
|
43
|
+
// Ignore last declaration if there's no trailing semicolon
|
|
44
|
+
const parentRule = decl.parent;
|
|
45
|
+
|
|
46
|
+
if (!parentRule) { throw new Error('A parent node must be present'); }
|
|
47
|
+
|
|
48
|
+
if (!isAtRule(parentRule) && !isRule(parentRule)) {
|
|
49
|
+
return;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
if (!parentRule.raws.semicolon && parentRule.last === decl) {
|
|
53
|
+
return;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
const nextDecl = decl.next();
|
|
57
|
+
|
|
58
|
+
if (!nextDecl) {
|
|
59
|
+
return;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
checker.after({
|
|
63
|
+
source: rawNodeString(nextDecl),
|
|
64
|
+
index: -1,
|
|
65
|
+
lineCheckStr: blockString(parentRule),
|
|
66
|
+
err: (m) => {
|
|
67
|
+
if (context.fix) {
|
|
68
|
+
if (primary.startsWith('always')) {
|
|
69
|
+
nextDecl.raws.before = ' ';
|
|
70
|
+
|
|
71
|
+
return;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
if (primary.startsWith('never')) {
|
|
75
|
+
nextDecl.raws.before = '';
|
|
76
|
+
|
|
77
|
+
return;
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
report({
|
|
82
|
+
message: m,
|
|
83
|
+
node: decl,
|
|
84
|
+
index: decl.toString().length + 1,
|
|
85
|
+
result,
|
|
86
|
+
ruleName
|
|
87
|
+
});
|
|
88
|
+
}
|
|
89
|
+
});
|
|
90
|
+
});
|
|
91
|
+
};
|
|
92
|
+
};
|
|
93
|
+
|
|
94
|
+
rule.ruleName = ruleName;
|
|
95
|
+
rule.messages = messages;
|
|
96
|
+
rule.meta = meta;
|
|
97
|
+
module.exports = stylelint.createPlugin(ruleName, rule);
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
# declaration-block-semicolon-space-before
|
|
2
|
+
|
|
3
|
+
Require a single space or disallow whitespace before the semicolons of declaration blocks.
|
|
4
|
+
|
|
5
|
+
<!-- prettier-ignore -->
|
|
6
|
+
```css
|
|
7
|
+
a { color: pink; }
|
|
8
|
+
/** ↑
|
|
9
|
+
* The space before this semicolon */
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
This rule ignores semicolons that are preceded by 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
|
+
`string`: `"always"|"never"|"always-single-line"|"never-single-line"`
|
|
19
|
+
|
|
20
|
+
### `"always"`
|
|
21
|
+
|
|
22
|
+
There _must always_ be a single space before the semicolons.
|
|
23
|
+
|
|
24
|
+
The following patterns are considered problems:
|
|
25
|
+
|
|
26
|
+
<!-- prettier-ignore -->
|
|
27
|
+
```css
|
|
28
|
+
a { color: pink; }
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
<!-- prettier-ignore -->
|
|
32
|
+
```css
|
|
33
|
+
a { color: pink; top: 0; }
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
The following patterns are _not_ considered problems:
|
|
37
|
+
|
|
38
|
+
<!-- prettier-ignore -->
|
|
39
|
+
```css
|
|
40
|
+
a { color: pink ; }
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
<!-- prettier-ignore -->
|
|
44
|
+
```css
|
|
45
|
+
a { color: pink ; top: 0 ; }
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
### `"never"`
|
|
49
|
+
|
|
50
|
+
There _must never_ be whitespace before the semicolons.
|
|
51
|
+
|
|
52
|
+
The following patterns are considered problems:
|
|
53
|
+
|
|
54
|
+
<!-- prettier-ignore -->
|
|
55
|
+
```css
|
|
56
|
+
a { color: pink ; }
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
<!-- prettier-ignore -->
|
|
60
|
+
```css
|
|
61
|
+
a { color: pink ; top: 0 ; }
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
The following patterns are _not_ considered problems:
|
|
65
|
+
|
|
66
|
+
<!-- prettier-ignore -->
|
|
67
|
+
```css
|
|
68
|
+
a { color: pink; }
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
<!-- prettier-ignore -->
|
|
72
|
+
```css
|
|
73
|
+
a { color: pink; top: 0; }
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
### `"always-single-line"`
|
|
77
|
+
|
|
78
|
+
There _must always_ be a single space before the semicolons in single-line declaration blocks.
|
|
79
|
+
|
|
80
|
+
The following patterns are considered problems:
|
|
81
|
+
|
|
82
|
+
<!-- prettier-ignore -->
|
|
83
|
+
```css
|
|
84
|
+
a { color: pink; }
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
The following patterns are _not_ considered problems:
|
|
88
|
+
|
|
89
|
+
<!-- prettier-ignore -->
|
|
90
|
+
```css
|
|
91
|
+
a { color: pink ; }
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
<!-- prettier-ignore -->
|
|
95
|
+
```css
|
|
96
|
+
a { color: pink; top: 0; }
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
<!-- prettier-ignore -->
|
|
100
|
+
```css
|
|
101
|
+
a { color: pink ; top: 0 ; }
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
### `"never-single-line"`
|
|
105
|
+
|
|
106
|
+
There _must never_ be whitespace before the semicolons in single-line declaration blocks.
|
|
107
|
+
|
|
108
|
+
The following patterns are considered problems:
|
|
109
|
+
|
|
110
|
+
<!-- prettier-ignore -->
|
|
111
|
+
```css
|
|
112
|
+
a { color: pink ; }
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
The following patterns are _not_ considered problems:
|
|
116
|
+
|
|
117
|
+
<!-- prettier-ignore -->
|
|
118
|
+
```css
|
|
119
|
+
a { color: pink; }
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
<!-- prettier-ignore -->
|
|
123
|
+
```css
|
|
124
|
+
a { color: pink; top: 0; }
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
<!-- prettier-ignore -->
|
|
128
|
+
```css
|
|
129
|
+
a { color: pink ; top: 0 ; }
|
|
130
|
+
```
|
|
@@ -0,0 +1,106 @@
|
|
|
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 blockString = require('stylelint/lib/utils/blockString.cjs');
|
|
6
|
+
const getDeclarationValue = require('stylelint/lib/utils/getDeclarationValue.cjs');
|
|
7
|
+
const report = require('stylelint/lib/utils/report.cjs');
|
|
8
|
+
const ruleMessages = require('stylelint/lib/utils/ruleMessages.cjs');
|
|
9
|
+
const setDeclarationValue = require('stylelint/lib/utils/setDeclarationValue.cjs');
|
|
10
|
+
const { isAtRule, isRule } = require('stylelint/lib/utils/typeGuards.cjs');
|
|
11
|
+
const validateOptions = require('stylelint/lib/utils/validateOptions.cjs');
|
|
12
|
+
|
|
13
|
+
const whitespaceChecker = require('../../utils/whitespaceChecker.cjs');
|
|
14
|
+
|
|
15
|
+
const ruleName = 'plugin/declaration-block-semicolon-space-before';
|
|
16
|
+
|
|
17
|
+
const messages = ruleMessages(ruleName, {
|
|
18
|
+
expectedBefore: () => 'Expected single space before ";"',
|
|
19
|
+
rejectedBefore: () => 'Unexpected whitespace before ";"',
|
|
20
|
+
expectedBeforeSingleLine: () => 'Expected single space before ";" in a single-line declaration block',
|
|
21
|
+
rejectedBeforeSingleLine: () => 'Unexpected whitespace before ";" in a single-line declaration block'
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
const meta = {
|
|
25
|
+
url: 'https://github.com/jens-duttke/linter-bundle/blob/main/stylelint/plugins/stylelint-15.11.0-stylistic/rules/declaration-block-semicolon-space-before/README.md',
|
|
26
|
+
fixable: true
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
/** @type {import('stylelint').Rule} */
|
|
30
|
+
const rule = (primary, _secondaryOptions, context) => {
|
|
31
|
+
const checker = whitespaceChecker('space', primary, messages);
|
|
32
|
+
|
|
33
|
+
return (root, result) => {
|
|
34
|
+
const validOptions = validateOptions(result, ruleName, {
|
|
35
|
+
actual: primary,
|
|
36
|
+
possible: ['always', 'never', 'always-single-line', 'never-single-line']
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
if (!validOptions) {
|
|
40
|
+
return;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
root.walkDecls((decl) => {
|
|
44
|
+
// Ignore last declaration if there's no trailing semicolon
|
|
45
|
+
const parentRule = decl.parent;
|
|
46
|
+
|
|
47
|
+
if (!parentRule) { throw new Error('A parent node must be present'); }
|
|
48
|
+
|
|
49
|
+
if (!isAtRule(parentRule) && !isRule(parentRule)) {
|
|
50
|
+
return;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
if (!parentRule.raws.semicolon && parentRule.last === decl) {
|
|
54
|
+
return;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
const declString = decl.toString();
|
|
58
|
+
|
|
59
|
+
checker.before({
|
|
60
|
+
source: declString,
|
|
61
|
+
index: declString.length,
|
|
62
|
+
lineCheckStr: blockString(parentRule),
|
|
63
|
+
err: (m) => {
|
|
64
|
+
if (context.fix) {
|
|
65
|
+
const value = getDeclarationValue(decl);
|
|
66
|
+
|
|
67
|
+
if (primary.startsWith('always')) {
|
|
68
|
+
if (decl.important) {
|
|
69
|
+
decl.raws.important = ' !important ';
|
|
70
|
+
}
|
|
71
|
+
else {
|
|
72
|
+
setDeclarationValue(decl, value.replace(/\s*$/, ' '));
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
return;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
if (primary.startsWith('never')) {
|
|
79
|
+
if (decl.raws.important) {
|
|
80
|
+
decl.raws.important = decl.raws.important.replace(/\s*$/, '');
|
|
81
|
+
}
|
|
82
|
+
else {
|
|
83
|
+
setDeclarationValue(decl, value.replace(/\s*$/, ''));
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
return;
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
report({
|
|
91
|
+
message: m,
|
|
92
|
+
node: decl,
|
|
93
|
+
index: decl.toString().length - 1,
|
|
94
|
+
result,
|
|
95
|
+
ruleName
|
|
96
|
+
});
|
|
97
|
+
}
|
|
98
|
+
});
|
|
99
|
+
});
|
|
100
|
+
};
|
|
101
|
+
};
|
|
102
|
+
|
|
103
|
+
rule.ruleName = ruleName;
|
|
104
|
+
rule.messages = messages;
|
|
105
|
+
rule.meta = meta;
|
|
106
|
+
module.exports = stylelint.createPlugin(ruleName, rule);
|