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
package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/value-list-comma-space-after/index.cjs
ADDED
|
@@ -0,0 +1,94 @@
|
|
|
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 declarationValueIndex = require('stylelint/lib/utils/declarationValueIndex.cjs');
|
|
6
|
+
const getDeclarationValue = require('stylelint/lib/utils/getDeclarationValue.cjs');
|
|
7
|
+
const ruleMessages = require('stylelint/lib/utils/ruleMessages.cjs');
|
|
8
|
+
const setDeclarationValue = require('stylelint/lib/utils/setDeclarationValue.cjs');
|
|
9
|
+
const validateOptions = require('stylelint/lib/utils/validateOptions.cjs');
|
|
10
|
+
|
|
11
|
+
const whitespaceChecker = require('../../utils/whitespaceChecker.cjs');
|
|
12
|
+
const valueListCommaWhitespaceChecker = require('../valueListCommaWhitespaceChecker.cjs');
|
|
13
|
+
|
|
14
|
+
const ruleName = 'plugin/value-list-comma-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 list',
|
|
20
|
+
rejectedAfterSingleLine: () => 'Unexpected whitespace after "," in a single-line list'
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
const meta = {
|
|
24
|
+
url: 'https://github.com/jens-duttke/linter-bundle/blob/main/stylelint/plugins/stylelint-15.11.0-stylistic/rules/value-list-comma-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
|
+
/** @type {Map<import('postcss').Declaration, number[]> | undefined} */
|
|
43
|
+
let fixData;
|
|
44
|
+
|
|
45
|
+
valueListCommaWhitespaceChecker({
|
|
46
|
+
root,
|
|
47
|
+
result,
|
|
48
|
+
locationChecker: checker.after,
|
|
49
|
+
checkedRuleName: ruleName,
|
|
50
|
+
fix: context.fix ?
|
|
51
|
+
(declNode, index) => {
|
|
52
|
+
const valueIndex = declarationValueIndex(declNode);
|
|
53
|
+
|
|
54
|
+
if (index <= valueIndex) {
|
|
55
|
+
return false;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
fixData ||= new Map();
|
|
59
|
+
const commaIndices = fixData.get(declNode) || [];
|
|
60
|
+
|
|
61
|
+
commaIndices.push(index);
|
|
62
|
+
fixData.set(declNode, commaIndices);
|
|
63
|
+
|
|
64
|
+
return true;
|
|
65
|
+
}
|
|
66
|
+
: null
|
|
67
|
+
});
|
|
68
|
+
|
|
69
|
+
if (fixData) {
|
|
70
|
+
for (const [decl, commaIndices] of fixData.entries()) {
|
|
71
|
+
for (const index of commaIndices.sort((a, b) => b - a)) {
|
|
72
|
+
const value = getDeclarationValue(decl);
|
|
73
|
+
const valueIndex = index - declarationValueIndex(decl);
|
|
74
|
+
const beforeValue = value.slice(0, valueIndex + 1);
|
|
75
|
+
let afterValue = value.slice(valueIndex + 1);
|
|
76
|
+
|
|
77
|
+
if (primary.startsWith('always')) {
|
|
78
|
+
afterValue = afterValue.replace(/^\s*/, ' ');
|
|
79
|
+
}
|
|
80
|
+
else if (primary.startsWith('never')) {
|
|
81
|
+
afterValue = afterValue.replace(/^\s*/, '');
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
setDeclarationValue(decl, beforeValue + afterValue);
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
};
|
|
89
|
+
};
|
|
90
|
+
|
|
91
|
+
rule.ruleName = ruleName;
|
|
92
|
+
rule.messages = messages;
|
|
93
|
+
rule.meta = meta;
|
|
94
|
+
module.exports = stylelint.createPlugin(ruleName, rule);
|
package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/value-list-comma-space-before/README.md
ADDED
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
# value-list-comma-space-before
|
|
2
|
+
|
|
3
|
+
Require a single space or disallow whitespace before the commas of value lists.
|
|
4
|
+
|
|
5
|
+
<!-- prettier-ignore -->
|
|
6
|
+
```css
|
|
7
|
+
a { background-size: 0 ,0; }
|
|
8
|
+
/** ↑
|
|
9
|
+
* The space before this comma */
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
The [`fix` option](https://stylelint.io/user-guide/options/#fix) can automatically fix most 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 before the commas.
|
|
21
|
+
|
|
22
|
+
The following patterns are considered problems:
|
|
23
|
+
|
|
24
|
+
<!-- prettier-ignore -->
|
|
25
|
+
```css
|
|
26
|
+
a { background-size: 0,0; }
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
<!-- prettier-ignore -->
|
|
30
|
+
```css
|
|
31
|
+
a { background-size: 0
|
|
32
|
+
, 0; }
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
The following patterns are _not_ considered problems:
|
|
36
|
+
|
|
37
|
+
<!-- prettier-ignore -->
|
|
38
|
+
```css
|
|
39
|
+
a { background-size: 0 ,0; }
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
<!-- prettier-ignore -->
|
|
43
|
+
```css
|
|
44
|
+
a { background-size: 0 ,
|
|
45
|
+
0; }
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
### `"never"`
|
|
49
|
+
|
|
50
|
+
There _must never_ be whitespace before the commas.
|
|
51
|
+
|
|
52
|
+
The following patterns are considered problems:
|
|
53
|
+
|
|
54
|
+
<!-- prettier-ignore -->
|
|
55
|
+
```css
|
|
56
|
+
a { background-size: 0 ,0; }
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
<!-- prettier-ignore -->
|
|
60
|
+
```css
|
|
61
|
+
a { background-size: 0 ,
|
|
62
|
+
0; }
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
The following patterns are _not_ considered problems:
|
|
66
|
+
|
|
67
|
+
<!-- prettier-ignore -->
|
|
68
|
+
```css
|
|
69
|
+
a { background-size: 0,0; }
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
<!-- prettier-ignore -->
|
|
73
|
+
```css
|
|
74
|
+
a { background-size: 0,
|
|
75
|
+
0; }
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
### `"always-single-line"`
|
|
79
|
+
|
|
80
|
+
There _must always_ be a single space before the commas in single-line value lists.
|
|
81
|
+
|
|
82
|
+
The following patterns are considered problems:
|
|
83
|
+
|
|
84
|
+
<!-- prettier-ignore -->
|
|
85
|
+
```css
|
|
86
|
+
a { background-size: 0,0; }
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
The following patterns are _not_ considered problems:
|
|
90
|
+
|
|
91
|
+
<!-- prettier-ignore -->
|
|
92
|
+
```css
|
|
93
|
+
a { background-size: 0 ,0; }
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
<!-- prettier-ignore -->
|
|
97
|
+
```css
|
|
98
|
+
a { background-size: 0 ,
|
|
99
|
+
0; }
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
<!-- prettier-ignore -->
|
|
103
|
+
```css
|
|
104
|
+
a { background-size: 0
|
|
105
|
+
, 0; }
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
### `"never-single-line"`
|
|
109
|
+
|
|
110
|
+
There _must never_ be whitespace before the commas in single-line value lists.
|
|
111
|
+
|
|
112
|
+
The following patterns are considered problems:
|
|
113
|
+
|
|
114
|
+
<!-- prettier-ignore -->
|
|
115
|
+
```css
|
|
116
|
+
a { background-size: 0 ,0; }
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
The following patterns are _not_ considered problems:
|
|
120
|
+
|
|
121
|
+
<!-- prettier-ignore -->
|
|
122
|
+
```css
|
|
123
|
+
a { background-size: 0,0; }
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
<!-- prettier-ignore -->
|
|
127
|
+
```css
|
|
128
|
+
a { background-size: 0,
|
|
129
|
+
0; }
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
<!-- prettier-ignore -->
|
|
133
|
+
```css
|
|
134
|
+
a { background-size: 0 ,
|
|
135
|
+
0; }
|
|
136
|
+
```
|
package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/value-list-comma-space-before/index.cjs
ADDED
|
@@ -0,0 +1,94 @@
|
|
|
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 declarationValueIndex = require('stylelint/lib/utils/declarationValueIndex.cjs');
|
|
6
|
+
const getDeclarationValue = require('stylelint/lib/utils/getDeclarationValue.cjs');
|
|
7
|
+
const ruleMessages = require('stylelint/lib/utils/ruleMessages.cjs');
|
|
8
|
+
const setDeclarationValue = require('stylelint/lib/utils/setDeclarationValue.cjs');
|
|
9
|
+
const validateOptions = require('stylelint/lib/utils/validateOptions.cjs');
|
|
10
|
+
|
|
11
|
+
const whitespaceChecker = require('../../utils/whitespaceChecker.cjs');
|
|
12
|
+
const valueListCommaWhitespaceChecker = require('../valueListCommaWhitespaceChecker.cjs');
|
|
13
|
+
|
|
14
|
+
const ruleName = 'plugin/value-list-comma-space-before';
|
|
15
|
+
|
|
16
|
+
const messages = ruleMessages(ruleName, {
|
|
17
|
+
expectedBefore: () => 'Expected single space before ","',
|
|
18
|
+
rejectedBefore: () => 'Unexpected whitespace before ","',
|
|
19
|
+
expectedBeforeSingleLine: () => 'Unexpected whitespace before "," in a single-line list',
|
|
20
|
+
rejectedBeforeSingleLine: () => 'Unexpected whitespace before "," in a single-line list'
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
const meta = {
|
|
24
|
+
url: 'https://github.com/jens-duttke/linter-bundle/blob/main/stylelint/plugins/stylelint-15.11.0-stylistic/rules/value-list-comma-space-before/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
|
+
/** @type {Map<import('postcss').Declaration, number[]> | undefined} */
|
|
43
|
+
let fixData;
|
|
44
|
+
|
|
45
|
+
valueListCommaWhitespaceChecker({
|
|
46
|
+
root,
|
|
47
|
+
result,
|
|
48
|
+
locationChecker: checker.before,
|
|
49
|
+
checkedRuleName: ruleName,
|
|
50
|
+
fix: context.fix ?
|
|
51
|
+
(declNode, index) => {
|
|
52
|
+
const valueIndex = declarationValueIndex(declNode);
|
|
53
|
+
|
|
54
|
+
if (index <= valueIndex) {
|
|
55
|
+
return false;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
fixData ||= new Map();
|
|
59
|
+
const commaIndices = fixData.get(declNode) || [];
|
|
60
|
+
|
|
61
|
+
commaIndices.push(index);
|
|
62
|
+
fixData.set(declNode, commaIndices);
|
|
63
|
+
|
|
64
|
+
return true;
|
|
65
|
+
}
|
|
66
|
+
: null
|
|
67
|
+
});
|
|
68
|
+
|
|
69
|
+
if (fixData) {
|
|
70
|
+
for (const [decl, commaIndices] of fixData.entries()) {
|
|
71
|
+
for (const index of commaIndices.sort((a, b) => b - a)) {
|
|
72
|
+
const value = getDeclarationValue(decl);
|
|
73
|
+
const valueIndex = index - declarationValueIndex(decl);
|
|
74
|
+
let beforeValue = value.slice(0, valueIndex);
|
|
75
|
+
const afterValue = value.slice(valueIndex);
|
|
76
|
+
|
|
77
|
+
if (primary.startsWith('always')) {
|
|
78
|
+
beforeValue = beforeValue.replace(/\s*$/, ' ');
|
|
79
|
+
}
|
|
80
|
+
else if (primary.startsWith('never')) {
|
|
81
|
+
beforeValue = beforeValue.replace(/\s*$/, '');
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
setDeclarationValue(decl, beforeValue + afterValue);
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
};
|
|
89
|
+
};
|
|
90
|
+
|
|
91
|
+
rule.ruleName = ruleName;
|
|
92
|
+
rule.messages = messages;
|
|
93
|
+
rule.meta = meta;
|
|
94
|
+
module.exports = stylelint.createPlugin(ruleName, rule);
|
package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/value-list-max-empty-lines/README.md
ADDED
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
# value-list-max-empty-lines
|
|
2
|
+
|
|
3
|
+
Limit the number of adjacent empty lines within value lists.
|
|
4
|
+
|
|
5
|
+
<!-- prettier-ignore -->
|
|
6
|
+
```css
|
|
7
|
+
a {
|
|
8
|
+
box-shadow:
|
|
9
|
+
inset 0 2px 0 #dcffa6,
|
|
10
|
+
/* ← */
|
|
11
|
+
0 2px 5px #000; /* ↑ */
|
|
12
|
+
} /* ↑ */
|
|
13
|
+
/** ↑
|
|
14
|
+
* This empty line */
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
The [`fix` option](https://stylelint.io/user-guide/options/#fix) can automatically fix all of the problems reported by this rule.
|
|
18
|
+
|
|
19
|
+
## Options
|
|
20
|
+
|
|
21
|
+
`int`: Maximum number of adjacent empty lines allowed.
|
|
22
|
+
|
|
23
|
+
For example, with `0`:
|
|
24
|
+
|
|
25
|
+
The following patterns are considered problems:
|
|
26
|
+
|
|
27
|
+
<!-- prettier-ignore -->
|
|
28
|
+
```css
|
|
29
|
+
a {
|
|
30
|
+
padding: 10px
|
|
31
|
+
|
|
32
|
+
10px
|
|
33
|
+
10px
|
|
34
|
+
10px
|
|
35
|
+
}
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
<!-- prettier-ignore -->
|
|
39
|
+
```css
|
|
40
|
+
a {
|
|
41
|
+
padding:
|
|
42
|
+
10px
|
|
43
|
+
10px
|
|
44
|
+
10px
|
|
45
|
+
|
|
46
|
+
10px
|
|
47
|
+
}
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
<!-- prettier-ignore -->
|
|
51
|
+
```css
|
|
52
|
+
a {
|
|
53
|
+
box-shadow: inset 0 2px 0 #dcffa6,
|
|
54
|
+
|
|
55
|
+
0 2px 5px #000;
|
|
56
|
+
}
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
<!-- prettier-ignore -->
|
|
60
|
+
```css
|
|
61
|
+
a {
|
|
62
|
+
box-shadow:
|
|
63
|
+
inset 0 2px 0 #dcffa6,
|
|
64
|
+
|
|
65
|
+
0 2px 5px #000;
|
|
66
|
+
}
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
The following patterns are _not_ considered problems:
|
|
70
|
+
|
|
71
|
+
<!-- prettier-ignore -->
|
|
72
|
+
```css
|
|
73
|
+
a {
|
|
74
|
+
padding: 10px 10px 10px 10px
|
|
75
|
+
}
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
<!-- prettier-ignore -->
|
|
79
|
+
```css
|
|
80
|
+
a {
|
|
81
|
+
padding: 10px
|
|
82
|
+
10px
|
|
83
|
+
10px
|
|
84
|
+
10px
|
|
85
|
+
}
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
<!-- prettier-ignore -->
|
|
89
|
+
```css
|
|
90
|
+
a {
|
|
91
|
+
padding:
|
|
92
|
+
10px
|
|
93
|
+
10px
|
|
94
|
+
10px
|
|
95
|
+
10px
|
|
96
|
+
}
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
<!-- prettier-ignore -->
|
|
100
|
+
```css
|
|
101
|
+
a {
|
|
102
|
+
box-shadow: inset 0 2px 0 #dcffa6, 0 2px 5px #000;
|
|
103
|
+
}
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
<!-- prettier-ignore -->
|
|
107
|
+
```css
|
|
108
|
+
a {
|
|
109
|
+
box-shadow: inset 0 2px 0 #dcffa6,
|
|
110
|
+
0 2px 5px #000;
|
|
111
|
+
}
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
<!-- prettier-ignore -->
|
|
115
|
+
```css
|
|
116
|
+
a {
|
|
117
|
+
box-shadow:
|
|
118
|
+
inset 0 2px 0 #dcffa6,
|
|
119
|
+
0 2px 5px #000;
|
|
120
|
+
}
|
|
121
|
+
```
|
package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/value-list-max-empty-lines/index.cjs
ADDED
|
@@ -0,0 +1,68 @@
|
|
|
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 getDeclarationValue = require('stylelint/lib/utils/getDeclarationValue.cjs');
|
|
6
|
+
const report = require('stylelint/lib/utils/report.cjs');
|
|
7
|
+
const ruleMessages = require('stylelint/lib/utils/ruleMessages.cjs');
|
|
8
|
+
const setDeclarationValue = require('stylelint/lib/utils/setDeclarationValue.cjs');
|
|
9
|
+
const validateOptions = require('stylelint/lib/utils/validateOptions.cjs');
|
|
10
|
+
const { isNumber } = require('stylelint/lib/utils/validateTypes.cjs');
|
|
11
|
+
|
|
12
|
+
const ruleName = 'plugin/value-list-max-empty-lines';
|
|
13
|
+
|
|
14
|
+
const messages = ruleMessages(ruleName, {
|
|
15
|
+
expected: (max) => `Expected no more than ${max} empty ${max === 1 ? 'line' : 'lines'}`
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
const meta = {
|
|
19
|
+
url: 'https://github.com/jens-duttke/linter-bundle/blob/main/stylelint/plugins/stylelint-15.11.0-stylistic/rules/value-list-max-empty-lines/README.md',
|
|
20
|
+
fixable: true
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
/** @type {import('stylelint').Rule} */
|
|
24
|
+
const rule = (primary, _secondaryOptions, context) => {
|
|
25
|
+
const maxAdjacentNewlines = primary + 1;
|
|
26
|
+
|
|
27
|
+
return (root, result) => {
|
|
28
|
+
const validOptions = validateOptions(result, ruleName, {
|
|
29
|
+
actual: primary,
|
|
30
|
+
possible: isNumber
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
if (!validOptions) {
|
|
34
|
+
return;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
const violatedCRLFNewLinesRegex = new RegExp(`(?:\r\n){${maxAdjacentNewlines + 1},}`);
|
|
38
|
+
const violatedLFNewLinesRegex = new RegExp(`\n{${maxAdjacentNewlines + 1},}`);
|
|
39
|
+
const allowedLFNewLinesString = context.fix ? '\n'.repeat(maxAdjacentNewlines) : '';
|
|
40
|
+
const allowedCRLFNewLinesString = context.fix ? '\r\n'.repeat(maxAdjacentNewlines) : '';
|
|
41
|
+
|
|
42
|
+
root.walkDecls((decl) => {
|
|
43
|
+
const value = getDeclarationValue(decl);
|
|
44
|
+
|
|
45
|
+
if (context.fix) {
|
|
46
|
+
const newValueString = value
|
|
47
|
+
.replace(new RegExp(violatedLFNewLinesRegex, 'gm'), allowedLFNewLinesString)
|
|
48
|
+
.replace(new RegExp(violatedCRLFNewLinesRegex, 'gm'), allowedCRLFNewLinesString);
|
|
49
|
+
|
|
50
|
+
setDeclarationValue(decl, newValueString);
|
|
51
|
+
}
|
|
52
|
+
else if (violatedLFNewLinesRegex.test(value) || violatedCRLFNewLinesRegex.test(value)) {
|
|
53
|
+
report({
|
|
54
|
+
message: messages.expected(primary),
|
|
55
|
+
node: decl,
|
|
56
|
+
index: 0,
|
|
57
|
+
result,
|
|
58
|
+
ruleName
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
});
|
|
62
|
+
};
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
rule.ruleName = ruleName;
|
|
66
|
+
rule.messages = messages;
|
|
67
|
+
rule.meta = meta;
|
|
68
|
+
module.exports = stylelint.createPlugin(ruleName, rule);
|
package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/valueListCommaWhitespaceChecker.cjs
ADDED
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
/* eslint-disable -- We want to keep as much of the original code as possible */
|
|
2
|
+
// @ts-nocheck
|
|
3
|
+
|
|
4
|
+
const isStandardSyntaxDeclaration = require('stylelint/lib/utils/isStandardSyntaxDeclaration.cjs');
|
|
5
|
+
const isStandardSyntaxProperty = require('stylelint/lib/utils/isStandardSyntaxProperty.cjs');
|
|
6
|
+
const report = require('stylelint/lib/utils/report.cjs');
|
|
7
|
+
|
|
8
|
+
const styleSearch = require('../style-search/index.cjs');
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* @param {{
|
|
12
|
+
* root: import('postcss').Root,
|
|
13
|
+
* result: import('stylelint').PostcssResult,
|
|
14
|
+
* locationChecker: (opts: { source: string, index: number, err: (msg: string) => void }) => void,
|
|
15
|
+
* checkedRuleName: string,
|
|
16
|
+
* fix?: ((node: import('postcss').Declaration, index: number) => boolean) | null,
|
|
17
|
+
* determineIndex?: (declString: string, match: import('style-search').StyleSearchMatch) => number | false,
|
|
18
|
+
* }} opts
|
|
19
|
+
* @param options
|
|
20
|
+
*/
|
|
21
|
+
module.exports = function valueListCommaWhitespaceChecker (options) {
|
|
22
|
+
options.root.walkDecls((decl) => {
|
|
23
|
+
if (!isStandardSyntaxDeclaration(decl) || !isStandardSyntaxProperty(decl.prop)) {
|
|
24
|
+
return;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
const declString = decl.toString();
|
|
28
|
+
|
|
29
|
+
styleSearch(
|
|
30
|
+
{
|
|
31
|
+
source: declString,
|
|
32
|
+
target: ',',
|
|
33
|
+
functionArguments: 'skip'
|
|
34
|
+
},
|
|
35
|
+
(match) => {
|
|
36
|
+
const indexToCheckAfter = options.determineIndex ?
|
|
37
|
+
options.determineIndex(declString, match)
|
|
38
|
+
: match.startIndex;
|
|
39
|
+
|
|
40
|
+
if (indexToCheckAfter === false) {
|
|
41
|
+
return;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
checkComma(declString, indexToCheckAfter, decl);
|
|
45
|
+
}
|
|
46
|
+
);
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* @param {string} source
|
|
51
|
+
* @param {number} index
|
|
52
|
+
* @param {import('postcss').Declaration} node
|
|
53
|
+
* @returns {void}
|
|
54
|
+
*/
|
|
55
|
+
function checkComma (source, index, node) {
|
|
56
|
+
options.locationChecker({
|
|
57
|
+
source,
|
|
58
|
+
index,
|
|
59
|
+
err: (message) => {
|
|
60
|
+
if (options.fix?.(node, index)) {
|
|
61
|
+
return;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
report({
|
|
65
|
+
message,
|
|
66
|
+
node,
|
|
67
|
+
index,
|
|
68
|
+
result: options.result,
|
|
69
|
+
ruleName: options.checkedRuleName
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
Copyright (c) 2016, David Clark
|
|
2
|
+
|
|
3
|
+
Permission to use, copy, modify, and/or distribute this software for any
|
|
4
|
+
purpose with or without fee is hereby granted, provided that the above
|
|
5
|
+
copyright notice and this permission notice appear in all copies.
|
|
6
|
+
|
|
7
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
|
8
|
+
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
|
9
|
+
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
|
10
|
+
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
|
11
|
+
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
|
12
|
+
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
|
13
|
+
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|