@spiracss/stylelint-plugin 0.3.4 → 0.4.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/README.md +9 -27
- package/dist/esm/helpers.d.ts +10 -3
- package/dist/esm/helpers.d.ts.map +1 -1
- package/dist/esm/helpers.js +19 -99
- package/dist/esm/helpers.js.map +1 -1
- package/dist/esm/index.js +1 -1
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/rules/spiracss-property-placement.js +1 -1
- package/dist/esm/rules/spiracss-property-placement.js.map +1 -1
- package/dist/esm/rules/spiracss-property-placement.messages.d.ts.map +1 -1
- package/dist/esm/rules/spiracss-property-placement.messages.js +7 -6
- package/dist/esm/rules/spiracss-property-placement.messages.js.map +1 -1
- package/package.json +9 -19
- package/dist/cjs/helpers.d.ts +0 -152
- package/dist/cjs/helpers.d.ts.map +0 -1
- package/dist/cjs/helpers.js +0 -483
- package/dist/cjs/helpers.js.map +0 -1
- package/dist/cjs/index.d.ts +0 -4
- package/dist/cjs/index.d.ts.map +0 -1
- package/dist/cjs/index.js +0 -31
- package/dist/cjs/index.js.map +0 -1
- package/dist/cjs/package.json +0 -3
- package/dist/cjs/rules/spiracss-class-structure.constants.d.ts +0 -2
- package/dist/cjs/rules/spiracss-class-structure.constants.d.ts.map +0 -1
- package/dist/cjs/rules/spiracss-class-structure.constants.js +0 -5
- package/dist/cjs/rules/spiracss-class-structure.constants.js.map +0 -1
- package/dist/cjs/rules/spiracss-class-structure.d.ts +0 -5
- package/dist/cjs/rules/spiracss-class-structure.d.ts.map +0 -1
- package/dist/cjs/rules/spiracss-class-structure.js +0 -398
- package/dist/cjs/rules/spiracss-class-structure.js.map +0 -1
- package/dist/cjs/rules/spiracss-class-structure.messages.d.ts +0 -24
- package/dist/cjs/rules/spiracss-class-structure.messages.d.ts.map +0 -1
- package/dist/cjs/rules/spiracss-class-structure.messages.js +0 -69
- package/dist/cjs/rules/spiracss-class-structure.messages.js.map +0 -1
- package/dist/cjs/rules/spiracss-class-structure.options.d.ts +0 -4
- package/dist/cjs/rules/spiracss-class-structure.options.d.ts.map +0 -1
- package/dist/cjs/rules/spiracss-class-structure.options.js +0 -155
- package/dist/cjs/rules/spiracss-class-structure.options.js.map +0 -1
- package/dist/cjs/rules/spiracss-class-structure.patterns.d.ts +0 -17
- package/dist/cjs/rules/spiracss-class-structure.patterns.d.ts.map +0 -1
- package/dist/cjs/rules/spiracss-class-structure.patterns.js +0 -184
- package/dist/cjs/rules/spiracss-class-structure.patterns.js.map +0 -1
- package/dist/cjs/rules/spiracss-class-structure.sections.d.ts +0 -6
- package/dist/cjs/rules/spiracss-class-structure.sections.d.ts.map +0 -1
- package/dist/cjs/rules/spiracss-class-structure.sections.js +0 -13
- package/dist/cjs/rules/spiracss-class-structure.sections.js.map +0 -1
- package/dist/cjs/rules/spiracss-class-structure.selectors.d.ts +0 -34
- package/dist/cjs/rules/spiracss-class-structure.selectors.d.ts.map +0 -1
- package/dist/cjs/rules/spiracss-class-structure.selectors.js +0 -325
- package/dist/cjs/rules/spiracss-class-structure.selectors.js.map +0 -1
- package/dist/cjs/rules/spiracss-class-structure.types.d.ts +0 -79
- package/dist/cjs/rules/spiracss-class-structure.types.d.ts.map +0 -1
- package/dist/cjs/rules/spiracss-class-structure.types.js +0 -3
- package/dist/cjs/rules/spiracss-class-structure.types.js.map +0 -1
- package/dist/cjs/rules/spiracss-interaction-properties.constants.d.ts +0 -2
- package/dist/cjs/rules/spiracss-interaction-properties.constants.d.ts.map +0 -1
- package/dist/cjs/rules/spiracss-interaction-properties.constants.js +0 -5
- package/dist/cjs/rules/spiracss-interaction-properties.constants.js.map +0 -1
- package/dist/cjs/rules/spiracss-interaction-properties.d.ts +0 -5
- package/dist/cjs/rules/spiracss-interaction-properties.d.ts.map +0 -1
- package/dist/cjs/rules/spiracss-interaction-properties.js +0 -537
- package/dist/cjs/rules/spiracss-interaction-properties.js.map +0 -1
- package/dist/cjs/rules/spiracss-interaction-properties.messages.d.ts +0 -11
- package/dist/cjs/rules/spiracss-interaction-properties.messages.d.ts.map +0 -1
- package/dist/cjs/rules/spiracss-interaction-properties.messages.js +0 -22
- package/dist/cjs/rules/spiracss-interaction-properties.messages.js.map +0 -1
- package/dist/cjs/rules/spiracss-interaction-properties.options.d.ts +0 -4
- package/dist/cjs/rules/spiracss-interaction-properties.options.d.ts.map +0 -1
- package/dist/cjs/rules/spiracss-interaction-properties.options.js +0 -25
- package/dist/cjs/rules/spiracss-interaction-properties.options.js.map +0 -1
- package/dist/cjs/rules/spiracss-interaction-properties.types.d.ts +0 -14
- package/dist/cjs/rules/spiracss-interaction-properties.types.d.ts.map +0 -1
- package/dist/cjs/rules/spiracss-interaction-properties.types.js +0 -3
- package/dist/cjs/rules/spiracss-interaction-properties.types.js.map +0 -1
- package/dist/cjs/rules/spiracss-interaction-scope.constants.d.ts +0 -2
- package/dist/cjs/rules/spiracss-interaction-scope.constants.d.ts.map +0 -1
- package/dist/cjs/rules/spiracss-interaction-scope.constants.js +0 -5
- package/dist/cjs/rules/spiracss-interaction-scope.constants.js.map +0 -1
- package/dist/cjs/rules/spiracss-interaction-scope.d.ts +0 -5
- package/dist/cjs/rules/spiracss-interaction-scope.d.ts.map +0 -1
- package/dist/cjs/rules/spiracss-interaction-scope.js +0 -173
- package/dist/cjs/rules/spiracss-interaction-scope.js.map +0 -1
- package/dist/cjs/rules/spiracss-interaction-scope.messages.d.ts +0 -10
- package/dist/cjs/rules/spiracss-interaction-scope.messages.d.ts.map +0 -1
- package/dist/cjs/rules/spiracss-interaction-scope.messages.js +0 -15
- package/dist/cjs/rules/spiracss-interaction-scope.messages.js.map +0 -1
- package/dist/cjs/rules/spiracss-interaction-scope.options.d.ts +0 -4
- package/dist/cjs/rules/spiracss-interaction-scope.options.d.ts.map +0 -1
- package/dist/cjs/rules/spiracss-interaction-scope.options.js +0 -54
- package/dist/cjs/rules/spiracss-interaction-scope.options.js.map +0 -1
- package/dist/cjs/rules/spiracss-interaction-scope.types.d.ts +0 -31
- package/dist/cjs/rules/spiracss-interaction-scope.types.d.ts.map +0 -1
- package/dist/cjs/rules/spiracss-interaction-scope.types.js +0 -3
- package/dist/cjs/rules/spiracss-interaction-scope.types.js.map +0 -1
- package/dist/cjs/rules/spiracss-interaction-scope.utils.d.ts +0 -13
- package/dist/cjs/rules/spiracss-interaction-scope.utils.d.ts.map +0 -1
- package/dist/cjs/rules/spiracss-interaction-scope.utils.js +0 -159
- package/dist/cjs/rules/spiracss-interaction-scope.utils.js.map +0 -1
- package/dist/cjs/rules/spiracss-keyframes-naming.constants.d.ts +0 -2
- package/dist/cjs/rules/spiracss-keyframes-naming.constants.d.ts.map +0 -1
- package/dist/cjs/rules/spiracss-keyframes-naming.constants.js +0 -5
- package/dist/cjs/rules/spiracss-keyframes-naming.constants.js.map +0 -1
- package/dist/cjs/rules/spiracss-keyframes-naming.d.ts +0 -5
- package/dist/cjs/rules/spiracss-keyframes-naming.d.ts.map +0 -1
- package/dist/cjs/rules/spiracss-keyframes-naming.js +0 -355
- package/dist/cjs/rules/spiracss-keyframes-naming.js.map +0 -1
- package/dist/cjs/rules/spiracss-keyframes-naming.messages.d.ts +0 -12
- package/dist/cjs/rules/spiracss-keyframes-naming.messages.d.ts.map +0 -1
- package/dist/cjs/rules/spiracss-keyframes-naming.messages.js +0 -18
- package/dist/cjs/rules/spiracss-keyframes-naming.messages.js.map +0 -1
- package/dist/cjs/rules/spiracss-keyframes-naming.options.d.ts +0 -4
- package/dist/cjs/rules/spiracss-keyframes-naming.options.d.ts.map +0 -1
- package/dist/cjs/rules/spiracss-keyframes-naming.options.js +0 -150
- package/dist/cjs/rules/spiracss-keyframes-naming.options.js.map +0 -1
- package/dist/cjs/rules/spiracss-keyframes-naming.types.d.ts +0 -27
- package/dist/cjs/rules/spiracss-keyframes-naming.types.d.ts.map +0 -1
- package/dist/cjs/rules/spiracss-keyframes-naming.types.js +0 -3
- package/dist/cjs/rules/spiracss-keyframes-naming.types.js.map +0 -1
- package/dist/cjs/rules/spiracss-page-layer.constants.d.ts +0 -2
- package/dist/cjs/rules/spiracss-page-layer.constants.d.ts.map +0 -1
- package/dist/cjs/rules/spiracss-page-layer.constants.js +0 -5
- package/dist/cjs/rules/spiracss-page-layer.constants.js.map +0 -1
- package/dist/cjs/rules/spiracss-page-layer.d.ts +0 -5
- package/dist/cjs/rules/spiracss-page-layer.d.ts.map +0 -1
- package/dist/cjs/rules/spiracss-page-layer.js +0 -243
- package/dist/cjs/rules/spiracss-page-layer.js.map +0 -1
- package/dist/cjs/rules/spiracss-page-layer.messages.d.ts +0 -7
- package/dist/cjs/rules/spiracss-page-layer.messages.d.ts.map +0 -1
- package/dist/cjs/rules/spiracss-page-layer.messages.js +0 -16
- package/dist/cjs/rules/spiracss-page-layer.messages.js.map +0 -1
- package/dist/cjs/rules/spiracss-page-layer.options.d.ts +0 -4
- package/dist/cjs/rules/spiracss-page-layer.options.d.ts.map +0 -1
- package/dist/cjs/rules/spiracss-page-layer.options.js +0 -59
- package/dist/cjs/rules/spiracss-page-layer.options.js.map +0 -1
- package/dist/cjs/rules/spiracss-page-layer.types.d.ts +0 -19
- package/dist/cjs/rules/spiracss-page-layer.types.d.ts.map +0 -1
- package/dist/cjs/rules/spiracss-page-layer.types.js +0 -3
- package/dist/cjs/rules/spiracss-page-layer.types.js.map +0 -1
- package/dist/cjs/rules/spiracss-property-placement.constants.d.ts +0 -2
- package/dist/cjs/rules/spiracss-property-placement.constants.d.ts.map +0 -1
- package/dist/cjs/rules/spiracss-property-placement.constants.js +0 -5
- package/dist/cjs/rules/spiracss-property-placement.constants.js.map +0 -1
- package/dist/cjs/rules/spiracss-property-placement.d.ts +0 -5
- package/dist/cjs/rules/spiracss-property-placement.d.ts.map +0 -1
- package/dist/cjs/rules/spiracss-property-placement.js +0 -673
- package/dist/cjs/rules/spiracss-property-placement.js.map +0 -1
- package/dist/cjs/rules/spiracss-property-placement.messages.d.ts +0 -19
- package/dist/cjs/rules/spiracss-property-placement.messages.d.ts.map +0 -1
- package/dist/cjs/rules/spiracss-property-placement.messages.js +0 -110
- package/dist/cjs/rules/spiracss-property-placement.messages.js.map +0 -1
- package/dist/cjs/rules/spiracss-property-placement.options.d.ts +0 -4
- package/dist/cjs/rules/spiracss-property-placement.options.d.ts.map +0 -1
- package/dist/cjs/rules/spiracss-property-placement.options.js +0 -74
- package/dist/cjs/rules/spiracss-property-placement.options.js.map +0 -1
- package/dist/cjs/rules/spiracss-property-placement.selectors.d.ts +0 -40
- package/dist/cjs/rules/spiracss-property-placement.selectors.d.ts.map +0 -1
- package/dist/cjs/rules/spiracss-property-placement.selectors.js +0 -1047
- package/dist/cjs/rules/spiracss-property-placement.selectors.js.map +0 -1
- package/dist/cjs/rules/spiracss-property-placement.types.d.ts +0 -28
- package/dist/cjs/rules/spiracss-property-placement.types.d.ts.map +0 -1
- package/dist/cjs/rules/spiracss-property-placement.types.js +0 -3
- package/dist/cjs/rules/spiracss-property-placement.types.js.map +0 -1
- package/dist/cjs/rules/spiracss-property-placement.values.d.ts +0 -19
- package/dist/cjs/rules/spiracss-property-placement.values.d.ts.map +0 -1
- package/dist/cjs/rules/spiracss-property-placement.values.js +0 -176
- package/dist/cjs/rules/spiracss-property-placement.values.js.map +0 -1
- package/dist/cjs/rules/spiracss-pseudo-nesting.constants.d.ts +0 -2
- package/dist/cjs/rules/spiracss-pseudo-nesting.constants.d.ts.map +0 -1
- package/dist/cjs/rules/spiracss-pseudo-nesting.constants.js +0 -5
- package/dist/cjs/rules/spiracss-pseudo-nesting.constants.js.map +0 -1
- package/dist/cjs/rules/spiracss-pseudo-nesting.d.ts +0 -5
- package/dist/cjs/rules/spiracss-pseudo-nesting.d.ts.map +0 -1
- package/dist/cjs/rules/spiracss-pseudo-nesting.js +0 -114
- package/dist/cjs/rules/spiracss-pseudo-nesting.js.map +0 -1
- package/dist/cjs/rules/spiracss-pseudo-nesting.messages.d.ts +0 -6
- package/dist/cjs/rules/spiracss-pseudo-nesting.messages.d.ts.map +0 -1
- package/dist/cjs/rules/spiracss-pseudo-nesting.messages.js +0 -10
- package/dist/cjs/rules/spiracss-pseudo-nesting.messages.js.map +0 -1
- package/dist/cjs/rules/spiracss-pseudo-nesting.types.d.ts +0 -5
- package/dist/cjs/rules/spiracss-pseudo-nesting.types.d.ts.map +0 -1
- package/dist/cjs/rules/spiracss-pseudo-nesting.types.js +0 -3
- package/dist/cjs/rules/spiracss-pseudo-nesting.types.js.map +0 -1
- package/dist/cjs/rules/spiracss-rel-comments.alias.d.ts +0 -6
- package/dist/cjs/rules/spiracss-rel-comments.alias.d.ts.map +0 -1
- package/dist/cjs/rules/spiracss-rel-comments.alias.js +0 -152
- package/dist/cjs/rules/spiracss-rel-comments.alias.js.map +0 -1
- package/dist/cjs/rules/spiracss-rel-comments.constants.d.ts +0 -2
- package/dist/cjs/rules/spiracss-rel-comments.constants.d.ts.map +0 -1
- package/dist/cjs/rules/spiracss-rel-comments.constants.js +0 -5
- package/dist/cjs/rules/spiracss-rel-comments.constants.js.map +0 -1
- package/dist/cjs/rules/spiracss-rel-comments.d.ts +0 -5
- package/dist/cjs/rules/spiracss-rel-comments.d.ts.map +0 -1
- package/dist/cjs/rules/spiracss-rel-comments.js +0 -427
- package/dist/cjs/rules/spiracss-rel-comments.js.map +0 -1
- package/dist/cjs/rules/spiracss-rel-comments.messages.d.ts +0 -11
- package/dist/cjs/rules/spiracss-rel-comments.messages.d.ts.map +0 -1
- package/dist/cjs/rules/spiracss-rel-comments.messages.js +0 -23
- package/dist/cjs/rules/spiracss-rel-comments.messages.js.map +0 -1
- package/dist/cjs/rules/spiracss-rel-comments.options.d.ts +0 -4
- package/dist/cjs/rules/spiracss-rel-comments.options.d.ts.map +0 -1
- package/dist/cjs/rules/spiracss-rel-comments.options.js +0 -101
- package/dist/cjs/rules/spiracss-rel-comments.options.js.map +0 -1
- package/dist/cjs/rules/spiracss-rel-comments.root.d.ts +0 -9
- package/dist/cjs/rules/spiracss-rel-comments.root.d.ts.map +0 -1
- package/dist/cjs/rules/spiracss-rel-comments.root.js +0 -121
- package/dist/cjs/rules/spiracss-rel-comments.root.js.map +0 -1
- package/dist/cjs/rules/spiracss-rel-comments.selectors.d.ts +0 -6
- package/dist/cjs/rules/spiracss-rel-comments.selectors.d.ts.map +0 -1
- package/dist/cjs/rules/spiracss-rel-comments.selectors.js +0 -78
- package/dist/cjs/rules/spiracss-rel-comments.selectors.js.map +0 -1
- package/dist/cjs/rules/spiracss-rel-comments.types.d.ts +0 -42
- package/dist/cjs/rules/spiracss-rel-comments.types.d.ts.map +0 -1
- package/dist/cjs/rules/spiracss-rel-comments.types.js +0 -3
- package/dist/cjs/rules/spiracss-rel-comments.types.js.map +0 -1
- package/dist/cjs/types.d.ts +0 -78
- package/dist/cjs/types.d.ts.map +0 -1
- package/dist/cjs/types.js +0 -3
- package/dist/cjs/types.js.map +0 -1
- package/dist/cjs/utils/cache.d.ts +0 -18
- package/dist/cjs/utils/cache.d.ts.map +0 -1
- package/dist/cjs/utils/cache.js +0 -94
- package/dist/cjs/utils/cache.js.map +0 -1
- package/dist/cjs/utils/constants.d.ts +0 -4
- package/dist/cjs/utils/constants.d.ts.map +0 -1
- package/dist/cjs/utils/constants.js +0 -32
- package/dist/cjs/utils/constants.js.map +0 -1
- package/dist/cjs/utils/formatting.d.ts +0 -10
- package/dist/cjs/utils/formatting.d.ts.map +0 -1
- package/dist/cjs/utils/formatting.js +0 -51
- package/dist/cjs/utils/formatting.js.map +0 -1
- package/dist/cjs/utils/messages.d.ts +0 -25
- package/dist/cjs/utils/messages.d.ts.map +0 -1
- package/dist/cjs/utils/messages.js +0 -174
- package/dist/cjs/utils/messages.js.map +0 -1
- package/dist/cjs/utils/naming.d.ts +0 -12
- package/dist/cjs/utils/naming.d.ts.map +0 -1
- package/dist/cjs/utils/naming.js +0 -70
- package/dist/cjs/utils/naming.js.map +0 -1
- package/dist/cjs/utils/normalize.d.ts +0 -12
- package/dist/cjs/utils/normalize.d.ts.map +0 -1
- package/dist/cjs/utils/normalize.js +0 -194
- package/dist/cjs/utils/normalize.js.map +0 -1
- package/dist/cjs/utils/option-schema.d.ts +0 -19
- package/dist/cjs/utils/option-schema.d.ts.map +0 -1
- package/dist/cjs/utils/option-schema.js +0 -23
- package/dist/cjs/utils/option-schema.js.map +0 -1
- package/dist/cjs/utils/options.d.ts +0 -34
- package/dist/cjs/utils/options.d.ts.map +0 -1
- package/dist/cjs/utils/options.js +0 -41
- package/dist/cjs/utils/options.js.map +0 -1
- package/dist/cjs/utils/postcss-helpers.d.ts +0 -9
- package/dist/cjs/utils/postcss-helpers.d.ts.map +0 -1
- package/dist/cjs/utils/postcss-helpers.js +0 -37
- package/dist/cjs/utils/postcss-helpers.js.map +0 -1
- package/dist/cjs/utils/rule-docs.d.ts +0 -2
- package/dist/cjs/utils/rule-docs.d.ts.map +0 -1
- package/dist/cjs/utils/rule-docs.js +0 -22
- package/dist/cjs/utils/rule-docs.js.map +0 -1
- package/dist/cjs/utils/section.d.ts +0 -17
- package/dist/cjs/utils/section.d.ts.map +0 -1
- package/dist/cjs/utils/section.js +0 -130
- package/dist/cjs/utils/section.js.map +0 -1
- package/dist/cjs/utils/selector-policy.d.ts +0 -16
- package/dist/cjs/utils/selector-policy.d.ts.map +0 -1
- package/dist/cjs/utils/selector-policy.js +0 -57
- package/dist/cjs/utils/selector-policy.js.map +0 -1
- package/dist/cjs/utils/selector.d.ts +0 -42
- package/dist/cjs/utils/selector.d.ts.map +0 -1
- package/dist/cjs/utils/selector.js +0 -238
- package/dist/cjs/utils/selector.js.map +0 -1
- package/dist/cjs/utils/stylelint.d.ts +0 -14
- package/dist/cjs/utils/stylelint.d.ts.map +0 -1
- package/dist/cjs/utils/stylelint.js +0 -67
- package/dist/cjs/utils/stylelint.js.map +0 -1
- package/dist/cjs/utils/validate.d.ts +0 -9
- package/dist/cjs/utils/validate.d.ts.map +0 -1
- package/dist/cjs/utils/validate.js +0 -35
- package/dist/cjs/utils/validate.js.map +0 -1
|
@@ -1,673 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.ruleName = void 0;
|
|
7
|
-
const stylelint_1 = __importDefault(require("stylelint"));
|
|
8
|
-
const constants_1 = require("../utils/constants");
|
|
9
|
-
const messages_1 = require("../utils/messages");
|
|
10
|
-
const naming_1 = require("../utils/naming");
|
|
11
|
-
const option_schema_1 = require("../utils/option-schema");
|
|
12
|
-
const postcss_helpers_1 = require("../utils/postcss-helpers");
|
|
13
|
-
const rule_docs_1 = require("../utils/rule-docs");
|
|
14
|
-
const section_1 = require("../utils/section");
|
|
15
|
-
const selector_1 = require("../utils/selector");
|
|
16
|
-
const selector_policy_1 = require("../utils/selector-policy");
|
|
17
|
-
const stylelint_2 = require("../utils/stylelint");
|
|
18
|
-
const validate_1 = require("../utils/validate");
|
|
19
|
-
const spiracss_class_structure_patterns_1 = require("./spiracss-class-structure.patterns");
|
|
20
|
-
const spiracss_class_structure_sections_1 = require("./spiracss-class-structure.sections");
|
|
21
|
-
const spiracss_class_structure_selectors_1 = require("./spiracss-class-structure.selectors");
|
|
22
|
-
const spiracss_property_placement_constants_1 = require("./spiracss-property-placement.constants");
|
|
23
|
-
Object.defineProperty(exports, "ruleName", { enumerable: true, get: function () { return spiracss_property_placement_constants_1.ruleName; } });
|
|
24
|
-
const spiracss_property_placement_messages_1 = require("./spiracss-property-placement.messages");
|
|
25
|
-
const spiracss_property_placement_options_1 = require("./spiracss-property-placement.options");
|
|
26
|
-
const spiracss_property_placement_selectors_1 = require("./spiracss-property-placement.selectors");
|
|
27
|
-
const spiracss_property_placement_values_1 = require("./spiracss-property-placement.values");
|
|
28
|
-
const meta = {
|
|
29
|
-
url: (0, rule_docs_1.getRuleDocsUrl)(spiracss_property_placement_constants_1.ruleName),
|
|
30
|
-
fixable: false,
|
|
31
|
-
description: 'Enforce SpiraCSS property placement rules (container/item/internal).',
|
|
32
|
-
category: 'stylistic'
|
|
33
|
-
};
|
|
34
|
-
const optionSchema = {
|
|
35
|
-
elementDepth: [validate_1.isNumber],
|
|
36
|
-
marginSide: [validate_1.isString],
|
|
37
|
-
position: [validate_1.isBoolean],
|
|
38
|
-
sizeInternal: [validate_1.isBoolean],
|
|
39
|
-
responsiveMixins: [validate_1.isString],
|
|
40
|
-
...option_schema_1.NAMING_SCHEMA,
|
|
41
|
-
...option_schema_1.COMMENTS_SCHEMA,
|
|
42
|
-
...option_schema_1.POLICY_SCHEMA,
|
|
43
|
-
...option_schema_1.EXTERNAL_SCHEMA,
|
|
44
|
-
...option_schema_1.CACHE_SCHEMA
|
|
45
|
-
};
|
|
46
|
-
const CONTAINER_PROP_NAMES = new Set([
|
|
47
|
-
'flex-direction',
|
|
48
|
-
'flex-wrap',
|
|
49
|
-
'gap',
|
|
50
|
-
'row-gap',
|
|
51
|
-
'column-gap',
|
|
52
|
-
'justify-content',
|
|
53
|
-
'justify-items',
|
|
54
|
-
'align-content',
|
|
55
|
-
'align-items'
|
|
56
|
-
]);
|
|
57
|
-
const ITEM_PROP_NAMES = new Set([
|
|
58
|
-
'margin',
|
|
59
|
-
'margin-top',
|
|
60
|
-
'margin-bottom',
|
|
61
|
-
'margin-left',
|
|
62
|
-
'margin-right',
|
|
63
|
-
'margin-inline',
|
|
64
|
-
'margin-inline-start',
|
|
65
|
-
'margin-inline-end',
|
|
66
|
-
'margin-block',
|
|
67
|
-
'margin-block-start',
|
|
68
|
-
'margin-block-end',
|
|
69
|
-
'flex',
|
|
70
|
-
'flex-grow',
|
|
71
|
-
'flex-shrink',
|
|
72
|
-
'flex-basis',
|
|
73
|
-
'order',
|
|
74
|
-
'align-self',
|
|
75
|
-
'justify-self',
|
|
76
|
-
'grid-column',
|
|
77
|
-
'grid-row',
|
|
78
|
-
'grid-area'
|
|
79
|
-
]);
|
|
80
|
-
const MARGIN_SIDE_PROP_NAMES = new Set([
|
|
81
|
-
'margin',
|
|
82
|
-
'margin-top',
|
|
83
|
-
'margin-bottom',
|
|
84
|
-
'margin-block',
|
|
85
|
-
'margin-block-start',
|
|
86
|
-
'margin-block-end'
|
|
87
|
-
]);
|
|
88
|
-
const DISPLAY_ALLOWED = new Set(['flex', 'inline-flex', 'grid', 'inline-grid']);
|
|
89
|
-
const OVERFLOW_PROP_NAMES = new Set(['overflow', 'overflow-x', 'overflow-y']);
|
|
90
|
-
const OFFSET_PROP_NAMES = new Set([
|
|
91
|
-
'top',
|
|
92
|
-
'right',
|
|
93
|
-
'bottom',
|
|
94
|
-
'left',
|
|
95
|
-
'inset',
|
|
96
|
-
'inset-block',
|
|
97
|
-
'inset-inline',
|
|
98
|
-
'inset-block-start',
|
|
99
|
-
'inset-block-end',
|
|
100
|
-
'inset-inline-start',
|
|
101
|
-
'inset-inline-end'
|
|
102
|
-
]);
|
|
103
|
-
const isPaddingProp = (prop) => prop === 'padding' || prop.startsWith('padding-');
|
|
104
|
-
const isContainerProp = (decl) => {
|
|
105
|
-
const prop = decl.prop.toLowerCase();
|
|
106
|
-
if (prop === 'display') {
|
|
107
|
-
const tokens = decl.value
|
|
108
|
-
.trim()
|
|
109
|
-
.toLowerCase()
|
|
110
|
-
.split(/\s+|!/)
|
|
111
|
-
.filter((token) => token.length > 0 && token !== 'important');
|
|
112
|
-
return tokens.some((token) => DISPLAY_ALLOWED.has(token));
|
|
113
|
-
}
|
|
114
|
-
if (prop === 'grid')
|
|
115
|
-
return true;
|
|
116
|
-
if (prop === 'grid-template' || prop.startsWith('grid-template-'))
|
|
117
|
-
return true;
|
|
118
|
-
if (prop.startsWith('grid-auto-'))
|
|
119
|
-
return true;
|
|
120
|
-
return CONTAINER_PROP_NAMES.has(prop);
|
|
121
|
-
};
|
|
122
|
-
const isItemProp = (prop) => ITEM_PROP_NAMES.has(prop);
|
|
123
|
-
const isMarginSideProp = (prop) => MARGIN_SIDE_PROP_NAMES.has(prop);
|
|
124
|
-
const isOverflowProp = (prop) => OVERFLOW_PROP_NAMES.has(prop);
|
|
125
|
-
const isSizeInternalProp = (prop) => prop === 'width' ||
|
|
126
|
-
prop === 'height' ||
|
|
127
|
-
prop === 'inline-size' ||
|
|
128
|
-
prop === 'block-size' ||
|
|
129
|
-
prop.startsWith('min-') ||
|
|
130
|
-
prop.startsWith('max-');
|
|
131
|
-
const isInternalProp = (prop, enableSizeInternal) => isPaddingProp(prop) ||
|
|
132
|
-
isOverflowProp(prop) ||
|
|
133
|
-
(enableSizeInternal && isSizeInternalProp(prop));
|
|
134
|
-
const isInsideAtRoot = (node) => {
|
|
135
|
-
let current = node.parent ?? undefined;
|
|
136
|
-
while (current) {
|
|
137
|
-
if ((0, postcss_helpers_1.isAtRule)(current) && current.name === 'at-root')
|
|
138
|
-
return true;
|
|
139
|
-
current = current.parent ?? undefined;
|
|
140
|
-
}
|
|
141
|
-
return false;
|
|
142
|
-
};
|
|
143
|
-
const rule = (0, stylelint_2.createRule)(spiracss_property_placement_constants_1.ruleName, spiracss_property_placement_messages_1.messages, (primaryOption, secondaryOption, _context) => {
|
|
144
|
-
if (primaryOption === false) {
|
|
145
|
-
return () => {
|
|
146
|
-
/* rule disabled */
|
|
147
|
-
};
|
|
148
|
-
}
|
|
149
|
-
const rawOptions = typeof primaryOption === 'object' && primaryOption !== null
|
|
150
|
-
? primaryOption
|
|
151
|
-
: secondaryOption;
|
|
152
|
-
let cache = null;
|
|
153
|
-
const getCache = (reportInvalid) => {
|
|
154
|
-
if (cache)
|
|
155
|
-
return cache;
|
|
156
|
-
let hasInvalidOptions = false;
|
|
157
|
-
const handleInvalid = reportInvalid
|
|
158
|
-
? (optionName, value, detail) => {
|
|
159
|
-
hasInvalidOptions = true;
|
|
160
|
-
reportInvalid(optionName, value, detail);
|
|
161
|
-
}
|
|
162
|
-
: undefined;
|
|
163
|
-
const options = (0, spiracss_property_placement_options_1.normalizeOptions)(rawOptions, handleInvalid);
|
|
164
|
-
const classifyOptions = {
|
|
165
|
-
external: options.external,
|
|
166
|
-
naming: options.naming
|
|
167
|
-
};
|
|
168
|
-
const customModifierPattern = (0, naming_1.normalizeCustomPattern)(options.naming?.customPatterns?.modifier, 'naming.customPatterns.modifier');
|
|
169
|
-
cache = {
|
|
170
|
-
options,
|
|
171
|
-
patterns: (0, spiracss_class_structure_patterns_1.buildPatterns)(classifyOptions, options.cache, handleInvalid),
|
|
172
|
-
policySets: (0, spiracss_property_placement_selectors_1.buildPolicySets)(options.selectorPolicy),
|
|
173
|
-
classifyOptions,
|
|
174
|
-
customModifierPattern,
|
|
175
|
-
hasInvalidOptions
|
|
176
|
-
};
|
|
177
|
-
return cache;
|
|
178
|
-
};
|
|
179
|
-
return (root, result) => {
|
|
180
|
-
const shouldValidate = result.stylelint?.config?.validate !== false;
|
|
181
|
-
if (shouldValidate) {
|
|
182
|
-
const validOptions = stylelint_1.default.utils.validateOptions(result, spiracss_property_placement_constants_1.ruleName, {
|
|
183
|
-
actual: primaryOption,
|
|
184
|
-
possible: [true, validate_1.isPlainObject]
|
|
185
|
-
}, {
|
|
186
|
-
actual: secondaryOption,
|
|
187
|
-
possible: validate_1.isPlainObject,
|
|
188
|
-
optional: true
|
|
189
|
-
}, {
|
|
190
|
-
actual: rawOptions,
|
|
191
|
-
possible: optionSchema,
|
|
192
|
-
optional: true
|
|
193
|
-
});
|
|
194
|
-
if (!validOptions)
|
|
195
|
-
return;
|
|
196
|
-
}
|
|
197
|
-
const reportInvalid = shouldValidate
|
|
198
|
-
? (optionName, value, detail) => {
|
|
199
|
-
(0, stylelint_2.reportInvalidOption)(result, spiracss_property_placement_constants_1.ruleName, optionName, value, detail);
|
|
200
|
-
}
|
|
201
|
-
: undefined;
|
|
202
|
-
const hasInvalid = (0, stylelint_2.validateOptionsArrayFields)(rawOptions, ['external.classes', 'external.prefixes', 'responsiveMixins'], validate_1.isStringArray, reportInvalid, (optionName) => `[spiracss] ${optionName} must be an array of non-empty strings.`);
|
|
203
|
-
if (shouldValidate && hasInvalid)
|
|
204
|
-
return;
|
|
205
|
-
const { options, patterns, policySets, classifyOptions, customModifierPattern, hasInvalidOptions } = getCache(reportInvalid);
|
|
206
|
-
if (shouldValidate && hasInvalidOptions)
|
|
207
|
-
return;
|
|
208
|
-
const cacheSizes = options.cache;
|
|
209
|
-
const selectorState = (0, selector_1.createSelectorCacheWithErrorFlag)(cacheSizes.selector);
|
|
210
|
-
const selectorCache = selectorState.cache;
|
|
211
|
-
const resolvedSelectorsCache = new WeakMap();
|
|
212
|
-
const ruleAnalysisCache = new WeakMap();
|
|
213
|
-
const ruleFamilyKeysCache = new WeakMap();
|
|
214
|
-
const wrapperKeyCache = new WeakMap();
|
|
215
|
-
const atRuleIds = new WeakMap();
|
|
216
|
-
let atRuleIdSeed = 0;
|
|
217
|
-
let firstRule = null;
|
|
218
|
-
const responsiveMixins = new Set(options.responsive.mixins.map((name) => name.toLowerCase()));
|
|
219
|
-
const { checkMarginSide, parsePositionValue, isZeroMinSize } = (0, spiracss_property_placement_values_1.createValueTokenHelpers)();
|
|
220
|
-
const selectorPolicy = options.selectorPolicy;
|
|
221
|
-
const variantMode = selectorPolicy.variant.mode;
|
|
222
|
-
const stateMode = selectorPolicy.state.mode;
|
|
223
|
-
// Display lowercase keys in messages to match actual selector matching behavior.
|
|
224
|
-
const { variantKeys, stateKeys } = (0, selector_policy_1.getLowercasePolicyKeys)(selectorPolicy);
|
|
225
|
-
const naming = options.naming ?? {};
|
|
226
|
-
const modifierPrefix = naming.modifierPrefix ?? '-';
|
|
227
|
-
const modifierCase = naming.modifierCase ?? 'kebab';
|
|
228
|
-
const modifierPattern = customModifierPattern ?? '';
|
|
229
|
-
const getAtRuleId = (atRule) => {
|
|
230
|
-
const cached = atRuleIds.get(atRule);
|
|
231
|
-
if (cached)
|
|
232
|
-
return cached;
|
|
233
|
-
atRuleIdSeed += 1;
|
|
234
|
-
atRuleIds.set(atRule, atRuleIdSeed);
|
|
235
|
-
return atRuleIdSeed;
|
|
236
|
-
};
|
|
237
|
-
const rootBlockRules = new WeakSet();
|
|
238
|
-
const externalRootRules = new WeakSet();
|
|
239
|
-
const declsByRule = new Map();
|
|
240
|
-
const isExternalRootSelectors = (selectors) => {
|
|
241
|
-
if (selectors.length === 0)
|
|
242
|
-
return false;
|
|
243
|
-
return selectors.every((sel) => {
|
|
244
|
-
let hasClass = false;
|
|
245
|
-
let hasExternal = false;
|
|
246
|
-
let hasNonExternal = false;
|
|
247
|
-
let invalid = false;
|
|
248
|
-
sel.walk((node) => {
|
|
249
|
-
if (invalid)
|
|
250
|
-
return;
|
|
251
|
-
if (node.type === 'comment')
|
|
252
|
-
return;
|
|
253
|
-
if (node.type === 'combinator')
|
|
254
|
-
return;
|
|
255
|
-
if (node.type === 'class') {
|
|
256
|
-
hasClass = true;
|
|
257
|
-
const kind = (0, spiracss_class_structure_patterns_1.classify)(node.value, classifyOptions, patterns);
|
|
258
|
-
if (kind === 'external') {
|
|
259
|
-
hasExternal = true;
|
|
260
|
-
return;
|
|
261
|
-
}
|
|
262
|
-
hasNonExternal = true;
|
|
263
|
-
return;
|
|
264
|
-
}
|
|
265
|
-
invalid = true;
|
|
266
|
-
});
|
|
267
|
-
if (invalid)
|
|
268
|
-
return false;
|
|
269
|
-
if (!hasClass)
|
|
270
|
-
return false;
|
|
271
|
-
if (hasNonExternal)
|
|
272
|
-
return false;
|
|
273
|
-
return hasExternal;
|
|
274
|
-
});
|
|
275
|
-
};
|
|
276
|
-
root.walk((node) => {
|
|
277
|
-
if (node.type === 'rule') {
|
|
278
|
-
const rule = node;
|
|
279
|
-
if (!firstRule)
|
|
280
|
-
firstRule = rule;
|
|
281
|
-
if ((0, section_1.isRuleInsideAtRule)(rule, constants_1.NON_SELECTOR_AT_RULE_NAMES))
|
|
282
|
-
return;
|
|
283
|
-
if ((0, postcss_helpers_1.findParentRule)(rule))
|
|
284
|
-
return;
|
|
285
|
-
if (!(0, spiracss_class_structure_sections_1.isRootBlockRule)(rule))
|
|
286
|
-
return;
|
|
287
|
-
if (typeof rule.selector !== 'string')
|
|
288
|
-
return;
|
|
289
|
-
const selectorTexts = (0, spiracss_property_placement_selectors_1.splitSelectors)(rule.selector, selectorCache);
|
|
290
|
-
// Root block detection strips :global parts while preserving leading combinators.
|
|
291
|
-
const localSelectors = selectorTexts
|
|
292
|
-
.map((selector) => (0, spiracss_property_placement_selectors_1.stripGlobalSelectorForRoot)(selector, selectorCache, options.cache.selector, {
|
|
293
|
-
preserveCombinator: true
|
|
294
|
-
}))
|
|
295
|
-
.filter((selector) => Boolean(selector));
|
|
296
|
-
if (localSelectors.length === 0)
|
|
297
|
-
return;
|
|
298
|
-
const selectors = localSelectors.flatMap((selector) => selectorCache.parse(selector));
|
|
299
|
-
const rootBlocks = (0, spiracss_class_structure_selectors_1.collectRootBlockNames)(selectors, classifyOptions, patterns);
|
|
300
|
-
if (rootBlocks.length > 0) {
|
|
301
|
-
rootBlockRules.add(rule);
|
|
302
|
-
return;
|
|
303
|
-
}
|
|
304
|
-
if (isExternalRootSelectors(selectors)) {
|
|
305
|
-
externalRootRules.add(rule);
|
|
306
|
-
}
|
|
307
|
-
return;
|
|
308
|
-
}
|
|
309
|
-
if (node.type === 'decl') {
|
|
310
|
-
const decl = node;
|
|
311
|
-
const parentRule = (0, postcss_helpers_1.findParentRule)(decl);
|
|
312
|
-
if (!parentRule)
|
|
313
|
-
return;
|
|
314
|
-
const bucket = declsByRule.get(parentRule);
|
|
315
|
-
if (bucket) {
|
|
316
|
-
bucket.push(decl);
|
|
317
|
-
}
|
|
318
|
-
else {
|
|
319
|
-
declsByRule.set(parentRule, [decl]);
|
|
320
|
-
}
|
|
321
|
-
return;
|
|
322
|
-
}
|
|
323
|
-
});
|
|
324
|
-
const commentPatterns = {
|
|
325
|
-
sharedCommentPattern: options.comments.shared,
|
|
326
|
-
interactionCommentPattern: options.comments.interaction
|
|
327
|
-
};
|
|
328
|
-
const interactionContainers = (0, section_1.markInteractionContainers)(root, commentPatterns, (_comment, parent) => (0, postcss_helpers_1.isRule)(parent) && (rootBlockRules.has(parent) || externalRootRules.has(parent)));
|
|
329
|
-
const selectorExplosion = { example: null, limit: 0 };
|
|
330
|
-
const reportSelectorExplosion = (selector, limit) => {
|
|
331
|
-
if (!selectorExplosion.example)
|
|
332
|
-
selectorExplosion.example = selector;
|
|
333
|
-
selectorExplosion.limit = limit;
|
|
334
|
-
};
|
|
335
|
-
const getResolvedSelectors = (rule) => (0, spiracss_property_placement_selectors_1.resolveSelectors)(rule, selectorCache, resolvedSelectorsCache, reportSelectorExplosion);
|
|
336
|
-
const resolveContextSelector = (rule) => {
|
|
337
|
-
if (!rule || typeof rule.selector !== 'string')
|
|
338
|
-
return '(unknown)';
|
|
339
|
-
const resolved = getResolvedSelectors(rule);
|
|
340
|
-
if (resolved.length > 0)
|
|
341
|
-
return resolved.join(', ');
|
|
342
|
-
return rule.selector;
|
|
343
|
-
};
|
|
344
|
-
const getRuleAnalysis = (rule) => {
|
|
345
|
-
const cached = ruleAnalysisCache.get(rule);
|
|
346
|
-
if (cached)
|
|
347
|
-
return cached;
|
|
348
|
-
const resolvedSelectors = getResolvedSelectors(rule);
|
|
349
|
-
const analysis = resolvedSelectors.length === 0
|
|
350
|
-
? { status: 'skip' }
|
|
351
|
-
: (0, spiracss_property_placement_selectors_1.analyzeSelectorList)(resolvedSelectors, selectorCache, options, policySets, patterns, classifyOptions);
|
|
352
|
-
const entry = {
|
|
353
|
-
resolvedSelectors,
|
|
354
|
-
analysis,
|
|
355
|
-
resolvedSelectorText: resolvedSelectors.join(', ')
|
|
356
|
-
};
|
|
357
|
-
ruleAnalysisCache.set(rule, entry);
|
|
358
|
-
return entry;
|
|
359
|
-
};
|
|
360
|
-
const getRuleFamilyKeys = (rule) => {
|
|
361
|
-
if (ruleFamilyKeysCache.has(rule)) {
|
|
362
|
-
return ruleFamilyKeysCache.get(rule) ?? null;
|
|
363
|
-
}
|
|
364
|
-
const { analysis } = getRuleAnalysis(rule);
|
|
365
|
-
if (analysis.status !== 'ok') {
|
|
366
|
-
ruleFamilyKeysCache.set(rule, null);
|
|
367
|
-
return null;
|
|
368
|
-
}
|
|
369
|
-
const keys = analysis.familyKeys;
|
|
370
|
-
if (keys.length === 0) {
|
|
371
|
-
ruleFamilyKeysCache.set(rule, null);
|
|
372
|
-
return null;
|
|
373
|
-
}
|
|
374
|
-
ruleFamilyKeysCache.set(rule, keys);
|
|
375
|
-
return keys;
|
|
376
|
-
};
|
|
377
|
-
const getWrapperContextKey = (node) => {
|
|
378
|
-
const cached = wrapperKeyCache.get(node);
|
|
379
|
-
if (cached)
|
|
380
|
-
return cached;
|
|
381
|
-
const parts = [];
|
|
382
|
-
let current = node.parent ?? undefined;
|
|
383
|
-
while (current) {
|
|
384
|
-
if ((0, postcss_helpers_1.isAtRule)(current)) {
|
|
385
|
-
const name = current.name ? current.name.toLowerCase() : '';
|
|
386
|
-
if (name === 'scope') {
|
|
387
|
-
const params = typeof current.params === 'string' ? current.params : '';
|
|
388
|
-
const normalized = (0, spiracss_property_placement_selectors_1.normalizeScopePrelude)(params);
|
|
389
|
-
if (normalized) {
|
|
390
|
-
parts.push(`scope:${normalized}`);
|
|
391
|
-
}
|
|
392
|
-
else {
|
|
393
|
-
const fallback = (0, spiracss_property_placement_selectors_1.normalizeUnverifiedScopePrelude)(params);
|
|
394
|
-
parts.push(`scope:unverified:${fallback ?? getAtRuleId(current)}`);
|
|
395
|
-
}
|
|
396
|
-
}
|
|
397
|
-
else if (constants_1.ROOT_WRAPPER_NAMES.has(name)) {
|
|
398
|
-
// allowed wrapper
|
|
399
|
-
}
|
|
400
|
-
else if (name === 'include') {
|
|
401
|
-
const params = typeof current.params === 'string' ? current.params : '';
|
|
402
|
-
const mixinName = (0, spiracss_property_placement_selectors_1.parseMixinName)(params);
|
|
403
|
-
const allowlisted = mixinName
|
|
404
|
-
? responsiveMixins.has(mixinName.toLowerCase())
|
|
405
|
-
: false;
|
|
406
|
-
if (!allowlisted) {
|
|
407
|
-
parts.push(`include:${getAtRuleId(current)}`);
|
|
408
|
-
}
|
|
409
|
-
}
|
|
410
|
-
else {
|
|
411
|
-
const keyName = name || 'unknown';
|
|
412
|
-
parts.push(`atrule:${keyName}:${getAtRuleId(current)}`);
|
|
413
|
-
}
|
|
414
|
-
}
|
|
415
|
-
current = current.parent ?? undefined;
|
|
416
|
-
}
|
|
417
|
-
let key = 'ctx:root';
|
|
418
|
-
if (parts.length > 0) {
|
|
419
|
-
let context = '';
|
|
420
|
-
for (let i = parts.length - 1; i >= 0; i -= 1) {
|
|
421
|
-
context += `${context ? '|' : ''}${parts[i]}`;
|
|
422
|
-
}
|
|
423
|
-
key = `ctx:${context}`;
|
|
424
|
-
}
|
|
425
|
-
wrapperKeyCache.set(node, key);
|
|
426
|
-
return key;
|
|
427
|
-
};
|
|
428
|
-
const familyOffsetMap = new Map();
|
|
429
|
-
if (options.position) {
|
|
430
|
-
for (const [rule, decls] of declsByRule) {
|
|
431
|
-
if (interactionContainers.has(rule))
|
|
432
|
-
continue;
|
|
433
|
-
if ((0, section_1.isRuleInsideAtRule)(rule, constants_1.NON_SELECTOR_AT_RULE_NAMES))
|
|
434
|
-
continue;
|
|
435
|
-
const familyKeys = getRuleFamilyKeys(rule);
|
|
436
|
-
if (!familyKeys)
|
|
437
|
-
continue;
|
|
438
|
-
const ruleWrapperKey = getWrapperContextKey(rule);
|
|
439
|
-
for (const decl of decls) {
|
|
440
|
-
if (isInsideAtRoot(decl))
|
|
441
|
-
continue;
|
|
442
|
-
const prop = decl.prop.toLowerCase();
|
|
443
|
-
if (!OFFSET_PROP_NAMES.has(prop))
|
|
444
|
-
continue;
|
|
445
|
-
const wrapperKey = decl.parent === rule ? ruleWrapperKey : getWrapperContextKey(decl);
|
|
446
|
-
familyKeys.forEach((key) => {
|
|
447
|
-
familyOffsetMap.set(`${wrapperKey}::${key}`, true);
|
|
448
|
-
});
|
|
449
|
-
}
|
|
450
|
-
}
|
|
451
|
-
}
|
|
452
|
-
root.walkAtRules((atRule) => {
|
|
453
|
-
const name = atRule.name ? atRule.name.toLowerCase() : '';
|
|
454
|
-
const parentRule = (0, postcss_helpers_1.findParentRule)(atRule);
|
|
455
|
-
if (name === 'extend') {
|
|
456
|
-
const placeholder = atRule.params?.trim() || '%unknown';
|
|
457
|
-
const parentSelector = resolveContextSelector(parentRule);
|
|
458
|
-
stylelint_1.default.utils.report({
|
|
459
|
-
ruleName: spiracss_property_placement_constants_1.ruleName,
|
|
460
|
-
result,
|
|
461
|
-
node: atRule,
|
|
462
|
-
message: spiracss_property_placement_messages_1.messages.forbiddenExtend(parentSelector, placeholder)
|
|
463
|
-
});
|
|
464
|
-
return;
|
|
465
|
-
}
|
|
466
|
-
if (name === 'at-root') {
|
|
467
|
-
if (interactionContainers.has(atRule))
|
|
468
|
-
return;
|
|
469
|
-
const parentSelector = resolveContextSelector(parentRule);
|
|
470
|
-
stylelint_1.default.utils.report({
|
|
471
|
-
ruleName: spiracss_property_placement_constants_1.ruleName,
|
|
472
|
-
result,
|
|
473
|
-
node: atRule,
|
|
474
|
-
message: spiracss_property_placement_messages_1.messages.forbiddenAtRoot(parentSelector, options.comments.interaction)
|
|
475
|
-
});
|
|
476
|
-
}
|
|
477
|
-
});
|
|
478
|
-
for (const [rule, decls] of declsByRule) {
|
|
479
|
-
if ((0, section_1.isRuleInsideAtRule)(rule, constants_1.NON_SELECTOR_AT_RULE_NAMES))
|
|
480
|
-
continue;
|
|
481
|
-
if (interactionContainers.has(rule))
|
|
482
|
-
continue;
|
|
483
|
-
if (isInsideAtRoot(rule))
|
|
484
|
-
continue;
|
|
485
|
-
if (typeof rule.selector !== 'string')
|
|
486
|
-
continue;
|
|
487
|
-
const { analysis, resolvedSelectorText } = getRuleAnalysis(rule);
|
|
488
|
-
if (analysis.status === 'skip')
|
|
489
|
-
continue;
|
|
490
|
-
if (analysis.status === 'error') {
|
|
491
|
-
stylelint_1.default.utils.report({
|
|
492
|
-
ruleName: spiracss_property_placement_constants_1.ruleName,
|
|
493
|
-
result,
|
|
494
|
-
node: rule,
|
|
495
|
-
message: analysis.message
|
|
496
|
-
});
|
|
497
|
-
continue;
|
|
498
|
-
}
|
|
499
|
-
const selectorInfos = analysis.selectors;
|
|
500
|
-
const resolvedSelector = resolvedSelectorText;
|
|
501
|
-
const ruleWrapperKey = getWrapperContextKey(rule);
|
|
502
|
-
decls.forEach((decl) => {
|
|
503
|
-
if (isInsideAtRoot(decl))
|
|
504
|
-
return;
|
|
505
|
-
const prop = decl.prop.toLowerCase();
|
|
506
|
-
if (!prop || prop.startsWith('--'))
|
|
507
|
-
return;
|
|
508
|
-
if (isContainerProp(decl)) {
|
|
509
|
-
const hasPageRoot = selectorInfos.some((info) => info.kind === 'page-root');
|
|
510
|
-
if (hasPageRoot) {
|
|
511
|
-
stylelint_1.default.utils.report({
|
|
512
|
-
ruleName: spiracss_property_placement_constants_1.ruleName,
|
|
513
|
-
result,
|
|
514
|
-
node: decl,
|
|
515
|
-
message: spiracss_property_placement_messages_1.messages.pageRootContainer(prop, resolvedSelector)
|
|
516
|
-
});
|
|
517
|
-
return;
|
|
518
|
-
}
|
|
519
|
-
const hasChildBlock = selectorInfos.some((info) => info.kind === 'child-block');
|
|
520
|
-
if (!hasChildBlock)
|
|
521
|
-
return;
|
|
522
|
-
stylelint_1.default.utils.report({
|
|
523
|
-
ruleName: spiracss_property_placement_constants_1.ruleName,
|
|
524
|
-
result,
|
|
525
|
-
node: decl,
|
|
526
|
-
message: spiracss_property_placement_messages_1.messages.containerInChildBlock(prop, resolvedSelector)
|
|
527
|
-
});
|
|
528
|
-
return;
|
|
529
|
-
}
|
|
530
|
-
if (isItemProp(prop)) {
|
|
531
|
-
const hasPageRoot = selectorInfos.some((info) => info.kind === 'page-root');
|
|
532
|
-
if (hasPageRoot) {
|
|
533
|
-
stylelint_1.default.utils.report({
|
|
534
|
-
ruleName: spiracss_property_placement_constants_1.ruleName,
|
|
535
|
-
result,
|
|
536
|
-
node: decl,
|
|
537
|
-
message: spiracss_property_placement_messages_1.messages.pageRootItem(prop, resolvedSelector)
|
|
538
|
-
});
|
|
539
|
-
return;
|
|
540
|
-
}
|
|
541
|
-
const hasInvalidPlacement = selectorInfos.some((info) => {
|
|
542
|
-
if (info.kind === 'root')
|
|
543
|
-
return true;
|
|
544
|
-
return info.tailCombinator === null;
|
|
545
|
-
});
|
|
546
|
-
if (hasInvalidPlacement) {
|
|
547
|
-
stylelint_1.default.utils.report({
|
|
548
|
-
ruleName: spiracss_property_placement_constants_1.ruleName,
|
|
549
|
-
result,
|
|
550
|
-
node: decl,
|
|
551
|
-
message: spiracss_property_placement_messages_1.messages.itemInRoot(prop, resolvedSelector)
|
|
552
|
-
});
|
|
553
|
-
return;
|
|
554
|
-
}
|
|
555
|
-
if (isMarginSideProp(prop)) {
|
|
556
|
-
const marginSideResult = checkMarginSide(prop, decl.value, options.margin.side);
|
|
557
|
-
if (marginSideResult === 'error') {
|
|
558
|
-
const disallowedSide = options.margin.side === 'top' ? 'bottom' : 'top';
|
|
559
|
-
stylelint_1.default.utils.report({
|
|
560
|
-
ruleName: spiracss_property_placement_constants_1.ruleName,
|
|
561
|
-
result,
|
|
562
|
-
node: decl,
|
|
563
|
-
message: spiracss_property_placement_messages_1.messages.marginSideViolation(prop, resolvedSelector, disallowedSide)
|
|
564
|
-
});
|
|
565
|
-
}
|
|
566
|
-
}
|
|
567
|
-
return;
|
|
568
|
-
}
|
|
569
|
-
if (isInternalProp(prop, options.size.internal)) {
|
|
570
|
-
// Allow min-* = 0 everywhere (self/item-side exception) before internal checks.
|
|
571
|
-
if (options.size.internal && isZeroMinSize(prop, decl.value))
|
|
572
|
-
return;
|
|
573
|
-
const hasPageRoot = selectorInfos.some((info) => info.kind === 'page-root');
|
|
574
|
-
if (hasPageRoot) {
|
|
575
|
-
stylelint_1.default.utils.report({
|
|
576
|
-
ruleName: spiracss_property_placement_constants_1.ruleName,
|
|
577
|
-
result,
|
|
578
|
-
node: decl,
|
|
579
|
-
message: spiracss_property_placement_messages_1.messages.pageRootInternal(prop, resolvedSelector)
|
|
580
|
-
});
|
|
581
|
-
return;
|
|
582
|
-
}
|
|
583
|
-
const hasChildBlock = selectorInfos.some((info) => info.kind === 'child-block');
|
|
584
|
-
if (!hasChildBlock)
|
|
585
|
-
return;
|
|
586
|
-
stylelint_1.default.utils.report({
|
|
587
|
-
ruleName: spiracss_property_placement_constants_1.ruleName,
|
|
588
|
-
result,
|
|
589
|
-
node: decl,
|
|
590
|
-
message: spiracss_property_placement_messages_1.messages.internalInChildBlock(prop, resolvedSelector, variantMode, variantKeys, stateMode, stateKeys, modifierPrefix, modifierCase, modifierPattern)
|
|
591
|
-
});
|
|
592
|
-
return;
|
|
593
|
-
}
|
|
594
|
-
if (options.position && prop === 'position') {
|
|
595
|
-
const hasChildBlock = selectorInfos.some((info) => info.kind === 'child-block');
|
|
596
|
-
if (!hasChildBlock)
|
|
597
|
-
return;
|
|
598
|
-
const parsedPosition = parsePositionValue(decl.value);
|
|
599
|
-
if (parsedPosition.status === 'skip')
|
|
600
|
-
return;
|
|
601
|
-
if (parsedPosition.status === 'unknown') {
|
|
602
|
-
stylelint_1.default.utils.report({
|
|
603
|
-
ruleName: spiracss_property_placement_constants_1.ruleName,
|
|
604
|
-
result,
|
|
605
|
-
node: decl,
|
|
606
|
-
message: spiracss_property_placement_messages_1.messages.positionInChildBlock(parsedPosition.value, resolvedSelector, options.responsive.mixins, parsedPosition.reason)
|
|
607
|
-
});
|
|
608
|
-
return;
|
|
609
|
-
}
|
|
610
|
-
if (parsedPosition.value === 'static')
|
|
611
|
-
return;
|
|
612
|
-
if (parsedPosition.value === 'fixed' || parsedPosition.value === 'sticky') {
|
|
613
|
-
stylelint_1.default.utils.report({
|
|
614
|
-
ruleName: spiracss_property_placement_constants_1.ruleName,
|
|
615
|
-
result,
|
|
616
|
-
node: decl,
|
|
617
|
-
message: spiracss_property_placement_messages_1.messages.positionInChildBlock(parsedPosition.value, resolvedSelector, options.responsive.mixins)
|
|
618
|
-
});
|
|
619
|
-
return;
|
|
620
|
-
}
|
|
621
|
-
if (parsedPosition.value === 'relative' || parsedPosition.value === 'absolute') {
|
|
622
|
-
if (analysis.hasUnverifiedFamilyKeys) {
|
|
623
|
-
stylelint_1.default.utils.report({
|
|
624
|
-
ruleName: spiracss_property_placement_constants_1.ruleName,
|
|
625
|
-
result,
|
|
626
|
-
node: decl,
|
|
627
|
-
message: spiracss_property_placement_messages_1.messages.positionInChildBlock(parsedPosition.value, resolvedSelector, options.responsive.mixins)
|
|
628
|
-
});
|
|
629
|
-
return;
|
|
630
|
-
}
|
|
631
|
-
const familyKeys = getRuleFamilyKeys(rule);
|
|
632
|
-
if (!familyKeys)
|
|
633
|
-
return;
|
|
634
|
-
const wrapperKey = decl.parent === rule ? ruleWrapperKey : getWrapperContextKey(decl);
|
|
635
|
-
// Require offsets for every selector in a list to avoid partial matches.
|
|
636
|
-
const hasOffsets = familyKeys.every((key) => familyOffsetMap.has(`${wrapperKey}::${key}`));
|
|
637
|
-
if (hasOffsets)
|
|
638
|
-
return;
|
|
639
|
-
stylelint_1.default.utils.report({
|
|
640
|
-
ruleName: spiracss_property_placement_constants_1.ruleName,
|
|
641
|
-
result,
|
|
642
|
-
node: decl,
|
|
643
|
-
message: spiracss_property_placement_messages_1.messages.positionInChildBlock(parsedPosition.value, resolvedSelector, options.responsive.mixins)
|
|
644
|
-
});
|
|
645
|
-
}
|
|
646
|
-
}
|
|
647
|
-
});
|
|
648
|
-
}
|
|
649
|
-
if (selectorState.hasError()) {
|
|
650
|
-
const targetNode = firstRule || root;
|
|
651
|
-
stylelint_1.default.utils.report({
|
|
652
|
-
ruleName: spiracss_property_placement_constants_1.ruleName,
|
|
653
|
-
result,
|
|
654
|
-
node: targetNode,
|
|
655
|
-
message: spiracss_property_placement_messages_1.messages.selectorParseFailed(...(0, messages_1.selectorParseFailedArgs)(selectorState.getErrorSelector())),
|
|
656
|
-
severity: 'warning'
|
|
657
|
-
});
|
|
658
|
-
}
|
|
659
|
-
if (selectorExplosion.example) {
|
|
660
|
-
const targetNode = firstRule || root;
|
|
661
|
-
stylelint_1.default.utils.report({
|
|
662
|
-
ruleName: spiracss_property_placement_constants_1.ruleName,
|
|
663
|
-
result,
|
|
664
|
-
node: targetNode,
|
|
665
|
-
message: spiracss_property_placement_messages_1.messages.selectorResolutionSkipped(selectorExplosion.limit, selectorExplosion.example),
|
|
666
|
-
severity: 'warning'
|
|
667
|
-
});
|
|
668
|
-
}
|
|
669
|
-
};
|
|
670
|
-
}, meta);
|
|
671
|
-
const spiracssPropertyPlacement = (0, stylelint_2.createPlugin)(spiracss_property_placement_constants_1.ruleName, rule);
|
|
672
|
-
exports.default = spiracssPropertyPlacement;
|
|
673
|
-
//# sourceMappingURL=spiracss-property-placement.js.map
|