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,144 @@
|
|
|
1
|
+
# function-parentheses-newline-inside
|
|
2
|
+
|
|
3
|
+
Require a newline or disallow whitespace on the inside of the parentheses of functions.
|
|
4
|
+
|
|
5
|
+
<!-- prettier-ignore -->
|
|
6
|
+
```css
|
|
7
|
+
a {
|
|
8
|
+
transform: translate(
|
|
9
|
+
1, /* ↑ */
|
|
10
|
+
1 /* ↑ */
|
|
11
|
+
); /* ↑ */
|
|
12
|
+
} /* ↑ */
|
|
13
|
+
/** ↑ ↑
|
|
14
|
+
* The newline inside these two parentheses */
|
|
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
|
+
`string`: `"always"|"always-multi-line"|"never-multi-line"`
|
|
22
|
+
|
|
23
|
+
### `"always"`
|
|
24
|
+
|
|
25
|
+
There _must always_ be a newline inside the parentheses.
|
|
26
|
+
|
|
27
|
+
The following patterns are considered problems:
|
|
28
|
+
|
|
29
|
+
<!-- prettier-ignore -->
|
|
30
|
+
```css
|
|
31
|
+
a { transform: translate(1, 1); }
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
<!-- prettier-ignore -->
|
|
35
|
+
```css
|
|
36
|
+
a { transform: translate(1,
|
|
37
|
+
1
|
|
38
|
+
); }
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
The following patterns are _not_ considered problems:
|
|
42
|
+
|
|
43
|
+
<!-- prettier-ignore -->
|
|
44
|
+
```css
|
|
45
|
+
a {
|
|
46
|
+
transform: translate(
|
|
47
|
+
1, 1
|
|
48
|
+
);
|
|
49
|
+
}
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
<!-- prettier-ignore -->
|
|
53
|
+
```css
|
|
54
|
+
a {
|
|
55
|
+
transform: translate(
|
|
56
|
+
1,
|
|
57
|
+
1
|
|
58
|
+
);
|
|
59
|
+
}
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
### `"always-multi-line"`
|
|
63
|
+
|
|
64
|
+
There _must always_ be a newline inside the parentheses of multi-line functions.
|
|
65
|
+
|
|
66
|
+
The following patterns are considered problems:
|
|
67
|
+
|
|
68
|
+
<!-- prettier-ignore -->
|
|
69
|
+
```css
|
|
70
|
+
a { transform: translate(1,
|
|
71
|
+
1) }
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
The following patterns are _not_ considered problems:
|
|
75
|
+
|
|
76
|
+
<!-- prettier-ignore -->
|
|
77
|
+
```css
|
|
78
|
+
a { transform: translate(1, 1) }
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
<!-- prettier-ignore -->
|
|
82
|
+
```css
|
|
83
|
+
a { transform: translate( 1, 1 ) }
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
<!-- prettier-ignore -->
|
|
87
|
+
```css
|
|
88
|
+
a {
|
|
89
|
+
transform: translate(
|
|
90
|
+
1, 1
|
|
91
|
+
);
|
|
92
|
+
}
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
<!-- prettier-ignore -->
|
|
96
|
+
```css
|
|
97
|
+
a {
|
|
98
|
+
transform: translate(
|
|
99
|
+
1,
|
|
100
|
+
1
|
|
101
|
+
);
|
|
102
|
+
}
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
### `"never-multi-line"`
|
|
106
|
+
|
|
107
|
+
The following patterns are considered problems:
|
|
108
|
+
|
|
109
|
+
<!-- prettier-ignore -->
|
|
110
|
+
```css
|
|
111
|
+
a {
|
|
112
|
+
transform: translate(
|
|
113
|
+
1, 1
|
|
114
|
+
);
|
|
115
|
+
}
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
<!-- prettier-ignore -->
|
|
119
|
+
```css
|
|
120
|
+
a {
|
|
121
|
+
transform: translate(
|
|
122
|
+
1,
|
|
123
|
+
1
|
|
124
|
+
);
|
|
125
|
+
}
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
The following patterns are _not_ considered problems:
|
|
129
|
+
|
|
130
|
+
<!-- prettier-ignore -->
|
|
131
|
+
```css
|
|
132
|
+
a { transform: translate(1, 1) }
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
<!-- prettier-ignore -->
|
|
136
|
+
```css
|
|
137
|
+
a { transform: translate( 1, 1 ) }
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
<!-- prettier-ignore -->
|
|
141
|
+
```css
|
|
142
|
+
a { transform: translate(1,
|
|
143
|
+
1) }
|
|
144
|
+
```
|
|
@@ -0,0 +1,282 @@
|
|
|
1
|
+
/* eslint-disable -- We want to keep as much of the original code as possible */
|
|
2
|
+
// @ts-nocheck
|
|
3
|
+
|
|
4
|
+
const valueParser = require('postcss-value-parser');
|
|
5
|
+
const stylelint = require('stylelint');
|
|
6
|
+
const declarationValueIndex = require('stylelint/lib/utils/declarationValueIndex.cjs');
|
|
7
|
+
const getDeclarationValue = require('stylelint/lib/utils/getDeclarationValue.cjs');
|
|
8
|
+
const isSingleLineString = require('stylelint/lib/utils/isSingleLineString.cjs');
|
|
9
|
+
const isStandardSyntaxFunction = require('stylelint/lib/utils/isStandardSyntaxFunction.cjs');
|
|
10
|
+
const report = require('stylelint/lib/utils/report.cjs');
|
|
11
|
+
const ruleMessages = require('stylelint/lib/utils/ruleMessages.cjs');
|
|
12
|
+
const setDeclarationValue = require('stylelint/lib/utils/setDeclarationValue.cjs');
|
|
13
|
+
const validateOptions = require('stylelint/lib/utils/validateOptions.cjs');
|
|
14
|
+
|
|
15
|
+
const ruleName = 'plugin/function-parentheses-newline-inside';
|
|
16
|
+
|
|
17
|
+
const messages = ruleMessages(ruleName, {
|
|
18
|
+
expectedOpening: 'Expected newline after "("',
|
|
19
|
+
expectedClosing: 'Expected newline before ")"',
|
|
20
|
+
expectedOpeningMultiLine: 'Expected newline after "(" in a multi-line function',
|
|
21
|
+
rejectedOpeningMultiLine: 'Unexpected whitespace after "(" in a multi-line function',
|
|
22
|
+
expectedClosingMultiLine: 'Expected newline before ")" in a multi-line function',
|
|
23
|
+
rejectedClosingMultiLine: 'Unexpected whitespace before ")" in a multi-line function'
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
const meta = {
|
|
27
|
+
url: 'https://github.com/jens-duttke/linter-bundle/blob/main/stylelint/plugins/stylelint-15.11.0-stylistic/rules/function-parentheses-newline-inside/README.md',
|
|
28
|
+
fixable: true
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
/** @type {import('stylelint').Rule} */
|
|
32
|
+
const rule = (primary, _secondaryOptions, context) => (root, result) => {
|
|
33
|
+
const validOptions = validateOptions(result, ruleName, {
|
|
34
|
+
actual: primary,
|
|
35
|
+
possible: ['always', 'always-multi-line', 'never-multi-line']
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
if (!validOptions) {
|
|
39
|
+
return;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
root.walkDecls((decl) => {
|
|
43
|
+
if (!decl.value.includes('(')) {
|
|
44
|
+
return;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
let hasFixed = false;
|
|
48
|
+
const declValue = getDeclarationValue(decl);
|
|
49
|
+
const parsedValue = valueParser(declValue);
|
|
50
|
+
|
|
51
|
+
parsedValue.walk((valueNode) => {
|
|
52
|
+
if (valueNode.type !== 'function') {
|
|
53
|
+
return;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
if (!isStandardSyntaxFunction(valueNode)) {
|
|
57
|
+
return;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
const functionString = valueParser.stringify(valueNode);
|
|
61
|
+
const isMultiLine = !isSingleLineString(functionString);
|
|
62
|
+
const containsNewline = (/** @type {string} */ string_) => string_.includes('\n');
|
|
63
|
+
|
|
64
|
+
// Check opening ...
|
|
65
|
+
|
|
66
|
+
const openingIndex = valueNode.sourceIndex + valueNode.value.length + 1;
|
|
67
|
+
const checkBefore = getCheckBefore(valueNode);
|
|
68
|
+
|
|
69
|
+
if (primary === 'always' && !containsNewline(checkBefore)) {
|
|
70
|
+
if (context.fix) {
|
|
71
|
+
hasFixed = true;
|
|
72
|
+
fixBeforeForAlways(valueNode, context.newline || '');
|
|
73
|
+
}
|
|
74
|
+
else {
|
|
75
|
+
complain(messages.expectedOpening, openingIndex);
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
if (isMultiLine && primary === 'always-multi-line' && !containsNewline(checkBefore)) {
|
|
80
|
+
if (context.fix) {
|
|
81
|
+
hasFixed = true;
|
|
82
|
+
fixBeforeForAlways(valueNode, context.newline || '');
|
|
83
|
+
}
|
|
84
|
+
else {
|
|
85
|
+
complain(messages.expectedOpeningMultiLine, openingIndex);
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
if (isMultiLine && primary === 'never-multi-line' && checkBefore !== '') {
|
|
90
|
+
if (context.fix) {
|
|
91
|
+
hasFixed = true;
|
|
92
|
+
fixBeforeForNever(valueNode);
|
|
93
|
+
}
|
|
94
|
+
else {
|
|
95
|
+
complain(messages.rejectedOpeningMultiLine, openingIndex);
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
// Check closing ...
|
|
100
|
+
|
|
101
|
+
const closingIndex = valueNode.sourceIndex + functionString.length - 2;
|
|
102
|
+
const checkAfter = getCheckAfter(valueNode);
|
|
103
|
+
|
|
104
|
+
if (primary === 'always' && !containsNewline(checkAfter)) {
|
|
105
|
+
if (context.fix) {
|
|
106
|
+
hasFixed = true;
|
|
107
|
+
fixAfterForAlways(valueNode, context.newline || '');
|
|
108
|
+
}
|
|
109
|
+
else {
|
|
110
|
+
complain(messages.expectedClosing, closingIndex);
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
if (isMultiLine && primary === 'always-multi-line' && !containsNewline(checkAfter)) {
|
|
115
|
+
if (context.fix) {
|
|
116
|
+
hasFixed = true;
|
|
117
|
+
fixAfterForAlways(valueNode, context.newline || '');
|
|
118
|
+
}
|
|
119
|
+
else {
|
|
120
|
+
complain(messages.expectedClosingMultiLine, closingIndex);
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
if (isMultiLine && primary === 'never-multi-line' && checkAfter !== '') {
|
|
125
|
+
if (context.fix) {
|
|
126
|
+
hasFixed = true;
|
|
127
|
+
fixAfterForNever(valueNode);
|
|
128
|
+
}
|
|
129
|
+
else {
|
|
130
|
+
complain(messages.rejectedClosingMultiLine, closingIndex);
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
});
|
|
134
|
+
|
|
135
|
+
if (hasFixed) {
|
|
136
|
+
setDeclarationValue(decl, parsedValue.toString());
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
/**
|
|
140
|
+
* @param {string} message
|
|
141
|
+
* @param {number} offset
|
|
142
|
+
*/
|
|
143
|
+
function complain (message, offset) {
|
|
144
|
+
report({
|
|
145
|
+
ruleName,
|
|
146
|
+
result,
|
|
147
|
+
message,
|
|
148
|
+
node: decl,
|
|
149
|
+
index: declarationValueIndex(decl) + offset
|
|
150
|
+
});
|
|
151
|
+
}
|
|
152
|
+
});
|
|
153
|
+
};
|
|
154
|
+
|
|
155
|
+
/** @typedef {import('postcss-value-parser').FunctionNode} FunctionNode */
|
|
156
|
+
|
|
157
|
+
/**
|
|
158
|
+
* @param {FunctionNode} valueNode
|
|
159
|
+
*/
|
|
160
|
+
function getCheckBefore (valueNode) {
|
|
161
|
+
let before = valueNode.before;
|
|
162
|
+
|
|
163
|
+
for (const node of valueNode.nodes) {
|
|
164
|
+
if (node.type === 'comment') {
|
|
165
|
+
continue;
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
if (node.type === 'space') {
|
|
169
|
+
before += node.value;
|
|
170
|
+
continue;
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
break;
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
return before;
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
/**
|
|
180
|
+
* @param {FunctionNode} valueNode
|
|
181
|
+
*/
|
|
182
|
+
function getCheckAfter (valueNode) {
|
|
183
|
+
let after = '';
|
|
184
|
+
|
|
185
|
+
for (const node of [...valueNode.nodes].reverse()) {
|
|
186
|
+
if (node.type === 'comment') {
|
|
187
|
+
continue;
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
if (node.type === 'space') {
|
|
191
|
+
after = node.value + after;
|
|
192
|
+
continue;
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
break;
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
after += valueNode.after;
|
|
199
|
+
|
|
200
|
+
return after;
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
/**
|
|
204
|
+
* @param {FunctionNode} valueNode
|
|
205
|
+
* @param {string} newline
|
|
206
|
+
*/
|
|
207
|
+
function fixBeforeForAlways (valueNode, newline) {
|
|
208
|
+
let target;
|
|
209
|
+
|
|
210
|
+
for (const node of valueNode.nodes) {
|
|
211
|
+
if (node.type === 'comment') {
|
|
212
|
+
continue;
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
if (node.type === 'space') {
|
|
216
|
+
target = node;
|
|
217
|
+
continue;
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
break;
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
if (target) {
|
|
224
|
+
target.value = newline + target.value;
|
|
225
|
+
}
|
|
226
|
+
else {
|
|
227
|
+
valueNode.before = newline + valueNode.before;
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
/**
|
|
232
|
+
* @param {FunctionNode} valueNode
|
|
233
|
+
*/
|
|
234
|
+
function fixBeforeForNever (valueNode) {
|
|
235
|
+
valueNode.before = '';
|
|
236
|
+
|
|
237
|
+
for (const node of valueNode.nodes) {
|
|
238
|
+
if (node.type === 'comment') {
|
|
239
|
+
continue;
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
if (node.type === 'space') {
|
|
243
|
+
node.value = '';
|
|
244
|
+
continue;
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
break;
|
|
248
|
+
}
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
/**
|
|
252
|
+
* @param {FunctionNode} valueNode
|
|
253
|
+
* @param {string} newline
|
|
254
|
+
*/
|
|
255
|
+
function fixAfterForAlways (valueNode, newline) {
|
|
256
|
+
valueNode.after = newline + valueNode.after;
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
/**
|
|
260
|
+
* @param {FunctionNode} valueNode
|
|
261
|
+
*/
|
|
262
|
+
function fixAfterForNever (valueNode) {
|
|
263
|
+
valueNode.after = '';
|
|
264
|
+
|
|
265
|
+
for (const node of [...valueNode.nodes].reverse()) {
|
|
266
|
+
if (node.type === 'comment') {
|
|
267
|
+
continue;
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
if (node.type === 'space') {
|
|
271
|
+
node.value = '';
|
|
272
|
+
continue;
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
break;
|
|
276
|
+
}
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
rule.ruleName = ruleName;
|
|
280
|
+
rule.messages = messages;
|
|
281
|
+
rule.meta = meta;
|
|
282
|
+
module.exports = stylelint.createPlugin(ruleName, rule);
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
# function-parentheses-space-inside
|
|
2
|
+
|
|
3
|
+
Require a single space or disallow whitespace on the inside of the parentheses of functions.
|
|
4
|
+
|
|
5
|
+
<!-- prettier-ignore -->
|
|
6
|
+
```css
|
|
7
|
+
a { transform: translate( 1, 1 ); }
|
|
8
|
+
/** ↑ ↑
|
|
9
|
+
* The space inside these two parentheses */
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
The [`fix` option](https://stylelint.io/user-guide/options/#fix) can automatically fix all of the problems reported by this rule.
|
|
13
|
+
|
|
14
|
+
## Options
|
|
15
|
+
|
|
16
|
+
`string`: `"always"|"never"|"always-single-line"|"never-single-line"`
|
|
17
|
+
|
|
18
|
+
### `"always"`
|
|
19
|
+
|
|
20
|
+
There _must always_ be a single space inside of the parentheses.
|
|
21
|
+
|
|
22
|
+
The following patterns are considered problems:
|
|
23
|
+
|
|
24
|
+
<!-- prettier-ignore -->
|
|
25
|
+
```css
|
|
26
|
+
a { transform: translate(1, 1); }
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
<!-- prettier-ignore -->
|
|
30
|
+
```css
|
|
31
|
+
a { transform: translate(1, 1 ); }
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
The following patterns are _not_ considered problems:
|
|
35
|
+
|
|
36
|
+
<!-- prettier-ignore -->
|
|
37
|
+
```css
|
|
38
|
+
a { transform: translate( 1, 1 ); }
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
### `"never"`
|
|
42
|
+
|
|
43
|
+
There _must never_ be whitespace on the inside of the parentheses.
|
|
44
|
+
|
|
45
|
+
The following patterns are considered problems:
|
|
46
|
+
|
|
47
|
+
<!-- prettier-ignore -->
|
|
48
|
+
```css
|
|
49
|
+
a { transform: translate( 1, 1 ); }
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
<!-- prettier-ignore -->
|
|
53
|
+
```css
|
|
54
|
+
a { transform: translate(1, 1 ); }
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
The following patterns are _not_ considered problems:
|
|
58
|
+
|
|
59
|
+
<!-- prettier-ignore -->
|
|
60
|
+
```css
|
|
61
|
+
a { transform: translate(1, 1); }
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
### `"always-single-line"`
|
|
65
|
+
|
|
66
|
+
There _must always_ be a single space inside the parentheses of single-line functions.
|
|
67
|
+
|
|
68
|
+
The following patterns are considered problems:
|
|
69
|
+
|
|
70
|
+
<!-- prettier-ignore -->
|
|
71
|
+
```css
|
|
72
|
+
a { transform: translate(1, 1) }
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
<!-- prettier-ignore -->
|
|
76
|
+
```css
|
|
77
|
+
a { transform: translate(1, 1 ) }
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
The following patterns are _not_ considered problems:
|
|
81
|
+
|
|
82
|
+
<!-- prettier-ignore -->
|
|
83
|
+
```css
|
|
84
|
+
a { transform: translate( 1, 1 ) }
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
<!-- prettier-ignore -->
|
|
88
|
+
```css
|
|
89
|
+
a { transform: translate(1,
|
|
90
|
+
1) }
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
<!-- prettier-ignore -->
|
|
94
|
+
```css
|
|
95
|
+
a {
|
|
96
|
+
transform: translate(
|
|
97
|
+
1,
|
|
98
|
+
1
|
|
99
|
+
)
|
|
100
|
+
}
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
### `"never-single-line"`
|
|
104
|
+
|
|
105
|
+
There _must never_ be whitespace inside the parentheses of single-line functions.
|
|
106
|
+
|
|
107
|
+
The following patterns are considered problems:
|
|
108
|
+
|
|
109
|
+
<!-- prettier-ignore -->
|
|
110
|
+
```css
|
|
111
|
+
a { transform: translate( 1, 1 ) }
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
<!-- prettier-ignore -->
|
|
115
|
+
```css
|
|
116
|
+
a { transform: translate(1, 1 ) }
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
The following patterns are _not_ considered problems:
|
|
120
|
+
|
|
121
|
+
<!-- prettier-ignore -->
|
|
122
|
+
```css
|
|
123
|
+
a { transform: translate(1, 1) }
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
<!-- prettier-ignore -->
|
|
127
|
+
```css
|
|
128
|
+
a { transform: translate( 1,
|
|
129
|
+
1) }
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
<!-- prettier-ignore -->
|
|
133
|
+
```css
|
|
134
|
+
a {
|
|
135
|
+
transform: translate(
|
|
136
|
+
1,
|
|
137
|
+
1
|
|
138
|
+
)
|
|
139
|
+
}
|
|
140
|
+
```
|