@alexlit/lint-kit 182.1.0 → 182.2.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/package.json +1 -1
- package/packages/config-eslint/package.json +3 -3
- package/packages/config-eslint/plugins/unocss.js +4 -6
- package/packages/config-stylelint/node_modules/ansi-regex/index.d.ts +33 -0
- package/packages/config-stylelint/node_modules/ansi-regex/index.js +14 -0
- package/packages/config-stylelint/node_modules/ansi-regex/license +9 -0
- package/packages/config-stylelint/node_modules/ansi-regex/package.json +61 -0
- package/packages/config-stylelint/node_modules/ansi-regex/readme.md +66 -0
- package/packages/config-stylelint/node_modules/file-entry-cache/LICENSE +19 -0
- package/packages/config-stylelint/node_modules/file-entry-cache/README.md +630 -0
- package/packages/config-stylelint/node_modules/file-entry-cache/dist/index.cjs +559 -0
- package/packages/config-stylelint/node_modules/file-entry-cache/dist/index.d.cts +304 -0
- package/packages/config-stylelint/node_modules/file-entry-cache/dist/index.d.ts +304 -0
- package/packages/config-stylelint/node_modules/file-entry-cache/dist/index.js +525 -0
- package/packages/config-stylelint/node_modules/file-entry-cache/package.json +62 -0
- package/packages/config-stylelint/node_modules/flat-cache/LICENSE +19 -0
- package/packages/config-stylelint/node_modules/flat-cache/README.md +235 -0
- package/packages/config-stylelint/node_modules/flat-cache/dist/index.cjs +495 -0
- package/packages/config-stylelint/node_modules/flat-cache/dist/index.d.cts +255 -0
- package/packages/config-stylelint/node_modules/flat-cache/dist/index.d.ts +255 -0
- package/packages/config-stylelint/node_modules/flat-cache/dist/index.js +455 -0
- package/packages/config-stylelint/node_modules/flat-cache/package.json +87 -0
- package/packages/config-stylelint/node_modules/globby/ignore.js +337 -0
- package/packages/config-stylelint/node_modules/globby/index.d.ts +394 -0
- package/packages/config-stylelint/node_modules/globby/index.js +488 -0
- package/packages/config-stylelint/node_modules/globby/license +9 -0
- package/packages/config-stylelint/node_modules/globby/package.json +94 -0
- package/packages/config-stylelint/node_modules/globby/readme.md +388 -0
- package/packages/config-stylelint/node_modules/globby/utilities.js +382 -0
- package/packages/config-stylelint/node_modules/meow/build/dependencies.js +7347 -0
- package/packages/config-stylelint/node_modules/meow/build/index.d.ts +2684 -0
- package/packages/config-stylelint/node_modules/meow/build/index.js +185 -0
- package/packages/config-stylelint/node_modules/meow/build/licenses.md +1254 -0
- package/packages/config-stylelint/node_modules/meow/build/options.js +147 -0
- package/packages/config-stylelint/node_modules/meow/build/parser.js +113 -0
- package/packages/config-stylelint/node_modules/meow/build/utils.js +7 -0
- package/packages/config-stylelint/node_modules/meow/build/validate.js +145 -0
- package/packages/config-stylelint/node_modules/meow/license +9 -0
- package/packages/config-stylelint/node_modules/meow/package.json +103 -0
- package/packages/config-stylelint/node_modules/meow/readme.md +387 -0
- package/packages/config-stylelint/node_modules/postcss-safe-parser/LICENSE +20 -0
- package/packages/config-stylelint/node_modules/postcss-safe-parser/README.md +25 -0
- package/packages/config-stylelint/node_modules/postcss-safe-parser/lib/safe-parse.js +12 -0
- package/packages/config-stylelint/node_modules/postcss-safe-parser/lib/safe-parser.js +100 -0
- package/packages/config-stylelint/node_modules/postcss-safe-parser/package.json +36 -0
- package/packages/config-stylelint/node_modules/slash/index.d.ts +23 -0
- package/packages/config-stylelint/node_modules/slash/index.js +9 -0
- package/packages/config-stylelint/node_modules/slash/license +9 -0
- package/packages/config-stylelint/node_modules/slash/package.json +39 -0
- package/packages/config-stylelint/node_modules/slash/readme.md +36 -0
- package/packages/config-stylelint/node_modules/string-width/index.d.ts +39 -0
- package/packages/config-stylelint/node_modules/string-width/index.js +119 -0
- package/packages/config-stylelint/node_modules/string-width/license +9 -0
- package/packages/config-stylelint/node_modules/string-width/package.json +65 -0
- package/packages/config-stylelint/node_modules/string-width/readme.md +66 -0
- package/packages/config-stylelint/node_modules/strip-ansi/index.d.ts +15 -0
- package/packages/config-stylelint/node_modules/strip-ansi/index.js +19 -0
- package/packages/config-stylelint/node_modules/strip-ansi/license +9 -0
- package/packages/config-stylelint/node_modules/strip-ansi/package.json +59 -0
- package/packages/config-stylelint/node_modules/strip-ansi/readme.md +37 -0
- package/packages/config-stylelint/node_modules/stylelint/LICENSE +20 -0
- package/packages/config-stylelint/node_modules/stylelint/README.md +113 -0
- package/packages/config-stylelint/node_modules/stylelint/bin/stylelint.mjs +7 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/assignDisabledRanges.mjs +483 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/augmentConfig.mjs +586 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/cli.mjs +746 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/constants.mjs +25 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/createPartialStylelintResult.mjs +114 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/createPlugin.mjs +9 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/createStylelint.mjs +37 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/descriptionlessDisables.mjs +51 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/formatters/calcSeverityCounts.mjs +21 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/formatters/compactFormatter.mjs +23 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/formatters/index.mjs +23 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/formatters/jsonFormatter.mjs +10 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/formatters/preprocessWarnings.mjs +74 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/formatters/stringFormatter.mjs +308 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/formatters/tapFormatter.mjs +85 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/formatters/terminalLink.mjs +21 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/formatters/unixFormatter.mjs +32 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/formatters/verboseFormatter.mjs +175 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/getConfigForFile.mjs +110 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/getPostcssResult.mjs +130 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/index.mjs +38 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/invalidScopeDisables.mjs +41 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/isPathIgnored.mjs +48 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/lintPostcssResult.mjs +172 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/lintSource.mjs +135 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/needlessDisables.mjs +91 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/normalizeAllRuleSettings.mjs +29 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/normalizeRuleSettings.mjs +56 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/postcssPlugin.mjs +50 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/prepareReturnValue.mjs +63 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/printConfig.mjs +44 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/reference/atKeywords.mjs +83 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/reference/functions.mjs +96 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/reference/keywords.mjs +663 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/reference/mediaFeatures.mjs +115 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/reference/mediaTypes.mjs +14 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/reference/prefixes.mjs +17 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/reference/properties.mjs +1112 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/reference/selectors.mjs +472 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/reference/units.mjs +82 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/reportDisables.mjs +48 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/reportUnknownRuleNames.mjs +76 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/resolveConfig.mjs +43 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/rules/alpha-value-notation/index.mjs +207 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/rules/annotation-no-unknown/index.mjs +88 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/rules/at-rule-allowed-list/index.mjs +62 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/rules/at-rule-descriptor-no-unknown/index.mjs +108 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/rules/at-rule-descriptor-value-no-unknown/index.mjs +64 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/rules/at-rule-disallowed-list/index.mjs +62 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/rules/at-rule-empty-line-before/index.mjs +178 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/rules/at-rule-no-deprecated/index.mjs +86 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/rules/at-rule-no-unknown/index.mjs +80 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/rules/at-rule-no-vendor-prefix/index.mjs +82 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/rules/at-rule-prelude-no-invalid/index.mjs +76 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/rules/at-rule-property-required-list/index.mjs +92 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/rules/block-no-empty/index.mjs +116 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/rules/block-no-redundant-nested-style-rules/index.mjs +52 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/rules/color-function-alias-notation/index.mjs +87 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/rules/color-function-notation/index.mjs +168 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/rules/color-hex-alpha/index.mjs +75 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/rules/color-hex-length/index.mjs +128 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/rules/color-named/colordUtils.mjs +109 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/rules/color-named/index.mjs +183 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/rules/color-no-hex/index.mjs +69 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/rules/color-no-invalid-hex/index.mjs +68 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/rules/comment-empty-line-before/index.mjs +131 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/rules/comment-no-empty/index.mjs +50 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/rules/comment-pattern/index.mjs +51 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/rules/comment-whitespace-inside/index.mjs +149 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/rules/comment-word-disallowed-list/index.mjs +63 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/rules/container-name-pattern/index.mjs +107 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/rules/custom-media-pattern/index.mjs +61 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/rules/custom-property-empty-line-before/index.mjs +156 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/rules/custom-property-no-missing-var-function/index.mjs +148 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/rules/custom-property-pattern/index.mjs +100 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/rules/declaration-block-no-duplicate-custom-properties/index.mjs +82 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/rules/declaration-block-no-duplicate-properties/index.mjs +301 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/rules/declaration-block-no-redundant-longhand-properties/index.mjs +411 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/rules/declaration-block-no-shorthand-property-overrides/index.mjs +74 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/rules/declaration-block-single-line-max-declarations/index.mjs +62 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/rules/declaration-empty-line-before/index.mjs +160 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/rules/declaration-no-important/index.mjs +51 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/rules/declaration-property-max-values/index.mjs +79 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/rules/declaration-property-unit-allowed-list/index.mjs +108 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/rules/declaration-property-unit-disallowed-list/index.mjs +94 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/rules/declaration-property-value-allowed-list/index.mjs +66 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/rules/declaration-property-value-disallowed-list/index.mjs +66 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/rules/declaration-property-value-keyword-no-deprecated/index.mjs +203 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/rules/declaration-property-value-no-unknown/index.mjs +424 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/rules/display-notation/index.mjs +225 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/rules/font-family-name-quotes/index.mjs +243 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/rules/font-family-no-duplicate-names/index.mjs +122 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/rules/font-family-no-missing-generic-family-keyword/index.mjs +122 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/rules/font-weight-notation/index.mjs +221 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/rules/function-allowed-list/index.mjs +114 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/rules/function-calc-no-unspaced-operator/index.mjs +589 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/rules/function-disallowed-list/index.mjs +73 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/rules/function-linear-gradient-no-nonstandard-direction/index.mjs +145 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/rules/function-name-case/index.mjs +120 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/rules/function-no-unknown/index.mjs +83 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/rules/function-url-no-scheme-relative/index.mjs +67 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/rules/function-url-quotes/index.mjs +230 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/rules/function-url-scheme-allowed-list/index.mjs +70 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/rules/function-url-scheme-disallowed-list/index.mjs +70 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/rules/hue-degree-notation/index.mjs +123 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/rules/import-notation/index.mjs +104 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/rules/index.mjs +180 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/rules/keyframe-block-no-duplicate-selectors/index.mjs +68 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/rules/keyframe-declaration-no-important/index.mjs +54 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/rules/keyframe-selector-notation/index.mjs +202 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/rules/keyframes-name-pattern/index.mjs +63 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/rules/layer-name-pattern/index.mjs +91 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/rules/length-zero-no-unit/index.mjs +221 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/rules/lightness-notation/index.mjs +165 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/rules/max-nesting-depth/index.mjs +195 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/rules/media-feature-name-allowed-list/index.mjs +67 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/rules/media-feature-name-disallowed-list/index.mjs +67 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/rules/media-feature-name-no-unknown/index.mjs +79 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/rules/media-feature-name-no-vendor-prefix/index.mjs +94 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/rules/media-feature-name-unit-allowed-list/index.mjs +110 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/rules/media-feature-name-value-allowed-list/index.mjs +100 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/rules/media-feature-name-value-no-unknown/index.mjs +277 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/rules/media-feature-range-notation/index.mjs +187 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/rules/media-query-no-invalid/index.mjs +193 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/rules/media-type-no-deprecated/index.mjs +82 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/rules/named-grid-areas-no-invalid/index.mjs +117 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/rules/named-grid-areas-no-invalid/utils/findNotContiguousOrRectangular.mjs +57 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/rules/nesting-selector-no-missing-scoping-root/index.mjs +165 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/rules/no-descending-specificity/index.mjs +200 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/rules/no-duplicate-at-import-rules/index.mjs +156 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/rules/no-duplicate-selectors/index.mjs +218 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/rules/no-empty-source/index.mjs +61 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/rules/no-invalid-double-slash-comments/index.mjs +77 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/rules/no-invalid-position-at-import-rule/index.mjs +76 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/rules/no-invalid-position-declaration/index.mjs +86 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/rules/no-irregular-whitespace/index.mjs +236 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/rules/no-unknown-animations/index.mjs +71 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/rules/no-unknown-custom-media/index.mjs +77 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/rules/no-unknown-custom-properties/index.mjs +72 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/rules/number-max-precision/index.mjs +209 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/rules/property-allowed-list/index.mjs +58 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/rules/property-disallowed-list/index.mjs +58 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/rules/property-no-deprecated/index.mjs +143 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/rules/property-no-unknown/index.mjs +126 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/rules/property-no-vendor-prefix/index.mjs +100 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/rules/rule-empty-line-before/index.mjs +156 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/rules/rule-nesting-at-rule-required-list/index.mjs +85 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/rules/rule-selector-property-disallowed-list/index.mjs +119 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/rules/selector-anb-no-unmatchable/index.mjs +121 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/rules/selector-attribute-name-disallowed-list/index.mjs +69 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/rules/selector-attribute-operator-allowed-list/index.mjs +70 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/rules/selector-attribute-operator-disallowed-list/index.mjs +70 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/rules/selector-attribute-quotes/index.mjs +107 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/rules/selector-class-pattern/index.mjs +71 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/rules/selector-combinator-allowed-list/index.mjs +81 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/rules/selector-combinator-disallowed-list/index.mjs +81 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/rules/selector-disallowed-list/index.mjs +115 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/rules/selector-id-pattern/index.mjs +66 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/rules/selector-max-attribute/index.mjs +92 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/rules/selector-max-class/index.mjs +75 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/rules/selector-max-combinators/index.mjs +77 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/rules/selector-max-compound-selectors/index.mjs +123 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/rules/selector-max-id/index.mjs +107 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/rules/selector-max-pseudo-class/index.mjs +85 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/rules/selector-max-specificity/index.mjs +146 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/rules/selector-max-type/index.mjs +219 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/rules/selector-max-universal/index.mjs +95 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/rules/selector-nested-pattern/index.mjs +95 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/rules/selector-no-qualifying-type/index.mjs +323 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/rules/selector-no-vendor-prefix/index.mjs +92 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/rules/selector-not-notation/index.mjs +217 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/rules/selector-pseudo-class-allowed-list/index.mjs +84 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/rules/selector-pseudo-class-disallowed-list/index.mjs +84 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/rules/selector-pseudo-class-no-unknown/index.mjs +179 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/rules/selector-pseudo-element-allowed-list/index.mjs +75 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/rules/selector-pseudo-element-colon-notation/index.mjs +93 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/rules/selector-pseudo-element-disallowed-list/index.mjs +74 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/rules/selector-pseudo-element-no-unknown/index.mjs +91 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/rules/selector-type-case/index.mjs +118 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/rules/selector-type-no-unknown/index.mjs +148 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/rules/shorthand-property-no-redundant-values/index.mjs +359 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/rules/string-no-newline/index.mjs +120 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/rules/syntax-string-no-invalid/index.mjs +80 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/rules/time-min-milliseconds/index.mjs +167 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/rules/unit-allowed-list/index.mjs +116 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/rules/unit-disallowed-list/index.mjs +211 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/rules/unit-no-unknown/index.mjs +207 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/rules/value-keyword-case/index.mjs +253 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/rules/value-no-vendor-prefix/index.mjs +92 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/standalone.mjs +381 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/timing.mjs +134 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/unscopedDisables.mjs +66 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/utils/FileCache.mjs +115 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/utils/addEmptyLineBefore.mjs +21 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/utils/addSemicolonForEditInfo.mjs +35 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/utils/appendRuleName.mjs +13 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/utils/arrayEqual.mjs +14 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/utils/beforeBlockString.mjs +28 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/utils/blockString.mjs +19 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/utils/blurInterpolation.mjs +8 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/utils/cachedImport.mjs +68 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/utils/checkAgainstRule.mjs +71 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/utils/checkInvalidCLIOptions.mjs +105 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/utils/configurationComment.mjs +74 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/utils/containsString.mjs +52 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/utils/createMapWithSet.mjs +19 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/utils/dynamicImport.mjs +13 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/utils/eachDeclarationBlock.mjs +59 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/utils/eachNodeUpToRoot.mjs +22 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/utils/emitWarning.mjs +83 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/utils/errors.mjs +55 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/utils/filterFilePaths.mjs +17 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/utils/findAnimationName.mjs +74 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/utils/findAtRuleContext.mjs +27 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/utils/findFontFamily.mjs +148 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/utils/findMediaFeatureNames.mjs +151 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/utils/findNodeUpToRoot.mjs +25 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/utils/fixEmptyLinesBefore.mjs +26 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/utils/functionArgumentsSearch.mjs +64 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/utils/getAtRuleParams.mjs +7 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/utils/getDeclarationValue.mjs +9 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/utils/getDimension.mjs +62 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/utils/getFileIgnorer.mjs +41 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/utils/getFormatter.mjs +43 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/utils/getFormatterOptionsText.mjs +12 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/utils/getImportantPosition.mjs +15 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/utils/getLexer.mjs +39 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/utils/getModulePath.mjs +35 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/utils/getNextNonSharedLineCommentNode.mjs +34 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/utils/getPreviousNonSharedLineCommentNode.mjs +36 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/utils/getRelativePath.mjs +12 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/utils/getRuleSelector.mjs +9 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/utils/getSchemeFromUrl.mjs +36 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/utils/getSelectorSourceIndex.mjs +12 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/utils/getStrippedSelectorSource.mjs +47 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/utils/getStylelintRule.mjs +22 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/utils/hasBlock.mjs +9 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/utils/hasEmptyLine.mjs +13 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/utils/hasInterpolation.mjs +24 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/utils/hasLessInterpolation.mjs +11 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/utils/hasPsvInterpolation.mjs +11 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/utils/hasScssInterpolation.mjs +11 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/utils/hasTplInterpolation.mjs +11 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/utils/hash.mjs +10 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/utils/isAfterBlock.mjs +15 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/utils/isAfterComment.mjs +15 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/utils/isAfterSingleLineComment.mjs +19 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/utils/isAfterStandardPropertyDeclaration.mjs +19 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/utils/isAutoprefixable.mjs +364 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/utils/isBlocklessAtRuleAfterBlocklessAtRule.mjs +21 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/utils/isBlocklessAtRuleAfterSameNameBlocklessAtRule.mjs +21 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/utils/isContextFunctionalPseudoClass.mjs +24 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/utils/isCounterIncrementCustomIdentValue.mjs +19 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/utils/isCounterResetCustomIdentValue.mjs +19 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/utils/isCustomElement.mjs +34 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/utils/isCustomFunction.mjs +9 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/utils/isCustomMediaQuery.mjs +8 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/utils/isCustomProperty.mjs +8 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/utils/isCustomSelector.mjs +9 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/utils/isDescriptorDeclaration.mjs +22 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/utils/isFirstNested.mjs +83 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/utils/isFirstNodeOfRoot.mjs +17 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/utils/isHexColor.mjs +9 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/utils/isInDocument.mjs +32 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/utils/isKeyframeRule.mjs +17 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/utils/isKeyframeSelector.mjs +29 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/utils/isMathFunction.mjs +11 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/utils/isNonNegativeInteger.mjs +6 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/utils/isNumbery.mjs +9 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/utils/isOnlyWhitespace.mjs +17 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/utils/isPathNotFoundError.mjs +9 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/utils/isScssVariable.mjs +19 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/utils/isSharedLineComment.mjs +53 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/utils/isSingleLineString.mjs +10 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/utils/isStandardSyntaxAtRule.mjs +32 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/utils/isStandardSyntaxColorFunction.mjs +24 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/utils/isStandardSyntaxCombinator.mjs +32 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/utils/isStandardSyntaxComment.mjs +13 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/utils/isStandardSyntaxDeclaration.mjs +57 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/utils/isStandardSyntaxFunction.mjs +28 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/utils/isStandardSyntaxHexColor.mjs +14 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/utils/isStandardSyntaxKeyframesName.mjs +15 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/utils/isStandardSyntaxProperty.mjs +32 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/utils/isStandardSyntaxRule.mjs +24 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/utils/isStandardSyntaxSelector.mjs +56 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/utils/isStandardSyntaxTypeSelector.mjs +56 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/utils/isStandardSyntaxUrl.mjs +49 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/utils/isStandardSyntaxValue.mjs +51 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/utils/isUnicodeRangeDescriptor.mjs +24 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/utils/isUnicodeSupported.mjs +26 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/utils/isUrlFunction.mjs +9 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/utils/isValidFontSize.mjs +38 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/utils/isValidHex.mjs +11 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/utils/isValidIdentifier.mjs +39 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/utils/isVarFunction.mjs +9 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/utils/isVariable.mjs +9 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/utils/isWhitespace.mjs +9 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/utils/matchesStringOrRegExp.mjs +97 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/utils/mergeSyntaxDefinitions.mjs +137 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/utils/narrowFixRange.mjs +68 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/utils/nodeContextLookup.mjs +41 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/utils/nodeFieldIndices.mjs +119 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/utils/normalizeFilePath.mjs +26 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/utils/normalizeFixMode.mjs +22 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/utils/normalizeSelector.mjs +166 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/utils/optionsMatches.mjs +20 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/utils/parseCustomMediaQuery.mjs +15 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/utils/parseMediaQuery.mjs +15 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/utils/parseSelector.mjs +19 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/utils/pathExists.mjs +16 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/utils/pluralize.mjs +10 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/utils/putIfAbsent.mjs +20 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/utils/rangesOverlap.mjs +19 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/utils/rawNodeString.mjs +29 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/utils/regexes.mjs +135 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/utils/removeEmptyLinesBefore.mjs +13 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/utils/report.mjs +321 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/utils/reportCommentProblem.mjs +39 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/utils/resolveFilePath.mjs +38 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/utils/resolveNestedSelectorsForRule.mjs +108 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/utils/resolveOptionValue.mjs +30 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/utils/resolveSilent.mjs +144 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/utils/ruleMessages.mjs +18 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/utils/setAtRuleParams.mjs +18 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/utils/setDeclarationValue.mjs +18 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/utils/suppressionsService.mjs +317 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/utils/toPath.mjs +23 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/utils/typeGuards.mjs +90 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/utils/uniteSets.mjs +9 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/utils/validateObjectWithArrayProps.mjs +29 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/utils/validateObjectWithProps.mjs +28 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/utils/validateOptions.mjs +176 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/utils/validateTypes.mjs +148 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/utils/vendor.mjs +43 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/validateDisableSettings.mjs +67 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/writeOutputFile.mjs +15 -0
- package/packages/config-stylelint/node_modules/stylelint/package.json +212 -0
- package/packages/config-stylelint/node_modules/stylelint/types/stylelint/index.d.ts +1590 -0
- package/packages/config-stylelint/node_modules/unicorn-magic/default.d.ts +13 -0
- package/packages/config-stylelint/node_modules/unicorn-magic/default.js +14 -0
- package/packages/config-stylelint/node_modules/unicorn-magic/license +9 -0
- package/packages/config-stylelint/node_modules/unicorn-magic/node.d.ts +125 -0
- package/packages/config-stylelint/node_modules/unicorn-magic/node.js +49 -0
- package/packages/config-stylelint/node_modules/unicorn-magic/package.json +68 -0
- package/packages/config-stylelint/node_modules/unicorn-magic/readme.md +31 -0
- package/packages/config-stylelint/package.json +2 -2
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
export const DEFAULT_CACHE_LOCATION = './.stylelintcache';
|
|
2
|
+
export const CACHE_STRATEGY_METADATA = 'metadata';
|
|
3
|
+
export const CACHE_STRATEGY_CONTENT = 'content';
|
|
4
|
+
export const DEFAULT_CACHE_STRATEGY = CACHE_STRATEGY_METADATA;
|
|
5
|
+
|
|
6
|
+
export const DEFAULT_IGNORE_FILENAME = '.stylelintignore';
|
|
7
|
+
|
|
8
|
+
export const DEFAULT_SUPPRESSION_FILENAME = 'stylelint-suppressions.json';
|
|
9
|
+
|
|
10
|
+
export const DEFAULT_FORMATTER = 'string';
|
|
11
|
+
|
|
12
|
+
// NOTE: Partially based on `sysexits.h`.
|
|
13
|
+
export const EXIT_CODE_SUCCESS = 0;
|
|
14
|
+
export const EXIT_CODE_FATAL_ERROR = 1;
|
|
15
|
+
export const EXIT_CODE_LINT_PROBLEM = 2;
|
|
16
|
+
export const EXIT_CODE_INVALID_USAGE = 64;
|
|
17
|
+
export const EXIT_CODE_INVALID_CONFIG = 78;
|
|
18
|
+
|
|
19
|
+
export const RULE_NAME_ALL = 'all';
|
|
20
|
+
|
|
21
|
+
export const SEVERITY_ERROR = 'error';
|
|
22
|
+
export const SEVERITY_WARNING = 'warning';
|
|
23
|
+
export const DEFAULT_SEVERITY = SEVERITY_ERROR;
|
|
24
|
+
|
|
25
|
+
export const DEFAULT_FIX_MODE = 'strict';
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
import { SEVERITY_ERROR } from './constants.mjs';
|
|
2
|
+
import process from 'node:process';
|
|
3
|
+
|
|
4
|
+
/** @import {LintResult as StylelintResult, PostcssResult} from 'stylelint' */
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* @param {PostcssResult} [postcssResult]
|
|
8
|
+
* @param {import('stylelint').CssSyntaxError} [cssSyntaxError]
|
|
9
|
+
* @returns {StylelintResult}
|
|
10
|
+
*/
|
|
11
|
+
export default function createPartialStylelintResult(postcssResult, cssSyntaxError) {
|
|
12
|
+
/** @type {StylelintResult} */
|
|
13
|
+
let stylelintResult;
|
|
14
|
+
/** @type {string | undefined} */
|
|
15
|
+
let source;
|
|
16
|
+
|
|
17
|
+
if (postcssResult && postcssResult.root) {
|
|
18
|
+
if (postcssResult.root.source) {
|
|
19
|
+
source = postcssResult.root.source.input.file;
|
|
20
|
+
|
|
21
|
+
if (!source && 'id' in postcssResult.root.source.input) {
|
|
22
|
+
source = postcssResult.root.source.input.id;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
// @ts-expect-error -- TS2339: Property 'noDeprecation' does not exist on type 'Process'.
|
|
27
|
+
// https://github.com/nodejs/node/blob/main/doc/api/process.md#processnodeprecation
|
|
28
|
+
const includeDeprecations = !process.noDeprecation;
|
|
29
|
+
const deprecationMessages = includeDeprecations
|
|
30
|
+
? postcssResult.messages.filter((message) => message.stylelintType === 'deprecation')
|
|
31
|
+
: [];
|
|
32
|
+
const deprecations = deprecationMessages.map((deprecationMessage) => {
|
|
33
|
+
return {
|
|
34
|
+
text: deprecationMessage.text,
|
|
35
|
+
reference: deprecationMessage.stylelintReference,
|
|
36
|
+
};
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
const invalidOptionMessages = postcssResult.messages.filter(
|
|
40
|
+
(message) => message.stylelintType === 'invalidOption',
|
|
41
|
+
);
|
|
42
|
+
const invalidOptionWarnings = invalidOptionMessages.map((invalidOptionMessage) => {
|
|
43
|
+
return {
|
|
44
|
+
text: invalidOptionMessage.text,
|
|
45
|
+
};
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
const parseErrors = postcssResult.messages.filter(
|
|
49
|
+
(message) => message.stylelintType === 'parseError',
|
|
50
|
+
);
|
|
51
|
+
|
|
52
|
+
// Remove deprecation warnings, invalid options, and parse errors from the messages
|
|
53
|
+
postcssResult.messages = postcssResult.messages.filter(
|
|
54
|
+
(message) =>
|
|
55
|
+
message.stylelintType !== 'deprecation' &&
|
|
56
|
+
message.stylelintType !== 'invalidOption' &&
|
|
57
|
+
message.stylelintType !== 'parseError',
|
|
58
|
+
);
|
|
59
|
+
|
|
60
|
+
// This defines the stylelint result object that formatters receive
|
|
61
|
+
stylelintResult = {
|
|
62
|
+
source,
|
|
63
|
+
deprecations,
|
|
64
|
+
invalidOptionWarnings,
|
|
65
|
+
// @ts-expect-error -- TS2322: Type 'Message[]' is not assignable to type '(Warning & { stylelintType: string; })[]'.
|
|
66
|
+
parseErrors,
|
|
67
|
+
errored: postcssResult.stylelint.stylelintError,
|
|
68
|
+
warnings: postcssResult.messages.map((message) => {
|
|
69
|
+
return {
|
|
70
|
+
line: message.line,
|
|
71
|
+
column: message.column,
|
|
72
|
+
endLine: message.endLine,
|
|
73
|
+
endColumn: message.endColumn,
|
|
74
|
+
fix: message.fix,
|
|
75
|
+
rule: message.rule,
|
|
76
|
+
severity: message.severity,
|
|
77
|
+
text: message.text,
|
|
78
|
+
url: message.url,
|
|
79
|
+
};
|
|
80
|
+
}),
|
|
81
|
+
ignored: postcssResult.stylelint.ignored,
|
|
82
|
+
_postcssResult: postcssResult,
|
|
83
|
+
};
|
|
84
|
+
} else if (cssSyntaxError) {
|
|
85
|
+
if (cssSyntaxError.name !== 'CssSyntaxError') {
|
|
86
|
+
throw cssSyntaxError;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
stylelintResult = {
|
|
90
|
+
source: cssSyntaxError.file || '<input css 1>',
|
|
91
|
+
deprecations: [],
|
|
92
|
+
invalidOptionWarnings: [],
|
|
93
|
+
parseErrors: [],
|
|
94
|
+
errored: true,
|
|
95
|
+
warnings: [
|
|
96
|
+
{
|
|
97
|
+
line: cssSyntaxError.line,
|
|
98
|
+
column: cssSyntaxError.column,
|
|
99
|
+
endLine: cssSyntaxError.endLine,
|
|
100
|
+
endColumn: cssSyntaxError.endColumn,
|
|
101
|
+
rule: cssSyntaxError.name,
|
|
102
|
+
severity: SEVERITY_ERROR,
|
|
103
|
+
text: `${cssSyntaxError.reason} (${cssSyntaxError.name})`,
|
|
104
|
+
},
|
|
105
|
+
],
|
|
106
|
+
};
|
|
107
|
+
} else {
|
|
108
|
+
throw new Error(
|
|
109
|
+
'createPartialStylelintResult must be called with either postcssResult or CssSyntaxError',
|
|
110
|
+
);
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
return stylelintResult;
|
|
114
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import process from 'node:process';
|
|
2
|
+
|
|
3
|
+
import { cosmiconfig } from 'cosmiconfig';
|
|
4
|
+
|
|
5
|
+
import FileCache from './utils/FileCache.mjs';
|
|
6
|
+
import { augmentConfigExtended } from './augmentConfig.mjs';
|
|
7
|
+
|
|
8
|
+
const IS_TEST = process.env.NODE_ENV === 'test';
|
|
9
|
+
const STOP_DIR = IS_TEST ? process.cwd() : undefined;
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* @type {import('stylelint').PublicApi['_createLinter']}
|
|
13
|
+
*/
|
|
14
|
+
export default function createStylelint(options = {}) {
|
|
15
|
+
const cwd = options.cwd || process.cwd();
|
|
16
|
+
|
|
17
|
+
return {
|
|
18
|
+
_options: { ...options, cwd },
|
|
19
|
+
|
|
20
|
+
_extendExplorer: cosmiconfig('', {
|
|
21
|
+
transform: augmentConfigExtended(cwd),
|
|
22
|
+
stopDir: STOP_DIR,
|
|
23
|
+
searchStrategy: 'global', // for backward compatibility
|
|
24
|
+
}),
|
|
25
|
+
|
|
26
|
+
_configExplorer: cosmiconfig('stylelint', {
|
|
27
|
+
stopDir: STOP_DIR,
|
|
28
|
+
searchStrategy: 'global', // for backward compatibility
|
|
29
|
+
}),
|
|
30
|
+
|
|
31
|
+
_specifiedConfigCache: new Map(),
|
|
32
|
+
_augmentedConfigCache: new Map(),
|
|
33
|
+
_postcssResultCache: new Map(),
|
|
34
|
+
_compiledOverridesCache: new Map(),
|
|
35
|
+
_fileCache: new FileCache(options.cacheLocation, options.cacheStrategy, cwd),
|
|
36
|
+
};
|
|
37
|
+
}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { RULE_NAME_ALL } from './constants.mjs';
|
|
2
|
+
|
|
3
|
+
import optionsMatches from './utils/optionsMatches.mjs';
|
|
4
|
+
import reportCommentProblem from './utils/reportCommentProblem.mjs';
|
|
5
|
+
import validateDisableSettings from './validateDisableSettings.mjs';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* @param {import('stylelint').PostcssResult} postcssResult
|
|
9
|
+
* @returns {void}
|
|
10
|
+
*/
|
|
11
|
+
export default function descriptionlessDisables(postcssResult) {
|
|
12
|
+
const [enabled, options] = validateDisableSettings(
|
|
13
|
+
postcssResult,
|
|
14
|
+
'reportDescriptionlessDisables',
|
|
15
|
+
);
|
|
16
|
+
|
|
17
|
+
if (!options) return;
|
|
18
|
+
|
|
19
|
+
/** @type {Set<import('postcss').Node>} */
|
|
20
|
+
const alreadyReported = new Set();
|
|
21
|
+
|
|
22
|
+
for (const [rule, ruleRanges] of Object.entries(postcssResult.stylelint.disabledRanges)) {
|
|
23
|
+
for (const range of ruleRanges) {
|
|
24
|
+
if (range.description) continue;
|
|
25
|
+
|
|
26
|
+
const node = range.node;
|
|
27
|
+
|
|
28
|
+
if (alreadyReported.has(node)) continue;
|
|
29
|
+
|
|
30
|
+
if (enabled === optionsMatches(options, 'except', rule)) {
|
|
31
|
+
// An 'all' rule will get copied for each individual rule. If the
|
|
32
|
+
// configuration is `[false, {except: ['specific-rule']}]`, we
|
|
33
|
+
// don't want to report the copies that match except, so we record
|
|
34
|
+
// the comment as already reported.
|
|
35
|
+
if (!enabled && rule === RULE_NAME_ALL) alreadyReported.add(node);
|
|
36
|
+
|
|
37
|
+
continue;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
alreadyReported.add(node);
|
|
41
|
+
|
|
42
|
+
reportCommentProblem({
|
|
43
|
+
rule: '--report-descriptionless-disables',
|
|
44
|
+
message: `Disable for "${rule}" is missing a description`,
|
|
45
|
+
severity: options.severity,
|
|
46
|
+
node,
|
|
47
|
+
postcssResult,
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
}
|
package/packages/config-stylelint/node_modules/stylelint/lib/formatters/calcSeverityCounts.mjs
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { SEVERITY_ERROR, SEVERITY_WARNING } from '../constants.mjs';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* @import {Severity} from 'stylelint'
|
|
5
|
+
*
|
|
6
|
+
* @param {Severity} severity
|
|
7
|
+
* @param {Record<Severity, number>} counts
|
|
8
|
+
* @returns {void}
|
|
9
|
+
*/
|
|
10
|
+
export default function calcSeverityCounts(severity, counts) {
|
|
11
|
+
switch (severity) {
|
|
12
|
+
case SEVERITY_ERROR:
|
|
13
|
+
counts.error += 1;
|
|
14
|
+
break;
|
|
15
|
+
case SEVERITY_WARNING:
|
|
16
|
+
counts.warning += 1;
|
|
17
|
+
break;
|
|
18
|
+
default:
|
|
19
|
+
throw new Error(`Unknown severity: "${severity}"`);
|
|
20
|
+
}
|
|
21
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import preprocessWarnings from './preprocessWarnings.mjs';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* @type {import('stylelint').Formatter}
|
|
5
|
+
*/
|
|
6
|
+
export default function compactFormatter(results) {
|
|
7
|
+
const lines = results.flatMap((result) => {
|
|
8
|
+
const { warnings } = preprocessWarnings(result);
|
|
9
|
+
|
|
10
|
+
return warnings.map(
|
|
11
|
+
(warning) =>
|
|
12
|
+
`${result.source}: ` +
|
|
13
|
+
`line ${warning.line}, ` +
|
|
14
|
+
`col ${warning.column}, ` +
|
|
15
|
+
`${warning.severity} - ` +
|
|
16
|
+
`${warning.text}`,
|
|
17
|
+
);
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
lines.push('');
|
|
21
|
+
|
|
22
|
+
return lines.join('\n');
|
|
23
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/** @type {import('stylelint').PublicApi['formatters']} */
|
|
2
|
+
const formatters = {
|
|
3
|
+
get compact() {
|
|
4
|
+
return import('./compactFormatter.mjs').then((m) => m.default);
|
|
5
|
+
},
|
|
6
|
+
get json() {
|
|
7
|
+
return import('./jsonFormatter.mjs').then((m) => m.default);
|
|
8
|
+
},
|
|
9
|
+
get string() {
|
|
10
|
+
return import('./stringFormatter.mjs').then((m) => m.default);
|
|
11
|
+
},
|
|
12
|
+
get tap() {
|
|
13
|
+
return import('./tapFormatter.mjs').then((m) => m.default);
|
|
14
|
+
},
|
|
15
|
+
get unix() {
|
|
16
|
+
return import('./unixFormatter.mjs').then((m) => m.default);
|
|
17
|
+
},
|
|
18
|
+
get verbose() {
|
|
19
|
+
return import('./verboseFormatter.mjs').then((m) => m.default);
|
|
20
|
+
},
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
export default formatters;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Omit any properties starting with `_`, which are fake-private
|
|
3
|
+
*
|
|
4
|
+
* @type {import('stylelint').Formatter}
|
|
5
|
+
*/
|
|
6
|
+
export default function jsonFormatter(results) {
|
|
7
|
+
return JSON.stringify(results, (key, value) => {
|
|
8
|
+
return key[0] === '_' ? undefined : value;
|
|
9
|
+
});
|
|
10
|
+
}
|
package/packages/config-stylelint/node_modules/stylelint/lib/formatters/preprocessWarnings.mjs
ADDED
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { DEFAULT_SEVERITY, SEVERITY_ERROR } from '../constants.mjs';
|
|
2
|
+
|
|
3
|
+
/** @import {LintResult} from 'stylelint' */
|
|
4
|
+
/** @typedef {LintResult['parseErrors'][0]} ParseError */
|
|
5
|
+
/** @typedef {LintResult['warnings'][0]} Warning */
|
|
6
|
+
/** @typedef {Warning['severity']} Severity */
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Preprocess warnings in a given lint result.
|
|
10
|
+
* Note that this function has a side-effect.
|
|
11
|
+
*
|
|
12
|
+
* @param {LintResult} result
|
|
13
|
+
* @returns {LintResult}
|
|
14
|
+
*/
|
|
15
|
+
export default function preprocessWarnings(result) {
|
|
16
|
+
for (const error of result.parseErrors || []) {
|
|
17
|
+
result.warnings.push(parseErrorToWarning(error));
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
for (const warning of result.warnings) {
|
|
21
|
+
warning.severity = normalizeSeverity(warning);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
result.warnings.sort(byLocationOrder);
|
|
25
|
+
|
|
26
|
+
return result;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* @param {ParseError} error
|
|
31
|
+
* @returns {Warning}
|
|
32
|
+
*/
|
|
33
|
+
function parseErrorToWarning(error) {
|
|
34
|
+
return {
|
|
35
|
+
line: error.line,
|
|
36
|
+
column: error.column,
|
|
37
|
+
rule: error.stylelintType,
|
|
38
|
+
severity: SEVERITY_ERROR,
|
|
39
|
+
text: `${error.text} (${error.stylelintType})`,
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* @param {Warning} warning
|
|
45
|
+
* @returns {Severity}
|
|
46
|
+
*/
|
|
47
|
+
function normalizeSeverity(warning) {
|
|
48
|
+
// NOTE: Plugins may add a warning without severity, for example,
|
|
49
|
+
// by directly using the PostCSS `Result#warn()` API.
|
|
50
|
+
return warning.severity || DEFAULT_SEVERITY;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* @param {Warning} a
|
|
55
|
+
* @param {Warning} b
|
|
56
|
+
* @returns {number}
|
|
57
|
+
*/
|
|
58
|
+
function byLocationOrder(a, b) {
|
|
59
|
+
// positionless first
|
|
60
|
+
if (!a.line && b.line) return -1;
|
|
61
|
+
|
|
62
|
+
// positionless first
|
|
63
|
+
if (a.line && !b.line) return 1;
|
|
64
|
+
|
|
65
|
+
if (a.line < b.line) return -1;
|
|
66
|
+
|
|
67
|
+
if (a.line > b.line) return 1;
|
|
68
|
+
|
|
69
|
+
if (a.column < b.column) return -1;
|
|
70
|
+
|
|
71
|
+
if (a.column > b.column) return 1;
|
|
72
|
+
|
|
73
|
+
return 0;
|
|
74
|
+
}
|
|
@@ -0,0 +1,308 @@
|
|
|
1
|
+
import { relative, sep } from 'node:path';
|
|
2
|
+
import process from 'node:process';
|
|
3
|
+
|
|
4
|
+
import { getBorderCharacters, table } from 'table';
|
|
5
|
+
import picocolors from 'picocolors';
|
|
6
|
+
import stringWidth from 'string-width';
|
|
7
|
+
|
|
8
|
+
import { assertNumber } from '../utils/validateTypes.mjs';
|
|
9
|
+
import calcSeverityCounts from './calcSeverityCounts.mjs';
|
|
10
|
+
import isUnicodeSupported from '../utils/isUnicodeSupported.mjs';
|
|
11
|
+
import pluralize from '../utils/pluralize.mjs';
|
|
12
|
+
import preprocessWarnings from './preprocessWarnings.mjs';
|
|
13
|
+
import terminalLink from './terminalLink.mjs';
|
|
14
|
+
|
|
15
|
+
const { yellow, dim, underline, blue, red, green } = picocolors;
|
|
16
|
+
|
|
17
|
+
const NON_ASCII_PATTERN = /\P{ASCII}/u;
|
|
18
|
+
const MARGIN_WIDTHS = 9;
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* @param {string} s
|
|
22
|
+
* @returns {string}
|
|
23
|
+
*/
|
|
24
|
+
function identity(s) {
|
|
25
|
+
return s;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
const levelColors = {
|
|
29
|
+
info: blue,
|
|
30
|
+
warning: yellow,
|
|
31
|
+
error: red,
|
|
32
|
+
success: identity,
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
const supportsUnicode = isUnicodeSupported();
|
|
36
|
+
|
|
37
|
+
const symbols = {
|
|
38
|
+
info: blue(supportsUnicode ? 'ℹ' : 'i'),
|
|
39
|
+
warning: yellow(supportsUnicode ? '⚠' : '‼'),
|
|
40
|
+
error: red(supportsUnicode ? '✖' : '×'),
|
|
41
|
+
success: green(supportsUnicode ? '✔' : '√'),
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* @param {import('stylelint').LintResult[]} results
|
|
46
|
+
* @returns {string}
|
|
47
|
+
*/
|
|
48
|
+
function deprecationsFormatter(results) {
|
|
49
|
+
const allDeprecationWarnings = results.flatMap((result) => result.deprecations || []);
|
|
50
|
+
|
|
51
|
+
if (allDeprecationWarnings.length === 0) {
|
|
52
|
+
return '';
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
const seenText = new Set();
|
|
56
|
+
const lines = [];
|
|
57
|
+
|
|
58
|
+
for (const { text, reference } of allDeprecationWarnings) {
|
|
59
|
+
if (seenText.has(text)) continue;
|
|
60
|
+
|
|
61
|
+
seenText.add(text);
|
|
62
|
+
|
|
63
|
+
let line = ` ${dim('-')} ${text}`;
|
|
64
|
+
|
|
65
|
+
if (reference) {
|
|
66
|
+
line += dim(` See: ${underline(reference)}`);
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
lines.push(line);
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
return ['', yellow('Deprecation warnings:'), ...lines, ''].join('\n');
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
* @param {import('stylelint').LintResult[]} results
|
|
77
|
+
* @returns {string}
|
|
78
|
+
*/
|
|
79
|
+
function invalidOptionsFormatter(results) {
|
|
80
|
+
const allInvalidOptionWarnings = results.flatMap((result) =>
|
|
81
|
+
(result.invalidOptionWarnings || []).map((warning) => warning.text),
|
|
82
|
+
);
|
|
83
|
+
const uniqueInvalidOptionWarnings = [...new Set(allInvalidOptionWarnings)];
|
|
84
|
+
|
|
85
|
+
return uniqueInvalidOptionWarnings.reduce((output, warning) => {
|
|
86
|
+
output += red('Invalid Option: ');
|
|
87
|
+
output += warning;
|
|
88
|
+
|
|
89
|
+
return `${output}\n`;
|
|
90
|
+
}, '\n');
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
/**
|
|
94
|
+
* @param {string} fromValue
|
|
95
|
+
* @param {string} cwd
|
|
96
|
+
* @returns {string}
|
|
97
|
+
*/
|
|
98
|
+
function logFrom(fromValue, cwd) {
|
|
99
|
+
if (fromValue.startsWith('<')) {
|
|
100
|
+
return underline(fromValue);
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
const filePath = relative(cwd, fromValue).split(sep).join('/');
|
|
104
|
+
|
|
105
|
+
return terminalLink(filePath, `file://${fromValue}`);
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
/**
|
|
109
|
+
* @param {{[k: number]: number}} columnWidths
|
|
110
|
+
* @returns {number}
|
|
111
|
+
*/
|
|
112
|
+
function getMessageWidth(columnWidths) {
|
|
113
|
+
const width = columnWidths[3];
|
|
114
|
+
|
|
115
|
+
assertNumber(width);
|
|
116
|
+
|
|
117
|
+
if (!process.stdout.isTTY) {
|
|
118
|
+
return width;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
const availableWidth = process.stdout.columns < 80 ? 80 : process.stdout.columns;
|
|
122
|
+
const fullWidth = Object.values(columnWidths).reduce((a, b) => a + b);
|
|
123
|
+
|
|
124
|
+
// If there is no reason to wrap the text, we won't align the last column to the right
|
|
125
|
+
if (availableWidth > fullWidth + MARGIN_WIDTHS) {
|
|
126
|
+
return width;
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
return availableWidth - (fullWidth - width + MARGIN_WIDTHS);
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
/**
|
|
133
|
+
* @param {import('stylelint').Warning[]} messages
|
|
134
|
+
* @param {string} source
|
|
135
|
+
* @param {string} cwd
|
|
136
|
+
* @returns {string}
|
|
137
|
+
*/
|
|
138
|
+
function formatter(messages, source, cwd) {
|
|
139
|
+
if (messages.length === 0) return '';
|
|
140
|
+
|
|
141
|
+
/**
|
|
142
|
+
* Create a list of column widths, needed to calculate
|
|
143
|
+
* the size of the message column and if needed wrap it.
|
|
144
|
+
* @type {{[k: string]: number}}
|
|
145
|
+
*/
|
|
146
|
+
const columnWidths = { 0: 1, 1: 1, 2: 1, 3: 1, 4: 1 };
|
|
147
|
+
|
|
148
|
+
/**
|
|
149
|
+
* @param {[string, string, string, string, string]} columns
|
|
150
|
+
* @returns {[string, string, string, string, string]}
|
|
151
|
+
*/
|
|
152
|
+
function calculateWidths(columns) {
|
|
153
|
+
for (const [key, value] of Object.entries(columns)) {
|
|
154
|
+
const normalisedValue = value ? value.toString() : value;
|
|
155
|
+
const width = columnWidths[key];
|
|
156
|
+
|
|
157
|
+
assertNumber(width);
|
|
158
|
+
columnWidths[key] = Math.max(width, stringWidth(normalisedValue));
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
return columns;
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
let output = '\n';
|
|
165
|
+
|
|
166
|
+
if (source) {
|
|
167
|
+
output += `${logFrom(source, cwd)}\n`;
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
/**
|
|
171
|
+
* @param {import('stylelint').Warning} message
|
|
172
|
+
* @returns {string}
|
|
173
|
+
*/
|
|
174
|
+
function formatMessageText(message) {
|
|
175
|
+
let result = message.text;
|
|
176
|
+
|
|
177
|
+
result = result
|
|
178
|
+
// Remove all control characters (newline, tab and etc)
|
|
179
|
+
.replace(/[\u0001-\u001A]+/g, ' ') // eslint-disable-line no-control-regex
|
|
180
|
+
.replace(/\.$/, '');
|
|
181
|
+
|
|
182
|
+
const ruleString = ` (${message.rule})`;
|
|
183
|
+
|
|
184
|
+
if (result.endsWith(ruleString)) {
|
|
185
|
+
result = result.slice(0, result.lastIndexOf(ruleString));
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
return result;
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
const cleanedMessages = messages.map((message) => {
|
|
192
|
+
const { line, column, severity } = message;
|
|
193
|
+
/**
|
|
194
|
+
* @type {[string, string, string, string, string]}
|
|
195
|
+
*/
|
|
196
|
+
const row = [
|
|
197
|
+
line ? line.toString() : '',
|
|
198
|
+
column ? column.toString() : '',
|
|
199
|
+
symbols[severity] ? levelColors[severity](symbols[severity]) : severity,
|
|
200
|
+
formatMessageText(message),
|
|
201
|
+
dim(message.rule || ''),
|
|
202
|
+
];
|
|
203
|
+
|
|
204
|
+
calculateWidths(row);
|
|
205
|
+
|
|
206
|
+
return row;
|
|
207
|
+
});
|
|
208
|
+
|
|
209
|
+
const messageWidth = getMessageWidth(columnWidths);
|
|
210
|
+
const hasNonAsciiChar = messages.some((msg) => NON_ASCII_PATTERN.test(msg.text));
|
|
211
|
+
|
|
212
|
+
output += table(cleanedMessages, {
|
|
213
|
+
border: getBorderCharacters('void'),
|
|
214
|
+
columns: {
|
|
215
|
+
0: { alignment: 'right', width: columnWidths[0], paddingRight: 0, paddingLeft: 2 },
|
|
216
|
+
1: { alignment: 'left', width: columnWidths[1] },
|
|
217
|
+
2: { alignment: 'center', width: columnWidths[2] },
|
|
218
|
+
3: {
|
|
219
|
+
alignment: 'left',
|
|
220
|
+
width: messageWidth,
|
|
221
|
+
wrapWord: messageWidth > 1 && !hasNonAsciiChar,
|
|
222
|
+
},
|
|
223
|
+
4: { alignment: 'left', width: columnWidths[4], paddingRight: 0 },
|
|
224
|
+
},
|
|
225
|
+
drawHorizontalLine: () => false,
|
|
226
|
+
})
|
|
227
|
+
.split('\n')
|
|
228
|
+
.map((el) => el.replace(/(\d+)\s+(\d+)/, (_m, p1, p2) => dim(`${p1}:${p2}`)).trimEnd())
|
|
229
|
+
.join('\n');
|
|
230
|
+
|
|
231
|
+
return output;
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
/**
|
|
235
|
+
* @type {import('stylelint').Formatter}
|
|
236
|
+
*/
|
|
237
|
+
export default function stringFormatter(results, returnValue) {
|
|
238
|
+
let output = invalidOptionsFormatter(results);
|
|
239
|
+
|
|
240
|
+
output += deprecationsFormatter(results);
|
|
241
|
+
|
|
242
|
+
const resultCounts = { error: 0, warning: 0 };
|
|
243
|
+
const fixableCounts = { error: 0, warning: 0 };
|
|
244
|
+
|
|
245
|
+
output = results.reduce((accum, result) => {
|
|
246
|
+
preprocessWarnings(result);
|
|
247
|
+
|
|
248
|
+
accum += formatter(
|
|
249
|
+
result.warnings,
|
|
250
|
+
result.source || '',
|
|
251
|
+
(returnValue && returnValue.cwd) || process.cwd(),
|
|
252
|
+
);
|
|
253
|
+
|
|
254
|
+
for (const warning of result.warnings) {
|
|
255
|
+
calcSeverityCounts(warning.severity, resultCounts);
|
|
256
|
+
const fixable = returnValue.ruleMetadata?.[warning.rule]?.fixable;
|
|
257
|
+
|
|
258
|
+
if (fixable === true) {
|
|
259
|
+
calcSeverityCounts(warning.severity, fixableCounts);
|
|
260
|
+
}
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
return accum;
|
|
264
|
+
}, output);
|
|
265
|
+
|
|
266
|
+
// Ensure consistent padding
|
|
267
|
+
output = output.trim();
|
|
268
|
+
|
|
269
|
+
if (output !== '') {
|
|
270
|
+
output = `\n${output}\n`;
|
|
271
|
+
|
|
272
|
+
const errorCount = resultCounts.error;
|
|
273
|
+
const warningCount = resultCounts.warning;
|
|
274
|
+
const total = errorCount + warningCount;
|
|
275
|
+
|
|
276
|
+
if (total > 0) {
|
|
277
|
+
const error = red(`${errorCount} ${pluralize('error', errorCount)}`);
|
|
278
|
+
const warning = yellow(`${warningCount} ${pluralize('warning', warningCount)}`);
|
|
279
|
+
const symbol = errorCount > 0 ? symbols.error : symbols.warning;
|
|
280
|
+
|
|
281
|
+
output += `\n${symbol} ${total} ${pluralize('problem', total)} (${error}, ${warning})`;
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
const fixErrorCount = fixableCounts.error;
|
|
285
|
+
const fixWarningCount = fixableCounts.warning;
|
|
286
|
+
|
|
287
|
+
if (fixErrorCount > 0 || fixWarningCount > 0) {
|
|
288
|
+
let fixErrorText;
|
|
289
|
+
let fixWarningText;
|
|
290
|
+
|
|
291
|
+
if (fixErrorCount > 0) {
|
|
292
|
+
fixErrorText = `${fixErrorCount} ${pluralize('error', fixErrorCount)}`;
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
if (fixWarningCount > 0) {
|
|
296
|
+
fixWarningText = `${fixWarningCount} ${pluralize('warning', fixWarningCount)}`;
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
const countText = [fixErrorText, fixWarningText].filter(Boolean).join(' and ');
|
|
300
|
+
|
|
301
|
+
output += `\n ${countText} potentially fixable with the "--fix" option.`;
|
|
302
|
+
}
|
|
303
|
+
|
|
304
|
+
output += '\n\n';
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
return output;
|
|
308
|
+
}
|