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,21 @@
|
|
|
1
|
+
# linebreaks
|
|
2
|
+
|
|
3
|
+
Specify unix or windows linebreaks.
|
|
4
|
+
|
|
5
|
+
The [`fix` option](https://stylelint.io/user-guide/options/#fix) can automatically fix all of the problems reported by this rule.
|
|
6
|
+
|
|
7
|
+
## Options
|
|
8
|
+
|
|
9
|
+
`string`: `"unix"|"windows"`
|
|
10
|
+
|
|
11
|
+
### `"unix"`
|
|
12
|
+
|
|
13
|
+
Linebreaks _must always_ be LF (`\n`).
|
|
14
|
+
|
|
15
|
+
Lines with CRLF linebreaks are considered problems.
|
|
16
|
+
|
|
17
|
+
### `"windows"`
|
|
18
|
+
|
|
19
|
+
Linebreaks _must always_ be CRLF (`\r\n`).
|
|
20
|
+
|
|
21
|
+
Lines with LF linebreaks are considered problems.
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
/* eslint-disable -- We want to keep as much of the original code as possible */
|
|
2
|
+
// @ts-nocheck
|
|
3
|
+
|
|
4
|
+
const postcss = require('postcss');
|
|
5
|
+
const stylelint = require('stylelint');
|
|
6
|
+
const report = require('stylelint/lib/utils/report.cjs');
|
|
7
|
+
const ruleMessages = require('stylelint/lib/utils/ruleMessages.cjs');
|
|
8
|
+
const validateOptions = require('stylelint/lib/utils/validateOptions.cjs');
|
|
9
|
+
|
|
10
|
+
const ruleName = 'plugin/linebreaks';
|
|
11
|
+
|
|
12
|
+
const messages = ruleMessages(ruleName, {
|
|
13
|
+
expected: (linebreak) => `Expected linebreak to be ${linebreak}`
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
const meta = {
|
|
17
|
+
url: 'https://github.com/jens-duttke/linter-bundle/blob/main/stylelint/plugins/stylelint-15.11.0-stylistic/rules/linebreaks/README.md',
|
|
18
|
+
fixable: true
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
/** @type {import('stylelint').Rule} */
|
|
22
|
+
const rule = (primary, _secondaryOptions, context) => (root, result) => {
|
|
23
|
+
const validOptions = validateOptions(result, ruleName, {
|
|
24
|
+
actual: primary,
|
|
25
|
+
possible: ['unix', 'windows']
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
if (!validOptions) {
|
|
29
|
+
return;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
const shouldHaveCR = primary === 'windows';
|
|
33
|
+
|
|
34
|
+
if (context.fix) {
|
|
35
|
+
root.walk((node) => {
|
|
36
|
+
if ('selector' in node) {
|
|
37
|
+
node.selector = fixData(node.selector);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
if ('value' in node) {
|
|
41
|
+
node.value = fixData(node.value);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
if ('text' in node) {
|
|
45
|
+
node.text = fixData(node.text);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
if (node.raws.before) {
|
|
49
|
+
node.raws.before = fixData(node.raws.before);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
if (typeof node.raws.after === 'string') {
|
|
53
|
+
node.raws.after = fixData(node.raws.after);
|
|
54
|
+
}
|
|
55
|
+
});
|
|
56
|
+
|
|
57
|
+
if (typeof root.raws.after === 'string') {
|
|
58
|
+
root.raws.after = fixData(root.raws.after);
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
else {
|
|
62
|
+
if (root.source == null) { throw new Error('The root node must have a source'); }
|
|
63
|
+
|
|
64
|
+
const lines = root.source.input.css.split('\n');
|
|
65
|
+
|
|
66
|
+
for (let [i, line] of lines.entries()) {
|
|
67
|
+
if (i < lines.length - 1 && !line.includes('\r')) {
|
|
68
|
+
line += '\n';
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
if (hasError(line)) {
|
|
72
|
+
const lineNum = i + 1;
|
|
73
|
+
const colNumber = line.length;
|
|
74
|
+
|
|
75
|
+
reportNewlineError(lineNum, colNumber);
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
/**
|
|
81
|
+
* @param {string} dataToCheck
|
|
82
|
+
*/
|
|
83
|
+
function hasError (dataToCheck) {
|
|
84
|
+
const hasNewlineToVerify = (/[\n\r]/).test(dataToCheck);
|
|
85
|
+
const hasCR = hasNewlineToVerify ? dataToCheck.includes('\r') : false;
|
|
86
|
+
|
|
87
|
+
return hasNewlineToVerify && hasCR !== shouldHaveCR;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
/**
|
|
91
|
+
* @param {string} data
|
|
92
|
+
*/
|
|
93
|
+
function fixData (data) {
|
|
94
|
+
if (data) {
|
|
95
|
+
let res = data.replace(/\r/g, '');
|
|
96
|
+
|
|
97
|
+
if (shouldHaveCR) {
|
|
98
|
+
res = res.replace(/\n/g, '\r\n');
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
return res;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
return data;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
/**
|
|
108
|
+
* @param {number} line
|
|
109
|
+
* @param {number} column
|
|
110
|
+
*/
|
|
111
|
+
function reportNewlineError (line, column) {
|
|
112
|
+
// Creating a node manually helps us to point to empty lines.
|
|
113
|
+
const node = postcss.rule({
|
|
114
|
+
source: {
|
|
115
|
+
start: { line, column, offset: 0 },
|
|
116
|
+
input: new postcss.Input('')
|
|
117
|
+
}
|
|
118
|
+
});
|
|
119
|
+
|
|
120
|
+
report({
|
|
121
|
+
message: messages.expected(primary),
|
|
122
|
+
node,
|
|
123
|
+
result,
|
|
124
|
+
ruleName
|
|
125
|
+
});
|
|
126
|
+
}
|
|
127
|
+
};
|
|
128
|
+
|
|
129
|
+
rule.ruleName = ruleName;
|
|
130
|
+
rule.messages = messages;
|
|
131
|
+
rule.meta = meta;
|
|
132
|
+
module.exports = stylelint.createPlugin(ruleName, rule);
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
# max-empty-lines
|
|
2
|
+
|
|
3
|
+
Limit the number of adjacent empty lines.
|
|
4
|
+
|
|
5
|
+
<!-- prettier-ignore -->
|
|
6
|
+
```css
|
|
7
|
+
a {}
|
|
8
|
+
/* ← */
|
|
9
|
+
/* ← */
|
|
10
|
+
a {} /* ↑ */
|
|
11
|
+
/** ↑
|
|
12
|
+
* These lines */
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
The [`fix` option](https://stylelint.io/user-guide/options/#fix) can automatically fix all of the problems reported by this rule.
|
|
16
|
+
|
|
17
|
+
## Options
|
|
18
|
+
|
|
19
|
+
`int`: Maximum number of adjacent empty lines allowed.
|
|
20
|
+
|
|
21
|
+
For example, with `2`:
|
|
22
|
+
|
|
23
|
+
The following patterns are considered problems:
|
|
24
|
+
|
|
25
|
+
<!-- prettier-ignore -->
|
|
26
|
+
```css
|
|
27
|
+
a {}
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
b {}
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
Comment strings are also checked -- so the following is a problem:
|
|
35
|
+
|
|
36
|
+
<!-- prettier-ignore -->
|
|
37
|
+
```css
|
|
38
|
+
/*
|
|
39
|
+
Call me Ishmael.
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
Some years ago--never mind how long precisely-—...
|
|
44
|
+
*/
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
The following patterns are _not_ considered problems:
|
|
48
|
+
|
|
49
|
+
<!-- prettier-ignore -->
|
|
50
|
+
```css
|
|
51
|
+
a {}
|
|
52
|
+
b {}
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
<!-- prettier-ignore -->
|
|
56
|
+
```css
|
|
57
|
+
a {}
|
|
58
|
+
|
|
59
|
+
b {}
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
<!-- prettier-ignore -->
|
|
63
|
+
```css
|
|
64
|
+
a {}
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
b {}
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
## Optional secondary options
|
|
71
|
+
|
|
72
|
+
### `ignore: ["comments"]`
|
|
73
|
+
|
|
74
|
+
Only enforce the adjacent empty lines limit for lines that are not comments.
|
|
75
|
+
|
|
76
|
+
For example, with `2` adjacent empty lines:
|
|
77
|
+
|
|
78
|
+
The following patterns are considered problems:
|
|
79
|
+
|
|
80
|
+
<!-- prettier-ignore -->
|
|
81
|
+
```css
|
|
82
|
+
/* horse */
|
|
83
|
+
a {}
|
|
84
|
+
|
|
85
|
+
|
|
86
|
+
|
|
87
|
+
b {}
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
The following patterns are _not_ considered problems:
|
|
91
|
+
|
|
92
|
+
<!-- prettier-ignore -->
|
|
93
|
+
```css
|
|
94
|
+
/*
|
|
95
|
+
Call me Ishmael.
|
|
96
|
+
|
|
97
|
+
|
|
98
|
+
|
|
99
|
+
Some years ago -- never mind how long precisely -- ...
|
|
100
|
+
*/
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
<!-- prettier-ignore -->
|
|
104
|
+
```css
|
|
105
|
+
a {
|
|
106
|
+
/*
|
|
107
|
+
Comment
|
|
108
|
+
|
|
109
|
+
|
|
110
|
+
|
|
111
|
+
|
|
112
|
+
inside the declaration with a lot of empty lines...
|
|
113
|
+
*/
|
|
114
|
+
color: pink;
|
|
115
|
+
}
|
|
116
|
+
```
|
|
@@ -0,0 +1,225 @@
|
|
|
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 optionsMatches = require('stylelint/lib/utils/optionsMatches.cjs');
|
|
6
|
+
const report = require('stylelint/lib/utils/report.cjs');
|
|
7
|
+
const ruleMessages = require('stylelint/lib/utils/ruleMessages.cjs');
|
|
8
|
+
const validateOptions = require('stylelint/lib/utils/validateOptions.cjs');
|
|
9
|
+
const { isNumber } = require('stylelint/lib/utils/validateTypes.cjs');
|
|
10
|
+
|
|
11
|
+
const styleSearch = require('../../style-search/index.cjs');
|
|
12
|
+
|
|
13
|
+
const ruleName = 'plugin/max-empty-lines';
|
|
14
|
+
|
|
15
|
+
const messages = ruleMessages(ruleName, {
|
|
16
|
+
expected: (max) => `Expected no more than ${max} empty ${max === 1 ? 'line' : 'lines'}`
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
const meta = {
|
|
20
|
+
url: 'https://github.com/jens-duttke/linter-bundle/blob/main/stylelint/plugins/stylelint-15.11.0-stylistic/rules/max-empty-lines/README.md',
|
|
21
|
+
fixable: true
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
/** @type {import('stylelint').Rule} */
|
|
25
|
+
const rule = (primary, secondaryOptions, context) => {
|
|
26
|
+
let emptyLines = 0;
|
|
27
|
+
let lastIndex = -1;
|
|
28
|
+
|
|
29
|
+
return (root, result) => {
|
|
30
|
+
const validOptions = validateOptions(
|
|
31
|
+
result,
|
|
32
|
+
ruleName,
|
|
33
|
+
{
|
|
34
|
+
actual: primary,
|
|
35
|
+
possible: isNumber
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
actual: secondaryOptions,
|
|
39
|
+
possible: {
|
|
40
|
+
ignore: ['comments']
|
|
41
|
+
},
|
|
42
|
+
optional: true
|
|
43
|
+
}
|
|
44
|
+
);
|
|
45
|
+
|
|
46
|
+
if (!validOptions) {
|
|
47
|
+
return;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
const ignoreComments = optionsMatches(secondaryOptions, 'ignore', 'comments');
|
|
51
|
+
const getChars = replaceEmptyLines.bind(null, primary);
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* 1. walk nodes & replace enterchar
|
|
55
|
+
* 2. deal with special case.
|
|
56
|
+
*/
|
|
57
|
+
if (context.fix) {
|
|
58
|
+
root.walk((node) => {
|
|
59
|
+
if (node.type === 'comment' && !ignoreComments) {
|
|
60
|
+
node.raws.left = getChars(node.raws.left);
|
|
61
|
+
node.raws.right = getChars(node.raws.right);
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
if (node.raws.before) {
|
|
65
|
+
node.raws.before = getChars(node.raws.before);
|
|
66
|
+
}
|
|
67
|
+
});
|
|
68
|
+
|
|
69
|
+
// first node
|
|
70
|
+
const firstNodeRawsBefore = root.first?.raws.before;
|
|
71
|
+
// root raws
|
|
72
|
+
const rootRawsAfter = root.raws.after;
|
|
73
|
+
|
|
74
|
+
// not document node
|
|
75
|
+
// @ts-expect-error -- TS2339: Property 'document' does not exist on type 'Root'.
|
|
76
|
+
if ((root.document?.constructor.name) !== 'Document') {
|
|
77
|
+
if (firstNodeRawsBefore) {
|
|
78
|
+
root.first.raws.before = getChars(firstNodeRawsBefore, true);
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
if (rootRawsAfter) {
|
|
82
|
+
// when max set 0, should be treated as 1 in this situation.
|
|
83
|
+
root.raws.after = replaceEmptyLines(primary === 0 ? 1 : primary, rootRawsAfter, true);
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
else if (rootRawsAfter) {
|
|
87
|
+
// `css in js` or `html`
|
|
88
|
+
root.raws.after = replaceEmptyLines(primary === 0 ? 1 : primary, rootRawsAfter);
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
return;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
emptyLines = 0;
|
|
95
|
+
lastIndex = -1;
|
|
96
|
+
const rootString = root.toString();
|
|
97
|
+
|
|
98
|
+
styleSearch(
|
|
99
|
+
{
|
|
100
|
+
source: rootString,
|
|
101
|
+
target: rootString.includes('\r\n') ? '\r\n' : '\n',
|
|
102
|
+
comments: ignoreComments ? 'skip' : 'check'
|
|
103
|
+
},
|
|
104
|
+
(match) => {
|
|
105
|
+
checkMatch(rootString, match.startIndex, match.endIndex, root);
|
|
106
|
+
}
|
|
107
|
+
);
|
|
108
|
+
|
|
109
|
+
/**
|
|
110
|
+
* @param {string} source
|
|
111
|
+
* @param {number} matchStartIndex
|
|
112
|
+
* @param {number} matchEndIndex
|
|
113
|
+
* @param {import('postcss').Root} node
|
|
114
|
+
*/
|
|
115
|
+
function checkMatch (source, matchStartIndex, matchEndIndex, node) {
|
|
116
|
+
const eof = matchEndIndex === source.length;
|
|
117
|
+
let problem = false;
|
|
118
|
+
|
|
119
|
+
// Additional check for beginning of file
|
|
120
|
+
if (!matchStartIndex || lastIndex === matchStartIndex) {
|
|
121
|
+
emptyLines++;
|
|
122
|
+
}
|
|
123
|
+
else {
|
|
124
|
+
emptyLines = 0;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
lastIndex = matchEndIndex;
|
|
128
|
+
|
|
129
|
+
if (emptyLines > primary) { problem = true; }
|
|
130
|
+
|
|
131
|
+
if (!eof && !problem) { return; }
|
|
132
|
+
|
|
133
|
+
if (problem) {
|
|
134
|
+
report({
|
|
135
|
+
message: messages.expected(primary),
|
|
136
|
+
node,
|
|
137
|
+
index: matchStartIndex,
|
|
138
|
+
result,
|
|
139
|
+
ruleName
|
|
140
|
+
});
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
// Additional check for end of file
|
|
144
|
+
if (eof && primary) {
|
|
145
|
+
emptyLines++;
|
|
146
|
+
|
|
147
|
+
if (emptyLines > primary && isEofNode(result.root, node)) {
|
|
148
|
+
report({
|
|
149
|
+
message: messages.expected(primary),
|
|
150
|
+
node,
|
|
151
|
+
index: matchEndIndex,
|
|
152
|
+
result,
|
|
153
|
+
ruleName
|
|
154
|
+
});
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
/**
|
|
160
|
+
* @param {number} maxLines
|
|
161
|
+
* @param {unknown} str
|
|
162
|
+
* @param string_
|
|
163
|
+
* @param {boolean?} isSpecialCase
|
|
164
|
+
*/
|
|
165
|
+
function replaceEmptyLines (maxLines, string_, isSpecialCase = false) {
|
|
166
|
+
const repeatTimes = isSpecialCase ? maxLines : maxLines + 1;
|
|
167
|
+
|
|
168
|
+
if (repeatTimes === 0 || typeof string_ !== 'string') {
|
|
169
|
+
return '';
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
const emptyLFLines = '\n'.repeat(repeatTimes);
|
|
173
|
+
const emptyCRLFLines = '\r\n'.repeat(repeatTimes);
|
|
174
|
+
|
|
175
|
+
return (/(?:\r\n)+/).test(string_) ?
|
|
176
|
+
string_.replace(/(\r\n)+/g, ($1) => {
|
|
177
|
+
if ($1.length / 2 > repeatTimes) {
|
|
178
|
+
return emptyCRLFLines;
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
return $1;
|
|
182
|
+
})
|
|
183
|
+
: string_.replace(/(\n)+/g, ($1) => {
|
|
184
|
+
if ($1.length > repeatTimes) {
|
|
185
|
+
return emptyLFLines;
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
return $1;
|
|
189
|
+
});
|
|
190
|
+
}
|
|
191
|
+
};
|
|
192
|
+
};
|
|
193
|
+
|
|
194
|
+
/**
|
|
195
|
+
* Checks whether the given node is the last node of file.
|
|
196
|
+
* @param {import('stylelint').PostcssResult['root']} document - the document node with `postcss-html` and `postcss-jsx`
|
|
197
|
+
* @param {import('postcss').Root} root - the root node of css
|
|
198
|
+
*/
|
|
199
|
+
function isEofNode (document, root) {
|
|
200
|
+
if (!document || document.constructor.name !== 'Document' || !('type' in document)) {
|
|
201
|
+
return true;
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
// In the `postcss-html` and `postcss-jsx` syntax, checks that there is text after the given node.
|
|
205
|
+
let after;
|
|
206
|
+
|
|
207
|
+
if (root === document.last) {
|
|
208
|
+
after = document.raws?.codeAfter;
|
|
209
|
+
}
|
|
210
|
+
else {
|
|
211
|
+
// @ts-expect-error -- TS2345: Argument of type 'Root' is not assignable to parameter of type 'number | ChildNode'.
|
|
212
|
+
const rootIndex = document.index(root);
|
|
213
|
+
|
|
214
|
+
const nextNode = document.nodes[rootIndex + 1];
|
|
215
|
+
|
|
216
|
+
after = nextNode.raws.codeBefore;
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
return !String(after).trim();
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
rule.ruleName = ruleName;
|
|
223
|
+
rule.messages = messages;
|
|
224
|
+
rule.meta = meta;
|
|
225
|
+
module.exports = stylelint.createPlugin(ruleName, rule);
|
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
# max-line-length
|
|
2
|
+
|
|
3
|
+
Limit the length of a line.
|
|
4
|
+
|
|
5
|
+
<!-- prettier-ignore -->
|
|
6
|
+
```css
|
|
7
|
+
a { color: red }
|
|
8
|
+
/** ↑
|
|
9
|
+
* The end */
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
Lines that exceed the maximum length but contain no whitespace (other than at the beginning of the line) are ignored.
|
|
13
|
+
|
|
14
|
+
When evaluating the line length, the arguments of any `url(...)` functions are excluded from the calculation, because typically you have no control over the length of these arguments. This means that long `url()` functions should not contribute to problems.
|
|
15
|
+
|
|
16
|
+
## Options
|
|
17
|
+
|
|
18
|
+
`int`: Maximum number of characters allowed.
|
|
19
|
+
|
|
20
|
+
For example, with `20`:
|
|
21
|
+
|
|
22
|
+
The following patterns are considered problems:
|
|
23
|
+
|
|
24
|
+
<!-- prettier-ignore -->
|
|
25
|
+
```css
|
|
26
|
+
a { color: 0; top: 0; }
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
<!-- prettier-ignore -->
|
|
30
|
+
```css
|
|
31
|
+
a {
|
|
32
|
+
background: linear-gradient(red, blue);
|
|
33
|
+
}
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
The following patterns are _not_ considered problems:
|
|
37
|
+
|
|
38
|
+
<!-- prettier-ignore -->
|
|
39
|
+
```css
|
|
40
|
+
a {
|
|
41
|
+
color: 0;
|
|
42
|
+
top: 0;
|
|
43
|
+
}
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
<!-- prettier-ignore -->
|
|
47
|
+
```css
|
|
48
|
+
a {
|
|
49
|
+
background: url(a-url-that-is-over-20-characters-long);
|
|
50
|
+
}
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
## Optional secondary options
|
|
54
|
+
|
|
55
|
+
### `ignore: ["non-comments"]`
|
|
56
|
+
|
|
57
|
+
Only enforce the line-length limit for lines within comments.
|
|
58
|
+
|
|
59
|
+
This does not apply to comments that are stuck in between other stuff, only to lines that begin at the beginning or in the middle of a comment.
|
|
60
|
+
|
|
61
|
+
For example, with a maximum length of `30`.
|
|
62
|
+
|
|
63
|
+
The following patterns are considered problems:
|
|
64
|
+
|
|
65
|
+
Each have only one problem.
|
|
66
|
+
|
|
67
|
+
<!-- prettier-ignore -->
|
|
68
|
+
```css
|
|
69
|
+
/* This line is too long for my rule */
|
|
70
|
+
a { color: pink; background: orange; }
|
|
71
|
+
a { color: pink; /* this comment is also long but not on its own line */ }
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
<!-- prettier-ignore -->
|
|
75
|
+
```css
|
|
76
|
+
a { color: pink; background: orange; }
|
|
77
|
+
/**
|
|
78
|
+
* This line is short,
|
|
79
|
+
* but this line is too long for my liking,
|
|
80
|
+
* though this one is fine
|
|
81
|
+
*/
|
|
82
|
+
a { color: pink; /* this comment is also long but not on its own line */ }
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
### `ignore: ["comments"]`
|
|
86
|
+
|
|
87
|
+
Only enforce the line-length limit for lines that are not comments.
|
|
88
|
+
|
|
89
|
+
This also applies to comments that are between code on the same line.
|
|
90
|
+
|
|
91
|
+
For example, with a maximum length of `30`.
|
|
92
|
+
|
|
93
|
+
The following patterns are considered problems:
|
|
94
|
+
|
|
95
|
+
<!-- prettier-ignore -->
|
|
96
|
+
```css
|
|
97
|
+
a { color: pink; } /* comment that is too long */
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
<!-- prettier-ignore -->
|
|
101
|
+
```css
|
|
102
|
+
a { /* this comment is too long for the max length */ }
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
The following patterns are _not_ considered problems:
|
|
106
|
+
|
|
107
|
+
<!-- prettier-ignore -->
|
|
108
|
+
```css
|
|
109
|
+
/* comment that is too long for my rule*/
|
|
110
|
+
a { color: pink; }
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
<!-- prettier-ignore -->
|
|
114
|
+
```css
|
|
115
|
+
/*
|
|
116
|
+
* comment that is too long the max length
|
|
117
|
+
* comment that is too long the max length
|
|
118
|
+
*
|
|
119
|
+
*/
|
|
120
|
+
a { color: pink; }
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
### `ignorePattern: "/regex/"`
|
|
124
|
+
|
|
125
|
+
Ignore any line that matches the given regex pattern, regardless of whether it is comment or not. The regex may be passed as a string (for JSON configuration) by enclosing in forward-slashes, or an ordinary JavaScript RegExp may be used.
|
|
126
|
+
|
|
127
|
+
Given:
|
|
128
|
+
|
|
129
|
+
```json
|
|
130
|
+
"/^@import\\s+/"
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
The following pattern is _not_ considered a problem:
|
|
134
|
+
|
|
135
|
+
<!-- prettier-ignore -->
|
|
136
|
+
```css
|
|
137
|
+
@import "../../../../another/css/or/scss/file/or/something.css";
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
Given the following, with a maximum length of `20`.
|
|
141
|
+
|
|
142
|
+
```js
|
|
143
|
+
["/https?://[0-9,a-z]*.*/"];
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
The following pattern is _not_ considered a problem:
|
|
147
|
+
|
|
148
|
+
<!-- prettier-ignore -->
|
|
149
|
+
```css
|
|
150
|
+
/* ignore urls https://www.example.com */
|
|
151
|
+
```
|