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,200 @@
|
|
|
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, isRegExp, isString, assert } = require('stylelint/lib/utils/validateTypes.cjs');
|
|
10
|
+
|
|
11
|
+
const styleSearch = require('../../style-search/index.cjs');
|
|
12
|
+
|
|
13
|
+
const ruleName = 'plugin/max-line-length';
|
|
14
|
+
|
|
15
|
+
const messages = ruleMessages(ruleName, {
|
|
16
|
+
expected: (max) => `Expected line length to be no more than ${max} ${max === 1 ? 'character' : 'characters'}`
|
|
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-line-length/README.md'
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
/** @type {import('stylelint').Rule} */
|
|
24
|
+
const rule = (primary, secondaryOptions, context) => (root, result) => {
|
|
25
|
+
const validOptions = validateOptions(
|
|
26
|
+
result,
|
|
27
|
+
ruleName,
|
|
28
|
+
{
|
|
29
|
+
actual: primary,
|
|
30
|
+
possible: isNumber
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
actual: secondaryOptions,
|
|
34
|
+
possible: {
|
|
35
|
+
ignore: ['non-comments', 'comments'],
|
|
36
|
+
ignorePattern: [isString, isRegExp]
|
|
37
|
+
},
|
|
38
|
+
optional: true
|
|
39
|
+
}
|
|
40
|
+
);
|
|
41
|
+
|
|
42
|
+
if (!validOptions) {
|
|
43
|
+
return;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
if (root.source == null) {
|
|
47
|
+
throw new Error('The root node must have a source');
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
const EXCLUDED_PATTERNS = [
|
|
51
|
+
/url\(\s*(\S.*\S)\s*\)/gi, // allow tab, whitespace in url content
|
|
52
|
+
/@import\s+(["'].*["'])/gi
|
|
53
|
+
];
|
|
54
|
+
|
|
55
|
+
const ignoreNonComments = optionsMatches(secondaryOptions, 'ignore', 'non-comments');
|
|
56
|
+
const ignoreComments = optionsMatches(secondaryOptions, 'ignore', 'comments');
|
|
57
|
+
const rootString = context.fix ? root.toString() : root.source.input.css;
|
|
58
|
+
// Array of skipped sub strings, i.e `url(...)`, `@import "..."`
|
|
59
|
+
/** @type {Array<[number, number]>} */
|
|
60
|
+
let skippedSubStrings = [];
|
|
61
|
+
let skippedSubStringsIndex = 0;
|
|
62
|
+
|
|
63
|
+
for (const pattern of EXCLUDED_PATTERNS) {
|
|
64
|
+
for (const match of rootString.matchAll(pattern)) {
|
|
65
|
+
const subMatch = match[1] || '';
|
|
66
|
+
const startOfSubString = (match.index || 0) + (match[0] || '').indexOf(subMatch);
|
|
67
|
+
|
|
68
|
+
skippedSubStrings.push([startOfSubString, startOfSubString + subMatch.length]);
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
skippedSubStrings = skippedSubStrings.sort((a, b) => a[0] - b[0]);
|
|
73
|
+
|
|
74
|
+
// Check first line
|
|
75
|
+
checkNewline({ endIndex: 0 });
|
|
76
|
+
// Check subsequent lines
|
|
77
|
+
styleSearch({ source: rootString, target: ['\n'], comments: 'check' }, (match) => checkNewline(match));
|
|
78
|
+
|
|
79
|
+
/**
|
|
80
|
+
* @param {number} index
|
|
81
|
+
*/
|
|
82
|
+
function complain (index) {
|
|
83
|
+
report({
|
|
84
|
+
index,
|
|
85
|
+
result,
|
|
86
|
+
ruleName,
|
|
87
|
+
message: messages.expected(primary),
|
|
88
|
+
node: root
|
|
89
|
+
});
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
/**
|
|
93
|
+
* @param {number} start
|
|
94
|
+
* @param {number} end
|
|
95
|
+
*/
|
|
96
|
+
function tryToPopSubString (start, end) {
|
|
97
|
+
const skippedSubString = skippedSubStrings[skippedSubStringsIndex];
|
|
98
|
+
|
|
99
|
+
assert(skippedSubString);
|
|
100
|
+
const [startSubString, endSubString] = skippedSubString;
|
|
101
|
+
|
|
102
|
+
// Excluded substring does not presented in current line
|
|
103
|
+
if (end < startSubString) {
|
|
104
|
+
return 0;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
// Compute excluded substring size regarding to current line indexes
|
|
108
|
+
const excluded = Math.min(end, endSubString) - Math.max(start, startSubString);
|
|
109
|
+
|
|
110
|
+
// Current substring is out of range for next lines
|
|
111
|
+
if (endSubString <= end) {
|
|
112
|
+
skippedSubStringsIndex++;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
return excluded;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
/**
|
|
119
|
+
* @param {import('style-search').StyleSearchMatch | { endIndex: number }} match
|
|
120
|
+
*/
|
|
121
|
+
function checkNewline (match) {
|
|
122
|
+
let nextNewlineIndex = rootString.indexOf('\n', match.endIndex);
|
|
123
|
+
|
|
124
|
+
if (rootString[nextNewlineIndex - 1] === '\r') {
|
|
125
|
+
nextNewlineIndex -= 1;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
// Accommodate last line
|
|
129
|
+
if (nextNewlineIndex === -1) {
|
|
130
|
+
nextNewlineIndex = rootString.length;
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
const rawLineLength = nextNewlineIndex - match.endIndex;
|
|
134
|
+
const excludedLength = skippedSubStrings[skippedSubStringsIndex] ?
|
|
135
|
+
tryToPopSubString(match.endIndex, nextNewlineIndex)
|
|
136
|
+
: 0;
|
|
137
|
+
const lineText = rootString.slice(match.endIndex, nextNewlineIndex);
|
|
138
|
+
|
|
139
|
+
// Case sensitive ignorePattern match
|
|
140
|
+
if (optionsMatches(secondaryOptions, 'ignorePattern', lineText)) {
|
|
141
|
+
return;
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
// If the line's length is less than or equal to the specified
|
|
145
|
+
// max, ignore it ... So anything below is liable to be complained about.
|
|
146
|
+
// **Note that the length of any url arguments or import urls
|
|
147
|
+
// are excluded from the calculation.**
|
|
148
|
+
if (rawLineLength - excludedLength <= primary) {
|
|
149
|
+
return;
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
const complaintIndex = nextNewlineIndex - 1;
|
|
153
|
+
|
|
154
|
+
if (ignoreComments) {
|
|
155
|
+
if ('insideComment' in match && match.insideComment) {
|
|
156
|
+
return;
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
// This trimming business is to notice when the line starts a
|
|
160
|
+
// comment but that comment is indented, e.g.
|
|
161
|
+
// /* something here */
|
|
162
|
+
const nextTwoChars = rootString.slice(match.endIndex).trim().slice(0, 2);
|
|
163
|
+
|
|
164
|
+
if (nextTwoChars === '/*' || nextTwoChars === '//') {
|
|
165
|
+
return;
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
if (ignoreNonComments) {
|
|
170
|
+
if ('insideComment' in match && match.insideComment) {
|
|
171
|
+
return complain(complaintIndex);
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
// This trimming business is to notice when the line starts a
|
|
175
|
+
// comment but that comment is indented, e.g.
|
|
176
|
+
// /* something here */
|
|
177
|
+
const nextTwoChars = rootString.slice(match.endIndex).trim().slice(0, 2);
|
|
178
|
+
|
|
179
|
+
if (nextTwoChars !== '/*' && nextTwoChars !== '//') {
|
|
180
|
+
return;
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
return complain(complaintIndex);
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
// If there are no spaces besides initial (indent) spaces, ignore it
|
|
187
|
+
const lineString = rootString.slice(match.endIndex, nextNewlineIndex);
|
|
188
|
+
|
|
189
|
+
if (!lineString.replace(/^\s+/, '').includes(' ')) {
|
|
190
|
+
return;
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
return complain(complaintIndex);
|
|
194
|
+
}
|
|
195
|
+
};
|
|
196
|
+
|
|
197
|
+
rule.ruleName = ruleName;
|
|
198
|
+
rule.messages = messages;
|
|
199
|
+
rule.meta = meta;
|
|
200
|
+
module.exports = stylelint.createPlugin(ruleName, rule);
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
# media-feature-colon-space-after
|
|
2
|
+
|
|
3
|
+
Require a single space or disallow whitespace after the colon in media features.
|
|
4
|
+
|
|
5
|
+
<!-- prettier-ignore -->
|
|
6
|
+
```css
|
|
7
|
+
@media (max-width: 600px) {}
|
|
8
|
+
/** ↑
|
|
9
|
+
* The space after this colon */
|
|
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"`
|
|
17
|
+
|
|
18
|
+
### `"always"`
|
|
19
|
+
|
|
20
|
+
There _must always_ be a single space after the colon.
|
|
21
|
+
|
|
22
|
+
The following patterns are considered problems:
|
|
23
|
+
|
|
24
|
+
<!-- prettier-ignore -->
|
|
25
|
+
```css
|
|
26
|
+
@media (max-width:600px) {}
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
<!-- prettier-ignore -->
|
|
30
|
+
```css
|
|
31
|
+
@media (max-width :600px) {}
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
The following patterns are _not_ considered problems:
|
|
35
|
+
|
|
36
|
+
<!-- prettier-ignore -->
|
|
37
|
+
```css
|
|
38
|
+
@media (max-width: 600px) {}
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
<!-- prettier-ignore -->
|
|
42
|
+
```css
|
|
43
|
+
@media (max-width : 600px) {}
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
### `"never"`
|
|
47
|
+
|
|
48
|
+
There _must never_ be whitespace after the colon.
|
|
49
|
+
|
|
50
|
+
The following patterns are considered problems:
|
|
51
|
+
|
|
52
|
+
<!-- prettier-ignore -->
|
|
53
|
+
```css
|
|
54
|
+
@media (max-width: 600px) {}
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
<!-- prettier-ignore -->
|
|
58
|
+
```css
|
|
59
|
+
@media (max-width : 600px) {}
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
The following patterns are _not_ considered problems:
|
|
63
|
+
|
|
64
|
+
<!-- prettier-ignore -->
|
|
65
|
+
```css
|
|
66
|
+
@media (max-width:600px) {}
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
<!-- prettier-ignore -->
|
|
70
|
+
```css
|
|
71
|
+
@media (max-width :600px) {}
|
|
72
|
+
```
|
|
@@ -0,0 +1,91 @@
|
|
|
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 atRuleParamIndex = require('stylelint/lib/utils/atRuleParamIndex.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 mediaFeatureColonSpaceChecker = require('../mediaFeatureColonSpaceChecker.cjs');
|
|
11
|
+
|
|
12
|
+
const ruleName = 'plugin/media-feature-colon-space-after';
|
|
13
|
+
|
|
14
|
+
const messages = ruleMessages(ruleName, {
|
|
15
|
+
expectedAfter: () => 'Expected single space after ":"',
|
|
16
|
+
rejectedAfter: () => 'Unexpected whitespace after ":"'
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
const meta = {
|
|
20
|
+
url: 'https://github.com/jens-duttke/linter-bundle/blob/main/stylelint/plugins/stylelint-15.11.0-stylistic/rules/media-feature-colon-space-after/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
|
+
/** @type {Map<import('postcss').AtRule, number[]> | undefined} */
|
|
39
|
+
let fixData;
|
|
40
|
+
|
|
41
|
+
mediaFeatureColonSpaceChecker({
|
|
42
|
+
root,
|
|
43
|
+
result,
|
|
44
|
+
locationChecker: checker.after,
|
|
45
|
+
checkedRuleName: ruleName,
|
|
46
|
+
fix: context.fix ?
|
|
47
|
+
(atRule, index) => {
|
|
48
|
+
const parameterColonIndex = index - atRuleParamIndex(atRule);
|
|
49
|
+
|
|
50
|
+
fixData ||= new Map();
|
|
51
|
+
const colonIndices = fixData.get(atRule) || [];
|
|
52
|
+
|
|
53
|
+
colonIndices.push(parameterColonIndex);
|
|
54
|
+
fixData.set(atRule, colonIndices);
|
|
55
|
+
|
|
56
|
+
return true;
|
|
57
|
+
}
|
|
58
|
+
: null
|
|
59
|
+
});
|
|
60
|
+
|
|
61
|
+
if (fixData) {
|
|
62
|
+
for (const [atRule, colonIndices] of fixData.entries()) {
|
|
63
|
+
let parameters = atRule.raws.params ? atRule.raws.params.raw : atRule.params;
|
|
64
|
+
|
|
65
|
+
for (const index of colonIndices.sort((a, b) => b - a)) {
|
|
66
|
+
const beforeColon = parameters.slice(0, index + 1);
|
|
67
|
+
const afterColon = parameters.slice(index + 1);
|
|
68
|
+
|
|
69
|
+
if (primary === 'always') {
|
|
70
|
+
parameters = beforeColon + afterColon.replace(/^\s*/, ' ');
|
|
71
|
+
}
|
|
72
|
+
else if (primary === 'never') {
|
|
73
|
+
parameters = beforeColon + afterColon.replace(/^\s*/, '');
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
if (atRule.raws.params) {
|
|
78
|
+
atRule.raws.params.raw = parameters;
|
|
79
|
+
}
|
|
80
|
+
else {
|
|
81
|
+
atRule.params = parameters;
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
};
|
|
86
|
+
};
|
|
87
|
+
|
|
88
|
+
rule.ruleName = ruleName;
|
|
89
|
+
rule.messages = messages;
|
|
90
|
+
rule.meta = meta;
|
|
91
|
+
module.exports = stylelint.createPlugin(ruleName, rule);
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
# media-feature-colon-space-before
|
|
2
|
+
|
|
3
|
+
Require a single space or disallow whitespace before the colon in media features.
|
|
4
|
+
|
|
5
|
+
<!-- prettier-ignore -->
|
|
6
|
+
```css
|
|
7
|
+
@media (max-width :600px) {}
|
|
8
|
+
/** ↑
|
|
9
|
+
* The space before this colon */
|
|
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"`
|
|
17
|
+
|
|
18
|
+
### `"always"`
|
|
19
|
+
|
|
20
|
+
There _must always_ be a single space before the colon.
|
|
21
|
+
|
|
22
|
+
The following patterns are considered problems:
|
|
23
|
+
|
|
24
|
+
<!-- prettier-ignore -->
|
|
25
|
+
```css
|
|
26
|
+
@media (max-width:600px) {}
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
<!-- prettier-ignore -->
|
|
30
|
+
```css
|
|
31
|
+
@media (max-width: 600px) {}
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
The following patterns are _not_ considered problems:
|
|
35
|
+
|
|
36
|
+
<!-- prettier-ignore -->
|
|
37
|
+
```css
|
|
38
|
+
@media (max-width :600px) {}
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
<!-- prettier-ignore -->
|
|
42
|
+
```css
|
|
43
|
+
@media (max-width : 600px) {}
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
### `"never"`
|
|
47
|
+
|
|
48
|
+
There _must never_ be whitespace before the colon.
|
|
49
|
+
|
|
50
|
+
The following patterns are considered problems:
|
|
51
|
+
|
|
52
|
+
<!-- prettier-ignore -->
|
|
53
|
+
```css
|
|
54
|
+
@media (max-width :600px) {}
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
<!-- prettier-ignore -->
|
|
58
|
+
```css
|
|
59
|
+
@media (max-width : 600px) {}
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
The following patterns are _not_ considered problems:
|
|
63
|
+
|
|
64
|
+
<!-- prettier-ignore -->
|
|
65
|
+
```css
|
|
66
|
+
@media (max-width:600px) {}
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
<!-- prettier-ignore -->
|
|
70
|
+
```css
|
|
71
|
+
@media (max-width: 600px) {}
|
|
72
|
+
```
|
|
@@ -0,0 +1,91 @@
|
|
|
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 atRuleParamIndex = require('stylelint/lib/utils/atRuleParamIndex.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 mediaFeatureColonSpaceChecker = require('../mediaFeatureColonSpaceChecker.cjs');
|
|
11
|
+
|
|
12
|
+
const ruleName = 'plugin/media-feature-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/media-feature-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
|
+
/** @type {Map<import('postcss').AtRule, number[]> | undefined} */
|
|
39
|
+
let fixData;
|
|
40
|
+
|
|
41
|
+
mediaFeatureColonSpaceChecker({
|
|
42
|
+
root,
|
|
43
|
+
result,
|
|
44
|
+
locationChecker: checker.before,
|
|
45
|
+
checkedRuleName: ruleName,
|
|
46
|
+
fix: context.fix ?
|
|
47
|
+
(atRule, index) => {
|
|
48
|
+
const parameterColonIndex = index - atRuleParamIndex(atRule);
|
|
49
|
+
|
|
50
|
+
fixData ||= new Map();
|
|
51
|
+
const colonIndices = fixData.get(atRule) || [];
|
|
52
|
+
|
|
53
|
+
colonIndices.push(parameterColonIndex);
|
|
54
|
+
fixData.set(atRule, colonIndices);
|
|
55
|
+
|
|
56
|
+
return true;
|
|
57
|
+
}
|
|
58
|
+
: null
|
|
59
|
+
});
|
|
60
|
+
|
|
61
|
+
if (fixData) {
|
|
62
|
+
for (const [atRule, colonIndices] of fixData.entries()) {
|
|
63
|
+
let parameters = atRule.raws.params ? atRule.raws.params.raw : atRule.params;
|
|
64
|
+
|
|
65
|
+
for (const index of colonIndices.sort((a, b) => b - a)) {
|
|
66
|
+
const beforeColon = parameters.slice(0, index);
|
|
67
|
+
const afterColon = parameters.slice(index);
|
|
68
|
+
|
|
69
|
+
if (primary === 'always') {
|
|
70
|
+
parameters = beforeColon.replace(/\s*$/, ' ') + afterColon;
|
|
71
|
+
}
|
|
72
|
+
else if (primary === 'never') {
|
|
73
|
+
parameters = beforeColon.replace(/\s*$/, '') + afterColon;
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
if (atRule.raws.params) {
|
|
78
|
+
atRule.raws.params.raw = parameters;
|
|
79
|
+
}
|
|
80
|
+
else {
|
|
81
|
+
atRule.params = parameters;
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
};
|
|
86
|
+
};
|
|
87
|
+
|
|
88
|
+
rule.ruleName = ruleName;
|
|
89
|
+
rule.messages = messages;
|
|
90
|
+
rule.meta = meta;
|
|
91
|
+
module.exports = stylelint.createPlugin(ruleName, rule);
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
# media-feature-name-case
|
|
2
|
+
|
|
3
|
+
Specify lowercase or uppercase for media feature names.
|
|
4
|
+
|
|
5
|
+
<!-- prettier-ignore -->
|
|
6
|
+
```css
|
|
7
|
+
@media (min-width: 700px) {}
|
|
8
|
+
/** ↑
|
|
9
|
+
* This media feature name */
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
The [`fix` option](https://stylelint.io/user-guide/options/#fix) can automatically fix all of the problems reported by this rule.
|
|
13
|
+
|
|
14
|
+
## Options
|
|
15
|
+
|
|
16
|
+
`string`: `"lower"|"upper"`
|
|
17
|
+
|
|
18
|
+
### `"lower"`
|
|
19
|
+
|
|
20
|
+
The following patterns are considered problems:
|
|
21
|
+
|
|
22
|
+
<!-- prettier-ignore -->
|
|
23
|
+
```css
|
|
24
|
+
@media (MIN-WIDTH: 700px) {}
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
<!-- prettier-ignore -->
|
|
28
|
+
```css
|
|
29
|
+
@media not all and (MONOCHROME) {}
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
<!-- prettier-ignore -->
|
|
33
|
+
```css
|
|
34
|
+
@media (min-width: 700px) and (ORIENTATION: landscape) {}
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
<!-- prettier-ignore -->
|
|
38
|
+
```css
|
|
39
|
+
@media (WIDTH > 10em) {}
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
The following patterns are _not_ considered problems:
|
|
43
|
+
|
|
44
|
+
<!-- prettier-ignore -->
|
|
45
|
+
```css
|
|
46
|
+
@media (min-width: 700px) {}
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
<!-- prettier-ignore -->
|
|
50
|
+
```css
|
|
51
|
+
@media not all and (monochrome) {}
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
<!-- prettier-ignore -->
|
|
55
|
+
```css
|
|
56
|
+
@media (min-width: 700px) and (orientation: landscape) {}
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
<!-- prettier-ignore -->
|
|
60
|
+
```css
|
|
61
|
+
@media (width > 10em) {}
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
### `"upper"`
|
|
65
|
+
|
|
66
|
+
The following patterns are considered problems:
|
|
67
|
+
|
|
68
|
+
<!-- prettier-ignore -->
|
|
69
|
+
```css
|
|
70
|
+
@media (min-width: 700px) {}
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
<!-- prettier-ignore -->
|
|
74
|
+
```css
|
|
75
|
+
@media not all and (monochrome) {}
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
<!-- prettier-ignore -->
|
|
79
|
+
```css
|
|
80
|
+
@media (MIN-WIDTH: 700px) and (orientation: landscape) {}
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
<!-- prettier-ignore -->
|
|
84
|
+
```css
|
|
85
|
+
@media (10em < width <= 50em) {}
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
The following patterns are _not_ considered problems:
|
|
89
|
+
|
|
90
|
+
<!-- prettier-ignore -->
|
|
91
|
+
```css
|
|
92
|
+
@media (MIN-WIDTH: 700px) {}
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
<!-- prettier-ignore -->
|
|
96
|
+
```css
|
|
97
|
+
@media not all and (MONOCHROME) {}
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
<!-- prettier-ignore -->
|
|
101
|
+
```css
|
|
102
|
+
@media (MIN-WIDTH: 700px) and (ORIENTATION: landscape) {}
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
<!-- prettier-ignore -->
|
|
106
|
+
```css
|
|
107
|
+
@media (10em < WIDTH <= 50em) {}
|
|
108
|
+
```
|