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,191 @@
|
|
|
1
|
+
# block-opening-brace-space-after
|
|
2
|
+
|
|
3
|
+
Require a single space or disallow whitespace after the opening brace of blocks.
|
|
4
|
+
|
|
5
|
+
<!-- prettier-ignore -->
|
|
6
|
+
```css
|
|
7
|
+
a { color: pink; }
|
|
8
|
+
/** ↑
|
|
9
|
+
* The space after this brace */
|
|
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"|"always-multi-line"|"never-multi-line"`
|
|
17
|
+
|
|
18
|
+
### `"always"`
|
|
19
|
+
|
|
20
|
+
There _must always_ be a single space after the opening brace.
|
|
21
|
+
|
|
22
|
+
The following patterns are considered problems:
|
|
23
|
+
|
|
24
|
+
<!-- prettier-ignore -->
|
|
25
|
+
```css
|
|
26
|
+
a {color: pink; }
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
<!-- prettier-ignore -->
|
|
30
|
+
```css
|
|
31
|
+
a {
|
|
32
|
+
color: pink; }
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
The following patterns are _not_ considered problems:
|
|
36
|
+
|
|
37
|
+
<!-- prettier-ignore -->
|
|
38
|
+
```css
|
|
39
|
+
a { color: pink; }
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
<!-- prettier-ignore -->
|
|
43
|
+
```css
|
|
44
|
+
a { color: pink;
|
|
45
|
+
}
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
### `"never"`
|
|
49
|
+
|
|
50
|
+
There _must never_ be whitespace after the opening brace.
|
|
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 {
|
|
62
|
+
color: pink; }
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
The following patterns are _not_ considered problems:
|
|
66
|
+
|
|
67
|
+
<!-- prettier-ignore -->
|
|
68
|
+
```css
|
|
69
|
+
a {color: pink; }
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
<!-- prettier-ignore -->
|
|
73
|
+
```css
|
|
74
|
+
a
|
|
75
|
+
{color: pink; }
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
### `"always-single-line"`
|
|
79
|
+
|
|
80
|
+
There _must always_ be a single space after the opening brace in single-line blocks.
|
|
81
|
+
|
|
82
|
+
The following patterns are considered problems:
|
|
83
|
+
|
|
84
|
+
<!-- prettier-ignore -->
|
|
85
|
+
```css
|
|
86
|
+
a {color: pink; }
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
The following patterns are _not_ considered problems:
|
|
90
|
+
|
|
91
|
+
<!-- prettier-ignore -->
|
|
92
|
+
```css
|
|
93
|
+
a { color: pink; }
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
<!-- prettier-ignore -->
|
|
97
|
+
```css
|
|
98
|
+
a {color: pink;
|
|
99
|
+
}
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
### `"never-single-line"`
|
|
103
|
+
|
|
104
|
+
There _must never_ be whitespace after the opening brace in single-line blocks.
|
|
105
|
+
|
|
106
|
+
The following patterns are considered problems:
|
|
107
|
+
|
|
108
|
+
<!-- prettier-ignore -->
|
|
109
|
+
```css
|
|
110
|
+
a { color: pink; }
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
The following patterns are _not_ considered problems:
|
|
114
|
+
|
|
115
|
+
<!-- prettier-ignore -->
|
|
116
|
+
```css
|
|
117
|
+
a {color: pink; }
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
<!-- prettier-ignore -->
|
|
121
|
+
```css
|
|
122
|
+
a { color: pink;
|
|
123
|
+
}
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
### `"always-multi-line"`
|
|
127
|
+
|
|
128
|
+
There _must always_ be a single space after the opening brace in multi-line blocks.
|
|
129
|
+
|
|
130
|
+
The following patterns are considered problems:
|
|
131
|
+
|
|
132
|
+
<!-- prettier-ignore -->
|
|
133
|
+
```css
|
|
134
|
+
a {color: pink;
|
|
135
|
+
}
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
The following patterns are _not_ considered problems:
|
|
139
|
+
|
|
140
|
+
<!-- prettier-ignore -->
|
|
141
|
+
```css
|
|
142
|
+
a {color: pink; }
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
<!-- prettier-ignore -->
|
|
146
|
+
```css
|
|
147
|
+
a { color: pink;
|
|
148
|
+
}
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
### `"never-multi-line"`
|
|
152
|
+
|
|
153
|
+
There _must never_ be whitespace after the opening brace in multi-line blocks.
|
|
154
|
+
|
|
155
|
+
The following patterns are considered problems:
|
|
156
|
+
|
|
157
|
+
<!-- prettier-ignore -->
|
|
158
|
+
```css
|
|
159
|
+
a { color: pink;
|
|
160
|
+
}
|
|
161
|
+
```
|
|
162
|
+
|
|
163
|
+
The following patterns are _not_ considered problems:
|
|
164
|
+
|
|
165
|
+
<!-- prettier-ignore -->
|
|
166
|
+
```css
|
|
167
|
+
a { color: pink; }
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
<!-- prettier-ignore -->
|
|
171
|
+
```css
|
|
172
|
+
a {color: pink;
|
|
173
|
+
}
|
|
174
|
+
```
|
|
175
|
+
|
|
176
|
+
## Optional secondary options
|
|
177
|
+
|
|
178
|
+
### `ignore: ["at-rules"]`
|
|
179
|
+
|
|
180
|
+
Ignore the opening brace of at-rules.
|
|
181
|
+
|
|
182
|
+
For example, with `"always"`:
|
|
183
|
+
|
|
184
|
+
The following pattern is _not_ considered a problem:
|
|
185
|
+
|
|
186
|
+
<!-- prettier-ignore -->
|
|
187
|
+
```css
|
|
188
|
+
@media print {
|
|
189
|
+
a { color: pink; }
|
|
190
|
+
}
|
|
191
|
+
```
|
|
@@ -0,0 +1,118 @@
|
|
|
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 beforeBlockString = require('stylelint/lib/utils/beforeBlockString.cjs');
|
|
6
|
+
const blockString = require('stylelint/lib/utils/blockString.cjs');
|
|
7
|
+
const hasBlock = require('stylelint/lib/utils/hasBlock.cjs');
|
|
8
|
+
const optionsMatches = require('stylelint/lib/utils/optionsMatches.cjs');
|
|
9
|
+
const report = require('stylelint/lib/utils/report.cjs');
|
|
10
|
+
const ruleMessages = require('stylelint/lib/utils/ruleMessages.cjs');
|
|
11
|
+
const validateOptions = require('stylelint/lib/utils/validateOptions.cjs');
|
|
12
|
+
|
|
13
|
+
const hasEmptyBlock = require('../../utils/hasEmptyBlock.cjs');
|
|
14
|
+
const whitespaceChecker = require('../../utils/whitespaceChecker.cjs');
|
|
15
|
+
|
|
16
|
+
const ruleName = 'plugin/block-opening-brace-space-after';
|
|
17
|
+
|
|
18
|
+
const messages = ruleMessages(ruleName, {
|
|
19
|
+
expectedAfter: () => 'Expected single space after "{"',
|
|
20
|
+
rejectedAfter: () => 'Unexpected whitespace after "{"',
|
|
21
|
+
expectedAfterSingleLine: () => 'Expected single space after "{" of a single-line block',
|
|
22
|
+
rejectedAfterSingleLine: () => 'Unexpected whitespace after "{" of a single-line block',
|
|
23
|
+
expectedAfterMultiLine: () => 'Expected single space after "{" of a multi-line block',
|
|
24
|
+
rejectedAfterMultiLine: () => 'Unexpected whitespace after "{" of a multi-line block'
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
const meta = {
|
|
28
|
+
url: 'https://github.com/jens-duttke/linter-bundle/blob/main/stylelint/plugins/stylelint-15.11.0-stylistic/rules/block-opening-brace-space-after/README.md',
|
|
29
|
+
fixable: true
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
/** @type {import('stylelint').Rule} */
|
|
33
|
+
const rule = (primary, secondaryOptions, context) => {
|
|
34
|
+
const checker = whitespaceChecker('space', primary, messages);
|
|
35
|
+
|
|
36
|
+
return (root, result) => {
|
|
37
|
+
const validOptions = validateOptions(
|
|
38
|
+
result,
|
|
39
|
+
ruleName,
|
|
40
|
+
{
|
|
41
|
+
actual: primary,
|
|
42
|
+
possible: [
|
|
43
|
+
'always',
|
|
44
|
+
'never',
|
|
45
|
+
'always-single-line',
|
|
46
|
+
'never-single-line',
|
|
47
|
+
'always-multi-line',
|
|
48
|
+
'never-multi-line'
|
|
49
|
+
]
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
actual: secondaryOptions,
|
|
53
|
+
possible: {
|
|
54
|
+
ignore: ['at-rules']
|
|
55
|
+
},
|
|
56
|
+
optional: true
|
|
57
|
+
}
|
|
58
|
+
);
|
|
59
|
+
|
|
60
|
+
if (!validOptions) {
|
|
61
|
+
return;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
// Check both kinds of statements: rules and at-rules
|
|
65
|
+
root.walkRules(check);
|
|
66
|
+
|
|
67
|
+
if (!optionsMatches(secondaryOptions, 'ignore', 'at-rules')) {
|
|
68
|
+
root.walkAtRules(check);
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
* @param {import('postcss').Rule | import('postcss').AtRule} statement
|
|
73
|
+
*/
|
|
74
|
+
function check (statement) {
|
|
75
|
+
// Return early if blockless or has an empty block
|
|
76
|
+
if (!hasBlock(statement) || hasEmptyBlock(statement)) {
|
|
77
|
+
return;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
checker.after({
|
|
81
|
+
source: blockString(statement),
|
|
82
|
+
index: 0,
|
|
83
|
+
err: (m) => {
|
|
84
|
+
if (context.fix) {
|
|
85
|
+
const statementFirst = statement.first;
|
|
86
|
+
|
|
87
|
+
if (statementFirst == null) { return; }
|
|
88
|
+
|
|
89
|
+
if (primary.startsWith('always')) {
|
|
90
|
+
statementFirst.raws.before = ' ';
|
|
91
|
+
|
|
92
|
+
return;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
if (primary.startsWith('never')) {
|
|
96
|
+
statementFirst.raws.before = '';
|
|
97
|
+
|
|
98
|
+
return;
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
report({
|
|
103
|
+
message: m,
|
|
104
|
+
node: statement,
|
|
105
|
+
index: beforeBlockString(statement, { noRawBefore: true }).length + 1,
|
|
106
|
+
result,
|
|
107
|
+
ruleName
|
|
108
|
+
});
|
|
109
|
+
}
|
|
110
|
+
});
|
|
111
|
+
}
|
|
112
|
+
};
|
|
113
|
+
};
|
|
114
|
+
|
|
115
|
+
rule.ruleName = ruleName;
|
|
116
|
+
rule.messages = messages;
|
|
117
|
+
rule.meta = meta;
|
|
118
|
+
module.exports = stylelint.createPlugin(ruleName, rule);
|
|
@@ -0,0 +1,218 @@
|
|
|
1
|
+
# block-opening-brace-space-before
|
|
2
|
+
|
|
3
|
+
Require a single space or disallow whitespace before the opening brace of blocks.
|
|
4
|
+
|
|
5
|
+
<!-- prettier-ignore -->
|
|
6
|
+
```css
|
|
7
|
+
a { color: pink; }
|
|
8
|
+
/** ↑
|
|
9
|
+
* The space before this brace */
|
|
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"|"always-multi-line"|"never-multi-line"`
|
|
17
|
+
|
|
18
|
+
### `"always"`
|
|
19
|
+
|
|
20
|
+
There _must always_ be a single space before the opening brace.
|
|
21
|
+
|
|
22
|
+
The following patterns are considered problems:
|
|
23
|
+
|
|
24
|
+
<!-- prettier-ignore -->
|
|
25
|
+
```css
|
|
26
|
+
a{ color: pink; }
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
<!-- prettier-ignore -->
|
|
30
|
+
```css
|
|
31
|
+
a
|
|
32
|
+
{ color: pink; }
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
The following patterns are _not_ considered problems:
|
|
36
|
+
|
|
37
|
+
<!-- prettier-ignore -->
|
|
38
|
+
```css
|
|
39
|
+
a { color: pink; }
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
<!-- prettier-ignore -->
|
|
43
|
+
```css
|
|
44
|
+
a {
|
|
45
|
+
color: pink; }
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
### `"never"`
|
|
49
|
+
|
|
50
|
+
There _must never_ be whitespace before the opening brace.
|
|
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
|
|
62
|
+
{ color: pink; }
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
The following patterns are _not_ considered problems:
|
|
66
|
+
|
|
67
|
+
<!-- prettier-ignore -->
|
|
68
|
+
```css
|
|
69
|
+
a{ color: pink; }
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
<!-- prettier-ignore -->
|
|
73
|
+
```css
|
|
74
|
+
a{
|
|
75
|
+
color: pink; }
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
### `"always-single-line"`
|
|
79
|
+
|
|
80
|
+
There _must always_ be a single space before the opening brace in single-line blocks.
|
|
81
|
+
|
|
82
|
+
The following patterns are considered problems:
|
|
83
|
+
|
|
84
|
+
<!-- prettier-ignore -->
|
|
85
|
+
```css
|
|
86
|
+
a{ color: pink; }
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
The following patterns are _not_ considered problems:
|
|
90
|
+
|
|
91
|
+
<!-- prettier-ignore -->
|
|
92
|
+
```css
|
|
93
|
+
a { color: pink; }
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
<!-- prettier-ignore -->
|
|
97
|
+
```css
|
|
98
|
+
a{
|
|
99
|
+
color: pink; }
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
### `"never-single-line"`
|
|
103
|
+
|
|
104
|
+
There _must never_ be whitespace before the opening brace in single-line blocks.
|
|
105
|
+
|
|
106
|
+
The following patterns are considered problems:
|
|
107
|
+
|
|
108
|
+
<!-- prettier-ignore -->
|
|
109
|
+
```css
|
|
110
|
+
a { color: pink; }
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
The following patterns are _not_ considered problems:
|
|
114
|
+
|
|
115
|
+
<!-- prettier-ignore -->
|
|
116
|
+
```css
|
|
117
|
+
a{ color: pink; }
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
<!-- prettier-ignore -->
|
|
121
|
+
```css
|
|
122
|
+
a {
|
|
123
|
+
color: pink; }
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
### `"always-multi-line"`
|
|
127
|
+
|
|
128
|
+
There _must always_ be a single space before the opening brace in multi-line blocks.
|
|
129
|
+
|
|
130
|
+
The following patterns are considered problems:
|
|
131
|
+
|
|
132
|
+
<!-- prettier-ignore -->
|
|
133
|
+
```css
|
|
134
|
+
a{
|
|
135
|
+
color: pink; }
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
The following patterns are _not_ considered problems:
|
|
139
|
+
|
|
140
|
+
<!-- prettier-ignore -->
|
|
141
|
+
```css
|
|
142
|
+
a{ color: pink; }
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
<!-- prettier-ignore -->
|
|
146
|
+
```css
|
|
147
|
+
a {
|
|
148
|
+
color: pink; }
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
### `"never-multi-line"`
|
|
152
|
+
|
|
153
|
+
There _must never_ be whitespace before the opening brace in multi-line blocks.
|
|
154
|
+
|
|
155
|
+
The following patterns are considered problems:
|
|
156
|
+
|
|
157
|
+
<!-- prettier-ignore -->
|
|
158
|
+
```css
|
|
159
|
+
a {
|
|
160
|
+
color: pink; }
|
|
161
|
+
```
|
|
162
|
+
|
|
163
|
+
The following patterns are _not_ considered problems:
|
|
164
|
+
|
|
165
|
+
<!-- prettier-ignore -->
|
|
166
|
+
```css
|
|
167
|
+
a { color: pink; }
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
<!-- prettier-ignore -->
|
|
171
|
+
```css
|
|
172
|
+
a{
|
|
173
|
+
color: pink;}
|
|
174
|
+
```
|
|
175
|
+
|
|
176
|
+
## Optional secondary options
|
|
177
|
+
|
|
178
|
+
### `ignoreAtRules: ["/regex/", /regex/, "non-regex"]`
|
|
179
|
+
|
|
180
|
+
Given:
|
|
181
|
+
|
|
182
|
+
```json
|
|
183
|
+
["/for/i"]
|
|
184
|
+
```
|
|
185
|
+
|
|
186
|
+
The following patterns are _not_ considered problems:
|
|
187
|
+
|
|
188
|
+
<!-- prettier-ignore -->
|
|
189
|
+
```css
|
|
190
|
+
@for ...
|
|
191
|
+
{}
|
|
192
|
+
```
|
|
193
|
+
|
|
194
|
+
<!-- prettier-ignore -->
|
|
195
|
+
```css
|
|
196
|
+
@for ...{}
|
|
197
|
+
```
|
|
198
|
+
|
|
199
|
+
### `ignoreSelectors: ["/regex/", /regex/, "non-regex"]`
|
|
200
|
+
|
|
201
|
+
Given:
|
|
202
|
+
|
|
203
|
+
```json
|
|
204
|
+
[":root"]
|
|
205
|
+
```
|
|
206
|
+
|
|
207
|
+
The following patterns are _not_ considered problems:
|
|
208
|
+
|
|
209
|
+
<!-- prettier-ignore -->
|
|
210
|
+
```css
|
|
211
|
+
:root
|
|
212
|
+
{}
|
|
213
|
+
```
|
|
214
|
+
|
|
215
|
+
<!-- prettier-ignore -->
|
|
216
|
+
```css
|
|
217
|
+
:root{}
|
|
218
|
+
```
|
|
@@ -0,0 +1,141 @@
|
|
|
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 beforeBlockString = require('stylelint/lib/utils/beforeBlockString.cjs');
|
|
6
|
+
const blockString = require('stylelint/lib/utils/blockString.cjs');
|
|
7
|
+
const hasBlock = require('stylelint/lib/utils/hasBlock.cjs');
|
|
8
|
+
const optionsMatches = require('stylelint/lib/utils/optionsMatches.cjs');
|
|
9
|
+
const report = require('stylelint/lib/utils/report.cjs');
|
|
10
|
+
const ruleMessages = require('stylelint/lib/utils/ruleMessages.cjs');
|
|
11
|
+
const validateOptions = require('stylelint/lib/utils/validateOptions.cjs');
|
|
12
|
+
const { isRegExp, isString } = require('stylelint/lib/utils/validateTypes.cjs');
|
|
13
|
+
|
|
14
|
+
const hasEmptyBlock = require('../../utils/hasEmptyBlock.cjs');
|
|
15
|
+
const whitespaceChecker = require('../../utils/whitespaceChecker.cjs');
|
|
16
|
+
|
|
17
|
+
const ruleName = 'plugin/block-opening-brace-space-before';
|
|
18
|
+
|
|
19
|
+
const messages = ruleMessages(ruleName, {
|
|
20
|
+
expectedBefore: () => 'Expected single space before "{"',
|
|
21
|
+
rejectedBefore: () => 'Unexpected whitespace before "{"',
|
|
22
|
+
expectedBeforeSingleLine: () => 'Expected single space before "{" of a single-line block',
|
|
23
|
+
rejectedBeforeSingleLine: () => 'Unexpected whitespace before "{" of a single-line block',
|
|
24
|
+
expectedBeforeMultiLine: () => 'Expected single space before "{" of a multi-line block',
|
|
25
|
+
rejectedBeforeMultiLine: () => 'Unexpected whitespace before "{" of a multi-line block'
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
const meta = {
|
|
29
|
+
url: 'https://github.com/jens-duttke/linter-bundle/blob/main/stylelint/plugins/stylelint-15.11.0-stylistic/rules/block-opening-brace-space-before/README.md',
|
|
30
|
+
fixable: true
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
/** @type {import('stylelint').Rule} */
|
|
34
|
+
const rule = (primary, secondaryOptions, context) => {
|
|
35
|
+
const checker = whitespaceChecker('space', primary, messages);
|
|
36
|
+
|
|
37
|
+
return (root, result) => {
|
|
38
|
+
const validOptions = validateOptions(
|
|
39
|
+
result,
|
|
40
|
+
ruleName,
|
|
41
|
+
{
|
|
42
|
+
actual: primary,
|
|
43
|
+
possible: [
|
|
44
|
+
'always',
|
|
45
|
+
'never',
|
|
46
|
+
'always-single-line',
|
|
47
|
+
'never-single-line',
|
|
48
|
+
'always-multi-line',
|
|
49
|
+
'never-multi-line'
|
|
50
|
+
]
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
actual: secondaryOptions,
|
|
54
|
+
possible: {
|
|
55
|
+
ignoreAtRules: [isString, isRegExp],
|
|
56
|
+
ignoreSelectors: [isString, isRegExp]
|
|
57
|
+
},
|
|
58
|
+
optional: true
|
|
59
|
+
}
|
|
60
|
+
);
|
|
61
|
+
|
|
62
|
+
if (!validOptions) {
|
|
63
|
+
return;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
// Check both kinds of statements: rules and at-rules
|
|
67
|
+
root.walkRules(check);
|
|
68
|
+
root.walkAtRules(check);
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* @param {import('postcss').Rule | import('postcss').AtRule} statement
|
|
72
|
+
*/
|
|
73
|
+
function check (statement) {
|
|
74
|
+
// Return early if blockless or has an empty block
|
|
75
|
+
if (!hasBlock(statement) || hasEmptyBlock(statement)) {
|
|
76
|
+
return;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
// Return early if at-rule is to be ignored
|
|
80
|
+
if (
|
|
81
|
+
statement.type === 'atrule' &&
|
|
82
|
+
optionsMatches(secondaryOptions, 'ignoreAtRules', statement.name)
|
|
83
|
+
) {
|
|
84
|
+
return;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
// Return early if selector is to be ignored
|
|
88
|
+
if (
|
|
89
|
+
statement.type === 'rule' &&
|
|
90
|
+
optionsMatches(secondaryOptions, 'ignoreSelectors', statement.selector)
|
|
91
|
+
) {
|
|
92
|
+
return;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
const source = beforeBlockString(statement);
|
|
96
|
+
const beforeBraceNoRaw = beforeBlockString(statement, {
|
|
97
|
+
noRawBefore: true
|
|
98
|
+
});
|
|
99
|
+
|
|
100
|
+
let index = beforeBraceNoRaw.length - 1;
|
|
101
|
+
|
|
102
|
+
if (beforeBraceNoRaw[index - 1] === '\r') {
|
|
103
|
+
index -= 1;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
checker.before({
|
|
107
|
+
source,
|
|
108
|
+
index: source.length,
|
|
109
|
+
lineCheckStr: blockString(statement),
|
|
110
|
+
err: (m) => {
|
|
111
|
+
if (context.fix) {
|
|
112
|
+
if (primary.startsWith('always')) {
|
|
113
|
+
statement.raws.between = ' ';
|
|
114
|
+
|
|
115
|
+
return;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
if (primary.startsWith('never')) {
|
|
119
|
+
statement.raws.between = '';
|
|
120
|
+
|
|
121
|
+
return;
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
report({
|
|
126
|
+
message: m,
|
|
127
|
+
node: statement,
|
|
128
|
+
index,
|
|
129
|
+
result,
|
|
130
|
+
ruleName
|
|
131
|
+
});
|
|
132
|
+
}
|
|
133
|
+
});
|
|
134
|
+
}
|
|
135
|
+
};
|
|
136
|
+
};
|
|
137
|
+
|
|
138
|
+
rule.ruleName = ruleName;
|
|
139
|
+
rule.messages = messages;
|
|
140
|
+
rule.meta = meta;
|
|
141
|
+
module.exports = stylelint.createPlugin(ruleName, rule);
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
# color-hex-case
|
|
2
|
+
|
|
3
|
+
Specify lowercase or uppercase for hex colors.
|
|
4
|
+
|
|
5
|
+
<!-- prettier-ignore -->
|
|
6
|
+
```css
|
|
7
|
+
a { color: #fff }
|
|
8
|
+
/** ↑
|
|
9
|
+
* This hex color */
|
|
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`: `"lower"|"upper"`
|
|
17
|
+
|
|
18
|
+
### `"lower"`
|
|
19
|
+
|
|
20
|
+
The following patterns are considered problems:
|
|
21
|
+
|
|
22
|
+
<!-- prettier-ignore -->
|
|
23
|
+
```css
|
|
24
|
+
a { color: #FFF; }
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
The following patterns are _not_ considered problems:
|
|
28
|
+
|
|
29
|
+
<!-- prettier-ignore -->
|
|
30
|
+
```css
|
|
31
|
+
a { color: #000; }
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
<!-- prettier-ignore -->
|
|
35
|
+
```css
|
|
36
|
+
a { color: #fff; }
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
### `"upper"`
|
|
40
|
+
|
|
41
|
+
The following patterns are considered problems:
|
|
42
|
+
|
|
43
|
+
<!-- prettier-ignore -->
|
|
44
|
+
```css
|
|
45
|
+
a { color: #fff; }
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
The following patterns are _not_ considered problems:
|
|
49
|
+
|
|
50
|
+
<!-- prettier-ignore -->
|
|
51
|
+
```css
|
|
52
|
+
a { color: #000; }
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
<!-- prettier-ignore -->
|
|
56
|
+
```css
|
|
57
|
+
a { color: #FFF; }
|
|
58
|
+
```
|