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/declaration-colon-space-before/index.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 stylelint = require('stylelint');
|
|
5
|
+
const declarationValueIndex = require('stylelint/lib/utils/declarationValueIndex.cjs');
|
|
6
|
+
const ruleMessages = require('stylelint/lib/utils/ruleMessages.cjs');
|
|
7
|
+
const validateOptions = require('stylelint/lib/utils/validateOptions.cjs');
|
|
8
|
+
|
|
9
|
+
const whitespaceChecker = require('../../utils/whitespaceChecker.cjs');
|
|
10
|
+
const declarationColonSpaceChecker = require('../declarationColonSpaceChecker.cjs');
|
|
11
|
+
|
|
12
|
+
const ruleName = 'plugin/declaration-colon-space-before';
|
|
13
|
+
|
|
14
|
+
const messages = ruleMessages(ruleName, {
|
|
15
|
+
expectedBefore: () => 'Expected single space before ":"',
|
|
16
|
+
rejectedBefore: () => 'Unexpected whitespace before ":"'
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
const meta = {
|
|
20
|
+
url: 'https://github.com/jens-duttke/linter-bundle/blob/main/stylelint/plugins/stylelint-15.11.0-stylistic/rules/declaration-colon-space-before/README.md',
|
|
21
|
+
fixable: true
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
/** @type {import('stylelint').Rule} */
|
|
25
|
+
const rule = (primary, _secondaryOptions, context) => {
|
|
26
|
+
const checker = whitespaceChecker('space', primary, messages);
|
|
27
|
+
|
|
28
|
+
return (root, result) => {
|
|
29
|
+
const validOptions = validateOptions(result, ruleName, {
|
|
30
|
+
actual: primary,
|
|
31
|
+
possible: ['always', 'never']
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
if (!validOptions) {
|
|
35
|
+
return;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
declarationColonSpaceChecker({
|
|
39
|
+
root,
|
|
40
|
+
result,
|
|
41
|
+
locationChecker: checker.before,
|
|
42
|
+
checkedRuleName: ruleName,
|
|
43
|
+
fix: context.fix ?
|
|
44
|
+
(decl, index) => {
|
|
45
|
+
const colonIndex = index - declarationValueIndex(decl);
|
|
46
|
+
const between = decl.raws.between;
|
|
47
|
+
|
|
48
|
+
if (between == null) { throw new Error('`between` must be present'); }
|
|
49
|
+
|
|
50
|
+
if (primary === 'always') {
|
|
51
|
+
decl.raws.between =
|
|
52
|
+
between.slice(0, colonIndex).replace(/\s*$/, ' ') + between.slice(colonIndex);
|
|
53
|
+
|
|
54
|
+
return true;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
if (primary === 'never') {
|
|
58
|
+
decl.raws.between =
|
|
59
|
+
between.slice(0, colonIndex).replace(/\s*$/, '') + between.slice(colonIndex);
|
|
60
|
+
|
|
61
|
+
return true;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
return false;
|
|
65
|
+
}
|
|
66
|
+
: null
|
|
67
|
+
});
|
|
68
|
+
};
|
|
69
|
+
};
|
|
70
|
+
|
|
71
|
+
rule.ruleName = ruleName;
|
|
72
|
+
rule.messages = messages;
|
|
73
|
+
rule.meta = meta;
|
|
74
|
+
module.exports = stylelint.createPlugin(ruleName, rule);
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
/* eslint-disable -- We want to keep as much of the original code as possible */
|
|
2
|
+
// @ts-nocheck
|
|
3
|
+
|
|
4
|
+
const declarationValueIndex = require('stylelint/lib/utils/declarationValueIndex.cjs');
|
|
5
|
+
const report = require('stylelint/lib/utils/report.cjs');
|
|
6
|
+
|
|
7
|
+
const styleSearch = require('../style-search/index.cjs');
|
|
8
|
+
|
|
9
|
+
/** @typedef {import('postcss').Declaration} Declaration */
|
|
10
|
+
|
|
11
|
+
/** @typedef {(args: { source: string, index: number, err: (message: string) => void }) => void} LocationChecker */
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* @param {{
|
|
15
|
+
* root: import('postcss').Root,
|
|
16
|
+
* locationChecker: LocationChecker,
|
|
17
|
+
* result: import('stylelint').PostcssResult,
|
|
18
|
+
* checkedRuleName: string,
|
|
19
|
+
* fix: ((decl: Declaration, index: number) => boolean) | null,
|
|
20
|
+
* }} opts
|
|
21
|
+
* @param options
|
|
22
|
+
* @returns {void}
|
|
23
|
+
*/
|
|
24
|
+
module.exports = function declarationBangSpaceChecker (options) {
|
|
25
|
+
options.root.walkDecls((decl) => {
|
|
26
|
+
const indexOffset = declarationValueIndex(decl);
|
|
27
|
+
const declString = decl.toString();
|
|
28
|
+
const valueString = decl.toString().slice(indexOffset);
|
|
29
|
+
|
|
30
|
+
if (!valueString.includes('!')) {
|
|
31
|
+
return;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
styleSearch({ source: valueString, target: '!' }, (match) => {
|
|
35
|
+
check(declString, match.startIndex + indexOffset, decl);
|
|
36
|
+
});
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* @param {string} source
|
|
41
|
+
* @param {number} index
|
|
42
|
+
* @param {Declaration} decl
|
|
43
|
+
*/
|
|
44
|
+
function check (source, index, decl) {
|
|
45
|
+
options.locationChecker({
|
|
46
|
+
source,
|
|
47
|
+
index,
|
|
48
|
+
err: (message) => {
|
|
49
|
+
if (options.fix?.(decl, index)) {
|
|
50
|
+
return;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
report({
|
|
54
|
+
message,
|
|
55
|
+
node: decl,
|
|
56
|
+
index,
|
|
57
|
+
result: options.result,
|
|
58
|
+
ruleName: options.checkedRuleName
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
};
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
/* eslint-disable -- We want to keep as much of the original code as possible */
|
|
2
|
+
// @ts-nocheck
|
|
3
|
+
|
|
4
|
+
const declarationValueIndex = require('stylelint/lib/utils/declarationValueIndex.cjs');
|
|
5
|
+
const isStandardSyntaxDeclaration = require('stylelint/lib/utils/isStandardSyntaxDeclaration.cjs');
|
|
6
|
+
const report = require('stylelint/lib/utils/report.cjs');
|
|
7
|
+
|
|
8
|
+
/** @typedef {(args: { source: string, index: number, lineCheckStr: string, err: (message: string) => void }) => void} LocationChecker */
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* @param {{
|
|
12
|
+
* root: import('postcss').Root,
|
|
13
|
+
* locationChecker: LocationChecker,
|
|
14
|
+
* fix: ((decl: import('postcss').Declaration, index: number) => boolean) | null,
|
|
15
|
+
* result: import('stylelint').PostcssResult,
|
|
16
|
+
* checkedRuleName: string,
|
|
17
|
+
* }} opts
|
|
18
|
+
*/
|
|
19
|
+
module.exports = function declarationColonSpaceChecker(opts) {
|
|
20
|
+
opts.root.walkDecls((decl) => {
|
|
21
|
+
if (!isStandardSyntaxDeclaration(decl)) {
|
|
22
|
+
return;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
// Get the raw prop, and only the prop
|
|
26
|
+
const endOfPropIndex = declarationValueIndex(decl) + (decl.raws.between || '').length - 1;
|
|
27
|
+
|
|
28
|
+
// The extra characters tacked onto the end ensure that there is a character to check
|
|
29
|
+
// after the colon. Otherwise, with `background:pink` the character after the
|
|
30
|
+
const propPlusColon = `${decl.toString().slice(0, endOfPropIndex)}xxx`;
|
|
31
|
+
|
|
32
|
+
for (let i = 0, l = propPlusColon.length; i < l; i++) {
|
|
33
|
+
if (propPlusColon[i] !== ':') {
|
|
34
|
+
continue;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
opts.locationChecker({
|
|
38
|
+
source: propPlusColon,
|
|
39
|
+
index: i,
|
|
40
|
+
lineCheckStr: decl.value,
|
|
41
|
+
err: (message) => {
|
|
42
|
+
if (opts.fix && opts.fix(decl, i)) {
|
|
43
|
+
return;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
report({
|
|
47
|
+
message,
|
|
48
|
+
node: decl,
|
|
49
|
+
index: decl.prop.toString().length + 1,
|
|
50
|
+
result: opts.result,
|
|
51
|
+
ruleName: opts.checkedRuleName,
|
|
52
|
+
});
|
|
53
|
+
},
|
|
54
|
+
});
|
|
55
|
+
break;
|
|
56
|
+
}
|
|
57
|
+
});
|
|
58
|
+
};
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/* eslint-disable -- We want to keep as much of the original code as possible */
|
|
2
|
+
// @ts-nocheck
|
|
3
|
+
|
|
4
|
+
const styleSearch = require('../style-search/index.cjs');
|
|
5
|
+
|
|
6
|
+
const rangeOperators = ['>=', '<=', '>', '<', '='];
|
|
7
|
+
|
|
8
|
+
/** @typedef {import('style-search').StyleSearchMatch} StyleSearchMatch */
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* @template {import('postcss').AtRule} T
|
|
12
|
+
* @param {T} atRule
|
|
13
|
+
* @param callback
|
|
14
|
+
* @param {(match: StyleSearchMatch, params: string, atRule: T) => void} cb
|
|
15
|
+
*/
|
|
16
|
+
module.exports = function findMediaOperator (atRule, callback) {
|
|
17
|
+
if (atRule.name.toLowerCase() !== 'media') {
|
|
18
|
+
return;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
const parameters = atRule.raws.params ? atRule.raws.params.raw : atRule.params;
|
|
22
|
+
|
|
23
|
+
styleSearch({ source: parameters, target: rangeOperators }, (match) => {
|
|
24
|
+
const before = parameters[match.startIndex - 1];
|
|
25
|
+
|
|
26
|
+
if (before === '>' || before === '<') {
|
|
27
|
+
return;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
callback(match, parameters, atRule);
|
|
31
|
+
});
|
|
32
|
+
};
|
package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/function-comma-newline-after/README.md
ADDED
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
# function-comma-newline-after
|
|
2
|
+
|
|
3
|
+
Require a newline or disallow whitespace after the commas of functions.
|
|
4
|
+
|
|
5
|
+
<!-- prettier-ignore -->
|
|
6
|
+
```css
|
|
7
|
+
a { transform: translate(1,
|
|
8
|
+
1) } /* ↑ */
|
|
9
|
+
/** ↑
|
|
10
|
+
* These commas */
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
The [`fix` option](https://stylelint.io/user-guide/options/#fix) can automatically fix all of the problems reported by this rule.
|
|
14
|
+
|
|
15
|
+
## Options
|
|
16
|
+
|
|
17
|
+
`string`: `"always"|"always-multi-line"|"never-multi-line"`
|
|
18
|
+
|
|
19
|
+
### `"always"`
|
|
20
|
+
|
|
21
|
+
There _must always_ be a newline after the commas.
|
|
22
|
+
|
|
23
|
+
The following patterns are considered problems:
|
|
24
|
+
|
|
25
|
+
<!-- prettier-ignore -->
|
|
26
|
+
```css
|
|
27
|
+
a { transform: translate(1,1) }
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
<!-- prettier-ignore -->
|
|
31
|
+
```css
|
|
32
|
+
a { transform: translate(1 ,1) }
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
<!-- prettier-ignore -->
|
|
36
|
+
```css
|
|
37
|
+
a { transform: translate(1
|
|
38
|
+
,1) }
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
The following patterns are _not_ considered problems:
|
|
42
|
+
|
|
43
|
+
<!-- prettier-ignore -->
|
|
44
|
+
```css
|
|
45
|
+
a {
|
|
46
|
+
transform: translate(1,
|
|
47
|
+
1)
|
|
48
|
+
}
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
### `"always-multi-line"`
|
|
52
|
+
|
|
53
|
+
There _must always_ be a newline after the commas in multi-line functions.
|
|
54
|
+
|
|
55
|
+
The following patterns are considered problems:
|
|
56
|
+
|
|
57
|
+
<!-- prettier-ignore -->
|
|
58
|
+
```css
|
|
59
|
+
a { transform: translate(1
|
|
60
|
+
,1) }
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
The following patterns are _not_ considered problems:
|
|
64
|
+
|
|
65
|
+
<!-- prettier-ignore -->
|
|
66
|
+
```css
|
|
67
|
+
a { transform: translate(1,1) }
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
<!-- prettier-ignore -->
|
|
71
|
+
```css
|
|
72
|
+
a { transform: translate(1 ,1) }
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
<!-- prettier-ignore -->
|
|
76
|
+
```css
|
|
77
|
+
a {
|
|
78
|
+
transform: translate(1,
|
|
79
|
+
1)
|
|
80
|
+
}
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
### `"never-multi-line"`
|
|
84
|
+
|
|
85
|
+
There _must never_ be whitespace after the commas in multi-line functions.
|
|
86
|
+
|
|
87
|
+
The following patterns are considered problems:
|
|
88
|
+
|
|
89
|
+
<!-- prettier-ignore -->
|
|
90
|
+
```css
|
|
91
|
+
a { transform: translate(1
|
|
92
|
+
, 1) }
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
The following patterns are _not_ considered problems:
|
|
96
|
+
|
|
97
|
+
<!-- prettier-ignore -->
|
|
98
|
+
```css
|
|
99
|
+
a { transform: translate(1, 1) }
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
<!-- prettier-ignore -->
|
|
103
|
+
```css
|
|
104
|
+
a { transform: translate(1 , 1) }
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
<!-- prettier-ignore -->
|
|
108
|
+
```css
|
|
109
|
+
a {
|
|
110
|
+
transform: translate(1
|
|
111
|
+
,1)
|
|
112
|
+
}
|
|
113
|
+
```
|
package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/function-comma-newline-after/index.cjs
ADDED
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
/* eslint-disable -- We want to keep as much of the original code as possible */
|
|
2
|
+
// @ts-nocheck
|
|
3
|
+
|
|
4
|
+
const stylelint = require('stylelint');
|
|
5
|
+
const ruleMessages = require('stylelint/lib/utils/ruleMessages.cjs');
|
|
6
|
+
const validateOptions = require('stylelint/lib/utils/validateOptions.cjs');
|
|
7
|
+
|
|
8
|
+
const whitespaceChecker = require('../../utils/whitespaceChecker.cjs');
|
|
9
|
+
const functionCommaSpaceChecker = require('../functionCommaSpaceChecker.cjs');
|
|
10
|
+
const fixer = require('../functionCommaSpaceFix.cjs');
|
|
11
|
+
|
|
12
|
+
const ruleName = 'plugin/function-comma-newline-after';
|
|
13
|
+
|
|
14
|
+
const messages = ruleMessages(ruleName, {
|
|
15
|
+
expectedAfter: () => 'Expected newline after ","',
|
|
16
|
+
expectedAfterMultiLine: () => 'Expected newline after "," in a multi-line function',
|
|
17
|
+
rejectedAfterMultiLine: () => 'Unexpected whitespace after "," in a multi-line function'
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
const meta = {
|
|
21
|
+
url: 'https://github.com/jens-duttke/linter-bundle/blob/main/stylelint/plugins/stylelint-15.11.0-stylistic/rules/function-comma-newline-after/README.md',
|
|
22
|
+
fixable: true
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
/** @type {import('stylelint').Rule} */
|
|
26
|
+
const rule = (primary, _secondaryOptions, context) => {
|
|
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
|
+
functionCommaSpaceChecker({
|
|
40
|
+
root,
|
|
41
|
+
result,
|
|
42
|
+
locationChecker: checker.afterOneOnly,
|
|
43
|
+
checkedRuleName: ruleName,
|
|
44
|
+
fix: context.fix ?
|
|
45
|
+
(div, index, nodes) => fixer({
|
|
46
|
+
div,
|
|
47
|
+
index,
|
|
48
|
+
nodes,
|
|
49
|
+
expectation: primary,
|
|
50
|
+
position: 'after',
|
|
51
|
+
symb: context.newline || ''
|
|
52
|
+
})
|
|
53
|
+
: null
|
|
54
|
+
});
|
|
55
|
+
};
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
rule.ruleName = ruleName;
|
|
59
|
+
rule.messages = messages;
|
|
60
|
+
rule.meta = meta;
|
|
61
|
+
module.exports = stylelint.createPlugin(ruleName, rule);
|
package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/function-comma-newline-before/README.md
ADDED
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
# function-comma-newline-before
|
|
2
|
+
|
|
3
|
+
Require a newline or disallow whitespace before the commas of functions.
|
|
4
|
+
|
|
5
|
+
<!-- prettier-ignore -->
|
|
6
|
+
```css
|
|
7
|
+
a { transform: translate(1
|
|
8
|
+
, 1) }
|
|
9
|
+
/** ↑
|
|
10
|
+
* This comma */
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
The [`fix` option](https://stylelint.io/user-guide/options/#fix) can automatically fix all of the problems reported by this rule.
|
|
14
|
+
|
|
15
|
+
## Options
|
|
16
|
+
|
|
17
|
+
`string`: `"always"|"always-multi-line"|"never-multi-line"`
|
|
18
|
+
|
|
19
|
+
### `"always"`
|
|
20
|
+
|
|
21
|
+
There _must always_ be a newline before the commas.
|
|
22
|
+
|
|
23
|
+
The following patterns are considered problems:
|
|
24
|
+
|
|
25
|
+
<!-- prettier-ignore -->
|
|
26
|
+
```css
|
|
27
|
+
a { transform: translate(1,1) }
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
<!-- prettier-ignore -->
|
|
31
|
+
```css
|
|
32
|
+
a { transform: translate(1 ,1) }
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
<!-- prettier-ignore -->
|
|
36
|
+
```css
|
|
37
|
+
a { transform: translate(1,
|
|
38
|
+
1) }
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
The following patterns are _not_ considered problems:
|
|
42
|
+
|
|
43
|
+
<!-- prettier-ignore -->
|
|
44
|
+
```css
|
|
45
|
+
a {
|
|
46
|
+
transform: translate(1
|
|
47
|
+
,1)
|
|
48
|
+
}
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
<!-- prettier-ignore -->
|
|
52
|
+
```css
|
|
53
|
+
a {
|
|
54
|
+
transform: translate(1
|
|
55
|
+
, 1)
|
|
56
|
+
}
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
### `"always-multi-line"`
|
|
60
|
+
|
|
61
|
+
There _must always_ be a newline before the commas in multi-line functions.
|
|
62
|
+
|
|
63
|
+
The following patterns are considered problems:
|
|
64
|
+
|
|
65
|
+
<!-- prettier-ignore -->
|
|
66
|
+
```css
|
|
67
|
+
a { transform: translate(1,
|
|
68
|
+
1) }
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
The following patterns are _not_ considered problems:
|
|
72
|
+
|
|
73
|
+
<!-- prettier-ignore -->
|
|
74
|
+
```css
|
|
75
|
+
a { transform: translate(1,1) }
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
<!-- prettier-ignore -->
|
|
79
|
+
```css
|
|
80
|
+
a { transform: translate(1 ,1) }
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
<!-- prettier-ignore -->
|
|
84
|
+
```css
|
|
85
|
+
a {
|
|
86
|
+
transform: translate(1
|
|
87
|
+
,1)
|
|
88
|
+
}
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
<!-- prettier-ignore -->
|
|
92
|
+
```css
|
|
93
|
+
a {
|
|
94
|
+
transform: translate(1
|
|
95
|
+
, 1)
|
|
96
|
+
}
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
### `"never-multi-line"`
|
|
100
|
+
|
|
101
|
+
There _must never_ be whitespace before the commas in multi-line functions.
|
|
102
|
+
|
|
103
|
+
The following patterns are considered problems:
|
|
104
|
+
|
|
105
|
+
<!-- prettier-ignore -->
|
|
106
|
+
```css
|
|
107
|
+
a { transform: translate(1 ,
|
|
108
|
+
1) }
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
The following patterns are _not_ considered problems:
|
|
112
|
+
|
|
113
|
+
<!-- prettier-ignore -->
|
|
114
|
+
```css
|
|
115
|
+
a { transform: translate(1 ,1) }
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
<!-- prettier-ignore -->
|
|
119
|
+
```css
|
|
120
|
+
a { transform: translate(1 , 1) }
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
<!-- prettier-ignore -->
|
|
124
|
+
```css
|
|
125
|
+
a {
|
|
126
|
+
transform: translate(1,
|
|
127
|
+
1)
|
|
128
|
+
}
|
|
129
|
+
```
|
package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/function-comma-newline-before/index.cjs
ADDED
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
/* eslint-disable -- We want to keep as much of the original code as possible */
|
|
2
|
+
// @ts-nocheck
|
|
3
|
+
|
|
4
|
+
const stylelint = require('stylelint');
|
|
5
|
+
const ruleMessages = require('stylelint/lib/utils/ruleMessages.cjs');
|
|
6
|
+
const validateOptions = require('stylelint/lib/utils/validateOptions.cjs');
|
|
7
|
+
|
|
8
|
+
const whitespaceChecker = require('../../utils/whitespaceChecker.cjs');
|
|
9
|
+
const functionCommaSpaceChecker = require('../functionCommaSpaceChecker.cjs');
|
|
10
|
+
const fixer = require('../functionCommaSpaceFix.cjs');
|
|
11
|
+
|
|
12
|
+
const ruleName = 'plugin/function-comma-newline-before';
|
|
13
|
+
|
|
14
|
+
const messages = ruleMessages(ruleName, {
|
|
15
|
+
expectedBefore: () => 'Expected newline before ","',
|
|
16
|
+
expectedBeforeMultiLine: () => 'Expected newline before "," in a multi-line function',
|
|
17
|
+
rejectedBeforeMultiLine: () => 'Unexpected whitespace before "," in a multi-line function'
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
const meta = {
|
|
21
|
+
url: 'https://github.com/jens-duttke/linter-bundle/blob/main/stylelint/plugins/stylelint-15.11.0-stylistic/rules/function-comma-newline-before/README.md',
|
|
22
|
+
fixable: true
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
/** @type {import('stylelint').Rule} */
|
|
26
|
+
const rule = (primary, _secondaryOptions, context) => {
|
|
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
|
+
functionCommaSpaceChecker({
|
|
40
|
+
root,
|
|
41
|
+
result,
|
|
42
|
+
locationChecker: checker.beforeAllowingIndentation,
|
|
43
|
+
checkedRuleName: ruleName,
|
|
44
|
+
fix: context.fix ?
|
|
45
|
+
(div, index, nodes) => fixer({
|
|
46
|
+
div,
|
|
47
|
+
index,
|
|
48
|
+
nodes,
|
|
49
|
+
expectation: primary,
|
|
50
|
+
position: 'before',
|
|
51
|
+
symb: context.newline || ''
|
|
52
|
+
})
|
|
53
|
+
: null
|
|
54
|
+
});
|
|
55
|
+
};
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
rule.ruleName = ruleName;
|
|
59
|
+
rule.messages = messages;
|
|
60
|
+
rule.meta = meta;
|
|
61
|
+
module.exports = stylelint.createPlugin(ruleName, rule);
|